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

Unified Diff: base/threading/thread_unittest.cc

Issue 2484283005: Expose Thread::using_external_message_loop() to subclasses. (Closed)
Patch Set: Created 4 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 | « base/threading/thread.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/threading/thread_unittest.cc
diff --git a/base/threading/thread_unittest.cc b/base/threading/thread_unittest.cc
index 92ccc87d2b581b76da8e083f9dc179744cbf6c92..afb8b4a0830ec2b855219f06490290f56c93da97 100644
--- a/base/threading/thread_unittest.cc
+++ b/base/threading/thread_unittest.cc
@@ -486,6 +486,12 @@ class ExternalMessageLoopThread : public Thread {
void InstallMessageLoop() { SetMessageLoop(&external_message_loop_); }
+ void VerifyUsingExternalMessageLoop(
+ bool expected_using_external_message_loop) {
+ EXPECT_EQ(expected_using_external_message_loop,
+ using_external_message_loop());
+ }
+
private:
base::MessageLoop external_message_loop_;
@@ -498,10 +504,12 @@ TEST_F(ThreadTest, ExternalMessageLoop) {
ExternalMessageLoopThread a;
EXPECT_FALSE(a.message_loop());
EXPECT_FALSE(a.IsRunning());
+ a.VerifyUsingExternalMessageLoop(false);
a.InstallMessageLoop();
EXPECT_TRUE(a.message_loop());
EXPECT_TRUE(a.IsRunning());
+ a.VerifyUsingExternalMessageLoop(true);
bool ran = false;
a.task_runner()->PostTask(
@@ -512,6 +520,7 @@ TEST_F(ThreadTest, ExternalMessageLoop) {
a.Stop();
EXPECT_FALSE(a.message_loop());
EXPECT_FALSE(a.IsRunning());
+ a.VerifyUsingExternalMessageLoop(true);
// Confirm that running any remaining tasks posted from Stop() goes smoothly
// (e.g. https://codereview.chromium.org/2135413003/#ps300001 crashed if
« no previous file with comments | « base/threading/thread.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698