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

Unified Diff: ash/shelf/shelf_layout_manager_unittest.cc

Issue 2190773003: [ABANDONED] Simplify ash shelf dimmer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Restore an EventHandler object; fix behavior tests. Created 4 years, 5 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
« no previous file with comments | « ash/shelf/shelf_layout_manager.cc ('k') | ash/shelf/shelf_widget.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/shelf/shelf_layout_manager_unittest.cc
diff --git a/ash/shelf/shelf_layout_manager_unittest.cc b/ash/shelf/shelf_layout_manager_unittest.cc
index 30854ef63ce71621958434331a548129fe2c0d0b..02ab50d724fa13bf564d8bba7331ddd4afb22ddb 100644
--- a/ash/shelf/shelf_layout_manager_unittest.cc
+++ b/ash/shelf/shelf_layout_manager_unittest.cc
@@ -19,7 +19,6 @@
#include "ash/common/wm/window_state.h"
#include "ash/common/wm_shell.h"
#include "ash/display/display_manager.h"
-#include "ash/display/window_tree_host_manager.h"
#include "ash/root_window_controller.h"
#include "ash/shelf/shelf.h"
#include "ash/shelf/shelf_layout_manager_observer.h"
@@ -29,6 +28,7 @@
#include "ash/test/ash_test_base.h"
#include "ash/test/display_manager_test_api.h"
#include "ash/test/shelf_test_api.h"
+#include "ash/test/status_area_widget_test_helper.h"
#include "ash/test/test_system_tray_item.h"
#include "ash/wm/window_state_aura.h"
#include "ash/wm/window_util.h"
@@ -178,11 +178,6 @@ class ShelfDragCallback {
EXPECT_EQ(shelf_widget_bounds_.x(), shelf_bounds.x());
}
- // if the shelf is being dimmed test dimmer bounds as well.
- if (GetShelfWidget()->GetDimsShelf())
- EXPECT_EQ(GetShelfWidget()->GetWindowBoundsInScreen(),
- GetShelfWidget()->GetDimmerBoundsForTest());
-
// Auto hidden shelf has a visible height of 0 in MD (where this inequality
// does not apply); whereas auto hidden shelf has a visible height of 3 in
// non-MD.
@@ -302,8 +297,7 @@ class ShelfLayoutManagerTest : public test::AshTestBase {
return out;
}
- // Create a simple widget attached to the current context (will
- // delete on TearDown).
+ // Create a simple widget in the current context (will delete on TearDown).
views::Widget* CreateTestWidget() {
views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW);
params.bounds = gfx::Rect(0, 0, 200, 200);
@@ -334,12 +328,8 @@ class ShelfLayoutManagerTest : public test::AshTestBase {
void ShelfLayoutManagerTest::RunGestureDragTests(gfx::Vector2d delta) {
Shelf* shelf = GetShelf();
shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
- views::Widget* widget = new views::Widget;
- views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW);
- params.bounds = gfx::Rect(0, 0, 200, 200);
- params.context = CurrentContext();
- widget->Init(params);
- widget->Show();
+
+ views::Widget* widget = CreateTestWidget();
widget->Maximize();
// The time delta should be large enough to prevent accidental fling creation.
@@ -363,7 +353,7 @@ void ShelfLayoutManagerTest::RunGestureDragTests(gfx::Vector2d delta) {
shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
layout_manager->LayoutShelf();
- ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow());
+ ui::test::EventGenerator& generator(GetEventGenerator());
const int kNumScrollSteps = 4;
ShelfDragCallback handler(shelf_hidden, shelf_shown);
@@ -391,8 +381,6 @@ void ShelfLayoutManagerTest::RunGestureDragTests(gfx::Vector2d delta) {
EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState());
EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_NEVER, shelf->auto_hide_behavior());
EXPECT_EQ(bounds_shelf.ToString(), window->bounds().ToString());
- EXPECT_EQ(GetShelfWidget()->GetDimmerBoundsForTest(),
- GetShelfWidget()->GetWindowBoundsInScreen());
EXPECT_EQ(shelf_shown.ToString(),
GetShelfWidget()->GetWindowBoundsInScreen().ToString());
@@ -438,7 +426,6 @@ void ShelfLayoutManagerTest::RunGestureDragTests(gfx::Vector2d delta) {
EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState());
EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState());
EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, shelf->auto_hide_behavior());
- EXPECT_EQ(GetShelfWidget()->GetDimmerBoundsForTest(), gfx::Rect());
EXPECT_EQ(bounds_noshelf.ToString(), window->bounds().ToString());
EXPECT_EQ(shelf_hidden.ToString(),
GetShelfWidget()->GetWindowBoundsInScreen().ToString());
@@ -460,8 +447,6 @@ void ShelfLayoutManagerTest::RunGestureDragTests(gfx::Vector2d delta) {
EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState());
EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_NEVER, shelf->auto_hide_behavior());
EXPECT_EQ(bounds_shelf.ToString(), window->bounds().ToString());
- EXPECT_EQ(GetShelfWidget()->GetDimmerBoundsForTest(),
- GetShelfWidget()->GetWindowBoundsInScreen());
EXPECT_EQ(shelf_shown.ToString(),
GetShelfWidget()->GetWindowBoundsInScreen().ToString());
@@ -474,7 +459,6 @@ void ShelfLayoutManagerTest::RunGestureDragTests(gfx::Vector2d delta) {
EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState());
EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState());
EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, shelf->auto_hide_behavior());
- EXPECT_EQ(GetShelfWidget()->GetDimmerBoundsForTest(), gfx::Rect());
EXPECT_EQ(bounds_noshelf.ToString(), window->bounds().ToString());
EXPECT_EQ(shelf_hidden.ToString(),
GetShelfWidget()->GetWindowBoundsInScreen().ToString());
@@ -509,8 +493,6 @@ void ShelfLayoutManagerTest::RunGestureDragTests(gfx::Vector2d delta) {
EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState());
EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_NEVER, shelf->auto_hide_behavior());
EXPECT_EQ(bounds_shelf.ToString(), window->bounds().ToString());
- EXPECT_EQ(GetShelfWidget()->GetDimmerBoundsForTest(),
- GetShelfWidget()->GetWindowBoundsInScreen());
EXPECT_EQ(shelf_shown.ToString(),
GetShelfWidget()->GetWindowBoundsInScreen().ToString());
@@ -523,7 +505,6 @@ void ShelfLayoutManagerTest::RunGestureDragTests(gfx::Vector2d delta) {
EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState());
EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState());
EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, shelf->auto_hide_behavior());
- EXPECT_EQ(GetShelfWidget()->GetDimmerBoundsForTest(), gfx::Rect());
EXPECT_EQ(bounds_noshelf.ToString(), window->bounds().ToString());
EXPECT_EQ(shelf_hidden.ToString(),
GetShelfWidget()->GetWindowBoundsInScreen().ToString());
@@ -626,9 +607,7 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_SetVisible) {
shelf_widget->status_area_widget()->GetWindowBoundsInScreen());
gfx::Rect shelf_bounds(shelf_widget->GetWindowBoundsInScreen());
int shelf_height = manager->GetIdealBounds().height();
- display::Screen* screen = display::Screen::GetScreen();
- display::Display display =
- screen->GetDisplayNearestWindow(Shell::GetPrimaryRootWindow());
+ display::Display display = display::Screen::GetScreen()->GetPrimaryDisplay();
ASSERT_NE(-1, display.id());
// Bottom inset should be the max of widget heights.
EXPECT_EQ(shelf_height, display.GetWorkAreaInsets().bottom());
@@ -639,15 +618,14 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_SetVisible) {
StepWidgetLayerAnimatorToEnd(shelf_widget);
StepWidgetLayerAnimatorToEnd(shelf_widget->status_area_widget());
EXPECT_EQ(SHELF_HIDDEN, manager->visibility_state());
- display = screen->GetDisplayNearestWindow(Shell::GetPrimaryRootWindow());
EXPECT_EQ(0, display.GetWorkAreaInsets().bottom());
// Make sure the bounds of the two widgets changed.
EXPECT_GE(shelf_widget->GetNativeView()->bounds().y(),
- screen->GetPrimaryDisplay().bounds().bottom());
+ display.bounds().bottom());
EXPECT_GE(shelf_widget->status_area_widget()->GetNativeView()->bounds().y(),
- screen->GetPrimaryDisplay().bounds().bottom());
+ display.bounds().bottom());
// And show it again.
SetState(manager, SHELF_VISIBLE);
@@ -655,14 +633,13 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_SetVisible) {
StepWidgetLayerAnimatorToEnd(shelf_widget);
StepWidgetLayerAnimatorToEnd(shelf_widget->status_area_widget());
EXPECT_EQ(SHELF_VISIBLE, manager->visibility_state());
- display = screen->GetDisplayNearestWindow(Shell::GetPrimaryRootWindow());
EXPECT_EQ(shelf_height, display.GetWorkAreaInsets().bottom());
// Make sure the bounds of the two widgets changed.
shelf_bounds = shelf_widget->GetNativeView()->bounds();
- EXPECT_LT(shelf_bounds.y(), screen->GetPrimaryDisplay().bounds().bottom());
+ EXPECT_LT(shelf_bounds.y(), display.bounds().bottom());
status_bounds = shelf_widget->status_area_widget()->GetNativeView()->bounds();
- EXPECT_LT(status_bounds.y(), screen->GetPrimaryDisplay().bounds().bottom());
+ EXPECT_LT(status_bounds.y(), display.bounds().bottom());
}
// Makes sure LayoutShelf invoked while animating cleans things up.
@@ -677,19 +654,15 @@ TEST_F(ShelfLayoutManagerTest, LayoutShelfWhileAnimating) {
SetState(layout_manager, SHELF_HIDDEN);
layout_manager->LayoutShelf();
EXPECT_EQ(SHELF_HIDDEN, shelf->GetVisibilityState());
- display::Display display =
- display::Screen::GetScreen()->GetDisplayNearestWindow(
- Shell::GetPrimaryRootWindow());
+ display::Display display = display::Screen::GetScreen()->GetPrimaryDisplay();
EXPECT_EQ(0, display.GetWorkAreaInsets().bottom());
// Make sure the bounds of the two widgets changed.
ShelfWidget* shelf_widget = GetShelfWidget();
- EXPECT_GE(
- shelf_widget->GetNativeView()->bounds().y(),
- display::Screen::GetScreen()->GetPrimaryDisplay().bounds().bottom());
- EXPECT_GE(
- shelf_widget->status_area_widget()->GetNativeView()->bounds().y(),
- display::Screen::GetScreen()->GetPrimaryDisplay().bounds().bottom());
+ EXPECT_GE(shelf_widget->GetNativeView()->bounds().y(),
+ display.bounds().bottom());
+ EXPECT_GE(shelf_widget->status_area_widget()->GetNativeView()->bounds().y(),
+ display.bounds().bottom());
}
// Test that switching to a different visibility state does not restart the
@@ -732,30 +705,15 @@ TEST_F(ShelfLayoutManagerTest, ShelfUpdatedWhenStatusAreaChangesSize) {
test::ShelfTestAPI(shelf).shelf_view()->width());
}
-#if defined(OS_WIN)
-// RootWindow and Display can't resize on Windows Ash. http://crbug.com/165962
-#define MAYBE_AutoHide DISABLED_AutoHide
-#else
-#define MAYBE_AutoHide AutoHide
-#endif
-
// Various assertions around auto-hide.
-TEST_F(ShelfLayoutManagerTest, MAYBE_AutoHide) {
- aura::Window* root = Shell::GetPrimaryRootWindow();
- ui::test::EventGenerator generator(root, root);
- generator.MoveMouseTo(0, 0);
+TEST_F(ShelfLayoutManagerTest, AutoHide) {
+ ui::test::EventGenerator& generator(GetEventGenerator());
Shelf* shelf = GetShelf();
ShelfLayoutManager* layout_manager = GetShelfLayoutManager();
shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
- views::Widget* widget = new views::Widget;
- views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW);
- params.bounds = gfx::Rect(0, 0, 200, 200);
- params.context = CurrentContext();
- // Widget is now owned by the parent window.
- widget->Init(params);
+ views::Widget* widget = CreateTestWidget();
widget->Maximize();
- widget->Show();
EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState());
EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState());
@@ -764,13 +722,12 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_AutoHide) {
layout_manager->LayoutShelf();
int shelf_insets = GetShelfConstant(SHELF_INSETS_FOR_AUTO_HIDE);
+ aura::Window* root = Shell::GetPrimaryRootWindow();
EXPECT_EQ(root->bounds().bottom() - kShelfAutoHideSize,
GetShelfWidget()->GetWindowBoundsInScreen().y());
+ display::Display display = display::Screen::GetScreen()->GetPrimaryDisplay();
EXPECT_EQ(root->bounds().bottom() - shelf_insets,
- display::Screen::GetScreen()
- ->GetDisplayNearestWindow(root)
- .work_area()
- .bottom());
+ display.work_area().bottom());
// Move the mouse to the bottom of the screen.
generator.MoveMouseTo(0, root->bounds().bottom() - 1);
@@ -782,10 +739,7 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_AutoHide) {
EXPECT_EQ(root->bounds().bottom() - layout_manager->GetIdealBounds().height(),
GetShelfWidget()->GetWindowBoundsInScreen().y());
EXPECT_EQ(root->bounds().bottom() - shelf_insets,
- display::Screen::GetScreen()
- ->GetDisplayNearestWindow(root)
- .work_area()
- .bottom());
+ display.work_area().bottom());
// Move mouse back up.
generator.MoveMouseTo(0, 0);
@@ -907,26 +861,11 @@ TEST_F(ShelfLayoutManagerTest, AutoHideShelfOnScreenBoundary) {
// Assertions around the lock screen showing.
TEST_F(ShelfLayoutManagerTest, VisibleWhenLockScreenShowing) {
- if (!SupportsHostWindowResize())
- return;
-
- // Since ShelfLayoutManager queries for mouse location, move the mouse so
- // it isn't over the shelf.
- ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(),
- gfx::Point());
- generator.MoveMouseTo(0, 0);
-
Shelf* shelf = GetShelf();
ShelfLayoutManager* layout_manager = GetShelfLayoutManager();
shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
- views::Widget* widget = new views::Widget;
- views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW);
- params.bounds = gfx::Rect(0, 0, 200, 200);
- params.context = CurrentContext();
- // Widget is now owned by the parent window.
- widget->Init(params);
+ views::Widget* widget = CreateTestWidget();
widget->Maximize();
- widget->Show();
EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState());
EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState());
@@ -937,18 +876,9 @@ TEST_F(ShelfLayoutManagerTest, VisibleWhenLockScreenShowing) {
EXPECT_EQ(root->bounds().bottom() - kShelfAutoHideSize,
GetShelfWidget()->GetWindowBoundsInScreen().y());
- aura::Window* lock_container = Shell::GetContainer(
- Shell::GetPrimaryRootWindow(), kShellWindowId_LockScreenContainer);
-
- views::Widget* lock_widget = new views::Widget;
- views::Widget::InitParams lock_params(views::Widget::InitParams::TYPE_WINDOW);
- lock_params.bounds = gfx::Rect(0, 0, 200, 200);
- params.context = CurrentContext();
- lock_params.parent = lock_container;
- // Widget is now owned by the parent window.
- lock_widget->Init(lock_params);
+ std::unique_ptr<views::Widget> lock_widget(AshTestBase::CreateTestWidget(
+ nullptr, kShellWindowId_LockScreenContainer, gfx::Rect(200, 200)));
lock_widget->Maximize();
- lock_widget->Show();
// Lock the screen.
LockScreen();
@@ -961,21 +891,8 @@ TEST_F(ShelfLayoutManagerTest, VisibleWhenLockScreenShowing) {
// Assertions around SetAutoHideBehavior.
TEST_F(ShelfLayoutManagerTest, SetAutoHideBehavior) {
- // Since ShelfLayoutManager queries for mouse location, move the mouse so
- // it isn't over the shelf.
- ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(),
- gfx::Point());
- generator.MoveMouseTo(0, 0);
-
Shelf* shelf = GetShelf();
- views::Widget* widget = new views::Widget;
- views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW);
- params.bounds = gfx::Rect(0, 0, 200, 200);
- params.context = CurrentContext();
- // Widget is now owned by the parent window.
- widget->Init(params);
- widget->Show();
- aura::Window* window = widget->GetNativeWindow();
+ views::Widget* widget = CreateTestWidget();
shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState());
@@ -985,18 +902,13 @@ TEST_F(ShelfLayoutManagerTest, SetAutoHideBehavior) {
widget->Maximize();
EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState());
- EXPECT_EQ(display::Screen::GetScreen()
- ->GetDisplayNearestWindow(window)
- .work_area()
- .bottom(),
+ display::Display display = display::Screen::GetScreen()->GetPrimaryDisplay();
+ EXPECT_EQ(display.work_area().bottom(),
widget->GetWorkAreaBoundsInScreen().bottom());
shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState());
- EXPECT_EQ(display::Screen::GetScreen()
- ->GetDisplayNearestWindow(window)
- .work_area()
- .bottom(),
+ EXPECT_EQ(display.work_area().bottom(),
widget->GetWorkAreaBoundsInScreen().bottom());
ui::ScopedAnimationDurationScaleMode animation_duration(
@@ -1008,84 +920,83 @@ TEST_F(ShelfLayoutManagerTest, SetAutoHideBehavior) {
StepWidgetLayerAnimatorToEnd(shelf_widget);
StepWidgetLayerAnimatorToEnd(shelf_widget->status_area_widget());
EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState());
- EXPECT_EQ(display::Screen::GetScreen()
- ->GetDisplayNearestWindow(window)
- .work_area()
- .bottom(),
+ EXPECT_EQ(display.work_area().bottom(),
widget->GetWorkAreaBoundsInScreen().bottom());
}
// Basic assertions around the dimming of the shelf.
TEST_F(ShelfLayoutManagerTest, DimmingBehavior) {
- // Since ShelfLayoutManager queries for mouse location, move the mouse so
- // it isn't over the shelf.
- ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(),
- gfx::Point());
- generator.MoveMouseTo(0, 0);
+ ui::test::EventGenerator& generator(GetEventGenerator());
+ views::Widget* widget = CreateTestWidget();
ShelfWidget* shelf_widget = GetShelfWidget();
- shelf_widget->DisableDimmingAnimationsForTest();
-
- views::Widget* widget = new views::Widget;
- views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW);
- params.bounds = gfx::Rect(0, 0, 200, 200);
- params.context = CurrentContext();
- // Widget is now owned by the parent window.
- widget->Init(params);
- widget->Show();
- aura::Window* window = widget->GetNativeWindow();
- gfx::Rect display_bounds(
- display::Screen::GetScreen()->GetDisplayNearestWindow(window).bounds());
-
- gfx::Point off_shelf = display_bounds.CenterPoint();
+ display::Display display = display::Screen::GetScreen()->GetPrimaryDisplay();
+ gfx::Point off_shelf = display.bounds().CenterPoint();
gfx::Point on_shelf = shelf_widget->GetWindowBoundsInScreen().CenterPoint();
- // Test there is no dimming object active at this point.
- generator.MoveMouseTo(on_shelf.x(), on_shelf.y());
- EXPECT_EQ(-1, shelf_widget->GetDimmingAlphaForTest());
- generator.MoveMouseTo(off_shelf.x(), off_shelf.y());
- EXPECT_EQ(-1, shelf_widget->GetDimmingAlphaForTest());
+ // Test that the shelf is not dimmed at this point.
+ generator.MoveMouseTo(on_shelf);
+ EXPECT_FALSE(shelf_widget->GetDimsShelf());
+ generator.MoveMouseTo(off_shelf);
+ EXPECT_FALSE(shelf_widget->GetDimsShelf());
- // After maximization, the shelf should be visible and the dimmer created.
+ // Maximizing the window should dim the shelf.
widget->Maximize();
+ EXPECT_TRUE(shelf_widget->GetDimsShelf());
- on_shelf = shelf_widget->GetWindowBoundsInScreen().CenterPoint();
- EXPECT_LT(0, shelf_widget->GetDimmingAlphaForTest());
+ // Mouse move events outside the shelf should keep the shelf dimmed.
+ generator.MoveMouseTo(off_shelf.x() + 10, off_shelf.y() + 10);
+ EXPECT_TRUE(shelf_widget->GetDimsShelf());
- // Moving the mouse off the shelf should dim the bar.
- generator.MoveMouseTo(off_shelf.x(), off_shelf.y());
- EXPECT_LT(0, shelf_widget->GetDimmingAlphaForTest());
+ // Mouse move events inside the shelf should undim the shelf.
+ generator.MoveMouseTo(on_shelf);
+ EXPECT_FALSE(shelf_widget->GetDimsShelf());
- // Adding touch events outside the shelf should still keep the shelf in
- // dimmed state.
- generator.PressTouch();
- generator.MoveTouch(off_shelf);
- EXPECT_LT(0, shelf_widget->GetDimmingAlphaForTest());
- // Move the touch into the shelf area should undim.
- generator.MoveTouch(on_shelf);
- EXPECT_EQ(0, shelf_widget->GetDimmingAlphaForTest());
- generator.ReleaseTouch();
- // And a release dims again.
- EXPECT_LT(0, shelf_widget->GetDimmingAlphaForTest());
+ // Mouse drags starting outside the shelf are not captured.
+ generator.MoveMouseTo(off_shelf);
+ generator.PressLeftButton();
+ EXPECT_TRUE(shelf_widget->GetDimsShelf());
+ generator.MoveMouseTo(on_shelf);
+ EXPECT_TRUE(shelf_widget->GetDimsShelf());
+ generator.MoveMouseTo(off_shelf);
+ generator.ReleaseLeftButton();
+ EXPECT_TRUE(shelf_widget->GetDimsShelf());
- // Moving the mouse on the shelf should undim the bar.
+ // Mouse drags starting inside the shelf are captured.
+ generator.MoveMouseTo(on_shelf);
+ generator.PressLeftButton();
+ EXPECT_FALSE(shelf_widget->GetDimsShelf());
+ generator.MoveMouseTo(off_shelf);
+ EXPECT_FALSE(shelf_widget->GetDimsShelf());
generator.MoveMouseTo(on_shelf);
- EXPECT_EQ(0, shelf_widget->GetDimmingAlphaForTest());
+ generator.ReleaseLeftButton();
+ EXPECT_FALSE(shelf_widget->GetDimsShelf());
- // No matter what the touch events do, the shelf should stay undimmed.
+ // Touch drags outside the shelf should keep the shelf dimmed.
+ generator.MoveTouch(off_shelf);
generator.PressTouch();
+ EXPECT_TRUE(shelf_widget->GetDimsShelf());
+ generator.MoveTouch(gfx::Point(off_shelf.x() + 10, off_shelf.y() + 10));
+ EXPECT_TRUE(shelf_widget->GetDimsShelf());
generator.MoveTouch(off_shelf);
- EXPECT_EQ(0, shelf_widget->GetDimmingAlphaForTest());
+ generator.ReleaseTouch();
+ EXPECT_TRUE(shelf_widget->GetDimsShelf());
+
+ // Touch drags inside the shelf should undim the shelf until release.
generator.MoveTouch(on_shelf);
- EXPECT_EQ(0, shelf_widget->GetDimmingAlphaForTest());
- generator.MoveTouch(off_shelf);
- EXPECT_EQ(0, shelf_widget->GetDimmingAlphaForTest());
+ generator.PressTouch();
+ EXPECT_FALSE(shelf_widget->GetDimsShelf());
+ generator.MoveTouch(gfx::Point(on_shelf.x() + 1, on_shelf.y() + 1));
+ EXPECT_FALSE(shelf_widget->GetDimsShelf());
generator.MoveTouch(on_shelf);
generator.ReleaseTouch();
+ EXPECT_TRUE(shelf_widget->GetDimsShelf());
- // After restore, the dimming object should be deleted again.
+ // After restore, the shelf should be undimmed.
+ generator.MoveMouseTo(off_shelf);
+ EXPECT_TRUE(shelf_widget->GetDimsShelf());
widget->Restore();
- EXPECT_EQ(-1, shelf_widget->GetDimmingAlphaForTest());
+ EXPECT_FALSE(shelf_widget->GetDimsShelf());
}
// Test that dimming works correctly with multiple displays.
@@ -1094,14 +1005,8 @@ TEST_F(ShelfLayoutManagerTest, DimmingBehaviorDualDisplay) {
return;
// Create two displays.
- Shell* shell = Shell::GetInstance();
- UpdateDisplay("0+0-200x200,+200+0-100x100");
- EXPECT_EQ(2U, shell->display_manager()->GetNumDisplays());
-
- WindowTreeHostManager* window_tree_host_manager =
- shell->window_tree_host_manager();
- aura::Window::Windows root_windows =
- window_tree_host_manager->GetAllRootWindows();
+ UpdateDisplay("0+0-300x300,+600+0-300x300");
+ aura::Window::Windows root_windows = Shell::GetAllRootWindows();
EXPECT_EQ(root_windows.size(), 2U);
std::vector<ShelfWidget*> shelf_widgets;
@@ -1109,127 +1014,97 @@ TEST_F(ShelfLayoutManagerTest, DimmingBehaviorDualDisplay) {
ShelfLayoutManager* shelf =
GetRootWindowController(root_window)->GetShelfLayoutManager();
shelf_widgets.push_back(shelf->shelf_widget());
-
- // For disabling the dimming animation to work, the animation must be
- // disabled prior to creating the dimmer.
- shelf_widgets.back()->DisableDimmingAnimationsForTest();
-
- // Create a maximized window to create the dimmer.
- views::Widget* widget = new views::Widget;
- views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW);
- params.context = root_window;
- params.bounds = root_window->GetBoundsInScreen();
- params.show_state = ui::SHOW_STATE_MAXIMIZED;
- widget->Init(params);
- widget->Show();
+ // Force the shelf to enable dimming with a maximized window background.
+ shelf->shelf_widget()->SetPaintsBackground(SHELF_BACKGROUND_MAXIMIZED,
+ BACKGROUND_CHANGE_IMMEDIATE);
}
ui::test::EventGenerator& generator(GetEventGenerator());
-
generator.MoveMouseTo(root_windows[0]->GetBoundsInScreen().CenterPoint());
- EXPECT_LT(0, shelf_widgets[0]->GetDimmingAlphaForTest());
- EXPECT_LT(0, shelf_widgets[1]->GetDimmingAlphaForTest());
+ EXPECT_TRUE(shelf_widgets[0]->GetDimsShelf());
+ EXPECT_TRUE(shelf_widgets[1]->GetDimsShelf());
generator.MoveMouseTo(
shelf_widgets[0]->GetWindowBoundsInScreen().CenterPoint());
- EXPECT_EQ(0, shelf_widgets[0]->GetDimmingAlphaForTest());
- EXPECT_LT(0, shelf_widgets[1]->GetDimmingAlphaForTest());
+ EXPECT_FALSE(shelf_widgets[0]->GetDimsShelf());
+ EXPECT_TRUE(shelf_widgets[1]->GetDimsShelf());
+
+ generator.MoveMouseTo(root_windows[0]->GetBoundsInScreen().CenterPoint());
+ EXPECT_TRUE(shelf_widgets[0]->GetDimsShelf());
+ EXPECT_TRUE(shelf_widgets[1]->GetDimsShelf());
+
+ generator.MoveMouseTo(root_windows[1]->GetBoundsInScreen().CenterPoint());
+ EXPECT_TRUE(shelf_widgets[0]->GetDimsShelf());
+ EXPECT_TRUE(shelf_widgets[1]->GetDimsShelf());
generator.MoveMouseTo(
shelf_widgets[1]->GetWindowBoundsInScreen().CenterPoint());
- EXPECT_LT(0, shelf_widgets[0]->GetDimmingAlphaForTest());
- EXPECT_EQ(0, shelf_widgets[1]->GetDimmingAlphaForTest());
+ EXPECT_TRUE(shelf_widgets[0]->GetDimsShelf());
+ EXPECT_FALSE(shelf_widgets[1]->GetDimsShelf());
generator.MoveMouseTo(root_windows[1]->GetBoundsInScreen().CenterPoint());
- EXPECT_LT(0, shelf_widgets[0]->GetDimmingAlphaForTest());
- EXPECT_LT(0, shelf_widgets[1]->GetDimmingAlphaForTest());
+ EXPECT_TRUE(shelf_widgets[0]->GetDimsShelf());
+ EXPECT_TRUE(shelf_widgets[1]->GetDimsShelf());
}
// Assertions around the dimming of the shelf in conjunction with menus.
TEST_F(ShelfLayoutManagerTest, DimmingBehaviorWithMenus) {
- // Since ShelfLayoutManager queries for mouse location, move the mouse so
- // it isn't over the shelf.
- ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(),
- gfx::Point());
- generator.MoveMouseTo(0, 0);
-
- ShelfWidget* shelf_widget = GetShelfWidget();
- shelf_widget->DisableDimmingAnimationsForTest();
-
- views::Widget* widget = new views::Widget;
- views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW);
- params.bounds = gfx::Rect(0, 0, 200, 200);
- params.context = CurrentContext();
- // Widget is now owned by the parent window.
- widget->Init(params);
- widget->Show();
- aura::Window* window = widget->GetNativeWindow();
- gfx::Rect display_bounds(
- display::Screen::GetScreen()->GetDisplayNearestWindow(window).bounds());
+ ui::test::EventGenerator& generator(GetEventGenerator());
- // After maximization, the shelf should be visible and the dimmer created.
+ // Maximize a widget to make shelf dimming possible.
+ views::Widget* widget = CreateTestWidget();
widget->Maximize();
- gfx::Point off_shelf = display_bounds.CenterPoint();
+ ShelfWidget* shelf_widget = GetShelfWidget();
+ display::Display display = display::Screen::GetScreen()->GetPrimaryDisplay();
+ gfx::Point off_shelf = display.bounds().CenterPoint();
gfx::Point on_shelf = shelf_widget->GetWindowBoundsInScreen().CenterPoint();
// Moving the mouse on the shelf should undim the bar.
- generator.MoveMouseTo(on_shelf.x(), on_shelf.y());
- EXPECT_EQ(0, shelf_widget->GetDimmingAlphaForTest());
+ generator.MoveMouseTo(on_shelf);
+ EXPECT_FALSE(shelf_widget->GetDimsShelf());
// Simulate a menu opening.
shelf_widget->ForceUndimming(true);
// Moving the mouse off the shelf should not dim the bar.
- generator.MoveMouseTo(off_shelf.x(), off_shelf.y());
- EXPECT_EQ(0, shelf_widget->GetDimmingAlphaForTest());
+ generator.MoveMouseTo(off_shelf);
+ EXPECT_FALSE(shelf_widget->GetDimsShelf());
// No matter what the touch events do, the shelf should stay undimmed.
generator.PressTouch();
generator.MoveTouch(off_shelf);
- EXPECT_EQ(0, shelf_widget->GetDimmingAlphaForTest());
+ EXPECT_FALSE(shelf_widget->GetDimsShelf());
generator.MoveTouch(on_shelf);
- EXPECT_EQ(0, shelf_widget->GetDimmingAlphaForTest());
+ EXPECT_FALSE(shelf_widget->GetDimsShelf());
generator.MoveTouch(off_shelf);
- EXPECT_EQ(0, shelf_widget->GetDimmingAlphaForTest());
+ EXPECT_FALSE(shelf_widget->GetDimsShelf());
generator.ReleaseTouch();
- EXPECT_EQ(0, shelf_widget->GetDimmingAlphaForTest());
+ EXPECT_FALSE(shelf_widget->GetDimsShelf());
// "Closing the menu" should now turn off the menu since no event is inside
// the shelf any longer.
shelf_widget->ForceUndimming(false);
- EXPECT_LT(0, shelf_widget->GetDimmingAlphaForTest());
+ EXPECT_TRUE(shelf_widget->GetDimsShelf());
// Moving the mouse again on the shelf which should undim the bar again.
// This time we check that the bar stays undimmed when the mouse remains on
// the bar and the "menu gets closed".
- generator.MoveMouseTo(on_shelf.x(), on_shelf.y());
- EXPECT_EQ(0, shelf_widget->GetDimmingAlphaForTest());
+ generator.MoveMouseTo(on_shelf);
+ EXPECT_FALSE(shelf_widget->GetDimsShelf());
shelf_widget->ForceUndimming(true);
- generator.MoveMouseTo(off_shelf.x(), off_shelf.y());
- EXPECT_EQ(0, shelf_widget->GetDimmingAlphaForTest());
- generator.MoveMouseTo(on_shelf.x(), on_shelf.y());
- EXPECT_EQ(0, shelf_widget->GetDimmingAlphaForTest());
+ generator.MoveMouseTo(off_shelf);
+ EXPECT_FALSE(shelf_widget->GetDimsShelf());
+ generator.MoveMouseTo(on_shelf);
+ EXPECT_FALSE(shelf_widget->GetDimsShelf());
shelf_widget->ForceUndimming(true);
- EXPECT_EQ(0, shelf_widget->GetDimmingAlphaForTest());
+ EXPECT_FALSE(shelf_widget->GetDimsShelf());
}
// Verifies the shelf is visible when status/shelf is focused.
TEST_F(ShelfLayoutManagerTest, VisibleWhenStatusOrShelfFocused) {
- // Since ShelfLayoutManager queries for mouse location, move the mouse so
- // it isn't over the shelf.
- ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(),
- gfx::Point());
- generator.MoveMouseTo(0, 0);
-
Shelf* shelf = GetShelf();
- views::Widget* widget = new views::Widget;
- views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW);
- params.bounds = gfx::Rect(0, 0, 200, 200);
- params.context = CurrentContext();
- // Widget is now owned by the parent window.
- widget->Init(params);
- widget->Show();
+ views::Widget* widget = CreateTestWidget();
shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState());
EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState());
@@ -1328,10 +1203,7 @@ TEST_F(ShelfLayoutManagerTest, DualDisplayOpenAppListWithShelfAutoHideState) {
UpdateDisplay("0+0-200x200,+200+0-100x100");
EXPECT_EQ(2U, display_manager->GetNumDisplays());
- WindowTreeHostManager* window_tree_host_manager =
- shell->window_tree_host_manager();
- aura::Window::Windows root_windows =
- window_tree_host_manager->GetAllRootWindows();
+ aura::Window::Windows root_windows = Shell::GetAllRootWindows();
EXPECT_EQ(root_windows.size(), 2U);
// Get the shelves in both displays and set them to be 'AutoHide'.
@@ -1459,10 +1331,7 @@ TEST_F(ShelfLayoutManagerTest, ShelfWithSystemModalWindowDualDisplay) {
UpdateDisplay("200x200,100x100");
EXPECT_EQ(2U, display_manager->GetNumDisplays());
- WindowTreeHostManager* window_tree_host_manager =
- shell->window_tree_host_manager();
- aura::Window::Windows root_windows =
- window_tree_host_manager->GetAllRootWindows();
+ aura::Window::Windows root_windows = Shell::GetAllRootWindows();
EXPECT_EQ(2U, root_windows.size());
// Get the shelves in both displays and set them to be 'AutoHide'.
@@ -1584,15 +1453,8 @@ TEST_F(ShelfLayoutManagerTest, PinnedWindowHidesShelf) {
EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState());
}
-#if defined(OS_WIN)
-// RootWindow and Display can't resize on Windows Ash. http://crbug.com/165962
-#define MAYBE_SetAlignment DISABLED_SetAlignment
-#else
-#define MAYBE_SetAlignment SetAlignment
-#endif
-
// Tests SHELF_ALIGNMENT_(LEFT, RIGHT).
-TEST_F(ShelfLayoutManagerTest, MAYBE_SetAlignment) {
+TEST_F(ShelfLayoutManagerTest, SetAlignment) {
Shelf* shelf = GetShelf();
ShelfLayoutManager* layout_manager = GetShelfLayoutManager();
// Force an initial layout.
@@ -1602,9 +1464,7 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_SetAlignment) {
shelf->SetAlignment(SHELF_ALIGNMENT_LEFT);
gfx::Rect shelf_bounds(GetShelfWidget()->GetWindowBoundsInScreen());
- const display::Screen* screen = display::Screen::GetScreen();
- display::Display display =
- screen->GetDisplayNearestWindow(Shell::GetPrimaryRootWindow());
+ display::Display display = display::Screen::GetScreen()->GetPrimaryDisplay();
ASSERT_NE(-1, display.id());
EXPECT_EQ(layout_manager->GetIdealBounds().width(),
display.GetWorkAreaInsets().left());
@@ -1624,7 +1484,6 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_SetAlignment) {
EXPECT_EQ(display.bounds().y(), shelf_bounds.y());
EXPECT_EQ(display.bounds().height(), shelf_bounds.height());
shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
- display = screen->GetDisplayNearestWindow(Shell::GetPrimaryRootWindow());
EXPECT_EQ(GetShelfConstant(SHELF_INSETS_FOR_AUTO_HIDE),
display.GetWorkAreaInsets().left());
EXPECT_EQ(GetShelfConstant(SHELF_INSETS_FOR_AUTO_HIDE),
@@ -1632,9 +1491,7 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_SetAlignment) {
shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
shelf->SetAlignment(SHELF_ALIGNMENT_RIGHT);
- display = screen->GetDisplayNearestWindow(Shell::GetPrimaryRootWindow());
shelf_bounds = GetShelfWidget()->GetWindowBoundsInScreen();
- display = screen->GetDisplayNearestWindow(Shell::GetPrimaryRootWindow());
ASSERT_NE(-1, display.id());
EXPECT_EQ(layout_manager->GetIdealBounds().width(),
display.GetWorkAreaInsets().right());
@@ -1653,7 +1510,6 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_SetAlignment) {
EXPECT_EQ(display.bounds().y(), shelf_bounds.y());
EXPECT_EQ(display.bounds().height(), shelf_bounds.height());
shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
- display = screen->GetDisplayNearestWindow(Shell::GetPrimaryRootWindow());
EXPECT_EQ(GetShelfConstant(SHELF_INSETS_FOR_AUTO_HIDE),
display.GetWorkAreaInsets().right());
EXPECT_EQ(GetShelfConstant(SHELF_INSETS_FOR_AUTO_HIDE),
@@ -1664,15 +1520,10 @@ TEST_F(ShelfLayoutManagerTest, GestureEdgeSwipe) {
Shelf* shelf = GetShelf();
ShelfLayoutManager* layout_manager = GetShelfLayoutManager();
shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
- views::Widget* widget = new views::Widget;
- views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW);
- params.bounds = gfx::Rect(0, 0, 200, 200);
- params.context = CurrentContext();
- widget->Init(params);
- widget->Show();
+ views::Widget* widget = CreateTestWidget();
widget->Maximize();
- ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow());
+ ui::test::EventGenerator& generator(GetEventGenerator());
aura::Window* window = widget->GetNativeWindow();
layout_manager->LayoutShelf();
@@ -1771,14 +1622,7 @@ TEST_F(ShelfLayoutManagerTest, GestureEdgeSwipeMultiMonitor) {
EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf_2->GetAutoHideState());
}
-#if defined(OS_WIN)
-// RootWindow and Display can't resize on Windows Ash. http://crbug.com/165962
-#define MAYBE_GestureDrag DISABLED_GestureDrag
-#else
-#define MAYBE_GestureDrag GestureDrag
-#endif
-
-TEST_F(ShelfLayoutManagerTest, MAYBE_GestureDrag) {
+TEST_F(ShelfLayoutManagerTest, GestureDrag) {
// Slop is an implementation detail of gesture recognition, and complicates
// these tests. Ignore it.
ui::GestureConfiguration::GetInstance()
@@ -1860,9 +1704,6 @@ TEST_F(ShelfLayoutManagerTest, WindowVisibilityDisablesAutoHide) {
// Test that the shelf animates back to its normal position upon a user
// completing a gesture drag.
TEST_F(ShelfLayoutManagerTest, ShelfAnimatesWhenGestureComplete) {
- if (!SupportsHostWindowResize())
- return;
-
// Test the shelf animates back to its original visible bounds when it is
// dragged when there are no visible windows.
Shelf* shelf = GetShelf();
@@ -1875,7 +1716,7 @@ TEST_F(ShelfLayoutManagerTest, ShelfAnimatesWhenGestureComplete) {
ui::ScopedAnimationDurationScaleMode regular_animations(
ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION);
- ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow());
+ ui::test::EventGenerator& generator(GetEventGenerator());
gfx::Rect shelf_bounds_in_screen =
GetShelfWidget()->GetWindowBoundsInScreen();
gfx::Point start(shelf_bounds_in_screen.CenterPoint());
@@ -1907,7 +1748,7 @@ TEST_F(ShelfLayoutManagerTest, ShelfAnimatesWhenGestureComplete) {
gfx::Point start =
GetShelfWidget()->GetWindowBoundsInScreen().CenterPoint();
gfx::Point end(start.x(), start.y() - 100);
- ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow());
+ ui::test::EventGenerator& generator(GetEventGenerator());
// Test that the shelf animates to the visible bounds after a swipe up on
// the auto hidden shelf.
@@ -1957,13 +1798,10 @@ TEST_F(ShelfLayoutManagerTest, WorkAreaChangeWorkspace) {
shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
layout_manager->LayoutShelf();
- views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW);
- params.bounds = gfx::Rect(0, 0, 200, 200);
- params.context = CurrentContext();
- views::Widget* widget_one = CreateTestWidgetWithParams(params);
+ views::Widget* widget_one = CreateTestWidget();
widget_one->Maximize();
- views::Widget* widget_two = CreateTestWidgetWithParams(params);
+ views::Widget* widget_two = CreateTestWidget();
widget_two->Maximize();
widget_two->Activate();
@@ -2037,7 +1875,7 @@ TEST_F(ShelfLayoutManagerTest, BubbleEnlargesShelfMouseHitArea) {
CreateTestWidget();
layout_manager->LayoutShelf();
- ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow());
+ ui::test::EventGenerator& generator(GetEventGenerator());
// Make two iterations - first without a message bubble which should make
// the shelf disappear and then with a message bubble which should keep it
@@ -2121,21 +1959,15 @@ TEST_F(ShelfLayoutManagerTest, ShelfBackgroundColorAutoHide) {
EXPECT_EQ(SHELF_BACKGROUND_OVERLAP, GetShelfWidget()->GetBackgroundType());
}
-#if defined(OS_CHROMEOS)
-#define MAYBE_StatusAreaHitBoxCoversEdge StatusAreaHitBoxCoversEdge
-#else
-#define MAYBE_StatusAreaHitBoxCoversEdge DISABLED_StatusAreaHitBoxCoversEdge
-#endif
-
// Verify the hit bounds of the status area extend to the edge of the shelf.
-TEST_F(ShelfLayoutManagerTest, MAYBE_StatusAreaHitBoxCoversEdge) {
- UpdateDisplay("400x400");
+TEST_F(ShelfLayoutManagerTest, StatusAreaHitBoxCoversEdge) {
Shelf* shelf = GetShelf();
- StatusAreaWidget* status_area_widget = Shell::GetPrimaryRootWindowController()
- ->shelf_widget()
- ->status_area_widget();
- ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow());
- generator.MoveMouseTo(399, 399);
+ StatusAreaWidget* status_area_widget =
+ StatusAreaWidgetTestHelper::GetStatusAreaWidget();
+
+ ui::test::EventGenerator& generator(GetEventGenerator());
+ display::Display display = display::Screen::GetScreen()->GetPrimaryDisplay();
+ generator.MoveMouseTo(display.bounds().bottom_right());
// Test bottom right pixel for bottom alignment.
EXPECT_FALSE(status_area_widget->IsMessageBubbleShown());
@@ -2153,7 +1985,7 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_StatusAreaHitBoxCoversEdge) {
EXPECT_FALSE(status_area_widget->IsMessageBubbleShown());
// Test bottom left pixel for left alignment.
- generator.MoveMouseTo(0, 399);
+ generator.MoveMouseTo(display.bounds().bottom_left());
shelf->SetAlignment(SHELF_ALIGNMENT_LEFT);
EXPECT_FALSE(status_area_widget->IsMessageBubbleShown());
generator.ClickLeftButton();
« no previous file with comments | « ash/shelf/shelf_layout_manager.cc ('k') | ash/shelf/shelf_widget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698