Chromium Code Reviews| Index: cc/test/layer_tree_test.cc |
| diff --git a/cc/test/layer_tree_test.cc b/cc/test/layer_tree_test.cc |
| index 95758c2af1ece29752c516d19eaec11b7f0132e9..9f64e804463c62bd43744bd1ccf23caccef306aa 100644 |
| --- a/cc/test/layer_tree_test.cc |
| +++ b/cc/test/layer_tree_test.cc |
| @@ -53,12 +53,8 @@ class LayerTreeHostImplForTesting : public LayerTreeHostImpl { |
| LayerTreeHostImplClient* host_impl_client, |
| Proxy* proxy, |
| RenderingStatsInstrumentation* stats_instrumentation) { |
| - return make_scoped_ptr( |
| - new LayerTreeHostImplForTesting(test_hooks, |
| - settings, |
| - host_impl_client, |
| - proxy, |
| - stats_instrumentation)); |
| + return make_scoped_ptr(new LayerTreeHostImplForTesting( |
| + test_hooks, settings, host_impl_client, proxy, stats_instrumentation)); |
| } |
| protected: |
| @@ -225,9 +221,7 @@ class LayerTreeHostClientForTesting : public LayerTreeHostClient, |
| monotonic_time * base::Time::kMicrosecondsPerSecond)); |
| } |
| - virtual void Layout() OVERRIDE { |
| - test_hooks_->Layout(); |
| - } |
| + virtual void Layout() OVERRIDE { test_hooks_->Layout(); } |
| virtual void ApplyScrollAndScale(gfx::Vector2d scroll_delta, |
| float scale) OVERRIDE { |
| @@ -249,9 +243,7 @@ class LayerTreeHostClientForTesting : public LayerTreeHostClient, |
| virtual void WillCommit() OVERRIDE { test_hooks_->WillCommit(); } |
| - virtual void DidCommit() OVERRIDE { |
| - test_hooks_->DidCommit(); |
| - } |
| + virtual void DidCommit() OVERRIDE { test_hooks_->DidCommit(); } |
| virtual void DidCommitAndDrawFrame() OVERRIDE { |
| test_hooks_->DidCommitAndDrawFrame(); |
| @@ -318,9 +310,7 @@ class LayerTreeHostForTesting : public LayerTreeHost { |
| void set_test_started(bool started) { test_started_ = started; } |
| - virtual void DidDeferCommit() OVERRIDE { |
| - test_hooks_->DidDeferCommit(); |
| - } |
| + virtual void DidDeferCommit() OVERRIDE { test_hooks_->DidDeferCommit(); } |
| private: |
| LayerTreeHostForTesting(TestHooks* test_hooks, |
| @@ -488,8 +478,8 @@ void LayerTreeTest::DoBeginTest() { |
| // Allow commits to happen once BeginTest() has had a chance to post tasks |
| // so that those tasks will happen before the first commit. |
| if (layer_tree_host_) { |
| - static_cast<LayerTreeHostForTesting*>(layer_tree_host_.get())-> |
| - set_test_started(true); |
| + static_cast<LayerTreeHostForTesting*>(layer_tree_host_.get()) |
| + ->set_test_started(true); |
| } |
| } |
| @@ -538,11 +528,8 @@ void LayerTreeTest::DispatchAddAnimation(Layer* layer_to_receive_animation, |
| DCHECK(!proxy() || proxy()->IsMainThread()); |
| if (layer_to_receive_animation) { |
| - AddOpacityTransitionToLayer(layer_to_receive_animation, |
| - animation_duration, |
| - 0, |
| - 0.5, |
| - true); |
| + AddOpacityTransitionToLayer( |
| + layer_to_receive_animation, animation_duration, 0, 0.5, true); |
| } |
| } |
| @@ -645,8 +632,8 @@ void LayerTreeTest::RunTest(bool threaded, |
| // mocked out. |
| settings_.refresh_rate = 200.0; |
| if (impl_side_painting) { |
| - DCHECK(threaded) << |
| - "Don't run single thread + impl side painting, it doesn't exist."; |
| + DCHECK(threaded) |
| + << "Don't run single thread + impl side painting, it doesn't exist."; |
| settings_.impl_side_painting = true; |
| } |
| InitializeSettings(&settings_); |
| @@ -684,15 +671,21 @@ void LayerTreeTest::RunTestWithImplSidePainting() { |
| } |
| scoped_ptr<OutputSurface> LayerTreeTest::CreateOutputSurface(bool fallback) { |
| - scoped_ptr<FakeOutputSurface> output_surface; |
| - if (delegating_renderer_) |
| - output_surface = FakeOutputSurface::CreateDelegating3d(); |
| - else |
| - output_surface = FakeOutputSurface::Create3d(); |
| + scoped_ptr<FakeOutputSurface> output_surface = |
| + CreateFakeOutputSurfaceForTest(fallback); |
| + |
| output_surface_ = output_surface.get(); |
| return output_surface.PassAs<OutputSurface>(); |
| } |
| +scoped_ptr<FakeOutputSurface> LayerTreeTest::CreateFakeOutputSurfaceForTest( |
| + bool fallback) { |
| + if (delegating_renderer_) |
| + return FakeOutputSurface::CreateDelegating3d(); |
| + else |
| + return FakeOutputSurface::Create3d(); |
| +} |
| + |
| scoped_refptr<ContextProvider> LayerTreeTest::OffscreenContextProvider() { |
| if (!compositor_contexts_.get() || |
| compositor_contexts_->DestroyedOnMainThread()) |
| @@ -700,4 +693,9 @@ scoped_refptr<ContextProvider> LayerTreeTest::OffscreenContextProvider() { |
| return compositor_contexts_; |
| } |
| +TestWebGraphicsContext3D* LayerTreeTest::TestContext() { |
| + return static_cast<TestContextProvider*>( |
|
danakj
2014/01/09 21:23:34
can you DCHECK we're on the impl side here?
or ma
jamesr
2014/01/10 00:12:34
That'd mean downcasting here instead of relying on
danakj
2014/01/13 19:36:42
I see, that's a good point.
|
| + output_surface_->context_provider().get())->TestContext3d(); |
| +} |
| + |
| } // namespace cc |