summaryrefslogtreecommitdiffstats
path: root/lldb/unittests/Core/BroadcasterTest.cpp
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2016-11-30 10:41:42 +0000
committerPavel Labath <labath@google.com>2016-11-30 10:41:42 +0000
commitd35031e1e5b1dbe31f960a1054f139f7ba2c3f35 (patch)
treee87ecf0672e25507d124b671ba079e9efa5bfc62 /lldb/unittests/Core/BroadcasterTest.cpp
parent6d2497d48f332888a0d6d0d3e4766396822acb0e (diff)
downloadbcm5719-llvm-d35031e1e5b1dbe31f960a1054f139f7ba2c3f35.tar.gz
bcm5719-llvm-d35031e1e5b1dbe31f960a1054f139f7ba2c3f35.zip
Use Timeout<> in the Listener class
Summary: Communication classes use the Timeout<> class to specify the timeout. Listener class was converted to chrono some time ago, but it used a different meaning for a timeout of zero (Listener: infinite wait, Communication: no wait). Instead, Listener provided separate functions which performed a non-blocking event read. This converts the Listener class to the new Timeout class, to improve consistency. It also allows us to get merge the different GetNextEvent*** and WaitForEvent*** functions into one. No functional change intended. Reviewers: jingham, clayborg, zturner Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D27136 llvm-svn: 288238
Diffstat (limited to 'lldb/unittests/Core/BroadcasterTest.cpp')
-rw-r--r--lldb/unittests/Core/BroadcasterTest.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/lldb/unittests/Core/BroadcasterTest.cpp b/lldb/unittests/Core/BroadcasterTest.cpp
index cc6f2417897..e3795822f9a 100644
--- a/lldb/unittests/Core/BroadcasterTest.cpp
+++ b/lldb/unittests/Core/BroadcasterTest.cpp
@@ -21,6 +21,7 @@ using namespace lldb_private;
TEST(BroadcasterTest, BroadcastEvent) {
EventSP event_sp;
Broadcaster broadcaster(nullptr, "test-broadcaster");
+ std::chrono::seconds timeout(0);
// Create a listener, sign it up, make sure it recieves an event.
ListenerSP listener1_sp = Listener::MakeListener("test-listener1");
@@ -28,7 +29,7 @@ TEST(BroadcasterTest, BroadcastEvent) {
EXPECT_EQ(event_mask1,
listener1_sp->StartListeningForEvents(&broadcaster, event_mask1));
broadcaster.BroadcastEvent(event_mask1, nullptr);
- EXPECT_TRUE(listener1_sp->GetNextEvent(event_sp));
+ EXPECT_TRUE(listener1_sp->GetEvent(event_sp, timeout));
EXPECT_EQ(event_mask1, event_sp->GetType());
{
@@ -38,20 +39,20 @@ TEST(BroadcasterTest, BroadcastEvent) {
EXPECT_EQ(event_mask2, listener2_sp->StartListeningForEvents(
&broadcaster, event_mask1 | event_mask2));
broadcaster.BroadcastEvent(event_mask2, nullptr);
- EXPECT_TRUE(listener2_sp->GetNextEvent(event_sp));
+ EXPECT_TRUE(listener2_sp->GetEvent(event_sp, timeout));
EXPECT_EQ(event_mask2, event_sp->GetType());
// Both listeners should get this event.
broadcaster.BroadcastEvent(event_mask1, nullptr);
- EXPECT_TRUE(listener1_sp->GetNextEvent(event_sp));
+ EXPECT_TRUE(listener1_sp->GetEvent(event_sp, timeout));
EXPECT_EQ(event_mask1, event_sp->GetType());
- EXPECT_TRUE(listener2_sp->GetNextEvent(event_sp));
+ EXPECT_TRUE(listener2_sp->GetEvent(event_sp, timeout));
EXPECT_EQ(event_mask2, event_sp->GetType());
}
// Now again only one listener should be active.
broadcaster.BroadcastEvent(event_mask1, nullptr);
- EXPECT_TRUE(listener1_sp->GetNextEvent(event_sp));
+ EXPECT_TRUE(listener1_sp->GetEvent(event_sp, timeout));
EXPECT_EQ(event_mask1, event_sp->GetType());
}
OpenPOWER on IntegriCloud