OLD | NEW |
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/layer_impl.h" | 7 #include "cc/layer_impl.h" |
8 | 8 |
9 #include "cc/single_thread_proxy.h" | 9 #include "cc/single_thread_proxy.h" |
10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 EXPECT_FALSE(grandChild->layerPropertyChanged()); \ | 51 EXPECT_FALSE(grandChild->layerPropertyChanged()); \ |
52 EXPECT_TRUE(root->layerSurfacePropertyChanged()) | 52 EXPECT_TRUE(root->layerSurfacePropertyChanged()) |
53 | 53 |
54 TEST(LayerImplTest, verifyLayerChangesAreTrackedProperly) | 54 TEST(LayerImplTest, verifyLayerChangesAreTrackedProperly) |
55 { | 55 { |
56 // | 56 // |
57 // This test checks that layerPropertyChanged() has the correct behavior. | 57 // This test checks that layerPropertyChanged() has the correct behavior. |
58 // | 58 // |
59 | 59 |
60 // The constructor on this will fake that we are on the correct thread. | 60 // The constructor on this will fake that we are on the correct thread. |
61 DebugScopedSetImplThread setImplThread; | |
62 | |
63 // Create a simple LayerImpl tree: | 61 // Create a simple LayerImpl tree: |
64 scoped_ptr<LayerImpl> root = LayerImpl::create(1); | 62 scoped_ptr<LayerImpl> root = LayerImpl::create(1); |
65 root->addChild(LayerImpl::create(2)); | 63 root->addChild(LayerImpl::create(2)); |
66 LayerImpl* child = root->children()[0]; | 64 LayerImpl* child = root->children()[0]; |
67 child->addChild(LayerImpl::create(3)); | 65 child->addChild(LayerImpl::create(3)); |
68 LayerImpl* grandChild = child->children()[0]; | 66 LayerImpl* grandChild = child->children()[0]; |
69 | 67 |
70 // Adding children is an internal operation and should not mark layers as ch
anged. | 68 // Adding children is an internal operation and should not mark layers as ch
anged. |
71 EXPECT_FALSE(root->layerPropertyChanged()); | 69 EXPECT_FALSE(root->layerPropertyChanged()); |
72 EXPECT_FALSE(child->layerPropertyChanged()); | 70 EXPECT_FALSE(child->layerPropertyChanged()); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setContentsOpaque(true)); | 153 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setContentsOpaque(true)); |
156 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setOpacity(arbitraryNumber))
; | 154 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setOpacity(arbitraryNumber))
; |
157 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setDebugBorderColor(arbitrar
yColor)); | 155 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setDebugBorderColor(arbitrar
yColor)); |
158 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setDebugBorderWidth(arbitrar
yNumber)); | 156 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setDebugBorderWidth(arbitrar
yNumber)); |
159 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setDrawsContent(true)); | 157 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setDrawsContent(true)); |
160 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setSublayerTransform(arbitra
ryTransform)); | 158 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setSublayerTransform(arbitra
ryTransform)); |
161 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setBounds(arbitraryIntSize))
; | 159 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setBounds(arbitraryIntSize))
; |
162 } | 160 } |
163 | 161 |
164 } // namespace | 162 } // namespace |
OLD | NEW |