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

Unified Diff: base/test/thread_test_helper.cc

Issue 2924813002: Make ThreadTestHelper sequence-friendly. (Closed)
Patch Set: fix typo Created 3 years, 6 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/test/thread_test_helper.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/test/thread_test_helper.cc
diff --git a/base/test/thread_test_helper.cc b/base/test/thread_test_helper.cc
index 38edc9d7f45fe7b8cb14c0582f0887b406196bb5..037de2b484a42766db36068c224795e9b6dc5753 100644
--- a/base/test/thread_test_helper.cc
+++ b/base/test/thread_test_helper.cc
@@ -13,15 +13,15 @@
namespace base {
ThreadTestHelper::ThreadTestHelper(
- scoped_refptr<SingleThreadTaskRunner> target_thread)
+ scoped_refptr<SequencedTaskRunner> target_sequence)
: test_result_(false),
- target_thread_(std::move(target_thread)),
+ target_sequence_(std::move(target_sequence)),
done_event_(WaitableEvent::ResetPolicy::AUTOMATIC,
WaitableEvent::InitialState::NOT_SIGNALED) {}
bool ThreadTestHelper::Run() {
- if (!target_thread_->PostTask(
- FROM_HERE, base::BindOnce(&ThreadTestHelper::RunInThread, this))) {
+ if (!target_sequence_->PostTask(
+ FROM_HERE, base::BindOnce(&ThreadTestHelper::RunOnSequence, this))) {
return false;
}
base::ThreadRestrictions::ScopedAllowWait allow_wait;
@@ -33,7 +33,7 @@ void ThreadTestHelper::RunTest() { set_test_result(true); }
ThreadTestHelper::~ThreadTestHelper() {}
-void ThreadTestHelper::RunInThread() {
+void ThreadTestHelper::RunOnSequence() {
RunTest();
done_event_.Signal();
}
« no previous file with comments | « base/test/thread_test_helper.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698