diff options
author | Vijay Pai <vpai@google.com> | 2018-02-02 08:44:20 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-02 08:44:20 -0800 |
commit | e5b0a504167fbc6277d034709aa29ea07fa09a00 (patch) | |
tree | 6c6c080621452edeaead91ba48a1857810829699 /test/cpp/common | |
parent | ba92ab53bf50c8e12c90e62bbd0935008d696fa3 (diff) | |
parent | 392e2131e17bd2a028d5b91b7a99aee26bbfbf19 (diff) |
Merge pull request #14015 from vjpai/alarm
Remove alarm from core, implement in C++ layer only
Diffstat (limited to 'test/cpp/common')
-rw-r--r-- | test/cpp/common/BUILD | 4 | ||||
-rw-r--r-- | test/cpp/common/alarm_test.cc (renamed from test/cpp/common/alarm_cpp_test.cc) | 23 |
2 files changed, 25 insertions, 2 deletions
diff --git a/test/cpp/common/BUILD b/test/cpp/common/BUILD index e2b6365b13..2cf3ad669f 100644 --- a/test/cpp/common/BUILD +++ b/test/cpp/common/BUILD @@ -19,8 +19,8 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_test", "grpc_package") grpc_package(name = "test/cpp/common") grpc_cc_test( - name = "alarm_cpp_test", - srcs = ["alarm_cpp_test.cc"], + name = "alarm_test", + srcs = ["alarm_test.cc"], deps = [ "//:grpc++_unsecure", "//test/core/util:gpr_test_util", diff --git a/test/cpp/common/alarm_cpp_test.cc b/test/cpp/common/alarm_test.cc index 7adc3102f4..2a933a84c4 100644 --- a/test/cpp/common/alarm_cpp_test.cc +++ b/test/cpp/common/alarm_test.cc @@ -182,6 +182,29 @@ TEST(AlarmTest, Cancellation) { EXPECT_EQ(junk, output_tag); } +TEST(AlarmTest, SetDestruction) { + CompletionQueue cq; + void* junk = reinterpret_cast<void*>(1618033); + { + Alarm alarm; + alarm.Set(&cq, grpc_timeout_seconds_to_deadline(2), junk); + } + + void* output_tag; + bool ok; + const CompletionQueue::NextStatus status = cq.AsyncNext( + (void**)&output_tag, &ok, grpc_timeout_seconds_to_deadline(1)); + + EXPECT_EQ(status, CompletionQueue::GOT_EVENT); + EXPECT_FALSE(ok); + EXPECT_EQ(junk, output_tag); +} + +TEST(AlarmTest, UnsetDestruction) { + CompletionQueue cq; + Alarm alarm; +} + } // namespace } // namespace grpc |