| 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/shelf/shelf_layout_manager.h" | 5 #include "ash/shelf/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/focus_cycler.h" | 9 #include "ash/focus_cycler.h" |
| 10 #include "ash/public/cpp/config.h" |
| 10 #include "ash/public/cpp/shell_window_ids.h" | 11 #include "ash/public/cpp/shell_window_ids.h" |
| 11 #include "ash/root_window_controller.h" | 12 #include "ash/root_window_controller.h" |
| 12 #include "ash/session/session_controller.h" | 13 #include "ash/session/session_controller.h" |
| 13 #include "ash/shelf/shelf_constants.h" | 14 #include "ash/shelf/shelf_constants.h" |
| 14 #include "ash/shelf/shelf_layout_manager_observer.h" | 15 #include "ash/shelf/shelf_layout_manager_observer.h" |
| 15 #include "ash/shelf/shelf_view.h" | 16 #include "ash/shelf/shelf_view.h" |
| 16 #include "ash/shelf/shelf_widget.h" | 17 #include "ash/shelf/shelf_widget.h" |
| 17 #include "ash/shelf/wm_shelf.h" | 18 #include "ash/shelf/wm_shelf.h" |
| 18 #include "ash/shell.h" | 19 #include "ash/shell.h" |
| 19 #include "ash/shell_port.h" | 20 #include "ash/shell_port.h" |
| (...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 ASSERT_TRUE(shelf_widget); | 679 ASSERT_TRUE(shelf_widget); |
| 679 ASSERT_TRUE(shelf_widget->status_area_widget()); | 680 ASSERT_TRUE(shelf_widget->status_area_widget()); |
| 680 shelf_widget->status_area_widget()->SetBounds(gfx::Rect(0, 0, 200, 200)); | 681 shelf_widget->status_area_widget()->SetBounds(gfx::Rect(0, 0, 200, 200)); |
| 681 EXPECT_EQ(200, shelf_widget->GetContentsView()->width() - | 682 EXPECT_EQ(200, shelf_widget->GetContentsView()->width() - |
| 682 shelf->GetShelfViewForTesting()->width()); | 683 shelf->GetShelfViewForTesting()->width()); |
| 683 } | 684 } |
| 684 | 685 |
| 685 // Various assertions around auto-hide. | 686 // Various assertions around auto-hide. |
| 686 TEST_F(ShelfLayoutManagerTest, AutoHide) { | 687 TEST_F(ShelfLayoutManagerTest, AutoHide) { |
| 687 // TODO: investigate failure in mash, http://crbug.com/695686. | 688 // TODO: investigate failure in mash, http://crbug.com/695686. |
| 688 if (ShellPort::Get()->IsRunningInMash()) | 689 if (Shell::GetAshConfig() == Config::MASH) |
| 689 return; | 690 return; |
| 690 | 691 |
| 691 ui::test::EventGenerator& generator(GetEventGenerator()); | 692 ui::test::EventGenerator& generator(GetEventGenerator()); |
| 692 | 693 |
| 693 WmShelf* shelf = GetPrimaryShelf(); | 694 WmShelf* shelf = GetPrimaryShelf(); |
| 694 ShelfLayoutManager* layout_manager = GetShelfLayoutManager(); | 695 ShelfLayoutManager* layout_manager = GetShelfLayoutManager(); |
| 695 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); | 696 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); |
| 696 views::Widget* widget = CreateTestWidget(); | 697 views::Widget* widget = CreateTestWidget(); |
| 697 widget->Maximize(); | 698 widget->Maximize(); |
| 698 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); | 699 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 741 generator.PressLeftButton(); | 742 generator.PressLeftButton(); |
| 742 generator.MoveMouseTo(1, display_bottom - 1); | 743 generator.MoveMouseTo(1, display_bottom - 1); |
| 743 UpdateAutoHideStateNow(); | 744 UpdateAutoHideStateNow(); |
| 744 EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->GetAutoHideState()); | 745 EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->GetAutoHideState()); |
| 745 } | 746 } |
| 746 | 747 |
| 747 // Test the behavior of the shelf when it is auto hidden and it is on the | 748 // Test the behavior of the shelf when it is auto hidden and it is on the |
| 748 // boundary between the primary and the secondary display. | 749 // boundary between the primary and the secondary display. |
| 749 TEST_F(ShelfLayoutManagerTest, AutoHideShelfOnScreenBoundary) { | 750 TEST_F(ShelfLayoutManagerTest, AutoHideShelfOnScreenBoundary) { |
| 750 // TODO: investigate failure in mash, http://crbug.com/695686. | 751 // TODO: investigate failure in mash, http://crbug.com/695686. |
| 751 if (ShellPort::Get()->IsRunningInMash()) | 752 if (Shell::GetAshConfig() == Config::MASH) |
| 752 return; | 753 return; |
| 753 | 754 |
| 754 UpdateDisplay("800x600,800x600"); | 755 UpdateDisplay("800x600,800x600"); |
| 755 // TODO: SetLayoutForCurrentDisplays() needs to ported to mash. | 756 // TODO: SetLayoutForCurrentDisplays() needs to ported to mash. |
| 756 // http://crbug.com/698043. | 757 // http://crbug.com/698043. |
| 757 Shell::Get()->display_manager()->SetLayoutForCurrentDisplays( | 758 Shell::Get()->display_manager()->SetLayoutForCurrentDisplays( |
| 758 display::test::CreateDisplayLayout(display_manager(), | 759 display::test::CreateDisplayLayout(display_manager(), |
| 759 display::DisplayPlacement::RIGHT, 0)); | 760 display::DisplayPlacement::RIGHT, 0)); |
| 760 // Put the primary monitor's shelf on the display boundary. | 761 // Put the primary monitor's shelf on the display boundary. |
| 761 WmShelf* shelf = GetPrimaryShelf(); | 762 WmShelf* shelf = GetPrimaryShelf(); |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 952 test::TestAppListViewPresenterImpl app_list_presenter_impl; | 953 test::TestAppListViewPresenterImpl app_list_presenter_impl; |
| 953 | 954 |
| 954 // Create a normal unmaximized window; the shelf should be visible. | 955 // Create a normal unmaximized window; the shelf should be visible. |
| 955 aura::Window* window = CreateTestWindow(); | 956 aura::Window* window = CreateTestWindow(); |
| 956 window->SetBounds(gfx::Rect(0, 0, 100, 100)); | 957 window->SetBounds(gfx::Rect(0, 0, 100, 100)); |
| 957 window->Show(); | 958 window->Show(); |
| 958 EXPECT_FALSE(app_list_presenter_impl.GetTargetVisibility()); | 959 EXPECT_FALSE(app_list_presenter_impl.GetTargetVisibility()); |
| 959 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState()); | 960 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState()); |
| 960 | 961 |
| 961 // TODO: fails in mash because of AppListPresenter. http://crbug.com/696028. | 962 // TODO: fails in mash because of AppListPresenter. http://crbug.com/696028. |
| 962 if (ShellPort::Get()->IsRunningInMash()) | 963 if (Shell::GetAshConfig() == Config::MASH) |
| 963 return; | 964 return; |
| 964 | 965 |
| 965 // Show the app list and the shelf stays visible. | 966 // Show the app list and the shelf stays visible. |
| 966 app_list_presenter_impl.Show(GetPrimaryDisplayId()); | 967 app_list_presenter_impl.Show(GetPrimaryDisplayId()); |
| 967 EXPECT_TRUE(app_list_presenter_impl.GetTargetVisibility()); | 968 EXPECT_TRUE(app_list_presenter_impl.GetTargetVisibility()); |
| 968 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState()); | 969 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState()); |
| 969 | 970 |
| 970 // Hide the app list and the shelf stays visible. | 971 // Hide the app list and the shelf stays visible. |
| 971 app_list_presenter_impl.Dismiss(); | 972 app_list_presenter_impl.Dismiss(); |
| 972 EXPECT_FALSE(app_list_presenter_impl.GetTargetVisibility()); | 973 EXPECT_FALSE(app_list_presenter_impl.GetTargetVisibility()); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 984 | 985 |
| 985 // Create a normal unmaximized window; the shelf should be hidden. | 986 // Create a normal unmaximized window; the shelf should be hidden. |
| 986 aura::Window* window = CreateTestWindow(); | 987 aura::Window* window = CreateTestWindow(); |
| 987 window->SetBounds(gfx::Rect(0, 0, 100, 100)); | 988 window->SetBounds(gfx::Rect(0, 0, 100, 100)); |
| 988 window->Show(); | 989 window->Show(); |
| 989 EXPECT_FALSE(app_list_presenter_impl.GetTargetVisibility()); | 990 EXPECT_FALSE(app_list_presenter_impl.GetTargetVisibility()); |
| 990 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); | 991 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); |
| 991 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState()); | 992 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState()); |
| 992 | 993 |
| 993 // TODO: fails in mash because of AppListPresenter. http://crbug.com/696028. | 994 // TODO: fails in mash because of AppListPresenter. http://crbug.com/696028. |
| 994 if (ShellPort::Get()->IsRunningInMash()) | 995 if (Shell::GetAshConfig() == Config::MASH) |
| 995 return; | 996 return; |
| 996 | 997 |
| 997 // Show the app list and the shelf should be temporarily visible. | 998 // Show the app list and the shelf should be temporarily visible. |
| 998 app_list_presenter_impl.Show(GetPrimaryDisplayId()); | 999 app_list_presenter_impl.Show(GetPrimaryDisplayId()); |
| 999 // The shelf's auto hide state won't be changed until the timer fires, so | 1000 // The shelf's auto hide state won't be changed until the timer fires, so |
| 1000 // force it to update now. | 1001 // force it to update now. |
| 1001 GetShelfLayoutManager()->UpdateVisibilityState(); | 1002 GetShelfLayoutManager()->UpdateVisibilityState(); |
| 1002 EXPECT_TRUE(app_list_presenter_impl.GetTargetVisibility()); | 1003 EXPECT_TRUE(app_list_presenter_impl.GetTargetVisibility()); |
| 1003 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); | 1004 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); |
| 1004 EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->GetAutoHideState()); | 1005 EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->GetAutoHideState()); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1052 test::TestAppListViewPresenterImpl app_list_presenter_impl; | 1053 test::TestAppListViewPresenterImpl app_list_presenter_impl; |
| 1053 | 1054 |
| 1054 Shell::Get()->UpdateShelfVisibility(); | 1055 Shell::Get()->UpdateShelfVisibility(); |
| 1055 EXPECT_FALSE(app_list_presenter_impl.GetTargetVisibility()); | 1056 EXPECT_FALSE(app_list_presenter_impl.GetTargetVisibility()); |
| 1056 EXPECT_EQ(SHELF_AUTO_HIDE, shelf_1->GetVisibilityState()); | 1057 EXPECT_EQ(SHELF_AUTO_HIDE, shelf_1->GetVisibilityState()); |
| 1057 EXPECT_EQ(SHELF_AUTO_HIDE, shelf_2->GetVisibilityState()); | 1058 EXPECT_EQ(SHELF_AUTO_HIDE, shelf_2->GetVisibilityState()); |
| 1058 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf_1->GetAutoHideState()); | 1059 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf_1->GetAutoHideState()); |
| 1059 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf_2->GetAutoHideState()); | 1060 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf_2->GetAutoHideState()); |
| 1060 | 1061 |
| 1061 // TODO: fails in mash because of AppListPresenter. http://crbug.com/696028. | 1062 // TODO: fails in mash because of AppListPresenter. http://crbug.com/696028. |
| 1062 if (ShellPort::Get()->IsRunningInMash()) | 1063 if (Shell::GetAshConfig() == Config::MASH) |
| 1063 return; | 1064 return; |
| 1064 | 1065 |
| 1065 // Show the app list; only the shelf on the same display should be shown. | 1066 // Show the app list; only the shelf on the same display should be shown. |
| 1066 app_list_presenter_impl.Show(GetPrimaryDisplayId()); | 1067 app_list_presenter_impl.Show(GetPrimaryDisplayId()); |
| 1067 Shell::Get()->UpdateShelfVisibility(); | 1068 Shell::Get()->UpdateShelfVisibility(); |
| 1068 EXPECT_TRUE(app_list_presenter_impl.GetTargetVisibility()); | 1069 EXPECT_TRUE(app_list_presenter_impl.GetTargetVisibility()); |
| 1069 EXPECT_EQ(SHELF_AUTO_HIDE, shelf_1->GetVisibilityState()); | 1070 EXPECT_EQ(SHELF_AUTO_HIDE, shelf_1->GetVisibilityState()); |
| 1070 EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf_1->GetAutoHideState()); | 1071 EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf_1->GetAutoHideState()); |
| 1071 EXPECT_EQ(SHELF_AUTO_HIDE, shelf_2->GetVisibilityState()); | 1072 EXPECT_EQ(SHELF_AUTO_HIDE, shelf_2->GetVisibilityState()); |
| 1072 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf_2->GetAutoHideState()); | 1073 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf_2->GetAutoHideState()); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1092 // Create a window and make it full screen; the shelf should be hidden. | 1093 // Create a window and make it full screen; the shelf should be hidden. |
| 1093 aura::Window* window = CreateTestWindow(); | 1094 aura::Window* window = CreateTestWindow(); |
| 1094 window->SetBounds(gfx::Rect(0, 0, 100, 100)); | 1095 window->SetBounds(gfx::Rect(0, 0, 100, 100)); |
| 1095 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); | 1096 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); |
| 1096 window->Show(); | 1097 window->Show(); |
| 1097 wm::ActivateWindow(window); | 1098 wm::ActivateWindow(window); |
| 1098 EXPECT_FALSE(app_list_presenter_impl.GetTargetVisibility()); | 1099 EXPECT_FALSE(app_list_presenter_impl.GetTargetVisibility()); |
| 1099 EXPECT_EQ(SHELF_HIDDEN, shelf->GetVisibilityState()); | 1100 EXPECT_EQ(SHELF_HIDDEN, shelf->GetVisibilityState()); |
| 1100 | 1101 |
| 1101 // TODO: fails in mash because of AppListPresenter. http://crbug.com/696028. | 1102 // TODO: fails in mash because of AppListPresenter. http://crbug.com/696028. |
| 1102 if (ShellPort::Get()->IsRunningInMash()) | 1103 if (Shell::GetAshConfig() == Config::MASH) |
| 1103 return; | 1104 return; |
| 1104 | 1105 |
| 1105 // Show the app list and the shelf should be temporarily visible. | 1106 // Show the app list and the shelf should be temporarily visible. |
| 1106 app_list_presenter_impl.Show(GetPrimaryDisplayId()); | 1107 app_list_presenter_impl.Show(GetPrimaryDisplayId()); |
| 1107 EXPECT_TRUE(app_list_presenter_impl.GetTargetVisibility()); | 1108 EXPECT_TRUE(app_list_presenter_impl.GetTargetVisibility()); |
| 1108 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState()); | 1109 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState()); |
| 1109 | 1110 |
| 1110 // Hide the app list and the shelf should be hidden again. | 1111 // Hide the app list and the shelf should be hidden again. |
| 1111 app_list_presenter_impl.Dismiss(); | 1112 app_list_presenter_impl.Dismiss(); |
| 1112 EXPECT_FALSE(app_list_presenter_impl.GetTargetVisibility()); | 1113 EXPECT_FALSE(app_list_presenter_impl.GetTargetVisibility()); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1237 SHELF_HIDDEN, | 1238 SHELF_HIDDEN, |
| 1238 root_window_controllers[0]->GetShelfLayoutManager()->visibility_state()); | 1239 root_window_controllers[0]->GetShelfLayoutManager()->visibility_state()); |
| 1239 EXPECT_EQ( | 1240 EXPECT_EQ( |
| 1240 SHELF_VISIBLE, | 1241 SHELF_VISIBLE, |
| 1241 root_window_controllers[1]->GetShelfLayoutManager()->visibility_state()); | 1242 root_window_controllers[1]->GetShelfLayoutManager()->visibility_state()); |
| 1242 } | 1243 } |
| 1243 | 1244 |
| 1244 // Test for Pinned mode. | 1245 // Test for Pinned mode. |
| 1245 TEST_F(ShelfLayoutManagerTest, PinnedWindowHidesShelf) { | 1246 TEST_F(ShelfLayoutManagerTest, PinnedWindowHidesShelf) { |
| 1246 // TODO: investigate failure in mash, http://crbug.com/695686. | 1247 // TODO: investigate failure in mash, http://crbug.com/695686. |
| 1247 if (ShellPort::Get()->IsRunningInMash()) | 1248 if (Shell::GetAshConfig() == Config::MASH) |
| 1248 return; | 1249 return; |
| 1249 | 1250 |
| 1250 WmShelf* shelf = GetPrimaryShelf(); | 1251 WmShelf* shelf = GetPrimaryShelf(); |
| 1251 | 1252 |
| 1252 aura::Window* window1 = CreateTestWindow(); | 1253 aura::Window* window1 = CreateTestWindow(); |
| 1253 window1->SetBounds(gfx::Rect(0, 0, 100, 100)); | 1254 window1->SetBounds(gfx::Rect(0, 0, 100, 100)); |
| 1254 window1->Show(); | 1255 window1->Show(); |
| 1255 | 1256 |
| 1256 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState()); | 1257 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState()); |
| 1257 | 1258 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1327 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); | 1328 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); |
| 1328 display = display::Screen::GetScreen()->GetPrimaryDisplay(); | 1329 display = display::Screen::GetScreen()->GetPrimaryDisplay(); |
| 1329 EXPECT_EQ(GetShelfConstant(SHELF_INSETS_FOR_AUTO_HIDE), | 1330 EXPECT_EQ(GetShelfConstant(SHELF_INSETS_FOR_AUTO_HIDE), |
| 1330 display.GetWorkAreaInsets().right()); | 1331 display.GetWorkAreaInsets().right()); |
| 1331 EXPECT_EQ(GetShelfConstant(SHELF_INSETS_FOR_AUTO_HIDE), | 1332 EXPECT_EQ(GetShelfConstant(SHELF_INSETS_FOR_AUTO_HIDE), |
| 1332 display.bounds().right() - display.work_area().right()); | 1333 display.bounds().right() - display.work_area().right()); |
| 1333 } | 1334 } |
| 1334 | 1335 |
| 1335 TEST_F(ShelfLayoutManagerTest, GestureDrag) { | 1336 TEST_F(ShelfLayoutManagerTest, GestureDrag) { |
| 1336 // TODO: investigate failure in mash, http://crbug.com/695686. | 1337 // TODO: investigate failure in mash, http://crbug.com/695686. |
| 1337 if (ShellPort::Get()->IsRunningInMash()) | 1338 if (Shell::GetAshConfig() == Config::MASH) |
| 1338 return; | 1339 return; |
| 1339 | 1340 |
| 1340 // Slop is an implementation detail of gesture recognition, and complicates | 1341 // Slop is an implementation detail of gesture recognition, and complicates |
| 1341 // these tests. Ignore it. | 1342 // these tests. Ignore it. |
| 1342 ui::GestureConfiguration::GetInstance() | 1343 ui::GestureConfiguration::GetInstance() |
| 1343 ->set_max_touch_move_in_pixels_for_click(0); | 1344 ->set_max_touch_move_in_pixels_for_click(0); |
| 1344 WmShelf* shelf = GetPrimaryShelf(); | 1345 WmShelf* shelf = GetPrimaryShelf(); |
| 1345 { | 1346 { |
| 1346 SCOPED_TRACE("BOTTOM"); | 1347 SCOPED_TRACE("BOTTOM"); |
| 1347 shelf->SetAlignment(SHELF_ALIGNMENT_BOTTOM); | 1348 shelf->SetAlignment(SHELF_ALIGNMENT_BOTTOM); |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1515 widget_one->Activate(); | 1516 widget_one->Activate(); |
| 1516 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState()); | 1517 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState()); |
| 1517 wm::GetWindowState(window_two) | 1518 wm::GetWindowState(window_two) |
| 1518 ->set_autohide_shelf_when_maximized_or_fullscreen(false); | 1519 ->set_autohide_shelf_when_maximized_or_fullscreen(false); |
| 1519 widget_two->Activate(); | 1520 widget_two->Activate(); |
| 1520 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState()); | 1521 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState()); |
| 1521 } | 1522 } |
| 1522 | 1523 |
| 1523 TEST_F(ShelfLayoutManagerTest, ShelfFlickerOnTrayActivation) { | 1524 TEST_F(ShelfLayoutManagerTest, ShelfFlickerOnTrayActivation) { |
| 1524 // TODO: investigate failure in mash, http://crbug.com/695686. | 1525 // TODO: investigate failure in mash, http://crbug.com/695686. |
| 1525 if (ShellPort::Get()->IsRunningInMash()) | 1526 if (Shell::GetAshConfig() == Config::MASH) |
| 1526 return; | 1527 return; |
| 1527 | 1528 |
| 1528 WmShelf* shelf = GetPrimaryShelf(); | 1529 WmShelf* shelf = GetPrimaryShelf(); |
| 1529 | 1530 |
| 1530 // Create a visible window so auto-hide behavior is enforced. | 1531 // Create a visible window so auto-hide behavior is enforced. |
| 1531 CreateTestWidget(); | 1532 CreateTestWidget(); |
| 1532 | 1533 |
| 1533 // Turn on auto-hide for the shelf. | 1534 // Turn on auto-hide for the shelf. |
| 1534 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); | 1535 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); |
| 1535 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); | 1536 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1713 GetShelfWidget()->Shutdown(); | 1714 GetShelfWidget()->Shutdown(); |
| 1714 | 1715 |
| 1715 // Deleting a focused maximized window will switch focus to |window2|. This | 1716 // Deleting a focused maximized window will switch focus to |window2|. This |
| 1716 // would normally cause the ShelfLayoutManager to update its state. However | 1717 // would normally cause the ShelfLayoutManager to update its state. However |
| 1717 // during shutdown we want to handle this without crashing. | 1718 // during shutdown we want to handle this without crashing. |
| 1718 delete window1; | 1719 delete window1; |
| 1719 } | 1720 } |
| 1720 | 1721 |
| 1721 TEST_F(ShelfLayoutManagerTest, ShelfLayoutInUnifiedDesktop) { | 1722 TEST_F(ShelfLayoutManagerTest, ShelfLayoutInUnifiedDesktop) { |
| 1722 // TODO: requires unified desktop mode. http://crbug.com/581462. | 1723 // TODO: requires unified desktop mode. http://crbug.com/581462. |
| 1723 if (ShellPort::Get()->IsRunningInMash()) | 1724 if (Shell::GetAshConfig() == Config::MASH) |
| 1724 return; | 1725 return; |
| 1725 | 1726 |
| 1726 Shell::Get()->display_manager()->SetUnifiedDesktopEnabled(true); | 1727 Shell::Get()->display_manager()->SetUnifiedDesktopEnabled(true); |
| 1727 UpdateDisplay("500x400, 500x400"); | 1728 UpdateDisplay("500x400, 500x400"); |
| 1728 | 1729 |
| 1729 StatusAreaWidget* status_area_widget = GetShelfWidget()->status_area_widget(); | 1730 StatusAreaWidget* status_area_widget = GetShelfWidget()->status_area_widget(); |
| 1730 EXPECT_TRUE(status_area_widget->IsVisible()); | 1731 EXPECT_TRUE(status_area_widget->IsVisible()); |
| 1731 // Shelf should be in the first display's area. | 1732 // Shelf should be in the first display's area. |
| 1732 gfx::Rect status_area_bounds(status_area_widget->GetWindowBoundsInScreen()); | 1733 gfx::Rect status_area_bounds(status_area_widget->GetWindowBoundsInScreen()); |
| 1733 EXPECT_TRUE(gfx::Rect(0, 0, 500, 400).Contains(status_area_bounds)); | 1734 EXPECT_TRUE(gfx::Rect(0, 0, 500, 400).Contains(status_area_bounds)); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1839 // Open keyboard in sticky mode. | 1840 // Open keyboard in sticky mode. |
| 1840 kb_controller->ShowKeyboard(true); | 1841 kb_controller->ShowKeyboard(true); |
| 1841 layout_manager->OnKeyboardBoundsChanging(keyboard_bounds()); | 1842 layout_manager->OnKeyboardBoundsChanging(keyboard_bounds()); |
| 1842 | 1843 |
| 1843 // Work area should be changed. | 1844 // Work area should be changed. |
| 1844 EXPECT_NE(orig_work_area, | 1845 EXPECT_NE(orig_work_area, |
| 1845 display::Screen::GetScreen()->GetPrimaryDisplay().work_area()); | 1846 display::Screen::GetScreen()->GetPrimaryDisplay().work_area()); |
| 1846 } | 1847 } |
| 1847 | 1848 |
| 1848 } // namespace ash | 1849 } // namespace ash |
| OLD | NEW |