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

Unified Diff: components/scheduler/renderer/webthread_impl_for_renderer_scheduler_unittest.cc

Issue 1308183005: Introduce WebTaskRunner Patch 2/5 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Final tweaks Created 5 years, 3 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/renderer/webthread_impl_for_renderer_scheduler_unittest.cc
diff --git a/components/scheduler/renderer/webthread_impl_for_renderer_scheduler_unittest.cc b/components/scheduler/renderer/webthread_impl_for_renderer_scheduler_unittest.cc
index 77173b06c36747e4bee15116b756e9e55e1c71a5..c29dbb30d251ff0bea84b1ca43536e3e90736d1b 100644
--- a/components/scheduler/renderer/webthread_impl_for_renderer_scheduler_unittest.cc
+++ b/components/scheduler/renderer/webthread_impl_for_renderer_scheduler_unittest.cc
@@ -11,6 +11,7 @@
#include "components/scheduler/renderer/renderer_scheduler_impl.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/WebKit/public/platform/WebTaskRunner.h"
#include "third_party/WebKit/public/platform/WebTraceLocation.h"
namespace scheduler {
@@ -18,7 +19,7 @@ namespace {
const int kWorkBatchSize = 2;
-class MockTask : public blink::WebThread::Task {
+class MockTask : public blink::WebTaskRunner::Task {
public:
MOCK_METHOD0(run, void());
};
@@ -67,7 +68,7 @@ TEST_F(WebThreadImplForRendererSchedulerTest, TestTaskObserver) {
EXPECT_CALL(observer, didProcessTask());
}
- thread_.postTask(blink::WebTraceLocation(), task.release());
+ thread_.taskRunner()->postTask(blink::WebTraceLocation(), task.release());
message_loop_.RunUntilIdle();
thread_.removeTaskObserver(&observer);
}
@@ -85,7 +86,7 @@ TEST_F(WebThreadImplForRendererSchedulerTest, TestWorkBatchWithOneTask) {
EXPECT_CALL(observer, didProcessTask());
}
- thread_.postTask(blink::WebTraceLocation(), task.release());
+ thread_.taskRunner()->postTask(blink::WebTraceLocation(), task.release());
message_loop_.RunUntilIdle();
thread_.removeTaskObserver(&observer);
}
@@ -108,8 +109,8 @@ TEST_F(WebThreadImplForRendererSchedulerTest, TestWorkBatchWithTwoTasks) {
EXPECT_CALL(observer, didProcessTask());
}
- thread_.postTask(blink::WebTraceLocation(), task1.release());
- thread_.postTask(blink::WebTraceLocation(), task2.release());
+ thread_.taskRunner()->postTask(blink::WebTraceLocation(), task1.release());
+ thread_.taskRunner()->postTask(blink::WebTraceLocation(), task2.release());
message_loop_.RunUntilIdle();
thread_.removeTaskObserver(&observer);
}
@@ -137,14 +138,14 @@ TEST_F(WebThreadImplForRendererSchedulerTest, TestWorkBatchWithThreeTasks) {
EXPECT_CALL(observer, didProcessTask());
}
- thread_.postTask(blink::WebTraceLocation(), task1.release());
- thread_.postTask(blink::WebTraceLocation(), task2.release());
- thread_.postTask(blink::WebTraceLocation(), task3.release());
+ thread_.taskRunner()->postTask(blink::WebTraceLocation(), task1.release());
+ thread_.taskRunner()->postTask(blink::WebTraceLocation(), task2.release());
+ thread_.taskRunner()->postTask(blink::WebTraceLocation(), task3.release());
message_loop_.RunUntilIdle();
thread_.removeTaskObserver(&observer);
}
-class ExitRunLoopTask : public blink::WebThread::Task {
+class ExitRunLoopTask : public blink::WebTaskRunner::Task {
public:
ExitRunLoopTask(base::RunLoop* run_loop) : run_loop_(run_loop) {}
@@ -158,7 +159,8 @@ void EnterRunLoop(base::MessageLoop* message_loop, blink::WebThread* thread) {
// Note: WebThreads do not support nested run loops, which is why we use a
// run loop directly.
base::RunLoop run_loop;
- thread->postTask(blink::WebTraceLocation(), new ExitRunLoopTask(&run_loop));
+ thread->taskRunner()->postTask(blink::WebTraceLocation(),
+ new ExitRunLoopTask(&run_loop));
message_loop->SetNestableTasksAllowed(true);
run_loop.Run();
}
« no previous file with comments | « components/scheduler/renderer/webthread_impl_for_renderer_scheduler.cc ('k') | components/scheduler/scheduler.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698