Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(178)

Side by Side Diff: cc/solid_color_layer_impl_unittest.cc

Issue 11232051: Remove static thread pointers from CC (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Apply code review comments Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/software_renderer_unittest.cc ('k') | cc/test/fake_proxy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "config.h" 5 #include "config.h"
6 6
7 #include "cc/solid_color_layer_impl.h" 7 #include "cc/solid_color_layer_impl.h"
8 8
9 #include "cc/append_quads_data.h" 9 #include "cc/append_quads_data.h"
10 #include "cc/single_thread_proxy.h" 10 #include "cc/single_thread_proxy.h"
11 #include "cc/solid_color_draw_quad.h" 11 #include "cc/solid_color_draw_quad.h"
12 #include "cc/test/layer_test_common.h" 12 #include "cc/test/layer_test_common.h"
13 #include "cc/test/mock_quad_culler.h" 13 #include "cc/test/mock_quad_culler.h"
14 #include "testing/gmock/include/gmock/gmock.h" 14 #include "testing/gmock/include/gmock/gmock.h"
15 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
16 16
17 using namespace cc; 17 using namespace cc;
18 using namespace LayerTestCommon; 18 using namespace LayerTestCommon;
19 19
20 namespace { 20 namespace {
21 21
22 TEST(SolidColorLayerImplTest, verifyTilingCompleteAndNoOverlap) 22 TEST(SolidColorLayerImplTest, verifyTilingCompleteAndNoOverlap)
23 { 23 {
24 DebugScopedSetImplThread scopedImplThread;
25
26 MockQuadCuller quadCuller; 24 MockQuadCuller quadCuller;
27 gfx::Size layerSize = gfx::Size(800, 600); 25 gfx::Size layerSize = gfx::Size(800, 600);
28 gfx::Rect visibleContentRect = gfx::Rect(gfx::Point(), layerSize); 26 gfx::Rect visibleContentRect = gfx::Rect(gfx::Point(), layerSize);
29 27
30 scoped_ptr<SolidColorLayerImpl> layer = SolidColorLayerImpl::create(1); 28 scoped_ptr<SolidColorLayerImpl> layer = SolidColorLayerImpl::create(1);
31 layer->setVisibleContentRect(visibleContentRect); 29 layer->setVisibleContentRect(visibleContentRect);
32 layer->setBounds(layerSize); 30 layer->setBounds(layerSize);
33 layer->setContentBounds(layerSize); 31 layer->setContentBounds(layerSize);
34 layer->createRenderSurface(); 32 layer->createRenderSurface();
35 layer->setRenderTarget(layer.get()); 33 layer->setRenderTarget(layer.get());
36 34
37 AppendQuadsData data; 35 AppendQuadsData data;
38 layer->appendQuads(quadCuller, data); 36 layer->appendQuads(quadCuller, data);
39 37
40 verifyQuadsExactlyCoverRect(quadCuller.quadList(), visibleContentRect); 38 verifyQuadsExactlyCoverRect(quadCuller.quadList(), visibleContentRect);
41 } 39 }
42 40
43 TEST(SolidColorLayerImplTest, verifyCorrectBackgroundColorInQuad) 41 TEST(SolidColorLayerImplTest, verifyCorrectBackgroundColorInQuad)
44 { 42 {
45 DebugScopedSetImplThread scopedImplThread;
46
47 SkColor testColor = 0xFFA55AFF; 43 SkColor testColor = 0xFFA55AFF;
48 44
49 MockQuadCuller quadCuller; 45 MockQuadCuller quadCuller;
50 gfx::Size layerSize = gfx::Size(100, 100); 46 gfx::Size layerSize = gfx::Size(100, 100);
51 gfx::Rect visibleContentRect = gfx::Rect(gfx::Point(), layerSize); 47 gfx::Rect visibleContentRect = gfx::Rect(gfx::Point(), layerSize);
52 48
53 scoped_ptr<SolidColorLayerImpl> layer = SolidColorLayerImpl::create(1); 49 scoped_ptr<SolidColorLayerImpl> layer = SolidColorLayerImpl::create(1);
54 layer->setVisibleContentRect(visibleContentRect); 50 layer->setVisibleContentRect(visibleContentRect);
55 layer->setBounds(layerSize); 51 layer->setBounds(layerSize);
56 layer->setContentBounds(layerSize); 52 layer->setContentBounds(layerSize);
57 layer->setBackgroundColor(testColor); 53 layer->setBackgroundColor(testColor);
58 layer->createRenderSurface(); 54 layer->createRenderSurface();
59 layer->setRenderTarget(layer.get()); 55 layer->setRenderTarget(layer.get());
60 56
61 AppendQuadsData data; 57 AppendQuadsData data;
62 layer->appendQuads(quadCuller, data); 58 layer->appendQuads(quadCuller, data);
63 59
64 ASSERT_EQ(quadCuller.quadList().size(), 1U); 60 ASSERT_EQ(quadCuller.quadList().size(), 1U);
65 EXPECT_EQ(SolidColorDrawQuad::materialCast(quadCuller.quadList()[0])->color( ), testColor); 61 EXPECT_EQ(SolidColorDrawQuad::materialCast(quadCuller.quadList()[0])->color( ), testColor);
66 } 62 }
67 63
68 TEST(SolidColorLayerImplTest, verifyCorrectOpacityInQuad) 64 TEST(SolidColorLayerImplTest, verifyCorrectOpacityInQuad)
69 { 65 {
70 DebugScopedSetImplThread scopedImplThread;
71
72 const float opacity = 0.5f; 66 const float opacity = 0.5f;
73 67
74 MockQuadCuller quadCuller; 68 MockQuadCuller quadCuller;
75 gfx::Size layerSize = gfx::Size(100, 100); 69 gfx::Size layerSize = gfx::Size(100, 100);
76 gfx::Rect visibleContentRect = gfx::Rect(gfx::Point(), layerSize); 70 gfx::Rect visibleContentRect = gfx::Rect(gfx::Point(), layerSize);
77 71
78 scoped_ptr<SolidColorLayerImpl> layer = SolidColorLayerImpl::create(1); 72 scoped_ptr<SolidColorLayerImpl> layer = SolidColorLayerImpl::create(1);
79 layer->setVisibleContentRect(visibleContentRect); 73 layer->setVisibleContentRect(visibleContentRect);
80 layer->setBounds(layerSize); 74 layer->setBounds(layerSize);
81 layer->setContentBounds(layerSize); 75 layer->setContentBounds(layerSize);
82 layer->setDrawOpacity(opacity); 76 layer->setDrawOpacity(opacity);
83 layer->createRenderSurface(); 77 layer->createRenderSurface();
84 layer->setRenderTarget(layer.get()); 78 layer->setRenderTarget(layer.get());
85 79
86 AppendQuadsData data; 80 AppendQuadsData data;
87 layer->appendQuads(quadCuller, data); 81 layer->appendQuads(quadCuller, data);
88 82
89 ASSERT_EQ(quadCuller.quadList().size(), 1U); 83 ASSERT_EQ(quadCuller.quadList().size(), 1U);
90 EXPECT_EQ(opacity, SolidColorDrawQuad::materialCast(quadCuller.quadList()[0] )->opacity()); 84 EXPECT_EQ(opacity, SolidColorDrawQuad::materialCast(quadCuller.quadList()[0] )->opacity());
91 } 85 }
92 86
93 } // anonymous namespace 87 } // anonymous namespace
OLDNEW
« no previous file with comments | « cc/software_renderer_unittest.cc ('k') | cc/test/fake_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698