diff options
author | vjpai <vpai@google.com> | 2016-02-10 23:16:55 -0800 |
---|---|---|
committer | vjpai <vpai@google.com> | 2016-02-10 23:16:55 -0800 |
commit | 8fdafede063a253e104f91c63c5c1599624fbe93 (patch) | |
tree | d85ad39d27fde76e95db442fa6bd580dbc988a3c /test/cpp | |
parent | f9f61cf5bca0063b417f7c6538868c41ebdddce4 (diff) |
tag fed in by user should be any arbitrary tag, not a CompletionQueueTag
type
Diffstat (limited to 'test/cpp')
-rw-r--r-- | test/cpp/common/alarm_cpp_test.cc | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/test/cpp/common/alarm_cpp_test.cc b/test/cpp/common/alarm_cpp_test.cc index 50fc9cd5dc..99c9a80297 100644 --- a/test/cpp/common/alarm_cpp_test.cc +++ b/test/cpp/common/alarm_cpp_test.cc @@ -33,7 +33,6 @@ #include <grpc++/alarm.h> #include <grpc++/completion_queue.h> -#include <grpc++/impl/codegen/completion_queue_tag.h> #include <gtest/gtest.h> #include "test/core/util/test_config.h" @@ -41,46 +40,35 @@ namespace grpc { namespace { -class TestTag : public CompletionQueueTag { - public: - TestTag() : tag_(0) {} - TestTag(intptr_t tag) : tag_(tag) {} - bool FinalizeResult(void** tag, bool* status) GRPC_OVERRIDE { return true; } - intptr_t tag() { return tag_; } - - private: - intptr_t tag_; -}; - TEST(AlarmTest, RegularExpiry) { CompletionQueue cq; - TestTag input_tag(1618033); - Alarm alarm(&cq, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(1), &input_tag); + void* junk = reinterpret_cast<void*>(1618033); + Alarm alarm(&cq, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(1), junk); - TestTag* output_tag; + 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(output_tag->tag(), input_tag.tag()); + EXPECT_EQ(junk, output_tag); } TEST(AlarmTest, Cancellation) { CompletionQueue cq; - TestTag input_tag(1618033); - Alarm alarm(&cq, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(2), &input_tag); + void* junk = reinterpret_cast<void*>(1618033); + Alarm alarm(&cq, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(2), junk); alarm.Cancel(); - TestTag* output_tag; + 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(output_tag->tag(), input_tag.tag()); + EXPECT_EQ(junk, output_tag); } } // namespace |