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

Unified Diff: base/threading/simple_thread_unittest.cc

Issue 2664953004: Do not block in SimpleThread::Start(). (Closed)
Patch Set: CR gab #26 (comment) 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 0e52500c522d7d84b6bebc6f69c9d2ad1e7289c6..969418b219a6fda80d03965630ed292c9a770b8e 100644
--- a/base/threading/simple_thread_unittest.cc
+++ b/base/threading/simple_thread_unittest.cc
@@ -129,17 +129,11 @@ TEST(SimpleThreadTest, CreateAndJoin) {
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);
}
@@ -165,16 +159,11 @@ TEST(SimpleThreadTest, NonJoinableStartAndDieOnJoin) {
options.joinable = false;
DelegateSimpleThread thread(&runner, "non_joinable", options);
- EXPECT_FALSE(thread.HasBeenStarted());
thread.Start();
- 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.
+ // Wait until Run() is 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