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

Unified Diff: base/threading/simple_thread_unittest.cc

Issue 2685533003: Revert of Do not block in SimpleThread::Start(). (Closed)
Patch Set: Created 3 years, 10 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 | « base/threading/simple_thread.cc ('k') | base/threading/thread_restrictions.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/threading/simple_thread_unittest.cc
diff --git a/base/threading/simple_thread_unittest.cc b/base/threading/simple_thread_unittest.cc
index 969418b219a6fda80d03965630ed292c9a770b8e..0e52500c522d7d84b6bebc6f69c9d2ad1e7289c6 100644
--- a/base/threading/simple_thread_unittest.cc
+++ b/base/threading/simple_thread_unittest.cc
@@ -129,11 +129,17 @@
EXPECT_EQ(0, stack_int);
DelegateSimpleThread thread(&runner, "int_setter");
+ EXPECT_FALSE(thread.HasBeenStarted());
+ EXPECT_FALSE(thread.HasBeenJoined());
EXPECT_EQ(0, stack_int);
thread.Start();
+ EXPECT_TRUE(thread.HasBeenStarted());
+ EXPECT_FALSE(thread.HasBeenJoined());
+
thread.Join();
-
+ EXPECT_TRUE(thread.HasBeenStarted());
+ EXPECT_TRUE(thread.HasBeenJoined());
EXPECT_EQ(7, stack_int);
}
@@ -159,11 +165,16 @@
options.joinable = false;
DelegateSimpleThread thread(&runner, "non_joinable", options);
+ EXPECT_FALSE(thread.HasBeenStarted());
thread.Start();
-
- // Wait until Run() is invoked.
+ EXPECT_TRUE(thread.HasBeenStarted());
+
+ // Note: this is not quite the same as |thread.HasBeenStarted()| which
+ // represents ThreadMain() getting ready to invoke Run() whereas
+ // |runner.WaitUntilStarted()| ensures Run() was actually invoked.
runner.WaitUntilStarted();
+ EXPECT_FALSE(thread.HasBeenJoined());
EXPECT_DCHECK_DEATH({ thread.Join(); });
}
« no previous file with comments | « base/threading/simple_thread.cc ('k') | base/threading/thread_restrictions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698