Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(779)

Unified Diff: mojo/edk/system/data_pipe_unittest.cc

Issue 2725133002: Mojo: Armed Watchers (Closed)
Patch Set: rebase Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: mojo/edk/system/data_pipe_unittest.cc
diff --git a/mojo/edk/system/data_pipe_unittest.cc b/mojo/edk/system/data_pipe_unittest.cc
index 610aeac67df924b0896dc4761301a075c5f727f6..114749628a363ce2a11dbf4662aeaed443ccacd7 100644
--- a/mojo/edk/system/data_pipe_unittest.cc
+++ b/mojo/edk/system/data_pipe_unittest.cc
@@ -21,7 +21,7 @@
#include "mojo/public/c/system/data_pipe.h"
#include "mojo/public/c/system/functions.h"
#include "mojo/public/c/system/message_pipe.h"
-#include "mojo/public/cpp/system/watcher.h"
+#include "mojo/public/cpp/system/simple_watcher.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace mojo {
@@ -2029,7 +2029,7 @@ DEFINE_TEST_CLIENT_TEST_WITH_PIPE(DataPipeStatusChangeInTransitClient,
base::MessageLoop message_loop;
- // Wait on producer 1 and consumer 1 using Watchers.
+ // Wait on producer 1 and consumer 1 using SimpleWatchers.
{
base::RunLoop run_loop;
int count = 0;
@@ -2040,12 +2040,16 @@ DEFINE_TEST_CLIENT_TEST_WITH_PIPE(DataPipeStatusChangeInTransitClient,
loop->Quit();
},
&run_loop, &count);
- Watcher producer_watcher(FROM_HERE), consumer_watcher(FROM_HERE);
- producer_watcher.Start(
- Handle(producers[1]), MOJO_HANDLE_SIGNAL_PEER_CLOSED, callback);
- consumer_watcher.Start(
- Handle(consumers[1]), MOJO_HANDLE_SIGNAL_PEER_CLOSED, callback);
+ SimpleWatcher producer_watcher(FROM_HERE,
+ SimpleWatcher::ArmingPolicy::AUTOMATIC);
+ SimpleWatcher consumer_watcher(FROM_HERE,
+ SimpleWatcher::ArmingPolicy::AUTOMATIC);
+ producer_watcher.Watch(Handle(producers[1]), MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+ callback);
+ consumer_watcher.Watch(Handle(consumers[1]), MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+ callback);
run_loop.Run();
+ EXPECT_EQ(2, count);
}
// Wait on producer 2 by polling with MojoWriteData.

Powered by Google App Engine
This is Rietveld 408576698