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

Unified Diff: mojo/message_pump/message_pump_mojo_unittest.cc

Issue 1467953002: Implement MessagePumpMojo using WaitSet. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojo-waitset-implementation
Patch Set: Rebase, address comments, and auto format. Created 4 years, 11 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
« no previous file with comments | « mojo/message_pump/message_pump_mojo.cc ('k') | third_party/mojo/src/mojo/edk/embedder/entrypoints.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/message_pump/message_pump_mojo_unittest.cc
diff --git a/mojo/message_pump/message_pump_mojo_unittest.cc b/mojo/message_pump/message_pump_mojo_unittest.cc
index 5c8fbb40f9a29f39368284ba369efb37930e669e..805b14120b67835885dcf386b16c4aafe19fc584 100644
--- a/mojo/message_pump/message_pump_mojo_unittest.cc
+++ b/mojo/message_pump/message_pump_mojo_unittest.cc
@@ -159,6 +159,35 @@ TEST(MessagePumpMojo, UnregisterAfterDeadline) {
EXPECT_EQ(1, handler.error_count());
}
+TEST(MessagePumpMojo, AddClosedHandle) {
+ base::MessageLoop message_loop(MessagePumpMojo::Create());
+ CountingMojoHandler handler;
+ MessagePipe handles;
+ Handle closed_handle = handles.handle0.get();
+ handles.handle0.reset();
+ MessagePumpMojo::current()->AddHandler(
+ &handler, closed_handle, MOJO_HANDLE_SIGNAL_READABLE, base::TimeTicks());
+ base::RunLoop run_loop;
+ run_loop.RunUntilIdle();
+ MessagePumpMojo::current()->RemoveHandler(closed_handle);
+ EXPECT_EQ(0, handler.error_count());
+ EXPECT_EQ(0, handler.success_count());
+}
+
+TEST(MessagePumpMojo, CloseAfterAdding) {
+ base::MessageLoop message_loop(MessagePumpMojo::Create());
+ CountingMojoHandler handler;
+ MessagePipe handles;
+ MessagePumpMojo::current()->AddHandler(&handler, handles.handle0.get(),
+ MOJO_HANDLE_SIGNAL_READABLE,
+ base::TimeTicks());
+ handles.handle0.reset();
+ base::RunLoop run_loop;
+ run_loop.RunUntilIdle();
+ EXPECT_EQ(1, handler.error_count());
+ EXPECT_EQ(0, handler.success_count());
+}
+
} // namespace test
} // namespace common
} // namespace mojo
« no previous file with comments | « mojo/message_pump/message_pump_mojo.cc ('k') | third_party/mojo/src/mojo/edk/embedder/entrypoints.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698