| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 12 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
| 13 #include "base/single_thread_task_runner.h" | 13 #include "base/single_thread_task_runner.h" |
| 14 #include "base/threading/thread_task_runner_handle.h" | 14 #include "base/threading/thread_task_runner_handle.h" |
| 15 #include "cc/output/begin_frame_args.h" | 15 #include "cc/output/begin_frame_args.h" |
| 16 #include "cc/output/copy_output_request.h" | 16 #include "cc/output/copy_output_request.h" |
| 17 #include "cc/test/fake_compositor_frame_sink.h" | 17 #include "cc/test/fake_compositor_frame_sink.h" |
| 18 #include "cc/test/test_context_provider.h" | 18 #include "cc/test/test_context_provider.h" |
| 19 #include "cc/test/test_web_graphics_context_3d.h" | 19 #include "cc/test/test_web_graphics_context_3d.h" |
| 20 #include "cc/trees/layer_tree_host.h" | 20 #include "cc/trees/layer_tree_host.h" |
| 21 #include "content/public/common/screen_info.h" |
| 21 #include "content/public/test/mock_render_thread.h" | 22 #include "content/public/test/mock_render_thread.h" |
| 22 #include "content/renderer/render_widget.h" | 23 #include "content/renderer/render_widget.h" |
| 23 #include "content/test/fake_compositor_dependencies.h" | 24 #include "content/test/fake_compositor_dependencies.h" |
| 24 #include "gpu/GLES2/gl2extchromium.h" | 25 #include "gpu/GLES2/gl2extchromium.h" |
| 25 #include "testing/gmock/include/gmock/gmock.h" | 26 #include "testing/gmock/include/gmock/gmock.h" |
| 26 #include "testing/gtest/include/gtest/gtest.h" | 27 #include "testing/gtest/include/gtest/gtest.h" |
| 27 | 28 |
| 28 using testing::AllOf; | 29 using testing::AllOf; |
| 29 using testing::Field; | 30 using testing::Field; |
| 30 | 31 |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 int expected_fallback_successes_ = 0; | 211 int expected_fallback_successes_ = 0; |
| 211 int expected_requests_ = 0; | 212 int expected_requests_ = 0; |
| 212 | 213 |
| 213 DISALLOW_COPY_AND_ASSIGN(RenderWidgetCompositorFrameSink); | 214 DISALLOW_COPY_AND_ASSIGN(RenderWidgetCompositorFrameSink); |
| 214 }; | 215 }; |
| 215 | 216 |
| 216 class RenderWidgetCompositorFrameSinkTest : public testing::Test { | 217 class RenderWidgetCompositorFrameSinkTest : public testing::Test { |
| 217 public: | 218 public: |
| 218 RenderWidgetCompositorFrameSinkTest() | 219 RenderWidgetCompositorFrameSinkTest() |
| 219 : render_widget_compositor_(&compositor_delegate_, &compositor_deps_) { | 220 : render_widget_compositor_(&compositor_delegate_, &compositor_deps_) { |
| 220 render_widget_compositor_.Initialize(1.f /* initial_device_scale_factor */); | 221 ScreenInfo dummy_screen_info; |
| 222 render_widget_compositor_.Initialize(1.f /* initial_device_scale_factor */, |
| 223 dummy_screen_info); |
| 221 } | 224 } |
| 222 | 225 |
| 223 void RunTest(bool use_null_compositor_frame_sink, | 226 void RunTest(bool use_null_compositor_frame_sink, |
| 224 int num_failures_before_success, | 227 int num_failures_before_success, |
| 225 int expected_successes, | 228 int expected_successes, |
| 226 int expected_fallback_succeses) { | 229 int expected_fallback_succeses) { |
| 227 compositor_delegate_.set_use_null_compositor_frame_sink( | 230 compositor_delegate_.set_use_null_compositor_frame_sink( |
| 228 use_null_compositor_frame_sink); | 231 use_null_compositor_frame_sink); |
| 229 compositor_delegate_.set_num_failures_before_success( | 232 compositor_delegate_.set_num_failures_before_success( |
| 230 num_failures_before_success); | 233 num_failures_before_success); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 | 291 |
| 289 TEST_F(RenderWidgetCompositorFrameSinkTest, FallbackSuccessNormalSuccess) { | 292 TEST_F(RenderWidgetCompositorFrameSinkTest, FallbackSuccessNormalSuccess) { |
| 290 // The first success is a fallback, but the next should not be a fallback. | 293 // The first success is a fallback, but the next should not be a fallback. |
| 291 RunTest(false, | 294 RunTest(false, |
| 292 RenderWidgetCompositor::COMPOSITOR_FRAME_SINK_RETRIES_BEFORE_FALLBACK, | 295 RenderWidgetCompositor::COMPOSITOR_FRAME_SINK_RETRIES_BEFORE_FALLBACK, |
| 293 1, 1); | 296 1, 1); |
| 294 } | 297 } |
| 295 | 298 |
| 296 } // namespace | 299 } // namespace |
| 297 } // namespace content | 300 } // namespace content |
| OLD | NEW |