| 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/accelerators/accelerator_controller.h" | 7 #include "ash/accelerators/accelerator_controller.h" |
| 8 #include "ash/accelerators/accelerator_table.h" | 8 #include "ash/accelerators/accelerator_table.h" |
| 9 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
| 10 #include "ash/focus_cycler.h" | 10 #include "ash/focus_cycler.h" |
| 11 #include "ash/launcher/launcher.h" | 11 #include "ash/launcher/launcher.h" |
| 12 #include "ash/root_window_controller.h" |
| 12 #include "ash/screen_ash.h" | 13 #include "ash/screen_ash.h" |
| 13 #include "ash/shell.h" | 14 #include "ash/shell.h" |
| 14 #include "ash/shell_delegate.h" | 15 #include "ash/shell_delegate.h" |
| 15 #include "ash/shell_window_ids.h" | 16 #include "ash/shell_window_ids.h" |
| 16 #include "ash/system/status_area_widget.h" | 17 #include "ash/system/status_area_widget.h" |
| 17 #include "ash/system/tray/system_tray.h" | 18 #include "ash/system/tray/system_tray.h" |
| 18 #include "ash/system/tray/system_tray_item.h" | 19 #include "ash/system/tray/system_tray_item.h" |
| 19 #include "ash/test/ash_test_base.h" | 20 #include "ash/test/ash_test_base.h" |
| 20 #include "ash/wm/window_util.h" | 21 #include "ash/wm/window_util.h" |
| 21 #include "base/command_line.h" | 22 #include "base/command_line.h" |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 | 146 |
| 146 DISALLOW_COPY_AND_ASSIGN(TestItem); | 147 DISALLOW_COPY_AND_ASSIGN(TestItem); |
| 147 }; | 148 }; |
| 148 | 149 |
| 149 } // namespace | 150 } // namespace |
| 150 | 151 |
| 151 class ShelfLayoutManagerTest : public ash::test::AshTestBase { | 152 class ShelfLayoutManagerTest : public ash::test::AshTestBase { |
| 152 public: | 153 public: |
| 153 ShelfLayoutManagerTest() {} | 154 ShelfLayoutManagerTest() {} |
| 154 | 155 |
| 156 ShelfLayoutManager* shelf_layout_manager() { |
| 157 return Shell::GetPrimaryRootWindowController()->shelf(); |
| 158 } |
| 159 |
| 155 void SetState(ShelfLayoutManager* shelf, | 160 void SetState(ShelfLayoutManager* shelf, |
| 156 ShelfLayoutManager::VisibilityState state) { | 161 ShelfLayoutManager::VisibilityState state) { |
| 157 shelf->SetState(state); | 162 shelf->SetState(state); |
| 158 } | 163 } |
| 159 | 164 |
| 160 void UpdateAutoHideStateNow() { | 165 void UpdateAutoHideStateNow() { |
| 161 GetShelfLayoutManager()->UpdateAutoHideStateNow(); | 166 GetShelfLayoutManager()->UpdateAutoHideStateNow(); |
| 162 } | 167 } |
| 163 | 168 |
| 164 aura::Window* CreateTestWindow() { | 169 aura::Window* CreateTestWindow() { |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 | 268 |
| 264 // Make sure the bounds of the two widgets changed. | 269 // Make sure the bounds of the two widgets changed. |
| 265 EXPECT_GE(shelf->launcher_widget()->GetNativeView()->bounds().y(), | 270 EXPECT_GE(shelf->launcher_widget()->GetNativeView()->bounds().y(), |
| 266 Shell::GetScreen()->GetPrimaryDisplay().bounds().bottom()); | 271 Shell::GetScreen()->GetPrimaryDisplay().bounds().bottom()); |
| 267 EXPECT_GE(shelf->status()->GetNativeView()->bounds().y(), | 272 EXPECT_GE(shelf->status()->GetNativeView()->bounds().y(), |
| 268 Shell::GetScreen()->GetPrimaryDisplay().bounds().bottom()); | 273 Shell::GetScreen()->GetPrimaryDisplay().bounds().bottom()); |
| 269 } | 274 } |
| 270 | 275 |
| 271 // Makes sure the launcher is initially sized correctly. | 276 // Makes sure the launcher is initially sized correctly. |
| 272 TEST_F(ShelfLayoutManagerTest, LauncherInitiallySized) { | 277 TEST_F(ShelfLayoutManagerTest, LauncherInitiallySized) { |
| 273 Launcher* launcher = Shell::GetInstance()->launcher(); | 278 Launcher* launcher = Launcher::ForPrimaryDisplay(); |
| 274 ASSERT_TRUE(launcher); | 279 ASSERT_TRUE(launcher); |
| 275 ShelfLayoutManager* shelf_layout_manager = GetShelfLayoutManager(); | 280 ShelfLayoutManager* shelf_layout_manager = GetShelfLayoutManager(); |
| 276 ASSERT_TRUE(shelf_layout_manager); | 281 ASSERT_TRUE(shelf_layout_manager); |
| 277 ASSERT_TRUE(shelf_layout_manager->status()); | 282 ASSERT_TRUE(shelf_layout_manager->status()); |
| 278 int status_width = | 283 int status_width = |
| 279 shelf_layout_manager->status()->GetWindowBoundsInScreen().width(); | 284 shelf_layout_manager->status()->GetWindowBoundsInScreen().width(); |
| 280 // Test only makes sense if the status is > 0, which is better be. | 285 // Test only makes sense if the status is > 0, which is better be. |
| 281 EXPECT_GT(status_width, 0); | 286 EXPECT_GT(status_width, 0); |
| 282 EXPECT_EQ(status_width, launcher->status_size().width()); | 287 EXPECT_EQ(status_width, launcher->status_size().width()); |
| 283 } | 288 } |
| 284 | 289 |
| 285 // Makes sure the launcher is sized when the status area changes size. | 290 // Makes sure the launcher is sized when the status area changes size. |
| 286 TEST_F(ShelfLayoutManagerTest, LauncherUpdatedWhenStatusAreaChangesSize) { | 291 TEST_F(ShelfLayoutManagerTest, LauncherUpdatedWhenStatusAreaChangesSize) { |
| 287 Launcher* launcher = Shell::GetInstance()->launcher(); | 292 Launcher* launcher = Launcher::ForPrimaryDisplay(); |
| 288 ASSERT_TRUE(launcher); | 293 ASSERT_TRUE(launcher); |
| 289 ShelfLayoutManager* shelf_layout_manager = GetShelfLayoutManager(); | 294 ShelfLayoutManager* shelf_layout_manager = GetShelfLayoutManager(); |
| 290 ASSERT_TRUE(shelf_layout_manager); | 295 ASSERT_TRUE(shelf_layout_manager); |
| 291 ASSERT_TRUE(shelf_layout_manager->status()); | 296 ASSERT_TRUE(shelf_layout_manager->status()); |
| 292 shelf_layout_manager->status()->SetBounds(gfx::Rect(0, 0, 200, 200)); | 297 shelf_layout_manager->status()->SetBounds(gfx::Rect(0, 0, 200, 200)); |
| 293 EXPECT_EQ(200, launcher->status_size().width()); | 298 EXPECT_EQ(200, launcher->status_size().width()); |
| 294 } | 299 } |
| 295 | 300 |
| 296 // Verifies when the shell is deleted with a full screen window we don't | 301 // Verifies when the shell is deleted with a full screen window we don't |
| 297 // crash. This test is here as originally the crash was in ShelfLayoutManager. | 302 // crash. This test is here as originally the crash was in ShelfLayoutManager. |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE_HIDDEN, shelf->auto_hide_state()); | 506 EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE_HIDDEN, shelf->auto_hide_state()); |
| 502 | 507 |
| 503 shelf->launcher()->GetFocusCycler()->RotateFocus(FocusCycler::FORWARD); | 508 shelf->launcher()->GetFocusCycler()->RotateFocus(FocusCycler::FORWARD); |
| 504 EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE_SHOWN, shelf->auto_hide_state()); | 509 EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE_SHOWN, shelf->auto_hide_state()); |
| 505 } | 510 } |
| 506 | 511 |
| 507 // Makes sure shelf will be visible when app list opens as shelf is in VISIBLE | 512 // Makes sure shelf will be visible when app list opens as shelf is in VISIBLE |
| 508 // state,and toggling app list won't change shelf visibility state. | 513 // state,and toggling app list won't change shelf visibility state. |
| 509 TEST_F(ShelfLayoutManagerTest, OpenAppListWithShelfVisibleState) { | 514 TEST_F(ShelfLayoutManagerTest, OpenAppListWithShelfVisibleState) { |
| 510 Shell* shell = Shell::GetInstance(); | 515 Shell* shell = Shell::GetInstance(); |
| 511 ShelfLayoutManager* shelf = Shell::GetInstance()->shelf(); | 516 ShelfLayoutManager* shelf = shelf_layout_manager(); |
| 512 shelf->LayoutShelf(); | 517 shelf->LayoutShelf(); |
| 513 shell->SetShelfAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); | 518 shell->SetShelfAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); |
| 514 | 519 |
| 515 // Create a normal unmaximized windowm shelf should be visible. | 520 // Create a normal unmaximized windowm shelf should be visible. |
| 516 aura::Window* window = CreateTestWindow(); | 521 aura::Window* window = CreateTestWindow(); |
| 517 window->SetBounds(gfx::Rect(0, 0, 100, 100)); | 522 window->SetBounds(gfx::Rect(0, 0, 100, 100)); |
| 518 window->Show(); | 523 window->Show(); |
| 519 EXPECT_FALSE(shell->GetAppListTargetVisibility()); | 524 EXPECT_FALSE(shell->GetAppListTargetVisibility()); |
| 520 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); | 525 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); |
| 521 | 526 |
| 522 // Toggle app list to show, and the shelf stays visible. | 527 // Toggle app list to show, and the shelf stays visible. |
| 523 shell->ToggleAppList(); | 528 shell->ToggleAppList(); |
| 524 EXPECT_TRUE(shell->GetAppListTargetVisibility()); | 529 EXPECT_TRUE(shell->GetAppListTargetVisibility()); |
| 525 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); | 530 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); |
| 526 | 531 |
| 527 // Toggle app list to hide, and the shelf stays visible. | 532 // Toggle app list to hide, and the shelf stays visible. |
| 528 shell->ToggleAppList(); | 533 shell->ToggleAppList(); |
| 529 EXPECT_FALSE(shell->GetAppListTargetVisibility()); | 534 EXPECT_FALSE(shell->GetAppListTargetVisibility()); |
| 530 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); | 535 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); |
| 531 } | 536 } |
| 532 | 537 |
| 533 // Makes sure shelf will be shown with AUTO_HIDE_SHOWN state when app list opens | 538 // Makes sure shelf will be shown with AUTO_HIDE_SHOWN state when app list opens |
| 534 // as shelf is in AUTO_HIDE state, and toggling app list won't change shelf | 539 // as shelf is in AUTO_HIDE state, and toggling app list won't change shelf |
| 535 // visibility state. | 540 // visibility state. |
| 536 TEST_F(ShelfLayoutManagerTest, OpenAppListWithShelfAutoHideState) { | 541 TEST_F(ShelfLayoutManagerTest, OpenAppListWithShelfAutoHideState) { |
| 537 Shell* shell = Shell::GetInstance(); | 542 Shell* shell = Shell::GetInstance(); |
| 538 ShelfLayoutManager* shelf = Shell::GetInstance()->shelf(); | 543 ShelfLayoutManager* shelf = shelf_layout_manager(); |
| 539 shelf->LayoutShelf(); | 544 shelf->LayoutShelf(); |
| 540 shell->SetShelfAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); | 545 shell->SetShelfAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); |
| 541 | 546 |
| 542 // Create a window and show it in maximized state. | 547 // Create a window and show it in maximized state. |
| 543 aura::Window* window = CreateTestWindow(); | 548 aura::Window* window = CreateTestWindow(); |
| 544 window->SetBounds(gfx::Rect(0, 0, 100, 100)); | 549 window->SetBounds(gfx::Rect(0, 0, 100, 100)); |
| 545 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); | 550 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
| 546 window->Show(); | 551 window->Show(); |
| 547 wm::ActivateWindow(window); | 552 wm::ActivateWindow(window); |
| 548 | 553 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 562 // Toggle app list to hide. | 567 // Toggle app list to hide. |
| 563 shell->ToggleAppList(); | 568 shell->ToggleAppList(); |
| 564 EXPECT_FALSE(shell->GetAppListTargetVisibility()); | 569 EXPECT_FALSE(shell->GetAppListTargetVisibility()); |
| 565 EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE, shelf->visibility_state()); | 570 EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE, shelf->visibility_state()); |
| 566 } | 571 } |
| 567 | 572 |
| 568 // Makes sure shelf will be hidden when app list opens as shelf is in HIDDEN | 573 // Makes sure shelf will be hidden when app list opens as shelf is in HIDDEN |
| 569 // state, and toggling app list won't change shelf visibility state. | 574 // state, and toggling app list won't change shelf visibility state. |
| 570 TEST_F(ShelfLayoutManagerTest, OpenAppListWithShelfHiddenState) { | 575 TEST_F(ShelfLayoutManagerTest, OpenAppListWithShelfHiddenState) { |
| 571 Shell* shell = Shell::GetInstance(); | 576 Shell* shell = Shell::GetInstance(); |
| 572 ShelfLayoutManager* shelf = Shell::GetInstance()->shelf(); | 577 ShelfLayoutManager* shelf = shelf_layout_manager(); |
| 573 // For shelf to be visible, app list is not open in initial state. | 578 // For shelf to be visible, app list is not open in initial state. |
| 574 shelf->LayoutShelf(); | 579 shelf->LayoutShelf(); |
| 575 | 580 |
| 576 // Create a window and make it full screen. | 581 // Create a window and make it full screen. |
| 577 aura::Window* window = CreateTestWindow(); | 582 aura::Window* window = CreateTestWindow(); |
| 578 window->SetBounds(gfx::Rect(0, 0, 100, 100)); | 583 window->SetBounds(gfx::Rect(0, 0, 100, 100)); |
| 579 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); | 584 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); |
| 580 window->Show(); | 585 window->Show(); |
| 581 wm::ActivateWindow(window); | 586 wm::ActivateWindow(window); |
| 582 | 587 |
| 583 // App list and shelf is not shown. | 588 // App list and shelf is not shown. |
| 584 EXPECT_FALSE(shell->GetAppListTargetVisibility()); | 589 EXPECT_FALSE(shell->GetAppListTargetVisibility()); |
| 585 EXPECT_EQ(ShelfLayoutManager::HIDDEN, shelf->visibility_state()); | 590 EXPECT_EQ(ShelfLayoutManager::HIDDEN, shelf->visibility_state()); |
| 586 | 591 |
| 587 // Toggle app list to show. | 592 // Toggle app list to show. |
| 588 shell->ToggleAppList(); | 593 shell->ToggleAppList(); |
| 589 EXPECT_TRUE(shell->GetAppListTargetVisibility()); | 594 EXPECT_TRUE(shell->GetAppListTargetVisibility()); |
| 590 EXPECT_EQ(ShelfLayoutManager::HIDDEN, shelf->visibility_state()); | 595 EXPECT_EQ(ShelfLayoutManager::HIDDEN, shelf->visibility_state()); |
| 591 | 596 |
| 592 // Toggle app list to hide. | 597 // Toggle app list to hide. |
| 593 shell->ToggleAppList(); | 598 shell->ToggleAppList(); |
| 594 EXPECT_FALSE(shell->GetAppListTargetVisibility()); | 599 EXPECT_FALSE(shell->GetAppListTargetVisibility()); |
| 595 EXPECT_EQ(ShelfLayoutManager::HIDDEN, shelf->visibility_state()); | 600 EXPECT_EQ(ShelfLayoutManager::HIDDEN, shelf->visibility_state()); |
| 596 } | 601 } |
| 597 | 602 |
| 598 // Tests SHELF_ALIGNMENT_LEFT and SHELF_ALIGNMENT_RIGHT. | 603 // Tests SHELF_ALIGNMENT_LEFT and SHELF_ALIGNMENT_RIGHT. |
| 599 TEST_F(ShelfLayoutManagerTest, SetAlignment) { | 604 TEST_F(ShelfLayoutManagerTest, SetAlignment) { |
| 600 ShelfLayoutManager* shelf = GetShelfLayoutManager(); | 605 ShelfLayoutManager* shelf = shelf_layout_manager(); |
| 601 // Force an initial layout. | 606 // Force an initial layout. |
| 602 shelf->LayoutShelf(); | 607 shelf->LayoutShelf(); |
| 603 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); | 608 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); |
| 604 | 609 |
| 605 shelf->SetAlignment(SHELF_ALIGNMENT_LEFT); | 610 shelf->SetAlignment(SHELF_ALIGNMENT_LEFT); |
| 606 | 611 |
| 607 gfx::Rect launcher_bounds( | 612 gfx::Rect launcher_bounds( |
| 608 shelf->launcher_widget()->GetWindowBoundsInScreen()); | 613 shelf->launcher_widget()->GetWindowBoundsInScreen()); |
| 609 const aura::DisplayManager* manager = | 614 const aura::DisplayManager* manager = |
| 610 aura::Env::GetInstance()->display_manager(); | 615 aura::Env::GetInstance()->display_manager(); |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 876 // Activate the first window. Now, both windows should be of the same size | 881 // Activate the first window. Now, both windows should be of the same size |
| 877 // again. | 882 // again. |
| 878 widget_two->Activate(); | 883 widget_two->Activate(); |
| 879 EXPECT_EQ(widget_one->GetNativeWindow()->bounds().ToString(), | 884 EXPECT_EQ(widget_one->GetNativeWindow()->bounds().ToString(), |
| 880 widget_two->GetNativeWindow()->bounds().ToString()); | 885 widget_two->GetNativeWindow()->bounds().ToString()); |
| 881 } | 886 } |
| 882 | 887 |
| 883 // Confirm that the shelf is dimmed only when content is maximized and | 888 // Confirm that the shelf is dimmed only when content is maximized and |
| 884 // shelf is not autohidden. | 889 // shelf is not autohidden. |
| 885 TEST_F(ShelfLayoutManagerTest, Dimming) { | 890 TEST_F(ShelfLayoutManagerTest, Dimming) { |
| 886 Shell::GetInstance()->shelf()->SetAutoHideBehavior( | 891 shelf_layout_manager()->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); |
| 887 SHELF_AUTO_HIDE_BEHAVIOR_NEVER); | |
| 888 scoped_ptr<aura::Window> w1(CreateTestWindow()); | 892 scoped_ptr<aura::Window> w1(CreateTestWindow()); |
| 889 w1->Show(); | 893 w1->Show(); |
| 890 wm::ActivateWindow(w1.get()); | 894 wm::ActivateWindow(w1.get()); |
| 891 | 895 |
| 892 // Normal window doesn't dim shelf. | 896 // Normal window doesn't dim shelf. |
| 893 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); | 897 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); |
| 894 EXPECT_FALSE(Shell::GetInstance()->launcher()->GetDimsShelf()); | 898 Launcher* launcher = Launcher::ForPrimaryDisplay(); |
| 899 EXPECT_FALSE(launcher->GetDimsShelf()); |
| 895 | 900 |
| 896 // Maximized window does. | 901 // Maximized window does. |
| 897 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); | 902 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
| 898 EXPECT_TRUE(Shell::GetInstance()->launcher()->GetDimsShelf()); | 903 EXPECT_TRUE(launcher->GetDimsShelf()); |
| 899 | 904 |
| 900 // Change back to normal stops dimming. | 905 // Change back to normal stops dimming. |
| 901 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); | 906 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); |
| 902 EXPECT_FALSE(Shell::GetInstance()->launcher()->GetDimsShelf()); | 907 EXPECT_FALSE(launcher->GetDimsShelf()); |
| 903 | 908 |
| 904 // Changing back to maximized dims again. | 909 // Changing back to maximized dims again. |
| 905 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); | 910 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
| 906 EXPECT_TRUE(Shell::GetInstance()->launcher()->GetDimsShelf()); | 911 EXPECT_TRUE(launcher->GetDimsShelf()); |
| 907 | 912 |
| 908 // Changing shelf to autohide stops dimming. | 913 // Changing shelf to autohide stops dimming. |
| 909 Shell::GetInstance()->shelf()->SetAutoHideBehavior( | 914 shelf_layout_manager()->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); |
| 910 SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); | 915 EXPECT_FALSE(launcher->GetDimsShelf()); |
| 911 EXPECT_FALSE(Shell::GetInstance()->launcher()->GetDimsShelf()); | |
| 912 } | 916 } |
| 913 | 917 |
| 914 // Make sure that the shelf will not hide if the mouse is between a bubble and | 918 // Make sure that the shelf will not hide if the mouse is between a bubble and |
| 915 // the shelf. | 919 // the shelf. |
| 916 TEST_F(ShelfLayoutManagerTest, BubbleEnlargesShelfMouseHitArea) { | 920 TEST_F(ShelfLayoutManagerTest, BubbleEnlargesShelfMouseHitArea) { |
| 917 ShelfLayoutManager* shelf = GetShelfLayoutManager(); | 921 ShelfLayoutManager* shelf = GetShelfLayoutManager(); |
| 918 StatusAreaWidget* status_area = Shell::GetInstance()->status_area_widget(); | 922 StatusAreaWidget* status_area = |
| 923 Shell::GetPrimaryRootWindowController()->status_area_widget(); |
| 919 SystemTray* tray = Shell::GetInstance()->system_tray(); | 924 SystemTray* tray = Shell::GetInstance()->system_tray(); |
| 920 | 925 |
| 921 shelf->LayoutShelf(); | 926 shelf->LayoutShelf(); |
| 922 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); | 927 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); |
| 923 | 928 |
| 924 // Make two iterations - first without a message bubble which should make | 929 // Make two iterations - first without a message bubble which should make |
| 925 // the shelf disappear and then with a message bubble which should keep it | 930 // the shelf disappear and then with a message bubble which should keep it |
| 926 // visible. | 931 // visible. |
| 927 for (int i = 0; i < 2; i++) { | 932 for (int i = 0; i < 2; i++) { |
| 928 // Make sure the shelf is visible and position the mouse over it. Then | 933 // Make sure the shelf is visible and position the mouse over it. Then |
| (...skipping 25 matching lines...) Expand all Loading... |
| 954 EXPECT_TRUE(status_area->IsMessageBubbleShown()); | 959 EXPECT_TRUE(status_area->IsMessageBubbleShown()); |
| 955 } else { | 960 } else { |
| 956 EXPECT_FALSE(shelf->IsVisible()); | 961 EXPECT_FALSE(shelf->IsVisible()); |
| 957 EXPECT_FALSE(status_area->IsMessageBubbleShown()); | 962 EXPECT_FALSE(status_area->IsMessageBubbleShown()); |
| 958 } | 963 } |
| 959 } | 964 } |
| 960 } | 965 } |
| 961 | 966 |
| 962 } // namespace internal | 967 } // namespace internal |
| 963 } // namespace ash | 968 } // namespace ash |
| OLD | NEW |