| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/wm/shelf_layout_manager.h" | 5 #include "ash/wm/shelf_layout_manager.h" |
| 6 | 6 |
| 7 #include "ash/focus_cycler.h" | 7 #include "ash/focus_cycler.h" |
| 8 #include "ash/launcher/launcher.h" | 8 #include "ash/launcher/launcher.h" |
| 9 #include "ash/screen_ash.h" | 9 #include "ash/screen_ash.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| 11 #include "ash/shell_delegate.h" | 11 #include "ash/shell_delegate.h" |
| 12 #include "ash/shell_window_ids.h" | 12 #include "ash/shell_window_ids.h" |
| 13 #include "ash/test/ash_test_base.h" | 13 #include "ash/test/ash_test_base.h" |
| 14 #include "ui/aura/client/aura_constants.h" | 14 #include "ui/aura/client/aura_constants.h" |
| 15 #include "ui/aura/env.h" | 15 #include "ui/aura/env.h" |
| 16 #include "ui/aura/monitor.h" | |
| 17 #include "ui/aura/monitor_manager.h" | 16 #include "ui/aura/monitor_manager.h" |
| 18 #include "ui/aura/root_window.h" | 17 #include "ui/aura/root_window.h" |
| 19 #include "ui/aura/test/event_generator.h" | 18 #include "ui/aura/test/event_generator.h" |
| 20 #include "ui/aura/window.h" | 19 #include "ui/aura/window.h" |
| 21 #include "ui/base/animation/animation_container_element.h" | 20 #include "ui/base/animation/animation_container_element.h" |
| 22 #include "ui/gfx/compositor/layer_animator.h" | 21 #include "ui/gfx/compositor/layer_animator.h" |
| 23 #include "ui/gfx/compositor/layer.h" | 22 #include "ui/gfx/compositor/layer.h" |
| 23 #include "ui/gfx/monitor.h" |
| 24 #include "ui/gfx/screen.h" | 24 #include "ui/gfx/screen.h" |
| 25 #include "ui/views/widget/widget.h" | 25 #include "ui/views/widget/widget.h" |
| 26 | 26 |
| 27 namespace ash { | 27 namespace ash { |
| 28 namespace internal { | 28 namespace internal { |
| 29 | 29 |
| 30 namespace { | 30 namespace { |
| 31 | 31 |
| 32 void StepWidgetLayerAnimatorToEnd(views::Widget* widget) { | 32 void StepWidgetLayerAnimatorToEnd(views::Widget* widget) { |
| 33 ui::AnimationContainerElement* element = | 33 ui::AnimationContainerElement* element = |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 #define MAYBE_SetVisible SetVisible | 79 #define MAYBE_SetVisible SetVisible |
| 80 #endif | 80 #endif |
| 81 // Makes sure SetVisible updates work area and widget appropriately. | 81 // Makes sure SetVisible updates work area and widget appropriately. |
| 82 TEST_F(ShelfLayoutManagerTest, MAYBE_SetVisible) { | 82 TEST_F(ShelfLayoutManagerTest, MAYBE_SetVisible) { |
| 83 ShelfLayoutManager* shelf = GetShelfLayoutManager(); | 83 ShelfLayoutManager* shelf = GetShelfLayoutManager(); |
| 84 // Force an initial layout. | 84 // Force an initial layout. |
| 85 shelf->LayoutShelf(); | 85 shelf->LayoutShelf(); |
| 86 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); | 86 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); |
| 87 const aura::MonitorManager* manager = | 87 const aura::MonitorManager* manager = |
| 88 aura::Env::GetInstance()->monitor_manager(); | 88 aura::Env::GetInstance()->monitor_manager(); |
| 89 const aura::Monitor* monitor = | 89 const gfx::Monitor& monitor = |
| 90 manager->GetMonitorNearestWindow(Shell::GetRootWindow()); | 90 manager->GetMonitorNearestWindow(Shell::GetRootWindow()); |
| 91 ASSERT_TRUE(monitor); | 91 ASSERT_NE(-1, monitor.id()); |
| 92 // Bottom inset should be the max of widget heights. | 92 // Bottom inset should be the max of widget heights. |
| 93 EXPECT_EQ(shelf->shelf_height(), | 93 EXPECT_EQ(shelf->shelf_height(), |
| 94 monitor->work_area_insets().bottom()); | 94 monitor.bounds().bottom() - monitor.work_area().bottom()); |
| 95 | 95 |
| 96 // Hide the shelf. | 96 // Hide the shelf. |
| 97 SetState(shelf, ShelfLayoutManager::HIDDEN); | 97 SetState(shelf, ShelfLayoutManager::HIDDEN); |
| 98 // Run the animation to completion. | 98 // Run the animation to completion. |
| 99 StepWidgetLayerAnimatorToEnd(shelf->launcher_widget()); | 99 StepWidgetLayerAnimatorToEnd(shelf->launcher_widget()); |
| 100 StepWidgetLayerAnimatorToEnd(shelf->status()); | 100 StepWidgetLayerAnimatorToEnd(shelf->status()); |
| 101 EXPECT_EQ(ShelfLayoutManager::HIDDEN, shelf->visibility_state()); | 101 EXPECT_EQ(ShelfLayoutManager::HIDDEN, shelf->visibility_state()); |
| 102 EXPECT_EQ(0, monitor->work_area_insets().bottom()); | 102 EXPECT_EQ(0, |
| 103 monitor.bounds().bottom() - monitor.work_area().bottom()); |
| 103 | 104 |
| 104 // Make sure the bounds of the two widgets changed. | 105 // Make sure the bounds of the two widgets changed. |
| 105 EXPECT_GE(shelf->launcher_widget()->GetNativeView()->bounds().y(), | 106 EXPECT_GE(shelf->launcher_widget()->GetNativeView()->bounds().y(), |
| 106 gfx::Screen::GetPrimaryMonitorBounds().bottom()); | 107 gfx::Screen::GetPrimaryMonitor().bounds().bottom()); |
| 107 EXPECT_GE(shelf->status()->GetNativeView()->bounds().y(), | 108 EXPECT_GE(shelf->status()->GetNativeView()->bounds().y(), |
| 108 gfx::Screen::GetPrimaryMonitorBounds().bottom()); | 109 gfx::Screen::GetPrimaryMonitor().bounds().bottom()); |
| 109 | 110 |
| 110 // And show it again. | 111 // And show it again. |
| 111 SetState(shelf, ShelfLayoutManager::VISIBLE); | 112 SetState(shelf, ShelfLayoutManager::VISIBLE); |
| 112 // Run the animation to completion. | 113 // Run the animation to completion. |
| 113 StepWidgetLayerAnimatorToEnd(shelf->launcher_widget()); | 114 StepWidgetLayerAnimatorToEnd(shelf->launcher_widget()); |
| 114 StepWidgetLayerAnimatorToEnd(shelf->status()); | 115 StepWidgetLayerAnimatorToEnd(shelf->status()); |
| 115 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); | 116 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); |
| 116 EXPECT_EQ(shelf->shelf_height(), | 117 EXPECT_EQ(shelf->shelf_height(), |
| 117 monitor->work_area_insets().bottom()); | 118 monitor.bounds().bottom() - monitor.work_area().bottom()); |
| 118 | 119 |
| 119 // Make sure the bounds of the two widgets changed. | 120 // Make sure the bounds of the two widgets changed. |
| 120 gfx::Rect launcher_bounds( | 121 gfx::Rect launcher_bounds( |
| 121 shelf->launcher_widget()->GetNativeView()->bounds()); | 122 shelf->launcher_widget()->GetNativeView()->bounds()); |
| 122 int bottom = gfx::Screen::GetPrimaryMonitorBounds().bottom() - | 123 int bottom = gfx::Screen::GetPrimaryMonitor().bounds().bottom() - |
| 123 shelf->shelf_height(); | 124 shelf->shelf_height(); |
| 124 EXPECT_EQ(launcher_bounds.y(), | 125 EXPECT_EQ(launcher_bounds.y(), |
| 125 bottom + (shelf->shelf_height() - launcher_bounds.height()) / 2); | 126 bottom + (shelf->shelf_height() - launcher_bounds.height()) / 2); |
| 126 gfx::Rect status_bounds(shelf->status()->GetNativeView()->bounds()); | 127 gfx::Rect status_bounds(shelf->status()->GetNativeView()->bounds()); |
| 127 EXPECT_EQ(status_bounds.y(), | 128 EXPECT_EQ(status_bounds.y(), |
| 128 bottom + shelf->shelf_height() - status_bounds.height()); | 129 bottom + shelf->shelf_height() - status_bounds.height()); |
| 129 } | 130 } |
| 130 | 131 |
| 131 // Makes sure LayoutShelf invoked while animating cleans things up. | 132 // Makes sure LayoutShelf invoked while animating cleans things up. |
| 132 TEST_F(ShelfLayoutManagerTest, LayoutShelfWhileAnimating) { | 133 TEST_F(ShelfLayoutManagerTest, LayoutShelfWhileAnimating) { |
| 133 ShelfLayoutManager* shelf = GetShelfLayoutManager(); | 134 ShelfLayoutManager* shelf = GetShelfLayoutManager(); |
| 134 // Force an initial layout. | 135 // Force an initial layout. |
| 135 shelf->LayoutShelf(); | 136 shelf->LayoutShelf(); |
| 136 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); | 137 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); |
| 137 | 138 |
| 138 const aura::MonitorManager* manager = | 139 const aura::MonitorManager* manager = |
| 139 aura::Env::GetInstance()->monitor_manager(); | 140 aura::Env::GetInstance()->monitor_manager(); |
| 140 const aura::Monitor* monitor = | 141 const gfx::Monitor& monitor = |
| 141 manager->GetMonitorNearestWindow(Shell::GetRootWindow()); | 142 manager->GetMonitorNearestWindow(Shell::GetRootWindow()); |
| 142 | 143 |
| 143 // Hide the shelf. | 144 // Hide the shelf. |
| 144 SetState(shelf, ShelfLayoutManager::HIDDEN); | 145 SetState(shelf, ShelfLayoutManager::HIDDEN); |
| 145 shelf->LayoutShelf(); | 146 shelf->LayoutShelf(); |
| 146 EXPECT_EQ(ShelfLayoutManager::HIDDEN, shelf->visibility_state()); | 147 EXPECT_EQ(ShelfLayoutManager::HIDDEN, shelf->visibility_state()); |
| 147 EXPECT_EQ(0, monitor->work_area_insets().bottom()); | 148 EXPECT_EQ(0, monitor.bounds().bottom() - monitor.work_area().bottom()); |
| 149 |
| 148 // Make sure the bounds of the two widgets changed. | 150 // Make sure the bounds of the two widgets changed. |
| 149 EXPECT_GE(shelf->launcher_widget()->GetNativeView()->bounds().y(), | 151 EXPECT_GE(shelf->launcher_widget()->GetNativeView()->bounds().y(), |
| 150 gfx::Screen::GetPrimaryMonitorBounds().bottom()); | 152 gfx::Screen::GetPrimaryMonitor().bounds().bottom()); |
| 151 EXPECT_GE(shelf->status()->GetNativeView()->bounds().y(), | 153 EXPECT_GE(shelf->status()->GetNativeView()->bounds().y(), |
| 152 gfx::Screen::GetPrimaryMonitorBounds().bottom()); | 154 gfx::Screen::GetPrimaryMonitor().bounds().bottom()); |
| 153 } | 155 } |
| 154 | 156 |
| 155 // Makes sure the launcher is initially sized correctly. | 157 // Makes sure the launcher is initially sized correctly. |
| 156 TEST_F(ShelfLayoutManagerTest, LauncherInitiallySized) { | 158 TEST_F(ShelfLayoutManagerTest, LauncherInitiallySized) { |
| 157 Launcher* launcher = Shell::GetInstance()->launcher(); | 159 Launcher* launcher = Shell::GetInstance()->launcher(); |
| 158 ASSERT_TRUE(launcher); | 160 ASSERT_TRUE(launcher); |
| 159 ShelfLayoutManager* shelf_layout_manager = GetShelfLayoutManager(); | 161 ShelfLayoutManager* shelf_layout_manager = GetShelfLayoutManager(); |
| 160 ASSERT_TRUE(shelf_layout_manager); | 162 ASSERT_TRUE(shelf_layout_manager); |
| 161 ASSERT_TRUE(shelf_layout_manager->status()); | 163 ASSERT_TRUE(shelf_layout_manager->status()); |
| 162 int status_width = | 164 int status_width = |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 widget->Show(); | 206 widget->Show(); |
| 205 EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE, shelf->visibility_state()); | 207 EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE, shelf->visibility_state()); |
| 206 EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE_HIDDEN, shelf->auto_hide_state()); | 208 EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE_HIDDEN, shelf->auto_hide_state()); |
| 207 | 209 |
| 208 // LayoutShelf() forces the animation to completion, at which point the | 210 // LayoutShelf() forces the animation to completion, at which point the |
| 209 // launcher should go off the screen. | 211 // launcher should go off the screen. |
| 210 shelf->LayoutShelf(); | 212 shelf->LayoutShelf(); |
| 211 EXPECT_EQ(root->bounds().bottom() - ShelfLayoutManager::kAutoHideHeight, | 213 EXPECT_EQ(root->bounds().bottom() - ShelfLayoutManager::kAutoHideHeight, |
| 212 shelf->launcher_widget()->GetWindowScreenBounds().y()); | 214 shelf->launcher_widget()->GetWindowScreenBounds().y()); |
| 213 EXPECT_EQ(root->bounds().bottom() - ShelfLayoutManager::kAutoHideHeight, | 215 EXPECT_EQ(root->bounds().bottom() - ShelfLayoutManager::kAutoHideHeight, |
| 214 gfx::Screen::GetMonitorWorkAreaNearestWindow(root).bottom()); | 216 gfx::Screen::GetMonitorNearestWindow(root).work_area().bottom()); |
| 215 | 217 |
| 216 // Move the mouse to the bottom of the screen. | 218 // Move the mouse to the bottom of the screen. |
| 217 generator.MoveMouseTo(0, root->bounds().bottom() - 1); | 219 generator.MoveMouseTo(0, root->bounds().bottom() - 1); |
| 218 | 220 |
| 219 // Shelf should be shown again (but it shouldn't have changed the work area). | 221 // Shelf should be shown again (but it shouldn't have changed the work area). |
| 220 SetState(shelf, ShelfLayoutManager::AUTO_HIDE); | 222 SetState(shelf, ShelfLayoutManager::AUTO_HIDE); |
| 221 EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE_SHOWN, shelf->auto_hide_state()); | 223 EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE_SHOWN, shelf->auto_hide_state()); |
| 222 shelf->LayoutShelf(); | 224 shelf->LayoutShelf(); |
| 223 EXPECT_EQ(root->bounds().bottom() - shelf->shelf_height(), | 225 EXPECT_EQ(root->bounds().bottom() - shelf->shelf_height(), |
| 224 shelf->launcher_widget()->GetWindowScreenBounds().y()); | 226 shelf->launcher_widget()->GetWindowScreenBounds().y()); |
| 225 EXPECT_EQ(root->bounds().bottom() - ShelfLayoutManager::kAutoHideHeight, | 227 EXPECT_EQ(root->bounds().bottom() - ShelfLayoutManager::kAutoHideHeight, |
| 226 gfx::Screen::GetMonitorWorkAreaNearestWindow(root).bottom()); | 228 gfx::Screen::GetMonitorNearestWindow(root).work_area().bottom()); |
| 227 | 229 |
| 228 // Move mouse back up. | 230 // Move mouse back up. |
| 229 generator.MoveMouseTo(0, 0); | 231 generator.MoveMouseTo(0, 0); |
| 230 SetState(shelf, ShelfLayoutManager::AUTO_HIDE); | 232 SetState(shelf, ShelfLayoutManager::AUTO_HIDE); |
| 231 EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE_HIDDEN, shelf->auto_hide_state()); | 233 EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE_HIDDEN, shelf->auto_hide_state()); |
| 232 shelf->LayoutShelf(); | 234 shelf->LayoutShelf(); |
| 233 EXPECT_EQ(root->bounds().bottom() - ShelfLayoutManager::kAutoHideHeight, | 235 EXPECT_EQ(root->bounds().bottom() - ShelfLayoutManager::kAutoHideHeight, |
| 234 shelf->launcher_widget()->GetWindowScreenBounds().y()); | 236 shelf->launcher_widget()->GetWindowScreenBounds().y()); |
| 235 | 237 |
| 236 // Drag mouse to bottom of screen. | 238 // Drag mouse to bottom of screen. |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 generator.MoveMouseTo(0, 0); | 310 generator.MoveMouseTo(0, 0); |
| 309 | 311 |
| 310 ShelfLayoutManager* shelf = GetShelfLayoutManager(); | 312 ShelfLayoutManager* shelf = GetShelfLayoutManager(); |
| 311 views::Widget* widget = new views::Widget; | 313 views::Widget* widget = new views::Widget; |
| 312 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); | 314 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); |
| 313 params.bounds = gfx::Rect(0, 0, 200, 200); | 315 params.bounds = gfx::Rect(0, 0, 200, 200); |
| 314 // Widget is now owned by the parent window. | 316 // Widget is now owned by the parent window. |
| 315 widget->Init(params); | 317 widget->Init(params); |
| 316 widget->Show(); | 318 widget->Show(); |
| 317 aura::Window* window = widget->GetNativeWindow(); | 319 aura::Window* window = widget->GetNativeWindow(); |
| 318 gfx::Rect monitor_bounds(gfx::Screen::GetMonitorAreaNearestWindow(window)); | 320 gfx::Rect monitor_bounds( |
| 321 gfx::Screen::GetMonitorNearestWindow(window).bounds()); |
| 319 EXPECT_EQ(monitor_bounds.bottom() - ShelfLayoutManager::kAutoHideHeight, | 322 EXPECT_EQ(monitor_bounds.bottom() - ShelfLayoutManager::kAutoHideHeight, |
| 320 shelf->GetMaximizedWindowBounds(window).bottom()); | 323 shelf->GetMaximizedWindowBounds(window).bottom()); |
| 321 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); | 324 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); |
| 322 | 325 |
| 323 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); | 326 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); |
| 324 EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE, shelf->visibility_state()); | 327 EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE, shelf->visibility_state()); |
| 325 EXPECT_EQ(monitor_bounds.bottom() - ShelfLayoutManager::kAutoHideHeight, | 328 EXPECT_EQ(monitor_bounds.bottom() - ShelfLayoutManager::kAutoHideHeight, |
| 326 shelf->GetMaximizedWindowBounds(window).bottom()); | 329 shelf->GetMaximizedWindowBounds(window).bottom()); |
| 327 | 330 |
| 328 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_DEFAULT); | 331 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_DEFAULT); |
| 329 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); | 332 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); |
| 330 EXPECT_EQ(monitor_bounds.bottom() - ShelfLayoutManager::kAutoHideHeight, | 333 EXPECT_EQ(monitor_bounds.bottom() - ShelfLayoutManager::kAutoHideHeight, |
| 331 shelf->GetMaximizedWindowBounds(window).bottom()); | 334 shelf->GetMaximizedWindowBounds(window).bottom()); |
| 332 | 335 |
| 333 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); | 336 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); |
| 334 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); | 337 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); |
| 335 EXPECT_GT(monitor_bounds.bottom() - ShelfLayoutManager::kAutoHideHeight, | 338 EXPECT_GT(monitor_bounds.bottom() - ShelfLayoutManager::kAutoHideHeight, |
| 336 shelf->GetMaximizedWindowBounds(window).bottom()); | 339 shelf->GetMaximizedWindowBounds(window).bottom()); |
| 337 | 340 |
| 338 widget->Maximize(); | 341 widget->Maximize(); |
| 339 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); | 342 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); |
| 340 EXPECT_EQ(gfx::Screen::GetMonitorWorkAreaNearestWindow(window).bottom(), | 343 EXPECT_EQ(gfx::Screen::GetMonitorNearestWindow(window).work_area().bottom(), |
| 341 widget->GetWorkAreaBoundsInScreen().bottom()); | 344 widget->GetWorkAreaBoundsInScreen().bottom()); |
| 342 | 345 |
| 343 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); | 346 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); |
| 344 EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE, shelf->visibility_state()); | 347 EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE, shelf->visibility_state()); |
| 345 EXPECT_EQ(gfx::Screen::GetMonitorWorkAreaNearestWindow(window).bottom(), | 348 EXPECT_EQ(gfx::Screen::GetMonitorNearestWindow(window).work_area().bottom(), |
| 346 widget->GetWorkAreaBoundsInScreen().bottom()); | 349 widget->GetWorkAreaBoundsInScreen().bottom()); |
| 347 | 350 |
| 348 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); | 351 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); |
| 349 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); | 352 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); |
| 350 EXPECT_EQ(gfx::Screen::GetMonitorWorkAreaNearestWindow(window).bottom(), | 353 EXPECT_EQ(gfx::Screen::GetMonitorNearestWindow(window).work_area().bottom(), |
| 351 widget->GetWorkAreaBoundsInScreen().bottom()); | 354 widget->GetWorkAreaBoundsInScreen().bottom()); |
| 352 } | 355 } |
| 353 | 356 |
| 354 // Verifies the shelf is visible when status/launcher is focused. | 357 // Verifies the shelf is visible when status/launcher is focused. |
| 355 TEST_F(ShelfLayoutManagerTest, VisibleWhenStatusOrLauncherFocused) { | 358 TEST_F(ShelfLayoutManagerTest, VisibleWhenStatusOrLauncherFocused) { |
| 356 // Since ShelfLayoutManager queries for mouse location, move the mouse so | 359 // Since ShelfLayoutManager queries for mouse location, move the mouse so |
| 357 // it isn't over the shelf. | 360 // it isn't over the shelf. |
| 358 aura::test::EventGenerator generator( | 361 aura::test::EventGenerator generator( |
| 359 Shell::GetInstance()->GetRootWindow(), gfx::Point()); | 362 Shell::GetInstance()->GetRootWindow(), gfx::Point()); |
| 360 generator.MoveMouseTo(0, 0); | 363 generator.MoveMouseTo(0, 0); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 EXPECT_EQ(ShelfLayoutManager::HIDDEN, shelf->visibility_state()); | 474 EXPECT_EQ(ShelfLayoutManager::HIDDEN, shelf->visibility_state()); |
| 472 | 475 |
| 473 // Toggle app list to hide. | 476 // Toggle app list to hide. |
| 474 shell->ToggleAppList(); | 477 shell->ToggleAppList(); |
| 475 EXPECT_FALSE(shell->GetAppListTargetVisibility()); | 478 EXPECT_FALSE(shell->GetAppListTargetVisibility()); |
| 476 EXPECT_EQ(ShelfLayoutManager::HIDDEN, shelf->visibility_state()); | 479 EXPECT_EQ(ShelfLayoutManager::HIDDEN, shelf->visibility_state()); |
| 477 } | 480 } |
| 478 | 481 |
| 479 } // namespace internal | 482 } // namespace internal |
| 480 } // namespace ash | 483 } // namespace ash |
| OLD | NEW |