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

Unified Diff: components/scheduler/child/webthread_impl_for_worker_scheduler_unittest.cc

Issue 1106213002: Adds a SHUTDOWN_TASK_QUEUE and a PreShutdown api to the scheduler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments. Created 5 years, 8 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
Index: components/scheduler/child/webthread_impl_for_worker_scheduler_unittest.cc
diff --git a/components/scheduler/child/webthread_impl_for_worker_scheduler_unittest.cc b/components/scheduler/child/webthread_impl_for_worker_scheduler_unittest.cc
index 7bb1f8990762e426df7004d2c12637105c542941..52c036160c15823de117f63d29e25fc3a1c5b0ec 100644
--- a/components/scheduler/child/webthread_impl_for_worker_scheduler_unittest.cc
+++ b/components/scheduler/child/webthread_impl_for_worker_scheduler_unittest.cc
@@ -8,6 +8,7 @@
#include "components/scheduler/child/worker_scheduler_impl.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/WebKit/public/platform/WebScheduler.h"
#include "third_party/WebKit/public/platform/WebTraceLocation.h"
using testing::_;
@@ -132,6 +133,23 @@ TEST_F(WebThreadImplForWorkerSchedulerTest,
thread_->postTask(blink::WebTraceLocation(), task.release());
thread_.reset();
+ completion.Wait();
+}
+
+TEST_F(WebThreadImplForWorkerSchedulerTest,
+ TestThreadShutdownAfterPreShutdown) {
+ scoped_ptr<MockTask> task(new MockTask());
+ base::WaitableEvent completion(false, false);
+
+ ON_CALL(*task, run())
+ .WillByDefault(Invoke([&completion]() { completion.Signal(); }));
+
+ // preShutdown should block the postTask, but not the internal shutdown task.
+ thread_->scheduler()->preShutdown();
+ thread_->postTask(blink::WebTraceLocation(), task.release());
+ thread_.reset();
+
+ EXPECT_FALSE(completion.IsSignaled());
}
TEST_F(WebThreadImplForWorkerSchedulerTest, TestIdleTask) {
« no previous file with comments | « components/scheduler/child/webthread_impl_for_worker_scheduler.cc ('k') | components/scheduler/child/worker_scheduler_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698