| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/renderer/gpu/render_widget_compositor.h" | 5 #include "content/renderer/gpu/render_widget_compositor.h" |
| 6 | 6 |
| 7 #include "cc/output/begin_frame_args.h" | 7 #include "cc/output/begin_frame_args.h" |
| 8 #include "cc/test/failure_output_surface.h" | 8 #include "cc/test/failure_output_surface.h" |
| 9 #include "cc/trees/layer_tree_host.h" | 9 #include "cc/trees/layer_tree_host.h" |
| 10 #include "components/scheduler/renderer/renderer_scheduler.h" | 10 #include "components/scheduler/renderer/renderer_scheduler.h" |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 bool use_null_output_surface_; | 225 bool use_null_output_surface_; |
| 226 | 226 |
| 227 DISALLOW_COPY_AND_ASSIGN(RenderWidgetCompositorOutputSurface); | 227 DISALLOW_COPY_AND_ASSIGN(RenderWidgetCompositorOutputSurface); |
| 228 }; | 228 }; |
| 229 | 229 |
| 230 class RenderWidgetCompositorOutputSurfaceTest : public testing::Test { | 230 class RenderWidgetCompositorOutputSurfaceTest : public testing::Test { |
| 231 public: | 231 public: |
| 232 RenderWidgetCompositorOutputSurfaceTest() | 232 RenderWidgetCompositorOutputSurfaceTest() |
| 233 : render_widget_(make_scoped_refptr(new RenderWidgetOutputSurface)), | 233 : render_widget_(make_scoped_refptr(new RenderWidgetOutputSurface)), |
| 234 compositor_deps_(make_scoped_ptr(new FakeCompositorDependencies)) { | 234 compositor_deps_(make_scoped_ptr(new FakeCompositorDependencies)) { |
| 235 // Required in order to call the synchronous LayerTreeHost::Composite. | |
| 236 compositor_deps_->set_use_single_thread_scheduler(false); | |
| 237 render_widget_compositor_.reset(new RenderWidgetCompositorOutputSurface( | 235 render_widget_compositor_.reset(new RenderWidgetCompositorOutputSurface( |
| 238 render_widget_.get(), compositor_deps_.get())); | 236 render_widget_.get(), compositor_deps_.get())); |
| 239 render_widget_compositor_->Initialize(); | 237 render_widget_compositor_->Initialize(); |
| 240 render_widget_->SetCompositor(render_widget_compositor_.get()); | 238 render_widget_->SetCompositor(render_widget_compositor_.get()); |
| 241 } | 239 } |
| 242 | 240 |
| 243 void RunTest(bool use_null_output_surface, | 241 void RunTest(bool use_null_output_surface, |
| 244 int num_failures_before_success, | 242 int num_failures_before_success, |
| 245 int expected_successes, | 243 int expected_successes, |
| 246 int expected_fallback_succeses) { | 244 int expected_fallback_succeses) { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 } | 308 } |
| 311 | 309 |
| 312 TEST_F(RenderWidgetCompositorOutputSurfaceTest, FallbackSuccessNormalSuccess) { | 310 TEST_F(RenderWidgetCompositorOutputSurfaceTest, FallbackSuccessNormalSuccess) { |
| 313 // The first success is a fallback, but the next should not be a fallback. | 311 // The first success is a fallback, but the next should not be a fallback. |
| 314 RunTest(false, RenderWidgetCompositor::OUTPUT_SURFACE_RETRIES_BEFORE_FALLBACK, | 312 RunTest(false, RenderWidgetCompositor::OUTPUT_SURFACE_RETRIES_BEFORE_FALLBACK, |
| 315 1, 1); | 313 1, 1); |
| 316 } | 314 } |
| 317 | 315 |
| 318 } // namespace | 316 } // namespace |
| 319 } // namespace content | 317 } // namespace content |
| OLD | NEW |