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

Unified Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 2554913002: Prevent overlay scrollbars expand or hover together (Closed)
Patch Set: Merge remote-tracking branch 'origin/master' into fix-669677 Created 3 years, 11 months 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
« cc/trees/layer_tree_host_impl.cc ('K') | « cc/trees/layer_tree_host_impl.cc ('k') | no next file » | 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 b2fd2e17215b8e00a617b949a2a20be090cd5e37..2cc85c17aa04694ee96bd93300e9a76436cbd9ea 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -2801,7 +2801,7 @@ class LayerTreeHostImplTestScrollbarAnimation : public LayerTreeHostImplTest {
BeginFrameArgs begin_frame_args =
CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 0, 2, fake_now);
host_impl_->WillBeginImplFrame(begin_frame_args);
- host_impl_->Animate();
+ host_impl_->Animate(); // All Animate will check need fade out?
bokan 2017/01/06 20:17:57 I don't understand what this comment is saying.
chaopeng 2017/01/10 20:49:50 It just a note I forgot to remove...
EXPECT_FALSE(did_request_next_frame_);
did_request_next_frame_ = false;
EXPECT_FALSE(did_request_redraw_);
@@ -2989,7 +2989,7 @@ class LayerTreeHostImplTestScrollbarOpacity : public LayerTreeHostImplTest {
if (expecting_animations) {
host_impl_->ScrollbarAnimationControllerForId(scroll->id())
- ->DidMouseMoveNear(0);
+ ->DidMouseMoveNear(VERTICAL, 0);
} else {
EXPECT_EQ(nullptr,
host_impl_->ScrollbarAnimationControllerForId(scroll->id()));
@@ -3249,26 +3249,34 @@ void LayerTreeHostImplTest::SetupMouseMoveAtWithDeviceScale(
scrollbar_animation_controller->set_mouse_move_distance_for_test(100.f);
host_impl_->MouseMoveAt(gfx::Point(200, 1));
- EXPECT_FALSE(scrollbar_animation_controller->mouse_is_near_scrollbar());
+ EXPECT_FALSE(
+ scrollbar_animation_controller->mouse_is_near_scrollbar(VERTICAL));
host_impl_->MouseMoveAt(gfx::Point(100, 50));
- EXPECT_TRUE(scrollbar_animation_controller->mouse_is_near_scrollbar());
+ EXPECT_TRUE(
+ scrollbar_animation_controller->mouse_is_near_scrollbar(VERTICAL));
host_impl_->MouseMoveAt(gfx::Point(116, 100));
- EXPECT_FALSE(scrollbar_animation_controller->mouse_is_near_scrollbar());
+ EXPECT_FALSE(
+ scrollbar_animation_controller->mouse_is_near_scrollbar(VERTICAL));
scrollbar_animation_controller->set_mouse_move_distance_for_test(102.f);
host_impl_->MouseMoveAt(gfx::Point(116, 100));
- EXPECT_TRUE(scrollbar_animation_controller->mouse_is_near_scrollbar());
+ EXPECT_TRUE(
+ scrollbar_animation_controller->mouse_is_near_scrollbar(VERTICAL));
did_request_redraw_ = false;
- EXPECT_FALSE(scrollbar_animation_controller->mouse_is_over_scrollbar());
+ EXPECT_FALSE(
+ scrollbar_animation_controller->mouse_is_over_scrollbar(VERTICAL));
host_impl_->MouseMoveAt(gfx::Point(10, 100));
- EXPECT_TRUE(scrollbar_animation_controller->mouse_is_over_scrollbar());
+ EXPECT_TRUE(
+ scrollbar_animation_controller->mouse_is_over_scrollbar(VERTICAL));
host_impl_->MouseMoveAt(gfx::Point(10, 120));
- EXPECT_TRUE(scrollbar_animation_controller->mouse_is_over_scrollbar());
+ EXPECT_TRUE(
+ scrollbar_animation_controller->mouse_is_over_scrollbar(VERTICAL));
host_impl_->MouseMoveAt(gfx::Point(150, 120));
- EXPECT_FALSE(scrollbar_animation_controller->mouse_is_over_scrollbar());
+ EXPECT_FALSE(
+ scrollbar_animation_controller->mouse_is_over_scrollbar(VERTICAL));
}
TEST_F(LayerTreeHostImplTest, MouseMoveAtWithDeviceScaleOf1) {
@@ -11702,20 +11710,30 @@ TEST_F(LayerTreeHostImplTest, LayerTreeHostImplTestScrollbarStates) {
// Mouse moves close to the scrollbar, goes over the scrollbar, and
// moves back to where it was.
host_impl_->MouseMoveAt(gfx::Point(100, 150));
- EXPECT_FALSE(scrollbar_1_animation_controller->mouse_is_near_scrollbar());
- EXPECT_FALSE(scrollbar_1_animation_controller->mouse_is_over_scrollbar());
+ EXPECT_FALSE(
+ scrollbar_1_animation_controller->mouse_is_near_scrollbar(VERTICAL));
+ EXPECT_FALSE(
+ scrollbar_1_animation_controller->mouse_is_over_scrollbar(VERTICAL));
host_impl_->MouseMoveAt(gfx::Point(40, 150));
- EXPECT_TRUE(scrollbar_1_animation_controller->mouse_is_near_scrollbar());
- EXPECT_FALSE(scrollbar_1_animation_controller->mouse_is_over_scrollbar());
+ EXPECT_TRUE(
+ scrollbar_1_animation_controller->mouse_is_near_scrollbar(VERTICAL));
+ EXPECT_FALSE(
+ scrollbar_1_animation_controller->mouse_is_over_scrollbar(VERTICAL));
host_impl_->MouseMoveAt(gfx::Point(10, 150));
- EXPECT_TRUE(scrollbar_1_animation_controller->mouse_is_near_scrollbar());
- EXPECT_TRUE(scrollbar_1_animation_controller->mouse_is_over_scrollbar());
+ EXPECT_TRUE(
+ scrollbar_1_animation_controller->mouse_is_near_scrollbar(VERTICAL));
+ EXPECT_TRUE(
+ scrollbar_1_animation_controller->mouse_is_over_scrollbar(VERTICAL));
host_impl_->MouseMoveAt(gfx::Point(40, 150));
- EXPECT_TRUE(scrollbar_1_animation_controller->mouse_is_near_scrollbar());
- EXPECT_FALSE(scrollbar_1_animation_controller->mouse_is_over_scrollbar());
+ EXPECT_TRUE(
+ scrollbar_1_animation_controller->mouse_is_near_scrollbar(VERTICAL));
+ EXPECT_FALSE(
+ scrollbar_1_animation_controller->mouse_is_over_scrollbar(VERTICAL));
host_impl_->MouseMoveAt(gfx::Point(100, 150));
- EXPECT_FALSE(scrollbar_1_animation_controller->mouse_is_near_scrollbar());
- EXPECT_FALSE(scrollbar_1_animation_controller->mouse_is_over_scrollbar());
+ EXPECT_FALSE(
+ scrollbar_1_animation_controller->mouse_is_near_scrollbar(VERTICAL));
+ EXPECT_FALSE(
+ scrollbar_1_animation_controller->mouse_is_over_scrollbar(VERTICAL));
// scrollbar_2 on child.
std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar_2 =
@@ -11751,25 +11769,41 @@ TEST_F(LayerTreeHostImplTest, LayerTreeHostImplTestScrollbarStates) {
// Mouse goes over scrollbar_2, moves close to scrollbar_2, moves close to
// scrollbar_1, goes over scrollbar_1.
host_impl_->MouseMoveAt(gfx::Point(60, 150));
- EXPECT_FALSE(scrollbar_1_animation_controller->mouse_is_near_scrollbar());
- EXPECT_FALSE(scrollbar_1_animation_controller->mouse_is_over_scrollbar());
- EXPECT_TRUE(scrollbar_2_animation_controller->mouse_is_near_scrollbar());
- EXPECT_TRUE(scrollbar_2_animation_controller->mouse_is_over_scrollbar());
+ EXPECT_FALSE(
+ scrollbar_1_animation_controller->mouse_is_near_scrollbar(VERTICAL));
+ EXPECT_FALSE(
+ scrollbar_1_animation_controller->mouse_is_over_scrollbar(VERTICAL));
+ EXPECT_TRUE(
+ scrollbar_2_animation_controller->mouse_is_near_scrollbar(VERTICAL));
+ EXPECT_TRUE(
+ scrollbar_2_animation_controller->mouse_is_over_scrollbar(VERTICAL));
host_impl_->MouseMoveAt(gfx::Point(100, 150));
- EXPECT_FALSE(scrollbar_1_animation_controller->mouse_is_near_scrollbar());
- EXPECT_FALSE(scrollbar_1_animation_controller->mouse_is_over_scrollbar());
- EXPECT_TRUE(scrollbar_2_animation_controller->mouse_is_near_scrollbar());
- EXPECT_FALSE(scrollbar_2_animation_controller->mouse_is_over_scrollbar());
+ EXPECT_FALSE(
+ scrollbar_1_animation_controller->mouse_is_near_scrollbar(VERTICAL));
+ EXPECT_FALSE(
+ scrollbar_1_animation_controller->mouse_is_over_scrollbar(VERTICAL));
+ EXPECT_TRUE(
+ scrollbar_2_animation_controller->mouse_is_near_scrollbar(VERTICAL));
+ EXPECT_FALSE(
+ scrollbar_2_animation_controller->mouse_is_over_scrollbar(VERTICAL));
host_impl_->MouseMoveAt(gfx::Point(40, 150));
- EXPECT_TRUE(scrollbar_1_animation_controller->mouse_is_near_scrollbar());
- EXPECT_FALSE(scrollbar_1_animation_controller->mouse_is_over_scrollbar());
- EXPECT_FALSE(scrollbar_2_animation_controller->mouse_is_near_scrollbar());
- EXPECT_FALSE(scrollbar_2_animation_controller->mouse_is_over_scrollbar());
+ EXPECT_TRUE(
+ scrollbar_1_animation_controller->mouse_is_near_scrollbar(VERTICAL));
+ EXPECT_FALSE(
+ scrollbar_1_animation_controller->mouse_is_over_scrollbar(VERTICAL));
+ EXPECT_FALSE(
+ scrollbar_2_animation_controller->mouse_is_near_scrollbar(VERTICAL));
+ EXPECT_FALSE(
+ scrollbar_2_animation_controller->mouse_is_over_scrollbar(VERTICAL));
host_impl_->MouseMoveAt(gfx::Point(10, 150));
- EXPECT_TRUE(scrollbar_1_animation_controller->mouse_is_near_scrollbar());
- EXPECT_TRUE(scrollbar_1_animation_controller->mouse_is_over_scrollbar());
- EXPECT_FALSE(scrollbar_2_animation_controller->mouse_is_near_scrollbar());
- EXPECT_FALSE(scrollbar_2_animation_controller->mouse_is_over_scrollbar());
+ EXPECT_TRUE(
+ scrollbar_1_animation_controller->mouse_is_near_scrollbar(VERTICAL));
+ EXPECT_TRUE(
+ scrollbar_1_animation_controller->mouse_is_over_scrollbar(VERTICAL));
+ EXPECT_FALSE(
+ scrollbar_2_animation_controller->mouse_is_near_scrollbar(VERTICAL));
+ EXPECT_FALSE(
+ scrollbar_2_animation_controller->mouse_is_over_scrollbar(VERTICAL));
}
} // namespace
« cc/trees/layer_tree_host_impl.cc ('K') | « cc/trees/layer_tree_host_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698