aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp
diff options
context:
space:
mode:
authorGravatar Vijay Pai <vpai@google.com>2016-02-25 14:46:14 -0800
committerGravatar Vijay Pai <vpai@google.com>2016-02-25 14:46:14 -0800
commit544b98fca3017843495e9f7846ec8d7e84066ca2 (patch)
tree71ea17d74d8efd82a0ed0ef29dc220a2be82e5f4 /test/cpp
parentc05865259bb662a4a777b5ba16b3ab6ed9964c51 (diff)
parente2f243ba7c8e9492e8a638bf5ac4dc3c6048cf8d (diff)
Merge pull request #5293 from dgquintas/alarm_cpp
Made Alarm's constructor a template for deadline
Diffstat (limited to 'test/cpp')
-rw-r--r--test/cpp/common/alarm_cpp_test.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/cpp/common/alarm_cpp_test.cc b/test/cpp/common/alarm_cpp_test.cc
index 5d7344046c..d4381c0515 100644
--- a/test/cpp/common/alarm_cpp_test.cc
+++ b/test/cpp/common/alarm_cpp_test.cc
@@ -55,6 +55,23 @@ TEST(AlarmTest, RegularExpiry) {
EXPECT_EQ(junk, output_tag);
}
+TEST(AlarmTest, RegularExpiryChrono) {
+ CompletionQueue cq;
+ void* junk = reinterpret_cast<void*>(1618033);
+ std::chrono::system_clock::time_point one_sec_deadline =
+ std::chrono::system_clock::now() + std::chrono::seconds(1);
+ Alarm alarm(&cq, one_sec_deadline, junk);
+
+ void* output_tag;
+ bool ok;
+ const CompletionQueue::NextStatus status = cq.AsyncNext(
+ (void**)&output_tag, &ok, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(2));
+
+ EXPECT_EQ(status, CompletionQueue::GOT_EVENT);
+ EXPECT_TRUE(ok);
+ EXPECT_EQ(junk, output_tag);
+}
+
TEST(AlarmTest, ZeroExpiry) {
CompletionQueue cq;
void* junk = reinterpret_cast<void*>(1618033);