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

Unified Diff: content/renderer/raster_worker_pool_unittest.cc

Issue 1449133002: TaskGraphRunner refactor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: feedback Created 5 years, 1 month 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 | « content/renderer/raster_worker_pool.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « content/renderer/raster_worker_pool.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698