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

Unified Diff: third_party/WebKit/Source/platform/threading/BackgroundTaskRunnerTest.cpp

Issue 2685673005: Use TaskScheduler instead of WorkerPool in BackgroundTaskRunner.cpp (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
Index: third_party/WebKit/Source/platform/threading/BackgroundTaskRunnerTest.cpp
diff --git a/third_party/WebKit/Source/platform/threading/BackgroundTaskRunnerTest.cpp b/third_party/WebKit/Source/platform/threading/BackgroundTaskRunnerTest.cpp
index 5b3cc3d5e025320f75fbc5538eeffd33022d11e7..137a913c0a820f5326d751e5b82a48fa0483e055 100644
--- a/third_party/WebKit/Source/platform/threading/BackgroundTaskRunnerTest.cpp
+++ b/third_party/WebKit/Source/platform/threading/BackgroundTaskRunnerTest.cpp
@@ -4,12 +4,13 @@
#include "platform/threading/BackgroundTaskRunner.h"
+#include <memory>
+#include "base/test/scoped_async_task_scheduler.h"
#include "platform/CrossThreadFunctional.h"
#include "platform/WaitableEvent.h"
#include "public/platform/WebTraceLocation.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "wtf/PtrUtil.h"
-#include <memory>
namespace blink {
@@ -19,26 +20,14 @@ void PingPongTask(WaitableEvent* doneEvent) {
doneEvent->signal();
}
-class BackgroundTaskRunnerTest : public testing::Test {};
-
} // namespace
-TEST_F(BackgroundTaskRunnerTest, RunShortTaskOnBackgroundThread) {
- std::unique_ptr<WaitableEvent> doneEvent = WTF::makeUnique<WaitableEvent>();
- BackgroundTaskRunner::postOnBackgroundThread(
- BLINK_FROM_HERE,
- crossThreadBind(&PingPongTask, crossThreadUnretained(doneEvent.get())),
- BackgroundTaskRunner::TaskSizeShortRunningTask);
- // Test passes by not hanging on the following wait().
- doneEvent->wait();
-}
-
-TEST_F(BackgroundTaskRunnerTest, RunLongTaskOnBackgroundThread) {
+TEST(BackgroundTaskRunnerTest, RunOnBackgroundThread) {
+ base::test::ScopedAsyncTaskScheduler scopedAsyncTaskScheduler;
std::unique_ptr<WaitableEvent> doneEvent = WTF::makeUnique<WaitableEvent>();
BackgroundTaskRunner::postOnBackgroundThread(
BLINK_FROM_HERE,
- crossThreadBind(&PingPongTask, crossThreadUnretained(doneEvent.get())),
- BackgroundTaskRunner::TaskSizeLongRunningTask);
+ crossThreadBind(&PingPongTask, crossThreadUnretained(doneEvent.get())));
// Test passes by not hanging on the following wait().
doneEvent->wait();
}

Powered by Google App Engine
This is Rietveld 408576698