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

Unified Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 761903003: Update from https://crrev.com/306655 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 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/trees/layer_tree_host_impl.cc ('k') | cc/trees/layer_tree_host_pixeltest_masks.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_impl_unittest.cc
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
index 715168928038e2a8c44ff8aeb0e309c3415009a3..4e070e2a856cc2be481a7711ae1fedf0b4c01843 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -945,7 +945,7 @@ TEST_F(LayerTreeHostImplTest, ImplPinchZoom) {
}
// Scrolling after a pinch gesture should always be in local space. The
- // scroll deltas do not have the page scale factor applied.
+ // scroll deltas have the page scale factor applied.
{
host_impl_->active_tree()->SetPageScaleFactorAndLimits(
page_scale_factor, min_page_scale, max_page_scale);
@@ -968,9 +968,8 @@ TEST_F(LayerTreeHostImplTest, ImplPinchZoom) {
scoped_ptr<ScrollAndScaleSet> scroll_info =
host_impl_->ProcessScrollDeltas();
- ExpectContains(*scroll_info.get(),
- scroll_layer->id(),
- scroll_delta);
+ ExpectContains(*scroll_info.get(), scroll_layer->id(),
+ gfx::Vector2d(0, scroll_delta.y() / page_scale_delta));
}
}
@@ -1395,7 +1394,8 @@ class LayerTreeHostImplOverridePhysicalTime : public LayerTreeHostImpl {
0) {}
BeginFrameArgs CurrentBeginFrameArgs() const override {
- return CreateBeginFrameArgsForTesting(fake_current_physical_time_);
+ return CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE,
+ fake_current_physical_time_);
}
void SetCurrentPhysicalTimeTicksForTest(base::TimeTicks fake_now) {
@@ -3596,7 +3596,7 @@ TEST_F(LayerTreeHostImplTest, ScrollScaledLayer) {
host_impl_->ScrollBy(gfx::Point(), wheel_scroll_delta);
host_impl_->ScrollEnd();
- // The scale should not have been applied to the scroll delta.
+ // It should apply the scale factor to the scroll delta for the wheel event.
scroll_info = host_impl_->ProcessScrollDeltas();
ExpectContains(*scroll_info.get(),
scroll_layer->id(),
@@ -7800,6 +7800,41 @@ TEST_F(LayerTreeHostImplTest, DidBecomeActive) {
EXPECT_EQ(1u, raw_replica_mask_layer->did_become_active_call_count());
}
+TEST_F(LayerTreeHostImplTest, WheelScrollWithPageScaleFactorOnInnerLayer) {
+ LayerImpl* scroll_layer = SetupScrollAndContentsLayers(gfx::Size(100, 100));
+ host_impl_->SetViewportSize(gfx::Size(50, 50));
+ DrawFrame();
+
+ EXPECT_EQ(scroll_layer, host_impl_->InnerViewportScrollLayer());
+
+ float min_page_scale = 1.f, max_page_scale = 4.f;
+ float page_scale_factor = 1.f;
+
+ // The scroll deltas should have the page scale factor applied.
+ {
+ host_impl_->active_tree()->SetPageScaleFactorAndLimits(
+ page_scale_factor, min_page_scale, max_page_scale);
+ host_impl_->active_tree()->SetPageScaleDelta(1.f);
+ scroll_layer->SetScrollDelta(gfx::Vector2d());
+
+ float page_scale_delta = 2.f;
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture);
+ host_impl_->PinchGestureBegin();
+ host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point());
+ host_impl_->PinchGestureEnd();
+ host_impl_->ScrollEnd();
+
+ gfx::Vector2dF scroll_delta(0, 5);
+ EXPECT_EQ(InputHandler::ScrollStarted,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel));
+ EXPECT_VECTOR_EQ(gfx::Vector2dF(), scroll_layer->TotalScrollOffset());
+
+ host_impl_->ScrollBy(gfx::Point(), scroll_delta);
+ host_impl_->ScrollEnd();
+ EXPECT_VECTOR_EQ(gfx::Vector2dF(0, 2.5), scroll_layer->TotalScrollOffset());
+ }
+}
+
class LayerTreeHostImplCountingLostSurfaces : public LayerTreeHostImplTest {
public:
LayerTreeHostImplCountingLostSurfaces() : num_lost_surfaces_(0) {}
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/layer_tree_host_pixeltest_masks.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698