OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/layers/solid_color_layer_impl.h" | 5 #include "cc/layers/solid_color_layer_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "cc/layers/append_quads_data.h" | 11 #include "cc/layers/append_quads_data.h" |
12 #include "cc/layers/layer_settings.h" | |
13 #include "cc/layers/solid_color_layer.h" | 12 #include "cc/layers/solid_color_layer.h" |
14 #include "cc/quads/solid_color_draw_quad.h" | 13 #include "cc/quads/solid_color_draw_quad.h" |
15 #include "cc/test/fake_impl_task_runner_provider.h" | 14 #include "cc/test/fake_impl_task_runner_provider.h" |
16 #include "cc/test/fake_layer_tree_host.h" | 15 #include "cc/test/fake_layer_tree_host.h" |
17 #include "cc/test/layer_test_common.h" | 16 #include "cc/test/layer_test_common.h" |
18 #include "cc/test/test_task_graph_runner.h" | 17 #include "cc/test/test_task_graph_runner.h" |
19 #include "cc/trees/single_thread_proxy.h" | 18 #include "cc/trees/single_thread_proxy.h" |
20 #include "testing/gmock/include/gmock/gmock.h" | 19 #include "testing/gmock/include/gmock/gmock.h" |
21 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
22 | 21 |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 | 126 |
128 ASSERT_EQ(render_pass->quad_list.size(), 1U); | 127 ASSERT_EQ(render_pass->quad_list.size(), 1U); |
129 EXPECT_EQ(blend_mode, | 128 EXPECT_EQ(blend_mode, |
130 render_pass->quad_list.front()->shared_quad_state->blend_mode); | 129 render_pass->quad_list.front()->shared_quad_state->blend_mode); |
131 } | 130 } |
132 | 131 |
133 TEST(SolidColorLayerImplTest, VerifyOpaqueRect) { | 132 TEST(SolidColorLayerImplTest, VerifyOpaqueRect) { |
134 gfx::Size layer_size = gfx::Size(100, 100); | 133 gfx::Size layer_size = gfx::Size(100, 100); |
135 gfx::Rect visible_layer_rect = gfx::Rect(layer_size); | 134 gfx::Rect visible_layer_rect = gfx::Rect(layer_size); |
136 | 135 |
137 LayerSettings layer_settings; | 136 scoped_refptr<SolidColorLayer> layer = SolidColorLayer::Create(); |
138 | |
139 scoped_refptr<SolidColorLayer> layer = | |
140 SolidColorLayer::Create(layer_settings); | |
141 layer->SetBounds(layer_size); | 137 layer->SetBounds(layer_size); |
142 layer->SetForceRenderSurface(true); | 138 layer->SetForceRenderSurface(true); |
143 | 139 |
144 scoped_refptr<Layer> root = Layer::Create(layer_settings); | 140 scoped_refptr<Layer> root = Layer::Create(); |
145 root->AddChild(layer); | 141 root->AddChild(layer); |
146 | 142 |
147 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D); | 143 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D); |
148 TestTaskGraphRunner task_graph_runner; | 144 TestTaskGraphRunner task_graph_runner; |
149 scoped_ptr<FakeLayerTreeHost> host = | 145 scoped_ptr<FakeLayerTreeHost> host = |
150 FakeLayerTreeHost::Create(&client, &task_graph_runner); | 146 FakeLayerTreeHost::Create(&client, &task_graph_runner); |
151 host->SetRootLayer(root); | 147 host->SetRootLayer(root); |
152 | 148 |
153 LayerTreeHostCommon::CalcDrawPropsMainInputs inputs(root.get(), | 149 LayerTreeHostCommon::CalcDrawPropsMainInputs inputs(root.get(), |
154 gfx::Size(500, 500)); | 150 gfx::Size(500, 500)); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 LayerTestCommon::VerifyQuadsAreOccluded( | 245 LayerTestCommon::VerifyQuadsAreOccluded( |
250 impl.quad_list(), occluded, &partially_occluded_count); | 246 impl.quad_list(), occluded, &partially_occluded_count); |
251 // 4 quads are completely occluded, 8 are partially occluded. | 247 // 4 quads are completely occluded, 8 are partially occluded. |
252 EXPECT_EQ(16u - 4u, impl.quad_list().size()); | 248 EXPECT_EQ(16u - 4u, impl.quad_list().size()); |
253 EXPECT_EQ(8u, partially_occluded_count); | 249 EXPECT_EQ(8u, partially_occluded_count); |
254 } | 250 } |
255 } | 251 } |
256 | 252 |
257 } // namespace | 253 } // namespace |
258 } // namespace cc | 254 } // namespace cc |
OLD | NEW |