| 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/output/delegating_renderer.h" | 5 #include "cc/output/delegating_renderer.h" |
| 6 | 6 |
| 7 #include "cc/test/fake_output_surface.h" | 7 #include "cc/test/fake_output_surface.h" |
| 8 #include "cc/test/layer_tree_test.h" | 8 #include "cc/test/layer_tree_test.h" |
| 9 #include "cc/test/render_pass_test_common.h" | 9 #include "cc/test/render_pass_test_common.h" |
| 10 #include "cc/test/render_pass_test_utils.h" | 10 #include "cc/test/render_pass_test_utils.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 class DelegatingRendererTestDraw : public DelegatingRendererTest { | 33 class DelegatingRendererTestDraw : public DelegatingRendererTest { |
| 34 public: | 34 public: |
| 35 virtual void BeginTest() OVERRIDE { | 35 virtual void BeginTest() OVERRIDE { |
| 36 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 0.5f, 4.f); | 36 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 0.5f, 4.f); |
| 37 PostSetNeedsCommitToMainThread(); | 37 PostSetNeedsCommitToMainThread(); |
| 38 } | 38 } |
| 39 | 39 |
| 40 virtual void AfterTest() OVERRIDE {} | 40 virtual void AfterTest() OVERRIDE {} |
| 41 | 41 |
| 42 virtual bool PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 42 virtual DrawSwapReadbackResult::DrawResult PrepareToDrawOnThread( |
| 43 LayerTreeHostImpl::FrameData* frame, | 43 LayerTreeHostImpl* host_impl, |
| 44 bool result) | 44 LayerTreeHostImpl::FrameData* frame, |
| 45 OVERRIDE { | 45 DrawSwapReadbackResult::DrawResult draw_result) OVERRIDE { |
| 46 EXPECT_EQ(0u, output_surface_->num_sent_frames()); | 46 EXPECT_EQ(0u, output_surface_->num_sent_frames()); |
| 47 | 47 |
| 48 const CompositorFrame& last_frame = output_surface_->last_sent_frame(); | 48 const CompositorFrame& last_frame = output_surface_->last_sent_frame(); |
| 49 EXPECT_FALSE(last_frame.delegated_frame_data); | 49 EXPECT_FALSE(last_frame.delegated_frame_data); |
| 50 EXPECT_FALSE(last_frame.gl_frame_data); | 50 EXPECT_FALSE(last_frame.gl_frame_data); |
| 51 EXPECT_EQ(0.f, last_frame.metadata.min_page_scale_factor); | 51 EXPECT_EQ(0.f, last_frame.metadata.min_page_scale_factor); |
| 52 EXPECT_EQ(0.f, last_frame.metadata.max_page_scale_factor); | 52 EXPECT_EQ(0.f, last_frame.metadata.max_page_scale_factor); |
| 53 return true; | 53 return DrawSwapReadbackResult::DID_DRAW; |
| 54 } | 54 } |
| 55 | 55 |
| 56 virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { | 56 virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { |
| 57 EXPECT_EQ(0u, output_surface_->num_sent_frames()); | 57 EXPECT_EQ(0u, output_surface_->num_sent_frames()); |
| 58 } | 58 } |
| 59 | 59 |
| 60 virtual void SwapBuffersOnThread(LayerTreeHostImpl* host_impl, | 60 virtual void SwapBuffersOnThread(LayerTreeHostImpl* host_impl, |
| 61 bool result) OVERRIDE { | 61 bool result) OVERRIDE { |
| 62 EXPECT_TRUE(result); | 62 EXPECT_TRUE(result); |
| 63 EXPECT_EQ(1u, output_surface_->num_sent_frames()); | 63 EXPECT_EQ(1u, output_surface_->num_sent_frames()); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 82 SINGLE_AND_MULTI_THREAD_DELEGATING_RENDERER_TEST_F(DelegatingRendererTestDraw); | 82 SINGLE_AND_MULTI_THREAD_DELEGATING_RENDERER_TEST_F(DelegatingRendererTestDraw); |
| 83 | 83 |
| 84 class DelegatingRendererTestResources : public DelegatingRendererTest { | 84 class DelegatingRendererTestResources : public DelegatingRendererTest { |
| 85 public: | 85 public: |
| 86 virtual void BeginTest() OVERRIDE { | 86 virtual void BeginTest() OVERRIDE { |
| 87 PostSetNeedsCommitToMainThread(); | 87 PostSetNeedsCommitToMainThread(); |
| 88 } | 88 } |
| 89 | 89 |
| 90 virtual void AfterTest() OVERRIDE {} | 90 virtual void AfterTest() OVERRIDE {} |
| 91 | 91 |
| 92 virtual bool PrepareToDrawOnThread( | 92 virtual DrawSwapReadbackResult::DrawResult PrepareToDrawOnThread( |
| 93 LayerTreeHostImpl* host_impl, | 93 LayerTreeHostImpl* host_impl, |
| 94 LayerTreeHostImpl::FrameData* frame, | 94 LayerTreeHostImpl::FrameData* frame, |
| 95 bool result) OVERRIDE { | 95 DrawSwapReadbackResult::DrawResult draw_result) OVERRIDE { |
| 96 frame->render_passes.clear(); | 96 frame->render_passes.clear(); |
| 97 frame->render_passes_by_id.clear(); | 97 frame->render_passes_by_id.clear(); |
| 98 | 98 |
| 99 TestRenderPass* child_pass = AddRenderPass( | 99 TestRenderPass* child_pass = AddRenderPass( |
| 100 &frame->render_passes, | 100 &frame->render_passes, |
| 101 RenderPass::Id(2, 1), | 101 RenderPass::Id(2, 1), |
| 102 gfx::Rect(3, 3, 10, 10), | 102 gfx::Rect(3, 3, 10, 10), |
| 103 gfx::Transform()); | 103 gfx::Transform()); |
| 104 child_pass->AppendOneOfEveryQuadType( | 104 child_pass->AppendOneOfEveryQuadType( |
| 105 host_impl->resource_provider(), RenderPass::Id(0, 0)); | 105 host_impl->resource_provider(), RenderPass::Id(0, 0)); |
| 106 | 106 |
| 107 TestRenderPass* pass = AddRenderPass( | 107 TestRenderPass* pass = AddRenderPass( |
| 108 &frame->render_passes, | 108 &frame->render_passes, |
| 109 RenderPass::Id(1, 1), | 109 RenderPass::Id(1, 1), |
| 110 gfx::Rect(3, 3, 10, 10), | 110 gfx::Rect(3, 3, 10, 10), |
| 111 gfx::Transform()); | 111 gfx::Transform()); |
| 112 pass->AppendOneOfEveryQuadType( | 112 pass->AppendOneOfEveryQuadType( |
| 113 host_impl->resource_provider(), child_pass->id); | 113 host_impl->resource_provider(), child_pass->id); |
| 114 return true; | 114 return DrawSwapReadbackResult::DID_DRAW; |
| 115 } | 115 } |
| 116 | 116 |
| 117 virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { | 117 virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { |
| 118 EXPECT_EQ(0u, output_surface_->num_sent_frames()); | 118 EXPECT_EQ(0u, output_surface_->num_sent_frames()); |
| 119 } | 119 } |
| 120 | 120 |
| 121 virtual void SwapBuffersOnThread(LayerTreeHostImpl* host_impl, | 121 virtual void SwapBuffersOnThread(LayerTreeHostImpl* host_impl, |
| 122 bool result) OVERRIDE { | 122 bool result) OVERRIDE { |
| 123 EXPECT_TRUE(result); | 123 EXPECT_TRUE(result); |
| 124 EXPECT_EQ(1u, output_surface_->num_sent_frames()); | 124 EXPECT_EQ(1u, output_surface_->num_sent_frames()); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 136 22u, last_frame.delegated_frame_data->resource_list.size()); | 136 22u, last_frame.delegated_frame_data->resource_list.size()); |
| 137 | 137 |
| 138 EndTest(); | 138 EndTest(); |
| 139 } | 139 } |
| 140 }; | 140 }; |
| 141 | 141 |
| 142 SINGLE_AND_MULTI_THREAD_DELEGATING_RENDERER_TEST_F( | 142 SINGLE_AND_MULTI_THREAD_DELEGATING_RENDERER_TEST_F( |
| 143 DelegatingRendererTestResources); | 143 DelegatingRendererTestResources); |
| 144 | 144 |
| 145 } // namespace cc | 145 } // namespace cc |
| OLD | NEW |