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

Side by Side Diff: cc/CCLayerTreeHostTest.cpp

Issue 10916279: Chromium compositor change implementing page-scale driven pinch-zoom. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Rebaselined to 160422. 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
« no previous file with comments | « cc/CCLayerTreeHostImplTest.cpp ('k') | cc/CCSettings.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 "CCLayerTreeHost.h" 7 #include "CCLayerTreeHost.h"
8 8
9 #include "CCGeometryTestUtils.h" 9 #include "CCGeometryTestUtils.h"
10 #include "CCGraphicsContext.h" 10 #include "CCGraphicsContext.h"
(...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after
1042 m_layerTreeHost->setBackgroundColor(SK_ColorGRAY); 1042 m_layerTreeHost->setBackgroundColor(SK_ColorGRAY);
1043 m_layerTreeHost->setPageScaleFactorAndLimits(5, 5, 5); 1043 m_layerTreeHost->setPageScaleFactorAndLimits(5, 5, 5);
1044 1044
1045 postSetNeedsCommitToMainThread(); 1045 postSetNeedsCommitToMainThread();
1046 } 1046 }
1047 1047
1048 virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE 1048 virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE
1049 { 1049 {
1050 EXPECT_EQ(IntSize(20, 20), impl->layoutViewportSize()); 1050 EXPECT_EQ(IntSize(20, 20), impl->layoutViewportSize());
1051 EXPECT_EQ(SK_ColorGRAY, impl->backgroundColor()); 1051 EXPECT_EQ(SK_ColorGRAY, impl->backgroundColor());
1052 EXPECT_EQ(5, impl->pageScale()); 1052 EXPECT_EQ(5, impl->pageScaleFactor());
1053 1053
1054 endTest(); 1054 endTest();
1055 } 1055 }
1056 1056
1057 virtual void afterTest() OVERRIDE { } 1057 virtual void afterTest() OVERRIDE { }
1058 }; 1058 };
1059 1059
1060 TEST_F(CCLayerTreeHostTestCommit, runTest) 1060 TEST_F(CCLayerTreeHostTestCommit, runTest)
1061 { 1061 {
1062 runTest(true); 1062 runTest(true);
(...skipping 18 matching lines...) Expand all
1081 1081
1082 void requestStartPageScaleAnimation() 1082 void requestStartPageScaleAnimation()
1083 { 1083 {
1084 layerTreeHost()->startPageScaleAnimation(IntSize(), false, 1.25, 0); 1084 layerTreeHost()->startPageScaleAnimation(IntSize(), false, 1.25, 0);
1085 } 1085 }
1086 1086
1087 virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE 1087 virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE
1088 { 1088 {
1089 impl->rootLayer()->setScrollable(true); 1089 impl->rootLayer()->setScrollable(true);
1090 impl->rootLayer()->setScrollPosition(IntPoint()); 1090 impl->rootLayer()->setScrollPosition(IntPoint());
1091 impl->setPageScaleFactorAndLimits(impl->pageScale(), 0.5, 2); 1091 impl->setPageScaleFactorAndLimits(impl->pageScaleFactor(), 0.5, 2);
1092 1092
1093 // We request animation only once. 1093 // We request animation only once.
1094 if (!m_animationRequested) { 1094 if (!m_animationRequested) {
1095 m_mainThreadProxy->postTask(createCCThreadTask(this, &CCLayerTreeHos tTestStartPageScaleAnimation::requestStartPageScaleAnimation)); 1095 m_mainThreadProxy->postTask(createCCThreadTask(this, &CCLayerTreeHos tTestStartPageScaleAnimation::requestStartPageScaleAnimation));
1096 m_animationRequested = true; 1096 m_animationRequested = true;
1097 } 1097 }
1098 } 1098 }
1099 1099
1100 virtual void applyScrollAndScale(const IntSize& scrollDelta, float scale) OV ERRIDE 1100 virtual void applyScrollAndScale(const IntSize& scrollDelta, float scale) OV ERRIDE
1101 { 1101 {
1102 IntPoint position = m_layerTreeHost->rootLayer()->scrollPosition(); 1102 IntPoint position = m_layerTreeHost->rootLayer()->scrollPosition();
1103 m_layerTreeHost->rootLayer()->setScrollPosition(position + scrollDelta); 1103 m_layerTreeHost->rootLayer()->setScrollPosition(position + scrollDelta);
1104 m_layerTreeHost->setPageScaleFactorAndLimits(scale, 0.5, 2); 1104 m_layerTreeHost->setPageScaleFactorAndLimits(scale, 0.5, 2);
1105 } 1105 }
1106 1106
1107 virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE 1107 virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE
1108 { 1108 {
1109 impl->processScrollDeltas(); 1109 impl->processScrollDeltas();
1110 // We get one commit before the first draw, and the animation doesn't ha ppen until the second draw. 1110 // We get one commit before the first draw, and the animation doesn't ha ppen until the second draw.
1111 if (impl->sourceFrameNumber() == 1) { 1111 if (impl->sourceFrameNumber() == 1) {
1112 EXPECT_EQ(1.25, impl->pageScale()); 1112 EXPECT_EQ(1.25, impl->pageScaleFactor());
1113 endTest(); 1113 endTest();
1114 } else 1114 } else
1115 postSetNeedsRedrawToMainThread(); 1115 postSetNeedsRedrawToMainThread();
1116 } 1116 }
1117 1117
1118 virtual void afterTest() OVERRIDE 1118 virtual void afterTest() OVERRIDE
1119 { 1119 {
1120 } 1120 }
1121 1121
1122 private: 1122 private:
(...skipping 1865 matching lines...) Expand 10 before | Expand all | Expand 10 after
2988 int m_numCommitComplete; 2988 int m_numCommitComplete;
2989 int m_numDrawLayers; 2989 int m_numDrawLayers;
2990 }; 2990 };
2991 2991
2992 TEST_F(CCLayerTreeHostTestContinuousAnimate, runMultiThread) 2992 TEST_F(CCLayerTreeHostTestContinuousAnimate, runMultiThread)
2993 { 2993 {
2994 runTest(true); 2994 runTest(true);
2995 } 2995 }
2996 2996
2997 } // namespace 2997 } // namespace
OLDNEW
« no previous file with comments | « cc/CCLayerTreeHostImplTest.cpp ('k') | cc/CCSettings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698