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/solid_color_layer_impl.h" | 5 #include "cc/solid_color_layer_impl.h" |
6 | 6 |
7 #include "cc/append_quads_data.h" | 7 #include "cc/append_quads_data.h" |
8 #include "cc/single_thread_proxy.h" | 8 #include "cc/single_thread_proxy.h" |
9 #include "cc/solid_color_draw_quad.h" | 9 #include "cc/solid_color_draw_quad.h" |
10 #include "cc/solid_color_layer.h" | 10 #include "cc/solid_color_layer.h" |
11 #include "cc/test/fake_impl_proxy.h" | 11 #include "cc/test/fake_impl_proxy.h" |
12 #include "cc/test/fake_layer_tree_host_impl.h" | 12 #include "cc/test/fake_layer_tree_host_impl.h" |
13 #include "cc/test/layer_test_common.h" | 13 #include "cc/test/layer_test_common.h" |
14 #include "cc/test/mock_quad_culler.h" | 14 #include "cc/test/mock_quad_culler.h" |
15 #include "testing/gmock/include/gmock/gmock.h" | 15 #include "testing/gmock/include/gmock/gmock.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
17 | 17 |
18 using namespace LayerTestCommon; | |
19 | |
20 namespace cc { | 18 namespace cc { |
21 namespace { | 19 namespace { |
22 | 20 |
23 TEST(SolidColorLayerImplTest, verifyTilingCompleteAndNoOverlap) | 21 TEST(SolidColorLayerImplTest, verifyTilingCompleteAndNoOverlap) |
24 { | 22 { |
25 MockQuadCuller quadCuller; | 23 MockQuadCuller quadCuller; |
26 gfx::Size layerSize = gfx::Size(800, 600); | 24 gfx::Size layerSize = gfx::Size(800, 600); |
27 gfx::Rect visibleContentRect = gfx::Rect(gfx::Point(), layerSize); | 25 gfx::Rect visibleContentRect = gfx::Rect(gfx::Point(), layerSize); |
28 | 26 |
29 FakeImplProxy proxy; | 27 FakeImplProxy proxy; |
30 FakeLayerTreeHostImpl hostImpl(&proxy); | 28 FakeLayerTreeHostImpl hostImpl(&proxy); |
31 scoped_ptr<SolidColorLayerImpl> layer = SolidColorLayerImpl::create(hostImpl
.activeTree(), 1); | 29 scoped_ptr<SolidColorLayerImpl> layer = SolidColorLayerImpl::create(hostImpl
.activeTree(), 1); |
32 layer->drawProperties().visible_content_rect = visibleContentRect; | 30 layer->drawProperties().visible_content_rect = visibleContentRect; |
33 layer->setBounds(layerSize); | 31 layer->setBounds(layerSize); |
34 layer->setContentBounds(layerSize); | 32 layer->setContentBounds(layerSize); |
35 layer->createRenderSurface(); | 33 layer->createRenderSurface(); |
36 layer->drawProperties().render_target = layer.get(); | 34 layer->drawProperties().render_target = layer.get(); |
37 | 35 |
38 AppendQuadsData data; | 36 AppendQuadsData data; |
39 layer->appendQuads(quadCuller, data); | 37 layer->appendQuads(quadCuller, data); |
40 | 38 |
41 verifyQuadsExactlyCoverRect(quadCuller.quadList(), visibleContentRect); | 39 LayerTestCommon::verifyQuadsExactlyCoverRect(quadCuller.quadList(), visibleC
ontentRect); |
42 } | 40 } |
43 | 41 |
44 TEST(SolidColorLayerImplTest, verifyCorrectBackgroundColorInQuad) | 42 TEST(SolidColorLayerImplTest, verifyCorrectBackgroundColorInQuad) |
45 { | 43 { |
46 SkColor testColor = 0xFFA55AFF; | 44 SkColor testColor = 0xFFA55AFF; |
47 | 45 |
48 MockQuadCuller quadCuller; | 46 MockQuadCuller quadCuller; |
49 gfx::Size layerSize = gfx::Size(100, 100); | 47 gfx::Size layerSize = gfx::Size(100, 100); |
50 gfx::Rect visibleContentRect = gfx::Rect(gfx::Point(), layerSize); | 48 gfx::Rect visibleContentRect = gfx::Rect(gfx::Point(), layerSize); |
51 | 49 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 AppendQuadsData data; | 143 AppendQuadsData data; |
146 layerImpl->appendQuads(quadCuller, data); | 144 layerImpl->appendQuads(quadCuller, data); |
147 | 145 |
148 ASSERT_EQ(quadCuller.quadList().size(), 1U); | 146 ASSERT_EQ(quadCuller.quadList().size(), 1U); |
149 EXPECT_EQ(gfx::Rect().ToString(), quadCuller.quadList()[0]->opaque_rect.
ToString()); | 147 EXPECT_EQ(gfx::Rect().ToString(), quadCuller.quadList()[0]->opaque_rect.
ToString()); |
150 } | 148 } |
151 } | 149 } |
152 | 150 |
153 } // namespace | 151 } // namespace |
154 } // namespace cc | 152 } // namespace cc |
OLD | NEW |