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

Unified Diff: cc/layer_tree_host_impl_unittest.cc

Issue 11596005: Revert 173406 - Crashes on Win & Mac (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/layer_tree_host_impl.cc ('k') | cc/layer_tree_host_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layer_tree_host_impl_unittest.cc
===================================================================
--- cc/layer_tree_host_impl_unittest.cc (revision 173406)
+++ cc/layer_tree_host_impl_unittest.cc (working copy)
@@ -206,12 +206,6 @@
protected:
virtual scoped_ptr<OutputSurface> createOutputSurface() { return createFakeOutputSurface(); }
- void drawOneFrame() {
- LayerTreeHostImpl::FrameData frameData;
- m_hostImpl->prepareToDraw(frameData);
- m_hostImpl->didDrawAllLayers(frameData);
- }
-
FakeProxy m_proxy;
DebugScopedSetImplThread m_alwaysImplThread;
DebugScopedSetMainThreadBlocked m_alwaysMainThreadBlocked;
@@ -1296,7 +1290,7 @@
m_hostImpl->pinchGestureBegin();
m_hostImpl->pinchGestureUpdate(pageScale, gfx::Point());
m_hostImpl->pinchGestureEnd();
- drawOneFrame();
+ m_hostImpl->updateRootScrollLayerImplTransform();
// The scroll delta is not scaled because the main thread did not scale.
scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas();
@@ -1334,7 +1328,7 @@
m_hostImpl->pinchGestureBegin();
m_hostImpl->pinchGestureUpdate(newPageScale, gfx::Point());
m_hostImpl->pinchGestureEnd();
- drawOneFrame();
+ m_hostImpl->updateRootScrollLayerImplTransform();
// The page scale delta should only be applied to the scrollable root layer.
EXPECT_EQ(root->implTransform(), newPageScaleMatrix);
@@ -1382,7 +1376,7 @@
float pageScale = 2;
m_hostImpl->setPageScaleFactorAndLimits(pageScale, 1, pageScale);
- drawOneFrame();
+ m_hostImpl->updateRootScrollLayerImplTransform();
if (!m_hostImpl->settings().pageScalePinchZoomEnabled) {
// The scale should apply to the scroll delta.
@@ -4555,7 +4549,7 @@
m_hostImpl->pinchGestureBegin();
m_hostImpl->pinchGestureUpdate(pageScale, gfx::Point());
m_hostImpl->pinchGestureEnd();
- drawOneFrame();
+ m_hostImpl->updateRootScrollLayerImplTransform();
gfx::Transform expectedImplTransform;
expectedImplTransform.Scale(pageScale, pageScale);
@@ -4627,7 +4621,7 @@
m_hostImpl->pinchGestureBegin();
m_hostImpl->pinchGestureUpdate(pageScale, gfx::Point());
m_hostImpl->pinchGestureEnd();
- drawOneFrame();
+ m_hostImpl->updateRootScrollLayerImplTransform();
gfx::Transform expectedImplTransform;
expectedImplTransform.Scale(pageScale, pageScale);
@@ -4640,14 +4634,11 @@
return;
gfx::Vector2d scrollDelta(5, 0);
- // TODO(wjmaclean): Fix the math here so that the expectedTranslation is
- // scaled instead of the scroll input.
- gfx::Vector2d scrollDeltaInZoomedViewport = ToFlooredVector2d(gfx::ScaleVector2d(scrollDelta, m_hostImpl->totalPageScaleFactorForTesting()));
gfx::Vector2d expectedMaxScroll(m_hostImpl->rootLayer()->maxScrollOffset());
EXPECT_EQ(InputHandlerClient::ScrollStarted, m_hostImpl->scrollBegin(gfx::Point(0, 0), InputHandlerClient::Gesture));
- m_hostImpl->scrollBy(gfx::Point(), scrollDeltaInZoomedViewport);
+ m_hostImpl->scrollBy(gfx::Point(), scrollDelta);
m_hostImpl->scrollEnd();
- drawOneFrame();
+ m_hostImpl->updateRootScrollLayerImplTransform();
gfx::Vector2dF expectedTranslation = gfx::ScaleVector2d(scrollDelta, m_hostImpl->deviceScaleFactor());
expectedImplTransform.Translate(-expectedTranslation.x(), -expectedTranslation.y());
@@ -4661,11 +4652,10 @@
// Test scroll in y-direction also.
scrollDelta = gfx::Vector2d(0, 5);
- scrollDeltaInZoomedViewport = ToFlooredVector2d(gfx::ScaleVector2d(scrollDelta, m_hostImpl->totalPageScaleFactorForTesting()));
EXPECT_EQ(InputHandlerClient::ScrollStarted, m_hostImpl->scrollBegin(gfx::Point(0, 0), InputHandlerClient::Gesture));
- m_hostImpl->scrollBy(gfx::Point(), scrollDeltaInZoomedViewport);
+ m_hostImpl->scrollBy(gfx::Point(), scrollDelta);
m_hostImpl->scrollEnd();
- drawOneFrame();
+ m_hostImpl->updateRootScrollLayerImplTransform();
expectedTranslation = gfx::ScaleVector2d(scrollDelta, m_hostImpl->deviceScaleFactor());
expectedImplTransform.Translate(-expectedTranslation.x(), -expectedTranslation.y());
@@ -4711,7 +4701,7 @@
m_hostImpl->pinchGestureBegin();
m_hostImpl->pinchGestureUpdate(pageScale, gfx::Point());
m_hostImpl->pinchGestureEnd();
- drawOneFrame();
+ m_hostImpl->updateRootScrollLayerImplTransform();
gfx::Transform expectedImplTransform;
expectedImplTransform.Scale(pageScale, pageScale);
@@ -4726,13 +4716,12 @@
// Scroll document only: scrollDelta chosen to move document horizontally
// to its max scroll offset.
gfx::Vector2d scrollDelta(3, 0);
- gfx::Vector2d scrollDeltaInZoomedViewport = ToFlooredVector2d(gfx::ScaleVector2d(scrollDelta, m_hostImpl->totalPageScaleFactorForTesting()));
gfx::Vector2d expectedScrollDelta(scrollDelta);
gfx::Vector2d expectedMaxScroll(m_hostImpl->rootLayer()->maxScrollOffset());
EXPECT_EQ(InputHandlerClient::ScrollStarted, m_hostImpl->scrollBegin(gfx::Point(0, 0), InputHandlerClient::Gesture));
- m_hostImpl->scrollBy(gfx::Point(), scrollDeltaInZoomedViewport);
+ m_hostImpl->scrollBy(gfx::Point(), scrollDelta);
m_hostImpl->scrollEnd();
- drawOneFrame();
+ m_hostImpl->updateRootScrollLayerImplTransform();
// The scroll delta is not scaled because the main thread did not scale.
scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas();
@@ -4744,11 +4733,10 @@
// Further scrolling should move the pinchZoomViewport only.
scrollDelta = gfx::Vector2d(2, 0);
- scrollDeltaInZoomedViewport = ToFlooredVector2d(gfx::ScaleVector2d(scrollDelta, m_hostImpl->totalPageScaleFactorForTesting()));
EXPECT_EQ(InputHandlerClient::ScrollStarted, m_hostImpl->scrollBegin(gfx::Point(0, 0), InputHandlerClient::Gesture));
- m_hostImpl->scrollBy(gfx::Point(), scrollDeltaInZoomedViewport);
+ m_hostImpl->scrollBy(gfx::Point(), scrollDelta);
m_hostImpl->scrollEnd();
- drawOneFrame();
+ m_hostImpl->updateRootScrollLayerImplTransform();
gfx::Vector2d expectedPanDelta(scrollDelta);
gfx::Vector2dF expectedTranslation = gfx::ScaleVector2d(expectedPanDelta, m_hostImpl->deviceScaleFactor());
@@ -4764,12 +4752,11 @@
// Perform same test sequence in y-direction also.
// Document only scroll.
scrollDelta = gfx::Vector2d(0, 4);
- scrollDeltaInZoomedViewport = ToFlooredVector2d(gfx::ScaleVector2d(scrollDelta, m_hostImpl->totalPageScaleFactorForTesting()));
expectedScrollDelta += scrollDelta;
EXPECT_EQ(InputHandlerClient::ScrollStarted, m_hostImpl->scrollBegin(gfx::Point(0, 0), InputHandlerClient::Gesture));
- m_hostImpl->scrollBy(gfx::Point(), scrollDeltaInZoomedViewport);
+ m_hostImpl->scrollBy(gfx::Point(), scrollDelta);
m_hostImpl->scrollEnd();
- drawOneFrame();
+ m_hostImpl->updateRootScrollLayerImplTransform();
// The scroll delta is not scaled because the main thread did not scale.
scrollInfo = m_hostImpl->processScrollDeltas();
@@ -4781,11 +4768,10 @@
// pinchZoomViewport scroll only.
scrollDelta = gfx::Vector2d(0, 1);
- scrollDeltaInZoomedViewport = ToFlooredVector2d(gfx::ScaleVector2d(scrollDelta, m_hostImpl->totalPageScaleFactorForTesting()));
EXPECT_EQ(InputHandlerClient::ScrollStarted, m_hostImpl->scrollBegin(gfx::Point(0, 0), InputHandlerClient::Gesture));
- m_hostImpl->scrollBy(gfx::Point(), scrollDeltaInZoomedViewport);
+ m_hostImpl->scrollBy(gfx::Point(), scrollDelta);
m_hostImpl->scrollEnd();
- drawOneFrame();
+ m_hostImpl->updateRootScrollLayerImplTransform();
expectedPanDelta = scrollDelta;
expectedTranslation = gfx::ScaleVector2d(expectedPanDelta, m_hostImpl->deviceScaleFactor());
@@ -4834,7 +4820,7 @@
m_hostImpl->pinchGestureBegin();
m_hostImpl->pinchGestureUpdate(pageScale, gfx::Point());
m_hostImpl->pinchGestureEnd();
- drawOneFrame();
+ m_hostImpl->updateRootScrollLayerImplTransform();
gfx::Transform expectedImplTransform;
expectedImplTransform.Scale(pageScale, pageScale);
@@ -4848,14 +4834,13 @@
// Scroll document and pann zoomViewport in one scroll-delta.
gfx::Vector2d scrollDelta(5, 0);
- gfx::Vector2d scrollDeltaInZoomedViewport = ToFlooredVector2d(gfx::ScaleVector2d(scrollDelta, m_hostImpl->totalPageScaleFactorForTesting()));
gfx::Vector2d expectedScrollDelta(gfx::Vector2d(3, 0)); // This component gets handled by document scroll.
gfx::Vector2d expectedMaxScroll(m_hostImpl->rootLayer()->maxScrollOffset());
EXPECT_EQ(InputHandlerClient::ScrollStarted, m_hostImpl->scrollBegin(gfx::Point(0, 0), InputHandlerClient::Gesture));
- m_hostImpl->scrollBy(gfx::Point(), scrollDeltaInZoomedViewport);
+ m_hostImpl->scrollBy(gfx::Point(), scrollDelta);
m_hostImpl->scrollEnd();
- drawOneFrame();
+ m_hostImpl->updateRootScrollLayerImplTransform();
// The scroll delta is not scaled because the main thread did not scale.
scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas();
@@ -4870,12 +4855,11 @@
// Perform same test sequence in y-direction also.
scrollDelta = gfx::Vector2d(0, 5);
- scrollDeltaInZoomedViewport = ToFlooredVector2d(gfx::ScaleVector2d(scrollDelta, m_hostImpl->totalPageScaleFactorForTesting()));
expectedScrollDelta += gfx::Vector2d(0, 4); // This component gets handled by document scroll.
EXPECT_EQ(InputHandlerClient::ScrollStarted, m_hostImpl->scrollBegin(gfx::Point(0, 0), InputHandlerClient::Gesture));
- m_hostImpl->scrollBy(gfx::Point(), scrollDeltaInZoomedViewport);
+ m_hostImpl->scrollBy(gfx::Point(), scrollDelta);
m_hostImpl->scrollEnd();
- drawOneFrame();
+ m_hostImpl->updateRootScrollLayerImplTransform();
// The scroll delta is not scaled because the main thread did not scale.
scrollInfo = m_hostImpl->processScrollDeltas(); // This component gets handled by zoomViewport pan.
« no previous file with comments | « cc/layer_tree_host_impl.cc ('k') | cc/layer_tree_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698