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

Side by Side Diff: cc/solid_color_layer_impl_unittest.cc

Issue 11369071: A speculative Revert for r165872 - Remove static thread pointers from CC, attempt 2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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 | Annotate | Revision Log
« 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
24 MockQuadCuller quadCuller; 26 MockQuadCuller quadCuller;
25 gfx::Size layerSize = gfx::Size(800, 600); 27 gfx::Size layerSize = gfx::Size(800, 600);
26 gfx::Rect visibleContentRect = gfx::Rect(gfx::Point(), layerSize); 28 gfx::Rect visibleContentRect = gfx::Rect(gfx::Point(), layerSize);
27 29
28 scoped_ptr<SolidColorLayerImpl> layer = SolidColorLayerImpl::create(1); 30 scoped_ptr<SolidColorLayerImpl> layer = SolidColorLayerImpl::create(1);
29 layer->setVisibleContentRect(visibleContentRect); 31 layer->setVisibleContentRect(visibleContentRect);
30 layer->setBounds(layerSize); 32 layer->setBounds(layerSize);
31 layer->setContentBounds(layerSize); 33 layer->setContentBounds(layerSize);
32 layer->createRenderSurface(); 34 layer->createRenderSurface();
33 layer->setRenderTarget(layer.get()); 35 layer->setRenderTarget(layer.get());
34 36
35 AppendQuadsData data; 37 AppendQuadsData data;
36 layer->appendQuads(quadCuller, data); 38 layer->appendQuads(quadCuller, data);
37 39
38 verifyQuadsExactlyCoverRect(quadCuller.quadList(), visibleContentRect); 40 verifyQuadsExactlyCoverRect(quadCuller.quadList(), visibleContentRect);
39 } 41 }
40 42
41 TEST(SolidColorLayerImplTest, verifyCorrectBackgroundColorInQuad) 43 TEST(SolidColorLayerImplTest, verifyCorrectBackgroundColorInQuad)
42 { 44 {
45 DebugScopedSetImplThread scopedImplThread;
46
43 SkColor testColor = 0xFFA55AFF; 47 SkColor testColor = 0xFFA55AFF;
44 48
45 MockQuadCuller quadCuller; 49 MockQuadCuller quadCuller;
46 gfx::Size layerSize = gfx::Size(100, 100); 50 gfx::Size layerSize = gfx::Size(100, 100);
47 gfx::Rect visibleContentRect = gfx::Rect(gfx::Point(), layerSize); 51 gfx::Rect visibleContentRect = gfx::Rect(gfx::Point(), layerSize);
48 52
49 scoped_ptr<SolidColorLayerImpl> layer = SolidColorLayerImpl::create(1); 53 scoped_ptr<SolidColorLayerImpl> layer = SolidColorLayerImpl::create(1);
50 layer->setVisibleContentRect(visibleContentRect); 54 layer->setVisibleContentRect(visibleContentRect);
51 layer->setBounds(layerSize); 55 layer->setBounds(layerSize);
52 layer->setContentBounds(layerSize); 56 layer->setContentBounds(layerSize);
53 layer->setBackgroundColor(testColor); 57 layer->setBackgroundColor(testColor);
54 layer->createRenderSurface(); 58 layer->createRenderSurface();
55 layer->setRenderTarget(layer.get()); 59 layer->setRenderTarget(layer.get());
56 60
57 AppendQuadsData data; 61 AppendQuadsData data;
58 layer->appendQuads(quadCuller, data); 62 layer->appendQuads(quadCuller, data);
59 63
60 ASSERT_EQ(quadCuller.quadList().size(), 1U); 64 ASSERT_EQ(quadCuller.quadList().size(), 1U);
61 EXPECT_EQ(SolidColorDrawQuad::materialCast(quadCuller.quadList()[0])->color( ), testColor); 65 EXPECT_EQ(SolidColorDrawQuad::materialCast(quadCuller.quadList()[0])->color( ), testColor);
62 } 66 }
63 67
64 TEST(SolidColorLayerImplTest, verifyCorrectOpacityInQuad) 68 TEST(SolidColorLayerImplTest, verifyCorrectOpacityInQuad)
65 { 69 {
70 DebugScopedSetImplThread scopedImplThread;
71
66 const float opacity = 0.5f; 72 const float opacity = 0.5f;
67 73
68 MockQuadCuller quadCuller; 74 MockQuadCuller quadCuller;
69 gfx::Size layerSize = gfx::Size(100, 100); 75 gfx::Size layerSize = gfx::Size(100, 100);
70 gfx::Rect visibleContentRect = gfx::Rect(gfx::Point(), layerSize); 76 gfx::Rect visibleContentRect = gfx::Rect(gfx::Point(), layerSize);
71 77
72 scoped_ptr<SolidColorLayerImpl> layer = SolidColorLayerImpl::create(1); 78 scoped_ptr<SolidColorLayerImpl> layer = SolidColorLayerImpl::create(1);
73 layer->setVisibleContentRect(visibleContentRect); 79 layer->setVisibleContentRect(visibleContentRect);
74 layer->setBounds(layerSize); 80 layer->setBounds(layerSize);
75 layer->setContentBounds(layerSize); 81 layer->setContentBounds(layerSize);
76 layer->setDrawOpacity(opacity); 82 layer->setDrawOpacity(opacity);
77 layer->createRenderSurface(); 83 layer->createRenderSurface();
78 layer->setRenderTarget(layer.get()); 84 layer->setRenderTarget(layer.get());
79 85
80 AppendQuadsData data; 86 AppendQuadsData data;
81 layer->appendQuads(quadCuller, data); 87 layer->appendQuads(quadCuller, data);
82 88
83 ASSERT_EQ(quadCuller.quadList().size(), 1U); 89 ASSERT_EQ(quadCuller.quadList().size(), 1U);
84 EXPECT_EQ(opacity, SolidColorDrawQuad::materialCast(quadCuller.quadList()[0] )->opacity()); 90 EXPECT_EQ(opacity, SolidColorDrawQuad::materialCast(quadCuller.quadList()[0] )->opacity());
85 } 91 }
86 92
87 } // namespace 93 } // 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