| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/test/pixel_test.h" | 5 #include "cc/test/pixel_test.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/message_loop/message_loop_proxy.h" | 8 #include "base/message_loop/message_loop_proxy.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 | 142 |
| 143 void PixelTest::ForceDeviceClip(const gfx::Rect& clip) { | 143 void PixelTest::ForceDeviceClip(const gfx::Rect& clip) { |
| 144 external_device_clip_rect_ = clip; | 144 external_device_clip_rect_ = clip; |
| 145 } | 145 } |
| 146 | 146 |
| 147 void PixelTest::EnableExternalStencilTest() { | 147 void PixelTest::EnableExternalStencilTest() { |
| 148 static_cast<PixelTestOutputSurface*>(output_surface_.get()) | 148 static_cast<PixelTestOutputSurface*>(output_surface_.get()) |
| 149 ->set_has_external_stencil_test(true); | 149 ->set_has_external_stencil_test(true); |
| 150 } | 150 } |
| 151 | 151 |
| 152 void PixelTest::RunOnDemandRasterTask(Task* on_demand_raster_task) { | |
| 153 TaskGraphRunner task_graph_runner; | |
| 154 NamespaceToken on_demand_task_namespace = | |
| 155 task_graph_runner.GetNamespaceToken(); | |
| 156 | |
| 157 // Construct a task graph that contains this single raster task. | |
| 158 TaskGraph graph; | |
| 159 graph.nodes.push_back( | |
| 160 TaskGraph::Node(on_demand_raster_task, | |
| 161 RasterWorkerPool::kOnDemandRasterTaskPriority, | |
| 162 0u)); | |
| 163 | |
| 164 // Schedule task and wait for task graph runner to finish running it. | |
| 165 task_graph_runner.ScheduleTasks(on_demand_task_namespace, &graph); | |
| 166 task_graph_runner.RunUntilIdle(); | |
| 167 | |
| 168 // Collect task now that it has finished running. | |
| 169 Task::Vector completed_tasks; | |
| 170 task_graph_runner.CollectCompletedTasks(on_demand_task_namespace, | |
| 171 &completed_tasks); | |
| 172 DCHECK_EQ(1u, completed_tasks.size()); | |
| 173 DCHECK_EQ(completed_tasks[0], on_demand_raster_task); | |
| 174 } | |
| 175 | |
| 176 void PixelTest::SetUpSoftwareRenderer() { | 152 void PixelTest::SetUpSoftwareRenderer() { |
| 177 scoped_ptr<SoftwareOutputDevice> device(new PixelTestSoftwareOutputDevice()); | 153 scoped_ptr<SoftwareOutputDevice> device(new PixelTestSoftwareOutputDevice()); |
| 178 output_surface_.reset(new PixelTestOutputSurface(device.Pass())); | 154 output_surface_.reset(new PixelTestOutputSurface(device.Pass())); |
| 179 output_surface_->BindToClient(output_surface_client_.get()); | 155 output_surface_->BindToClient(output_surface_client_.get()); |
| 180 shared_bitmap_manager_.reset(new TestSharedBitmapManager()); | 156 shared_bitmap_manager_.reset(new TestSharedBitmapManager()); |
| 181 resource_provider_ = ResourceProvider::Create( | 157 resource_provider_ = ResourceProvider::Create( |
| 182 output_surface_.get(), shared_bitmap_manager_.get(), 0, false, 1, false); | 158 output_surface_.get(), shared_bitmap_manager_.get(), 0, false, 1, false); |
| 183 renderer_ = | 159 renderer_ = |
| 184 SoftwareRenderer::Create( | 160 SoftwareRenderer::Create( |
| 185 this, &settings_, output_surface_.get(), resource_provider_.get()) | 161 this, &settings_, output_surface_.get(), resource_provider_.get()) |
| 186 .PassAs<DirectRenderer>(); | 162 .PassAs<DirectRenderer>(); |
| 187 } | 163 } |
| 188 | 164 |
| 189 } // namespace cc | 165 } // namespace cc |
| OLD | NEW |