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

Unified Diff: mojo/edk/base_edk/platform_message_loop_impl_unittest.cc

Issue 1465203003: EDK: Make ConnectionManagerTest not use base::MessageLoop/RunLoop. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 1 month 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/edk/base_edk/platform_message_loop_impl.cc ('k') | mojo/edk/platform/message_loop.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/base_edk/platform_message_loop_impl_unittest.cc
diff --git a/mojo/edk/base_edk/platform_message_loop_impl_unittest.cc b/mojo/edk/base_edk/platform_message_loop_impl_unittest.cc
index e5ea2e9dac41da9bf06f37f6323478562dd8b4ac..e74dcc403a9a9a8f90431599240704d96505c642 100644
--- a/mojo/edk/base_edk/platform_message_loop_impl_unittest.cc
+++ b/mojo/edk/base_edk/platform_message_loop_impl_unittest.cc
@@ -69,6 +69,20 @@ TEST(PlatformMessageLoopImpl, Basic) {
EXPECT_EQ(std::vector<int>({4, 5, 6}), stuff);
stuff.clear();
+ task_runner->PostTask(ToClosure([&stuff, &message_loop, &task_runner]() {
+ EXPECT_TRUE(message_loop.IsRunningOnCurrentThread());
+ stuff.push_back(7);
+ message_loop.QuitNow();
+ task_runner->PostTask(ToClosure([&stuff]() { stuff.push_back(9); }));
+ }));
+ task_runner->PostTask(ToClosure([&stuff]() { stuff.push_back(8); }));
+ message_loop.Run();
+ EXPECT_EQ(std::vector<int>({7}), stuff);
+ stuff.clear();
+ message_loop.RunUntilIdle();
+ EXPECT_EQ(std::vector<int>({8, 9}), stuff);
+
+ stuff.clear();
message_loop.RunUntilIdle();
EXPECT_TRUE(stuff.empty());
@@ -86,19 +100,19 @@ TEST(PlatformMessageLoopImpl, Basic) {
std::thread other_thread([&stuff, &message_loop, task_runner]() {
EXPECT_FALSE(message_loop.IsRunningOnCurrentThread());
EXPECT_EQ(task_runner, message_loop.GetTaskRunner());
- stuff.push_back(7);
+ stuff.push_back(10);
task_runner->PostTask(ToClosure([&stuff, &message_loop]() {
EXPECT_TRUE(message_loop.IsRunningOnCurrentThread());
- stuff.push_back(8);
+ stuff.push_back(11);
message_loop.QuitWhenIdle();
}));
});
other_thread.join();
- EXPECT_EQ(std::vector<int>({7}), stuff);
+ EXPECT_EQ(std::vector<int>({10}), stuff);
stuff.clear();
}));
message_loop.Run();
- EXPECT_EQ(std::vector<int>({8}), stuff);
+ EXPECT_EQ(std::vector<int>({11}), stuff);
}
TEST(PlatformMessageLoopImpl, TypeIO) {
« no previous file with comments | « mojo/edk/base_edk/platform_message_loop_impl.cc ('k') | mojo/edk/platform/message_loop.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698