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" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 | 12 |
13 namespace cc { | 13 namespace cc { |
14 | 14 |
15 class DelegatingRendererTest : public LayerTreeTest { | 15 class DelegatingRendererTest : public LayerTreeTest { |
16 public: | 16 public: |
17 DelegatingRendererTest() : LayerTreeTest(), output_surface_(NULL) {} | 17 DelegatingRendererTest() : LayerTreeTest(), output_surface_(NULL) {} |
18 virtual ~DelegatingRendererTest() {} | 18 virtual ~DelegatingRendererTest() {} |
19 | 19 |
20 virtual scoped_ptr<OutputSurface> CreateOutputSurface() OVERRIDE { | 20 virtual scoped_ptr<OutputSurface> CreateOutputSurface() OVERRIDE { |
21 scoped_ptr<TestWebGraphicsContext3D> context3d = | |
22 TestWebGraphicsContext3D::Create( | |
23 WebKit::WebGraphicsContext3D::Attributes()); | |
24 context3d_ = context3d.get(); | |
25 scoped_ptr<FakeOutputSurface> output_surface = | 21 scoped_ptr<FakeOutputSurface> output_surface = |
26 FakeOutputSurface::CreateDelegating3d( | 22 FakeOutputSurface::CreateDelegating3d(); |
27 context3d.PassAs<WebKit::WebGraphicsContext3D>()); | |
28 output_surface_ = output_surface.get(); | 23 output_surface_ = output_surface.get(); |
29 return output_surface.PassAs<OutputSurface>(); | 24 return output_surface.PassAs<OutputSurface>(); |
30 } | 25 } |
31 | 26 |
32 protected: | 27 protected: |
33 TestWebGraphicsContext3D* context3d_; | 28 TestWebGraphicsContext3D* context3d_; |
34 FakeOutputSurface* output_surface_; | 29 FakeOutputSurface* output_surface_; |
35 }; | 30 }; |
36 | 31 |
37 class DelegatingRendererTestDraw : public DelegatingRendererTest { | 32 class DelegatingRendererTestDraw : public DelegatingRendererTest { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 EXPECT_EQ(4.f, last_frame.metadata.max_page_scale_factor); | 72 EXPECT_EQ(4.f, last_frame.metadata.max_page_scale_factor); |
78 | 73 |
79 EXPECT_EQ( | 74 EXPECT_EQ( |
80 0u, last_frame.delegated_frame_data->resource_list.size()); | 75 0u, last_frame.delegated_frame_data->resource_list.size()); |
81 EXPECT_EQ(1u, last_frame.delegated_frame_data->render_pass_list.size()); | 76 EXPECT_EQ(1u, last_frame.delegated_frame_data->render_pass_list.size()); |
82 | 77 |
83 EndTest(); | 78 EndTest(); |
84 } | 79 } |
85 }; | 80 }; |
86 | 81 |
87 SINGLE_AND_MULTI_THREAD_TEST_F(DelegatingRendererTestDraw); | 82 SINGLE_AND_MULTI_THREAD_DELEGATING_RENDERER_TEST_F(DelegatingRendererTestDraw); |
88 | 83 |
89 class DelegatingRendererTestResources : public DelegatingRendererTest { | 84 class DelegatingRendererTestResources : public DelegatingRendererTest { |
90 public: | 85 public: |
91 virtual void BeginTest() OVERRIDE { | 86 virtual void BeginTest() OVERRIDE { |
92 PostSetNeedsCommitToMainThread(); | 87 PostSetNeedsCommitToMainThread(); |
93 } | 88 } |
94 | 89 |
95 virtual void AfterTest() OVERRIDE {} | 90 virtual void AfterTest() OVERRIDE {} |
96 | 91 |
97 virtual bool PrepareToDrawOnThread( | 92 virtual bool PrepareToDrawOnThread( |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 // mask resource used when drawing the child render pass. The number 9 may | 131 // mask resource used when drawing the child render pass. The number 9 may |
137 // change if AppendOneOfEveryQuadType() is updated, and the value here | 132 // change if AppendOneOfEveryQuadType() is updated, and the value here |
138 // should be updated accordingly. | 133 // should be updated accordingly. |
139 EXPECT_EQ( | 134 EXPECT_EQ( |
140 19u, last_frame.delegated_frame_data->resource_list.size()); | 135 19u, last_frame.delegated_frame_data->resource_list.size()); |
141 | 136 |
142 EndTest(); | 137 EndTest(); |
143 } | 138 } |
144 }; | 139 }; |
145 | 140 |
146 SINGLE_AND_MULTI_THREAD_TEST_F(DelegatingRendererTestResources); | 141 SINGLE_AND_MULTI_THREAD_DELEGATING_RENDERER_TEST_F( |
| 142 DelegatingRendererTestResources); |
147 | 143 |
148 } // namespace cc | 144 } // namespace cc |
OLD | NEW |