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

Side by Side Diff: cc/render_surface_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/rate_limiter.cc ('k') | cc/renderer.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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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/render_surface_impl.h" 7 #include "cc/render_surface_impl.h"
8 8
9 #include "cc/append_quads_data.h" 9 #include "cc/append_quads_data.h"
10 #include "cc/layer_impl.h" 10 #include "cc/layer_impl.h"
(...skipping 21 matching lines...) Expand all
32 renderSurface->resetPropertyChangedFlag(); \ 32 renderSurface->resetPropertyChangedFlag(); \
33 codeToTest; \ 33 codeToTest; \
34 EXPECT_FALSE(renderSurface->surfacePropertyChanged()) 34 EXPECT_FALSE(renderSurface->surfacePropertyChanged())
35 35
36 TEST(RenderSurfaceTest, verifySurfaceChangesAreTrackedProperly) 36 TEST(RenderSurfaceTest, verifySurfaceChangesAreTrackedProperly)
37 { 37 {
38 // 38 //
39 // This test checks that surfacePropertyChanged() has the correct behavior. 39 // This test checks that surfacePropertyChanged() has the correct behavior.
40 // 40 //
41 41
42 // This will fake that we are on the correct thread for testing purposes.
43 DebugScopedSetImplThread setImplThread;
44
42 scoped_ptr<LayerImpl> owningLayer = LayerImpl::create(1); 45 scoped_ptr<LayerImpl> owningLayer = LayerImpl::create(1);
43 owningLayer->createRenderSurface(); 46 owningLayer->createRenderSurface();
44 ASSERT_TRUE(owningLayer->renderSurface()); 47 ASSERT_TRUE(owningLayer->renderSurface());
45 RenderSurfaceImpl* renderSurface = owningLayer->renderSurface(); 48 RenderSurfaceImpl* renderSurface = owningLayer->renderSurface();
46 gfx::Rect testRect = gfx::Rect(gfx::Point(3, 4), gfx::Size(5, 6)); 49 gfx::Rect testRect = gfx::Rect(gfx::Point(3, 4), gfx::Size(5, 6));
47 owningLayer->resetAllChangeTrackingForSubtree(); 50 owningLayer->resetAllChangeTrackingForSubtree();
48 51
49 // Currently, the contentRect, clipRect, and owningLayer->layerPropertyChang ed() are 52 // Currently, the contentRect, clipRect, and owningLayer->layerPropertyChang ed() are
50 // the only sources of change. 53 // the only sources of change.
51 EXECUTE_AND_VERIFY_SURFACE_CHANGED(renderSurface->setClipRect(testRect)); 54 EXECUTE_AND_VERIFY_SURFACE_CHANGED(renderSurface->setClipRect(testRect));
(...skipping 14 matching lines...) Expand all
66 // The rest of the surface properties are either internal and should not cau se change, 69 // The rest of the surface properties are either internal and should not cau se change,
67 // or they are already accounted for by the owninglayer->layerPropertyChange d(). 70 // or they are already accounted for by the owninglayer->layerPropertyChange d().
68 EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(renderSurface->setDrawOpacity(0.5) ); 71 EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(renderSurface->setDrawOpacity(0.5) );
69 EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(renderSurface->setDrawTransform(du mmyMatrix)); 72 EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(renderSurface->setDrawTransform(du mmyMatrix));
70 EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(renderSurface->setReplicaDrawTrans form(dummyMatrix)); 73 EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(renderSurface->setReplicaDrawTrans form(dummyMatrix));
71 EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(renderSurface->clearLayerLists()); 74 EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(renderSurface->clearLayerLists());
72 } 75 }
73 76
74 TEST(RenderSurfaceTest, sanityCheckSurfaceCreatesCorrectSharedQuadState) 77 TEST(RenderSurfaceTest, sanityCheckSurfaceCreatesCorrectSharedQuadState)
75 { 78 {
79 // This will fake that we are on the correct thread for testing purposes.
80 DebugScopedSetImplThread setImplThread;
81
76 scoped_ptr<LayerImpl> rootLayer = LayerImpl::create(1); 82 scoped_ptr<LayerImpl> rootLayer = LayerImpl::create(1);
77 83
78 scoped_ptr<LayerImpl> owningLayer = LayerImpl::create(2); 84 scoped_ptr<LayerImpl> owningLayer = LayerImpl::create(2);
79 owningLayer->createRenderSurface(); 85 owningLayer->createRenderSurface();
80 ASSERT_TRUE(owningLayer->renderSurface()); 86 ASSERT_TRUE(owningLayer->renderSurface());
81 owningLayer->setRenderTarget(owningLayer.get()); 87 owningLayer->setRenderTarget(owningLayer.get());
82 RenderSurfaceImpl* renderSurface = owningLayer->renderSurface(); 88 RenderSurfaceImpl* renderSurface = owningLayer->renderSurface();
83 89
84 rootLayer->addChild(owningLayer.Pass()); 90 rootLayer->addChild(owningLayer.Pass());
85 91
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 virtual void appendRenderPass(scoped_ptr<RenderPass> renderPass) OVERRIDE { m_renderPasses.append(renderPass.Pass()); } 123 virtual void appendRenderPass(scoped_ptr<RenderPass> renderPass) OVERRIDE { m_renderPasses.append(renderPass.Pass()); }
118 124
119 const ScopedPtrVector<RenderPass>& renderPasses() const { return m_renderPas ses; } 125 const ScopedPtrVector<RenderPass>& renderPasses() const { return m_renderPas ses; }
120 126
121 private: 127 private:
122 ScopedPtrVector<RenderPass> m_renderPasses; 128 ScopedPtrVector<RenderPass> m_renderPasses;
123 }; 129 };
124 130
125 TEST(RenderSurfaceTest, sanityCheckSurfaceCreatesCorrectRenderPass) 131 TEST(RenderSurfaceTest, sanityCheckSurfaceCreatesCorrectRenderPass)
126 { 132 {
133 // This will fake that we are on the correct thread for testing purposes.
134 DebugScopedSetImplThread setImplThread;
135
127 scoped_ptr<LayerImpl> rootLayer = LayerImpl::create(1); 136 scoped_ptr<LayerImpl> rootLayer = LayerImpl::create(1);
128 137
129 scoped_ptr<LayerImpl> owningLayer = LayerImpl::create(2); 138 scoped_ptr<LayerImpl> owningLayer = LayerImpl::create(2);
130 owningLayer->createRenderSurface(); 139 owningLayer->createRenderSurface();
131 ASSERT_TRUE(owningLayer->renderSurface()); 140 ASSERT_TRUE(owningLayer->renderSurface());
132 owningLayer->setRenderTarget(owningLayer.get()); 141 owningLayer->setRenderTarget(owningLayer.get());
133 RenderSurfaceImpl* renderSurface = owningLayer->renderSurface(); 142 RenderSurfaceImpl* renderSurface = owningLayer->renderSurface();
134 143
135 rootLayer->addChild(owningLayer.Pass()); 144 rootLayer->addChild(owningLayer.Pass());
136 145
(...skipping 10 matching lines...) Expand all
147 156
148 ASSERT_EQ(1u, passSink.renderPasses().size()); 157 ASSERT_EQ(1u, passSink.renderPasses().size());
149 RenderPass* pass = passSink.renderPasses()[0]; 158 RenderPass* pass = passSink.renderPasses()[0];
150 159
151 EXPECT_EQ(RenderPass::Id(2, 0), pass->id()); 160 EXPECT_EQ(RenderPass::Id(2, 0), pass->id());
152 EXPECT_RECT_EQ(contentRect, pass->outputRect()); 161 EXPECT_RECT_EQ(contentRect, pass->outputRect());
153 EXPECT_EQ(origin, pass->transformToRootTarget()); 162 EXPECT_EQ(origin, pass->transformToRootTarget());
154 } 163 }
155 164
156 } // namespace 165 } // namespace
OLDNEW
« no previous file with comments | « cc/rate_limiter.cc ('k') | cc/renderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698