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

Unified Diff: cc/layer_tree_host_impl_unittest.cc

Issue 11090062: cc: Rewrite PageScaleAnimation for new coordinate system. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Address gfx::Size::Scale() currently not being mutating 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 side-by-side diff with in-line comments
Download patch
Index: cc/layer_tree_host_impl_unittest.cc
diff --git a/cc/layer_tree_host_impl_unittest.cc b/cc/layer_tree_host_impl_unittest.cc
index 61c7d272261ccc6f213e3cbf70dc62887af5f371..1b8e1972afa36972010ebb89d91926fe4fb33169 100644
--- a/cc/layer_tree_host_impl_unittest.cc
+++ b/cc/layer_tree_host_impl_unittest.cc
@@ -643,7 +643,7 @@ TEST_P(LayerTreeHostImplTest, pageScaleAnimation)
LayerImpl* scrollLayer = m_hostImpl->rootScrollLayer();
DCHECK(scrollLayer);
- const float minPageScale = Settings::pageScalePinchZoomEnabled() ? 1 : 0.5;
+ const float minPageScale = 0.5;
const float maxPageScale = 4;
const base::TimeTicks startTime = base::TimeTicks() + base::TimeDelta::FromSeconds(1);
const base::TimeDelta duration = base::TimeDelta::FromMilliseconds(100);
@@ -764,33 +764,32 @@ TEST_P(LayerTreeHostImplTest, inhibitScrollAndPageScaleUpdatesWhileAnimatingPage
LayerImpl* scrollLayer = m_hostImpl->rootScrollLayer();
DCHECK(scrollLayer);
- const float minPageScale = Settings::pageScalePinchZoomEnabled() ? 1 : 0.5;
+ const float minPageScale = 0.5;
const float maxPageScale = 4;
const base::TimeTicks startTime = base::TimeTicks() + base::TimeDelta::FromSeconds(1);
const base::TimeDelta duration = base::TimeDelta::FromMilliseconds(100);
const base::TimeTicks halfwayThroughAnimation = startTime + duration / 2;
const base::TimeTicks endTime = startTime + duration;
- // Start a page scale animation.
+
const float pageScaleDelta = 2;
+ gfx::Vector2d target(25, 25);
+ gfx::Vector2d scaledTarget = target;
+ if (!Settings::pageScalePinchZoomEnabled())
+ scaledTarget = gfx::Vector2d(12, 12);
+
m_hostImpl->setPageScaleFactorAndLimits(1, minPageScale, maxPageScale);
- m_hostImpl->startPageScaleAnimation(gfx::Vector2d(50, 50), false, pageScaleDelta, startTime, duration);
+ m_hostImpl->startPageScaleAnimation(target, false, pageScaleDelta, startTime, duration);
// We should immediately get the final zoom and scroll values for the
// animation.
m_hostImpl->animate(halfwayThroughAnimation, base::Time());
scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas();
-
- if (!Settings::pageScalePinchZoomEnabled()) {
- EXPECT_EQ(scrollInfo->pageScaleDelta, pageScaleDelta);
- expectContains(*scrollInfo, scrollLayer->id(), gfx::Vector2d(25, 25));
- } else {
- EXPECT_EQ(scrollInfo->pageScaleDelta, 1);
- EXPECT_TRUE(scrollInfo->scrolls.empty());
- }
+ EXPECT_EQ(scrollInfo->pageScaleDelta, pageScaleDelta);
+ expectContains(*scrollInfo, scrollLayer->id(), scaledTarget);
// Scrolling during the animation is ignored.
const gfx::Vector2d scrollDelta(0, 10);
- EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(25, 25), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted);
+ EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(target.x(), target.y()), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted);
m_hostImpl->scrollBy(gfx::Point(), scrollDelta);
m_hostImpl->scrollEnd();
@@ -799,7 +798,7 @@ TEST_P(LayerTreeHostImplTest, inhibitScrollAndPageScaleUpdatesWhileAnimatingPage
m_hostImpl->animate(endTime, base::Time());
scrollInfo = m_hostImpl->processScrollDeltas();
EXPECT_EQ(scrollInfo->pageScaleDelta, pageScaleDelta);
- expectContains(*scrollInfo, scrollLayer->id(), gfx::Vector2d(25, 25));
+ expectContains(*scrollInfo, scrollLayer->id(), scaledTarget);
}
class DidDrawCheckLayer : public TiledLayerImpl {

Powered by Google App Engine
This is Rietveld 408576698