From cf2d38822a0633972caf9c6f6d41e31a908d0c6e Mon Sep 17 00:00:00 2001 From: "jbauman@chromium.org" Date: Wed, 21 Aug 2013 03:56:55 +0000 Subject: Fix LayerTreeHostDamageTestScrollbarDoesDamage. Test that not changing the scrollbar doesn't do damage before we test that changing it does, because otherwise the commit from the previous test could come in and cause damage. BUG=274116 Review URL: https://chromiumcodereview.appspot.com/22853008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@218628 0039d316-1c4b-4281-b951-d872f2087c98 --- cc/trees/layer_tree_host_unittest_damage.cc | 31 +++++++++++++---------------- 1 file changed, 14 insertions(+), 17 deletions(-) (limited to 'cc') diff --git a/cc/trees/layer_tree_host_unittest_damage.cc b/cc/trees/layer_tree_host_unittest_damage.cc index 9a5f3d2..3eee02c 100644 --- a/cc/trees/layer_tree_host_unittest_damage.cc +++ b/cc/trees/layer_tree_host_unittest_damage.cc @@ -334,16 +334,16 @@ class LayerTreeHostDamageTestScrollbarDoesDamage // The first frame has damage, so we should draw and swap. break; case 1: - // The second frame should damage the scrollbars. - EXPECT_TRUE(root_damage.Contains(gfx::Rect(300, 300, 10, 100))); + // The second frame should not damage the scrollbars. + EXPECT_FALSE(root_damage.Intersects(gfx::Rect(300, 300, 10, 100))); break; case 2: // The third frame should damage the scrollbars. EXPECT_TRUE(root_damage.Contains(gfx::Rect(300, 300, 10, 100))); break; case 3: - // The fourth frame should not damage the scrollbars. - EXPECT_FALSE(root_damage.Intersects(gfx::Rect(300, 300, 10, 100))); + // The fourth frame should damage the scrollbars. + EXPECT_TRUE(root_damage.Contains(gfx::Rect(300, 300, 10, 100))); EndTest(); break; } @@ -358,19 +358,21 @@ class LayerTreeHostDamageTestScrollbarDoesDamage LayerImpl* scroll_layer = root->children()[0]; switch (did_swaps_) { case 1: + // Test that modifying the position of the content layer (not + // scrolling) won't damage the scrollbar. Do this before the other + // tests, as they can cause commits that will later damage the + // scrollbar. http://crbug.com/276657 + scroll_layer->SetPosition(gfx::Point(1,1)); + scroll_layer->SetScrollOffset(scroll_layer->scroll_offset()); + host_impl->SetNeedsRedraw(); + break; + case 2: host_impl->ScrollBegin(gfx::Point(1,1), InputHandler::Wheel); EXPECT_TRUE(host_impl->ScrollBy(gfx::Point(), gfx::Vector2dF(10.0, 10.0))); break; - case 2: - scroll_layer->SetMaxScrollOffset(gfx::Vector2d(60, 100)); - host_impl->SetNeedsRedraw(); - break; case 3: - // Test that modifying the position of the content layer (not - // scrolling) won't damage the scrollbar. - scroll_layer->SetPosition(gfx::Point(1,1)); - scroll_layer->SetScrollOffset(scroll_layer->scroll_offset()); + scroll_layer->SetMaxScrollOffset(gfx::Vector2d(60, 100)); host_impl->SetNeedsRedraw(); break; } @@ -385,12 +387,7 @@ class LayerTreeHostDamageTestScrollbarDoesDamage int did_swaps_; }; -// Flaky on win. http://crbug.com/274116 -// Can't specify the normal DISABLED_ since we don't have access to the test -// names through this macro. Just ifdef it out completely. -#if !defined(OS_WIN) MULTI_THREAD_TEST_F(LayerTreeHostDamageTestScrollbarDoesDamage); -#endif } // namespace } // namespace cc -- cgit v1.1