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

Side by Side Diff: cc/layer_unittest.cc

Issue 11774005: Migrate more functions from MathUtil to gfx::Transform (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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 "cc/layer.h" 5 #include "cc/layer.h"
6 6
7 #include "cc/keyframed_animation_curve.h" 7 #include "cc/keyframed_animation_curve.h"
8 #include "cc/layer_impl.h" 8 #include "cc/layer_impl.h"
9 #include "cc/layer_painter.h" 9 #include "cc/layer_painter.h"
10 #include "cc/layer_tree_host.h" 10 #include "cc/layer_tree_host.h"
11 #include "cc/math_util.h" 11 #include "cc/math_util.h"
12 #include "cc/single_thread_proxy.h" 12 #include "cc/single_thread_proxy.h"
13 #include "cc/test/fake_impl_proxy.h" 13 #include "cc/test/fake_impl_proxy.h"
14 #include "cc/test/fake_layer_tree_host_client.h" 14 #include "cc/test/fake_layer_tree_host_client.h"
15 #include "cc/test/fake_layer_tree_host_impl.h" 15 #include "cc/test/fake_layer_tree_host_impl.h"
16 #include "cc/test/geometry_test_utils.h" 16 #include "cc/test/geometry_test_utils.h"
17 #include "cc/thread.h" 17 #include "cc/thread.h"
18 #include "testing/gmock/include/gmock/gmock.h" 18 #include "testing/gmock/include/gmock/gmock.h"
19 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
20 #include "ui/gfx/transform.h" 20 #include "ui/gfx/transform.h"
21 #include "ui/gfx/transform_util.h"
21 22
22 using ::testing::AnyNumber; 23 using ::testing::AnyNumber;
23 using ::testing::AtLeast; 24 using ::testing::AtLeast;
24 using ::testing::Mock; 25 using ::testing::Mock;
25 using ::testing::StrictMock; 26 using ::testing::StrictMock;
26 using ::testing::_; 27 using ::testing::_;
27 28
28 #define EXPECT_SET_NEEDS_COMMIT(expect, codeToTest) do { \ 29 #define EXPECT_SET_NEEDS_COMMIT(expect, codeToTest) do { \
29 EXPECT_CALL(*m_layerTreeHost, setNeedsCommit()).Times((expect)); \ 30 EXPECT_CALL(*m_layerTreeHost, setNeedsCommit()).Times((expect)); \
30 codeToTest; \ 31 codeToTest; \
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 527
527 // Next, test properties that should call setNeedsCommit (but not setNeedsDi splay) 528 // Next, test properties that should call setNeedsCommit (but not setNeedsDi splay)
528 // All properties need to be set to new values in order for setNeedsCommit t o be called. 529 // All properties need to be set to new values in order for setNeedsCommit t o be called.
529 EXPECT_SET_NEEDS_COMMIT(1, testLayer->setAnchorPoint(gfx::PointF(1.23f, 4.56 f))); 530 EXPECT_SET_NEEDS_COMMIT(1, testLayer->setAnchorPoint(gfx::PointF(1.23f, 4.56 f)));
530 EXPECT_SET_NEEDS_COMMIT(1, testLayer->setAnchorPointZ(0.7f)); 531 EXPECT_SET_NEEDS_COMMIT(1, testLayer->setAnchorPointZ(0.7f));
531 EXPECT_SET_NEEDS_COMMIT(1, testLayer->setBackgroundColor(SK_ColorLTGRAY)); 532 EXPECT_SET_NEEDS_COMMIT(1, testLayer->setBackgroundColor(SK_ColorLTGRAY));
532 EXPECT_SET_NEEDS_COMMIT(1, testLayer->setMasksToBounds(true)); 533 EXPECT_SET_NEEDS_COMMIT(1, testLayer->setMasksToBounds(true));
533 EXPECT_SET_NEEDS_COMMIT(1, testLayer->setOpacity(0.5)); 534 EXPECT_SET_NEEDS_COMMIT(1, testLayer->setOpacity(0.5));
534 EXPECT_SET_NEEDS_COMMIT(1, testLayer->setContentsOpaque(true)); 535 EXPECT_SET_NEEDS_COMMIT(1, testLayer->setContentsOpaque(true));
535 EXPECT_SET_NEEDS_COMMIT(1, testLayer->setPosition(gfx::PointF(4, 9))); 536 EXPECT_SET_NEEDS_COMMIT(1, testLayer->setPosition(gfx::PointF(4, 9)));
536 EXPECT_SET_NEEDS_COMMIT(1, testLayer->setSublayerTransform(MathUtil::createG fxTransform(0, 0, 0, 0, 0, 0))); 537 EXPECT_SET_NEEDS_COMMIT(1, testLayer->setSublayerTransform(gfx::CreateGfxTra nsform(0, 0, 0, 0, 0, 0)));
537 EXPECT_SET_NEEDS_COMMIT(1, testLayer->setScrollable(true)); 538 EXPECT_SET_NEEDS_COMMIT(1, testLayer->setScrollable(true));
538 EXPECT_SET_NEEDS_COMMIT(1, testLayer->setShouldScrollOnMainThread(true)); 539 EXPECT_SET_NEEDS_COMMIT(1, testLayer->setShouldScrollOnMainThread(true));
539 EXPECT_SET_NEEDS_COMMIT(1, testLayer->setNonFastScrollableRegion(gfx::Rect(1 , 1, 2, 2))); 540 EXPECT_SET_NEEDS_COMMIT(1, testLayer->setNonFastScrollableRegion(gfx::Rect(1 , 1, 2, 2)));
540 EXPECT_SET_NEEDS_COMMIT(1, testLayer->setHaveWheelEventHandlers(true)); 541 EXPECT_SET_NEEDS_COMMIT(1, testLayer->setHaveWheelEventHandlers(true));
541 EXPECT_SET_NEEDS_COMMIT(1, testLayer->setTransform(MathUtil::createGfxTransf orm(0, 0, 0, 0, 0, 0))); 542 EXPECT_SET_NEEDS_COMMIT(1, testLayer->setTransform(gfx::CreateGfxTransform(0 , 0, 0, 0, 0, 0)));
542 EXPECT_SET_NEEDS_COMMIT(1, testLayer->setDoubleSided(false)); 543 EXPECT_SET_NEEDS_COMMIT(1, testLayer->setDoubleSided(false));
543 EXPECT_SET_NEEDS_COMMIT(1, testLayer->setDebugName("Test Layer")); 544 EXPECT_SET_NEEDS_COMMIT(1, testLayer->setDebugName("Test Layer"));
544 EXPECT_SET_NEEDS_COMMIT(1, testLayer->setDrawCheckerboardForMissingTiles(!te stLayer->drawCheckerboardForMissingTiles())); 545 EXPECT_SET_NEEDS_COMMIT(1, testLayer->setDrawCheckerboardForMissingTiles(!te stLayer->drawCheckerboardForMissingTiles()));
545 EXPECT_SET_NEEDS_COMMIT(1, testLayer->setForceRenderSurface(true)); 546 EXPECT_SET_NEEDS_COMMIT(1, testLayer->setForceRenderSurface(true));
546 547
547 EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, testLayer->setMaskLayer(dummyLayer.get()) ); 548 EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, testLayer->setMaskLayer(dummyLayer.get()) );
548 EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, testLayer->setReplicaLayer(dummyLayer.get ())); 549 EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, testLayer->setReplicaLayer(dummyLayer.get ()));
549 EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, testLayer->setScrollOffset(gfx::Vector2d( 10, 10))); 550 EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, testLayer->setScrollOffset(gfx::Vector2d( 10, 10)));
550 551
551 // The above tests should not have caused a change to the needsDisplay flag. 552 // The above tests should not have caused a change to the needsDisplay flag.
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
854 scoped_refptr<MockLayer> layer(new MockLayer); 855 scoped_refptr<MockLayer> layer(new MockLayer);
855 EXPECT_FALSE(layer->needsDisplay()); 856 EXPECT_FALSE(layer->needsDisplay());
856 layer->setBounds(gfx::Size(0, 10)); 857 layer->setBounds(gfx::Size(0, 10));
857 EXPECT_FALSE(layer->needsDisplay()); 858 EXPECT_FALSE(layer->needsDisplay());
858 layer->setBounds(gfx::Size(10, 10)); 859 layer->setBounds(gfx::Size(10, 10));
859 EXPECT_TRUE(layer->needsDisplay()); 860 EXPECT_TRUE(layer->needsDisplay());
860 } 861 }
861 862
862 } // namespace 863 } // namespace
863 } // namespace cc 864 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layer_tree_host_impl_unittest.cc ('k') | cc/math_util.h » ('j') | cc/math_util_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698