| Index: mojo/public/cpp/system/tests/watcher_unittest.cc
|
| diff --git a/mojo/public/cpp/system/tests/watcher_unittest.cc b/mojo/public/cpp/system/tests/watcher_unittest.cc
|
| index f72f495fd683874e325ba24976226e03508f1649..4689a727116bc2ef30e4f702efa864942dfcb143 100644
|
| --- a/mojo/public/cpp/system/tests/watcher_unittest.cc
|
| +++ b/mojo/public/cpp/system/tests/watcher_unittest.cc
|
| @@ -202,5 +202,30 @@ TEST_F(WatcherTest, CloseAndCancel) {
|
| base::RunLoop().RunUntilIdle();
|
| }
|
|
|
| +TEST_F(WatcherTest, SyncDispatch) {
|
| + ScopedMessagePipeHandle a, b;
|
| + CreateMessagePipe(nullptr, &a, &b);
|
| +
|
| + bool notified = false;
|
| + Watcher b_watcher;
|
| + EXPECT_EQ(MOJO_RESULT_OK,
|
| + b_watcher.Start(b.get(), MOJO_HANDLE_SIGNAL_READABLE,
|
| + OnReady([&] (MojoResult result) {
|
| + EXPECT_EQ(MOJO_RESULT_OK, result);
|
| + notified = true;
|
| + })));
|
| + EXPECT_TRUE(b_watcher.IsWatching());
|
| +
|
| + b_watcher.SetAllowSyncDispatch(true);
|
| + EXPECT_EQ(MOJO_RESULT_OK, WriteMessageRaw(a.get(), "hello", 5, nullptr, 0,
|
| + MOJO_WRITE_MESSAGE_FLAG_NONE));
|
| +
|
| + // We don't spin the MessageLoop but should have been notified anyway.
|
| +
|
| + EXPECT_TRUE(notified);
|
| +
|
| + b_watcher.Cancel();
|
| +}
|
| +
|
| } // namespace
|
| } // namespace mojo
|
|
|