Index: cc/test/pixel_test.cc |
diff --git a/cc/test/pixel_test.cc b/cc/test/pixel_test.cc |
index ae2e9984fdb9c1485015e2b976561aeae9142414..73abc1c3828bd6cda9eab556cda460fff187ea9e 100644 |
--- a/cc/test/pixel_test.cc |
+++ b/cc/test/pixel_test.cc |
@@ -15,6 +15,7 @@ |
#include "cc/output/gl_renderer.h" |
#include "cc/output/output_surface_client.h" |
#include "cc/output/software_renderer.h" |
+#include "cc/resources/raster_worker_pool.h" |
#include "cc/resources/resource_provider.h" |
#include "cc/resources/texture_mailbox_deleter.h" |
#include "cc/test/fake_output_surface_client.h" |
@@ -146,6 +147,30 @@ void PixelTest::EnableExternalStencilTest() { |
->set_has_external_stencil_test(true); |
} |
+void PixelTest::RunOnDemandRasterTask(Task* on_demand_raster_task) { |
+ TaskGraphRunner task_graph_runner; |
+ NamespaceToken on_demand_task_namespace = |
+ task_graph_runner.GetNamespaceToken(); |
+ |
+ // Construct a task graph that contains this single raster task. |
+ TaskGraph graph; |
+ graph.nodes.push_back( |
+ TaskGraph::Node(on_demand_raster_task, |
+ RasterWorkerPool::kOnDemandRasterTaskPriority, |
+ 0u)); |
+ |
+ // Schedule task and wait for task graph runner to finish running it. |
+ task_graph_runner.ScheduleTasks(on_demand_task_namespace, &graph); |
+ task_graph_runner.RunUntilIdle(); |
+ |
+ // Collect task now that it has finished running. |
+ Task::Vector completed_tasks; |
+ task_graph_runner.CollectCompletedTasks(on_demand_task_namespace, |
+ &completed_tasks); |
+ DCHECK_EQ(1u, completed_tasks.size()); |
+ DCHECK_EQ(completed_tasks[0], on_demand_raster_task); |
+} |
+ |
void PixelTest::SetUpSoftwareRenderer() { |
scoped_ptr<SoftwareOutputDevice> device(new PixelTestSoftwareOutputDevice()); |
output_surface_.reset(new PixelTestOutputSurface(device.Pass())); |