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

Side by Side Diff: cc/layer_tree_host_impl_unittest.cc

Issue 11293193: ui: Add non-member Vector2dScale() and Vector3dScale() methods to create scaled vectors (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use it in cc/ Created 8 years, 1 month 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 "cc/layer_tree_host_impl.h" 7 #include "cc/layer_tree_host_impl.h"
8 8
9 #include <cmath> 9 #include <cmath>
10 10
(...skipping 1157 matching lines...) Expand 10 before | Expand all | Expand 10 after
1168 gfx::Vector2d expectedMaxScroll(m_hostImpl->rootLayer()->maxScrollOffset()); 1168 gfx::Vector2d expectedMaxScroll(m_hostImpl->rootLayer()->maxScrollOffset());
1169 EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::Whee l), InputHandlerClient::ScrollStarted); 1169 EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::Whee l), InputHandlerClient::ScrollStarted);
1170 m_hostImpl->scrollBy(gfx::Point(), scrollDelta); 1170 m_hostImpl->scrollBy(gfx::Point(), scrollDelta);
1171 m_hostImpl->scrollEnd(); 1171 m_hostImpl->scrollEnd();
1172 1172
1173 // Set new page scale from main thread. 1173 // Set new page scale from main thread.
1174 m_hostImpl->setPageScaleFactorAndLimits(pageScale, pageScale, pageScale); 1174 m_hostImpl->setPageScaleFactorAndLimits(pageScale, pageScale, pageScale);
1175 1175
1176 if (!Settings::pageScalePinchZoomEnabled()) { 1176 if (!Settings::pageScalePinchZoomEnabled()) {
1177 // The scale should apply to the scroll delta. 1177 // The scale should apply to the scroll delta.
1178 expectedScrollDelta = gfx::ToFlooredVector2d(cc::ScaleVector2d(expectedS crollDelta, pageScale)); 1178 expectedScrollDelta = gfx::ToFlooredVector2d(gfx::ScaleVector2d(expected ScrollDelta, pageScale));
1179 } 1179 }
1180 scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas() ; 1180 scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas() ;
1181 expectContains(*scrollInfo.get(), m_hostImpl->rootLayer()->id(), expectedScr ollDelta); 1181 expectContains(*scrollInfo.get(), m_hostImpl->rootLayer()->id(), expectedScr ollDelta);
1182 1182
1183 // The scroll range should also have been updated. 1183 // The scroll range should also have been updated.
1184 EXPECT_EQ(m_hostImpl->rootLayer()->maxScrollOffset(), expectedMaxScroll); 1184 EXPECT_EQ(m_hostImpl->rootLayer()->maxScrollOffset(), expectedMaxScroll);
1185 1185
1186 // The page scale delta remains constant because the impl thread did not sca le. 1186 // The page scale delta remains constant because the impl thread did not sca le.
1187 EXPECT_EQ(m_hostImpl->rootLayer()->implTransform(), WebTransformationMatrix( )); 1187 EXPECT_EQ(m_hostImpl->rootLayer()->implTransform(), WebTransformationMatrix( ));
1188 } 1188 }
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1291 m_hostImpl->scrollBy(gfx::Point(), scrollDelta); 1291 m_hostImpl->scrollBy(gfx::Point(), scrollDelta);
1292 m_hostImpl->scrollEnd(); 1292 m_hostImpl->scrollEnd();
1293 1293
1294 float pageScale = 2; 1294 float pageScale = 2;
1295 m_hostImpl->setPageScaleFactorAndLimits(pageScale, 1, pageScale); 1295 m_hostImpl->setPageScaleFactorAndLimits(pageScale, 1, pageScale);
1296 1296
1297 m_hostImpl->updateRootScrollLayerImplTransform(); 1297 m_hostImpl->updateRootScrollLayerImplTransform();
1298 1298
1299 if (!Settings::pageScalePinchZoomEnabled()) { 1299 if (!Settings::pageScalePinchZoomEnabled()) {
1300 // The scale should apply to the scroll delta. 1300 // The scale should apply to the scroll delta.
1301 expectedScrollDelta = gfx::ToFlooredVector2d(cc::ScaleVector2d(expectedS crollDelta, pageScale)); 1301 expectedScrollDelta = gfx::ToFlooredVector2d(gfx::ScaleVector2d(expected ScrollDelta, pageScale));
1302 } 1302 }
1303 scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas() ; 1303 scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas() ;
1304 expectContains(*scrollInfo.get(), scrollLayerId, expectedScrollDelta); 1304 expectContains(*scrollInfo.get(), scrollLayerId, expectedScrollDelta);
1305 1305
1306 // The scroll range should not have changed. 1306 // The scroll range should not have changed.
1307 EXPECT_EQ(child->maxScrollOffset(), expectedMaxScroll); 1307 EXPECT_EQ(child->maxScrollOffset(), expectedMaxScroll);
1308 1308
1309 // The page scale delta remains constant because the impl thread did not sca le. 1309 // The page scale delta remains constant because the impl thread did not sca le.
1310 WebTransformationMatrix identityTransform; 1310 WebTransformationMatrix identityTransform;
1311 EXPECT_EQ(child->implTransform(), WebTransformationMatrix()); 1311 EXPECT_EQ(child->implTransform(), WebTransformationMatrix());
(...skipping 3105 matching lines...) Expand 10 before | Expand all | Expand 10 after
4417 verifyRenderPassTestData(removeRenderPassesCases[testCaseIndex], testDat a); 4417 verifyRenderPassTestData(removeRenderPassesCases[testCaseIndex], testDat a);
4418 testCaseIndex++; 4418 testCaseIndex++;
4419 } 4419 }
4420 } 4420 }
4421 4421
4422 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, 4422 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests,
4423 LayerTreeHostImplTest, 4423 LayerTreeHostImplTest,
4424 ::testing::Values(false, true)); 4424 ::testing::Values(false, true));
4425 4425
4426 } // anonymous namespace 4426 } // anonymous namespace
OLDNEW
« no previous file with comments | « cc/geometry.h ('k') | cc/page_scale_animation.cc » ('j') | ui/gfx/vector2d_f.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698