Commit a28c67d5 authored by Andrew Xu's avatar Andrew Xu Committed by Commit Bot

Fix wrong shelf view tests

ShelfViewTest::ShouldHideTooltipTest and ShelfViewTest::
ShouldHideTooltipWithAppListWindowTest assumes that home button is
still the child view of shelf view. It is incorrect now. This CL
fixes these two tests.

Bug: 1002576
Change-Id: I8350fa9fab8c21497f3ac24f9bf0a32bde1aaf30
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1795759Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Andrew Xu <andrewxu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#695229}
parent 5cf311b8
......@@ -1423,21 +1423,23 @@ TEST_F(ShelfViewTest, ShouldHideTooltipTest) {
// The tooltip should hide if placed in between the home button and the
// first shelf button.
const int left = home_button->bounds().right();
const int left = home_button->GetBoundsInScreen().right();
// Find the first shelf button that's to the right of the home button.
int right = 0;
for (int i = 0; i < test_api_->GetButtonCount(); ++i) {
ShelfAppButton* button = test_api_->GetButton(i);
if (!button)
continue;
right = button->bounds().x();
right = button->GetBoundsInScreen().x();
if (right > left)
break;
}
const int center_x =
shelf_view_->GetMirroredXInView(left + (right - left) / 2);
EXPECT_TRUE(shelf_view_->ShouldHideTooltip(
gfx::Point(center_x, home_button->GetMirroredBounds().left_center().y())))
gfx::Point test_point(left + (right - left) / 2,
home_button->GetBoundsInScreen().y());
views::View::ConvertPointFromScreen(shelf_view_, &test_point);
EXPECT_TRUE(shelf_view_->ShouldHideTooltip(gfx::Point(
shelf_view_->GetMirroredXInView(test_point.x()), test_point.y())))
<< "Tooltip should hide between home button and first shelf item";
// The tooltip shouldn't hide if the mouse is in the gap between two buttons.
......@@ -1486,8 +1488,10 @@ TEST_F(ShelfViewTest, ShouldHideTooltipWithAppListWindowTest) {
// The tooltip should hide on the home button if the app list is visible.
HomeButton* home_button = shelf_view_->shelf_widget()->GetHomeButton();
EXPECT_TRUE(shelf_view_->ShouldHideTooltip(
home_button->GetMirroredBounds().CenterPoint()));
gfx::Point center_point = home_button->GetBoundsInScreen().CenterPoint();
views::View::ConvertPointFromScreen(shelf_view_, &center_point);
EXPECT_TRUE(shelf_view_->ShouldHideTooltip(gfx::Point(
shelf_view_->GetMirroredXInView(center_point.x()), center_point.y())));
}
// Test that by moving the mouse cursor off the button onto the bubble it closes
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment