Index: content/renderer/raster_worker_pool_unittest.cc |
diff --git a/content/renderer/raster_worker_pool_unittest.cc b/content/renderer/raster_worker_pool_unittest.cc |
index 926ba2b6d0631fab216d1f7e6c6badb11aa49fae..7a402b76183b63b1bd1bb74fb0ac6e0399babdb9 100644 |
--- a/content/renderer/raster_worker_pool_unittest.cc |
+++ b/content/renderer/raster_worker_pool_unittest.cc |
@@ -5,6 +5,7 @@ |
#include "base/test/sequenced_task_runner_test_template.h" |
#include "base/test/task_runner_test_template.h" |
#include "base/threading/simple_thread.h" |
+#include "cc/test/task_graph_runner_test_template.h" |
#include "content/renderer/raster_worker_pool.h" |
namespace base { |
@@ -26,9 +27,7 @@ class RasterWorkerPoolTestDelegate { |
return raster_worker_pool_; |
} |
- void StopTaskRunner() { |
- raster_worker_pool_->GetTaskGraphRunner()->FlushForTesting(); |
- } |
+ void StopTaskRunner() { raster_worker_pool_->FlushForTesting(); } |
~RasterWorkerPoolTestDelegate() { raster_worker_pool_->Shutdown(); } |
@@ -53,9 +52,7 @@ class RasterWorkerPoolSequencedTestDelegate { |
return raster_worker_pool_->CreateSequencedTaskRunner(); |
} |
- void StopTaskRunner() { |
- raster_worker_pool_->GetTaskGraphRunner()->FlushForTesting(); |
- } |
+ void StopTaskRunner() { raster_worker_pool_->FlushForTesting(); } |
~RasterWorkerPoolSequencedTestDelegate() { raster_worker_pool_->Shutdown(); } |
@@ -69,3 +66,55 @@ INSTANTIATE_TYPED_TEST_CASE_P(RasterWorkerPool, |
} // namespace |
} // namespace base |
+ |
+namespace cc { |
+namespace { |
+ |
+template <int NumThreads> |
+class RasterWorkerPoolTaskGraphRunnerTestDelegate { |
+ public: |
+ RasterWorkerPoolTaskGraphRunnerTestDelegate() |
+ : raster_worker_pool_(new content::RasterWorkerPool()) {} |
+ |
+ void StartTaskGraphRunner() { |
+ raster_worker_pool_->Start(NumThreads, base::SimpleThread::Options()); |
+ } |
+ |
+ cc::TaskGraphRunner* GetTaskGraphRunner() { |
+ return raster_worker_pool_->GetTaskGraphRunner(); |
+ } |
+ |
+ void StopTaskGraphRunner() { raster_worker_pool_->FlushForTesting(); } |
+ |
+ ~RasterWorkerPoolTaskGraphRunnerTestDelegate() { |
+ raster_worker_pool_->Shutdown(); |
+ } |
+ |
+ private: |
+ scoped_refptr<content::RasterWorkerPool> raster_worker_pool_; |
+}; |
+ |
+// Multithreaded tests. |
+INSTANTIATE_TYPED_TEST_CASE_P(RasterWorkerPool_1_Threads, |
+ TaskGraphRunnerTest, |
+ RasterWorkerPoolTaskGraphRunnerTestDelegate<1>); |
+INSTANTIATE_TYPED_TEST_CASE_P(RasterWorkerPool_2_Threads, |
+ TaskGraphRunnerTest, |
+ RasterWorkerPoolTaskGraphRunnerTestDelegate<2>); |
+INSTANTIATE_TYPED_TEST_CASE_P(RasterWorkerPool_3_Threads, |
+ TaskGraphRunnerTest, |
+ RasterWorkerPoolTaskGraphRunnerTestDelegate<3>); |
+INSTANTIATE_TYPED_TEST_CASE_P(RasterWorkerPool_4_Threads, |
+ TaskGraphRunnerTest, |
+ RasterWorkerPoolTaskGraphRunnerTestDelegate<4>); |
+INSTANTIATE_TYPED_TEST_CASE_P(RasterWorkerPool_5_Threads, |
+ TaskGraphRunnerTest, |
+ RasterWorkerPoolTaskGraphRunnerTestDelegate<5>); |
+ |
+// Single threaded tests. |
+INSTANTIATE_TYPED_TEST_CASE_P(RasterWorkerPool, |
+ SingleThreadTaskGraphRunnerTest, |
+ RasterWorkerPoolTaskGraphRunnerTestDelegate<1>); |
+ |
+} // namespace |
+} // namespace cc |