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

Side by Side Diff: cc/layer_impl_unittest.cc

Issue 11189043: cc: Rename cc classes and members to match filenames (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 months 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
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 "CCLayerImpl.h" 7 #include "CCLayerImpl.h"
8 8
9 #include "CCSingleThreadProxy.h" 9 #include "CCSingleThreadProxy.h"
10 #include "testing/gmock/include/gmock/gmock.h" 10 #include "testing/gmock/include/gmock/gmock.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 EXPECT_FALSE(root->layerSurfacePropertyChanged()) 43 EXPECT_FALSE(root->layerSurfacePropertyChanged())
44 44
45 #define EXECUTE_AND_VERIFY_ONLY_SURFACE_CHANGED(codeToTest) \ 45 #define EXECUTE_AND_VERIFY_ONLY_SURFACE_CHANGED(codeToTest) \
46 root->resetAllChangeTrackingForSubtree(); \ 46 root->resetAllChangeTrackingForSubtree(); \
47 codeToTest; \ 47 codeToTest; \
48 EXPECT_FALSE(root->layerPropertyChanged()); \ 48 EXPECT_FALSE(root->layerPropertyChanged()); \
49 EXPECT_FALSE(child->layerPropertyChanged()); \ 49 EXPECT_FALSE(child->layerPropertyChanged()); \
50 EXPECT_FALSE(grandChild->layerPropertyChanged()); \ 50 EXPECT_FALSE(grandChild->layerPropertyChanged()); \
51 EXPECT_TRUE(root->layerSurfacePropertyChanged()) 51 EXPECT_TRUE(root->layerSurfacePropertyChanged())
52 52
53 TEST(CCLayerImplTest, verifyLayerChangesAreTrackedProperly) 53 TEST(LayerImplTest, verifyLayerChangesAreTrackedProperly)
54 { 54 {
55 // 55 //
56 // This test checks that layerPropertyChanged() has the correct behavior. 56 // This test checks that layerPropertyChanged() has the correct behavior.
57 // 57 //
58 58
59 // The constructor on this will fake that we are on the correct thread. 59 // The constructor on this will fake that we are on the correct thread.
60 DebugScopedSetImplThread setImplThread; 60 DebugScopedSetImplThread setImplThread;
61 61
62 // Create a simple CCLayerImpl tree: 62 // Create a simple LayerImpl tree:
63 scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); 63 scoped_ptr<LayerImpl> root = LayerImpl::create(1);
64 root->addChild(CCLayerImpl::create(2)); 64 root->addChild(LayerImpl::create(2));
65 CCLayerImpl* child = root->children()[0]; 65 LayerImpl* child = root->children()[0];
66 child->addChild(CCLayerImpl::create(3)); 66 child->addChild(LayerImpl::create(3));
67 CCLayerImpl* grandChild = child->children()[0]; 67 LayerImpl* grandChild = child->children()[0];
68 68
69 // Adding children is an internal operation and should not mark layers as ch anged. 69 // Adding children is an internal operation and should not mark layers as ch anged.
70 EXPECT_FALSE(root->layerPropertyChanged()); 70 EXPECT_FALSE(root->layerPropertyChanged());
71 EXPECT_FALSE(child->layerPropertyChanged()); 71 EXPECT_FALSE(child->layerPropertyChanged());
72 EXPECT_FALSE(grandChild->layerPropertyChanged()); 72 EXPECT_FALSE(grandChild->layerPropertyChanged());
73 73
74 FloatPoint arbitraryFloatPoint = FloatPoint(0.125f, 0.25f); 74 FloatPoint arbitraryFloatPoint = FloatPoint(0.125f, 0.25f);
75 float arbitraryNumber = 0.352f; 75 float arbitraryNumber = 0.352f;
76 IntSize arbitraryIntSize = IntSize(111, 222); 76 IntSize arbitraryIntSize = IntSize(111, 222);
77 IntPoint arbitraryIntPoint = IntPoint(333, 444); 77 IntPoint arbitraryIntPoint = IntPoint(333, 444);
(...skipping 13 matching lines...) Expand all
91 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setScreenSpaceTransform(arbi traryTransform)); 91 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setScreenSpaceTransform(arbi traryTransform));
92 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setDrawableContentRect(arbit raryIntRect)); 92 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setDrawableContentRect(arbit raryIntRect));
93 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setUpdateRect(arbitraryFloat Rect)); 93 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setUpdateRect(arbitraryFloat Rect));
94 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setVisibleContentRect(arbitr aryIntRect)); 94 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setVisibleContentRect(arbitr aryIntRect));
95 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setMaxScrollPosition(arbitra ryIntSize)); 95 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setMaxScrollPosition(arbitra ryIntSize));
96 96
97 // Changing these properties affects the entire subtree of layers. 97 // Changing these properties affects the entire subtree of layers.
98 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setAnchorPoint(arbitraryFloatPoint) ); 98 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setAnchorPoint(arbitraryFloatPoint) );
99 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setAnchorPointZ(arbitraryNumber)); 99 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setAnchorPointZ(arbitraryNumber));
100 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setFilters(arbitraryFilters)); 100 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setFilters(arbitraryFilters));
101 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setMaskLayer(CCLayerImpl::create(4) )); 101 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setMaskLayer(LayerImpl::create(4))) ;
102 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setMasksToBounds(true)); 102 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setMasksToBounds(true));
103 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setContentsOpaque(true)); 103 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setContentsOpaque(true));
104 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setReplicaLayer(CCLayerImpl::create (5))); 104 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setReplicaLayer(LayerImpl::create(5 )));
105 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setPosition(arbitraryFloatPoint)); 105 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setPosition(arbitraryFloatPoint));
106 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setPreserves3D(true)); 106 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setPreserves3D(true));
107 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setDoubleSided(false)); // construc tor initializes it to "true". 107 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setDoubleSided(false)); // construc tor initializes it to "true".
108 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->scrollBy(arbitraryIntSize)); 108 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->scrollBy(arbitraryIntSize));
109 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setScrollDelta(IntSize())); 109 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setScrollDelta(IntSize()));
110 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setScrollPosition(arbitraryIntPoint )); 110 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setScrollPosition(arbitraryIntPoint ));
111 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setImplTransform(arbitraryTransform )); 111 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setImplTransform(arbitraryTransform ));
112 112
113 // Changing these properties only affects the layer itself. 113 // Changing these properties only affects the layer itself.
114 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(root->setContentBounds(arbitraryIntSiz e)); 114 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(root->setContentBounds(arbitraryIntSiz e));
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setContentsOpaque(true)); 151 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setContentsOpaque(true));
152 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setOpacity(arbitraryNumber)) ; 152 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setOpacity(arbitraryNumber)) ;
153 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setDebugBorderColor(arbitrar yColor)); 153 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setDebugBorderColor(arbitrar yColor));
154 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setDebugBorderWidth(arbitrar yNumber)); 154 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setDebugBorderWidth(arbitrar yNumber));
155 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setDrawsContent(true)); 155 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setDrawsContent(true));
156 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setSublayerTransform(arbitra ryTransform)); 156 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setSublayerTransform(arbitra ryTransform));
157 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setBounds(arbitraryIntSize)) ; 157 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setBounds(arbitraryIntSize)) ;
158 } 158 }
159 159
160 } // namespace 160 } // namespace
OLDNEW
« cc/active_animation.h ('K') | « cc/layer_impl.cc ('k') | cc/layer_iterator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698