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

Side by Side Diff: cc/layer_impl_unittest.cc

Issue 11447028: cc: Split out calcDrawEtc from drawLayers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix TODO comment about animations Created 8 years 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 "cc/layer_impl.h" 5 #include "cc/layer_impl.h"
6 6
7 #include "cc/single_thread_proxy.h" 7 #include "cc/single_thread_proxy.h"
8 #include "cc/test/fake_impl_proxy.h" 8 #include "cc/test/fake_impl_proxy.h"
9 #include "cc/test/fake_layer_tree_host_impl.h" 9 #include "cc/test/fake_layer_tree_host_impl.h"
10 #include "cc/thread.h"
10 #include "testing/gmock/include/gmock/gmock.h" 11 #include "testing/gmock/include/gmock/gmock.h"
11 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
12 #include "third_party/skia/include/effects/SkBlurImageFilter.h" 13 #include "third_party/skia/include/effects/SkBlurImageFilter.h"
13 #include <public/WebFilterOperation.h> 14 #include <public/WebFilterOperation.h>
14 #include <public/WebFilterOperations.h> 15 #include <public/WebFilterOperations.h>
15 16
16 using namespace WebKit; 17 using namespace WebKit;
17 18
18 namespace cc { 19 namespace cc {
19 namespace { 20 namespace {
(...skipping 24 matching lines...) Expand all
44 EXPECT_FALSE(root->layerSurfacePropertyChanged()) 45 EXPECT_FALSE(root->layerSurfacePropertyChanged())
45 46
46 #define EXECUTE_AND_VERIFY_ONLY_SURFACE_CHANGED(codeToTest) \ 47 #define EXECUTE_AND_VERIFY_ONLY_SURFACE_CHANGED(codeToTest) \
47 root->resetAllChangeTrackingForSubtree(); \ 48 root->resetAllChangeTrackingForSubtree(); \
48 codeToTest; \ 49 codeToTest; \
49 EXPECT_FALSE(root->layerPropertyChanged()); \ 50 EXPECT_FALSE(root->layerPropertyChanged()); \
50 EXPECT_FALSE(child->layerPropertyChanged()); \ 51 EXPECT_FALSE(child->layerPropertyChanged()); \
51 EXPECT_FALSE(grandChild->layerPropertyChanged()); \ 52 EXPECT_FALSE(grandChild->layerPropertyChanged()); \
52 EXPECT_TRUE(root->layerSurfacePropertyChanged()) 53 EXPECT_TRUE(root->layerSurfacePropertyChanged())
53 54
55 #define VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(codeToTest) \
56 root->resetAllChangeTrackingForSubtree(); \
57 hostImpl.resetNeedsUpdateDrawProperties(); \
58 codeToTest; \
59 EXPECT_TRUE(hostImpl.needsUpdateDrawProperties());
60
61 #define VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(codeToTest) \
62 root->resetAllChangeTrackingForSubtree(); \
63 hostImpl.resetNeedsUpdateDrawProperties(); \
64 codeToTest; \
65 EXPECT_FALSE(hostImpl.needsUpdateDrawProperties());
66
54 TEST(LayerImplTest, verifyLayerChangesAreTrackedProperly) 67 TEST(LayerImplTest, verifyLayerChangesAreTrackedProperly)
55 { 68 {
56 // 69 //
57 // This test checks that layerPropertyChanged() has the correct behavior. 70 // This test checks that layerPropertyChanged() has the correct behavior.
58 // 71 //
59 72
60 // The constructor on this will fake that we are on the correct thread. 73 // The constructor on this will fake that we are on the correct thread.
61 // Create a simple LayerImpl tree: 74 // Create a simple LayerImpl tree:
62 FakeImplProxy proxy; 75 FakeImplProxy proxy;
63 FakeLayerTreeHostImpl hostImpl(&proxy); 76 FakeLayerTreeHostImpl hostImpl(&proxy);
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setContentsScale(arbitraryNu mber, arbitraryNumber)); 162 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setContentsScale(arbitraryNu mber, arbitraryNumber));
150 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setContentsOpaque(true)); 163 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setContentsOpaque(true));
151 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setOpacity(arbitraryNumber)) ; 164 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setOpacity(arbitraryNumber)) ;
152 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setDrawsContent(true)); 165 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setDrawsContent(true));
153 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setSublayerTransform(arbitra ryTransform)); 166 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setSublayerTransform(arbitra ryTransform));
154 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setBounds(arbitrarySize)); 167 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setBounds(arbitrarySize));
155 } 168 }
156 169
157 } // namespace 170 } // namespace
158 } // namespace cc 171 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layer_impl.cc ('k') | cc/layer_tree_host_impl.h » ('j') | cc/layer_tree_host_impl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698