Index: cc/trees/layer_tree_host_unittest_scroll.cc |
diff --git a/cc/trees/layer_tree_host_unittest_scroll.cc b/cc/trees/layer_tree_host_unittest_scroll.cc |
index 47393f99f2904ac0c2909e62d43d1dab4ec64bb1..0bd7ffa6ca6c49712fe7940182178b23c9baf1b6 100644 |
--- a/cc/trees/layer_tree_host_unittest_scroll.cc |
+++ b/cc/trees/layer_tree_host_unittest_scroll.cc |
@@ -140,8 +140,9 @@ class LayerTreeHostScrollTestScrollMultipleRedraw |
EXPECT_VECTOR_EQ(root->scroll_offset(), initial_scroll_); |
PostSetNeedsCommitToMainThread(); |
} else if (impl->active_tree()->source_frame_number() == 1) { |
- // Third or later draw after second commit. |
- EXPECT_GE(impl->SourceAnimationFrameNumber(), 3); |
+ // Any draw after second commit. The animation frame may not update |
+ // if no damage occurs here and the draw is skipped. |
+ EXPECT_GE(impl->SourceAnimationFrameNumber(), 2); |
danakj
2013/07/08 21:53:42
Does this mean we do the above elseif{} block (sou
enne (OOO)
2013/07/08 22:03:46
All three blocks run in order on different "draws"
enne (OOO)
2013/07/09 00:49:45
I fixed this case by resizing the root. Now that
|
EXPECT_VECTOR_EQ(root->ScrollDelta(), gfx::Vector2d()); |
EXPECT_VECTOR_EQ(root->scroll_offset(), |
initial_scroll_ + scroll_amount_ + scroll_amount_); |
@@ -238,7 +239,7 @@ class LayerTreeHostScrollTestCaseWithChild : public LayerTreeHostScrollTest { |
root_scroll_layer_ = ContentLayer::Create(&fake_content_layer_client_); |
root_scroll_layer_->SetBounds(gfx::Size(110, 110)); |
- root_scroll_layer_->SetPosition(gfx::Point(0, 0)); |
+ root_scroll_layer_->SetPosition(gfx::Point()); |
root_scroll_layer_->SetAnchorPoint(gfx::PointF()); |
root_scroll_layer_->SetIsDrawable(true); |
@@ -252,10 +253,17 @@ class LayerTreeHostScrollTestCaseWithChild : public LayerTreeHostScrollTest { |
base::Unretained(this))); |
child_layer_->SetBounds(gfx::Size(110, 110)); |
- // Scrolls on the child layer will happen at 5, 5. If they are treated |
- // like device pixels, and device scale factor is 2, then they will |
- // be considered at 2.5, 2.5 in logical pixels, and will miss this layer. |
- child_layer_->SetPosition(gfx::Point(5, 5)); |
+ if (scroll_child_layer_) { |
+ child_layer_->SetPosition(gfx::Point()); |
+ } else { |
+ // Offset the child layer further than the sum of all scrolls so that |
+ // scrolls beginning at the viewport origin will always hit the root. |
+ child_layer_->SetPosition(gfx::Point(60, 60)); |
+ EXPECT_GT(child_layer_->position().x(), |
+ (initial_offset_ + javascript_scroll_).x()); |
+ EXPECT_GT(child_layer_->position().y(), |
+ (initial_offset_ + javascript_scroll_).y()); |
+ } |
child_layer_->SetAnchorPoint(gfx::PointF()); |
child_layer_->SetIsDrawable(true); |
@@ -345,10 +353,8 @@ class LayerTreeHostScrollTestCaseWithChild : public LayerTreeHostScrollTest { |
switch (impl->active_tree()->source_frame_number()) { |
case 0: { |
// Gesture scroll on impl thread. |
- InputHandler::ScrollStatus status = impl->ScrollBegin( |
- gfx::ToCeiledPoint(expected_scroll_layer_impl->position() + |
- gfx::Vector2dF(0.5f, 0.5f)), |
- InputHandler::Gesture); |
+ InputHandler::ScrollStatus status = |
+ impl->ScrollBegin(gfx::Point(), InputHandler::Gesture); |
EXPECT_EQ(InputHandler::ScrollStarted, status); |
impl->ScrollBy(gfx::Point(), scroll_amount_); |
impl->ScrollEnd(); |
@@ -362,10 +368,8 @@ class LayerTreeHostScrollTestCaseWithChild : public LayerTreeHostScrollTest { |
} |
case 1: { |
// Wheel scroll on impl thread. |
- InputHandler::ScrollStatus status = impl->ScrollBegin( |
- gfx::ToCeiledPoint(expected_scroll_layer_impl->position() + |
- gfx::Vector2dF(0.5f, 0.5f)), |
- InputHandler::Wheel); |
+ InputHandler::ScrollStatus status = |
+ impl->ScrollBegin(gfx::Point(), InputHandler::Wheel); |
EXPECT_EQ(InputHandler::ScrollStarted, status); |
impl->ScrollBy(gfx::Point(), scroll_amount_); |
impl->ScrollEnd(); |