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/common/shelf/shelf_layout_manager.h" | 5 #include "ash/common/shelf/shelf_layout_manager.h" |
6 | 6 |
7 #include "ash/common/accelerators/accelerator_controller.h" | 7 #include "ash/common/accelerators/accelerator_controller.h" |
8 #include "ash/common/accelerators/accelerator_table.h" | 8 #include "ash/common/accelerators/accelerator_table.h" |
9 #include "ash/common/focus_cycler.h" | 9 #include "ash/common/focus_cycler.h" |
10 #include "ash/common/session/session_controller.h" | 10 #include "ash/common/session/session_controller.h" |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 ash::WmShell::Get()->session_controller()->SetSessionInfo(std::move(info)); | 296 ash::WmShell::Get()->session_controller()->SetSessionInfo(std::move(info)); |
297 } | 297 } |
298 | 298 |
299 // Turn off the lock screen. | 299 // Turn off the lock screen. |
300 void UnlockScreen() { | 300 void UnlockScreen() { |
301 mojom::SessionInfoPtr info = mojom::SessionInfo::New(); | 301 mojom::SessionInfoPtr info = mojom::SessionInfo::New(); |
302 info->state = session_manager::SessionState::ACTIVE; | 302 info->state = session_manager::SessionState::ACTIVE; |
303 ash::WmShell::Get()->session_controller()->SetSessionInfo(std::move(info)); | 303 ash::WmShell::Get()->session_controller()->SetSessionInfo(std::move(info)); |
304 } | 304 } |
305 | 305 |
| 306 int64_t GetPrimaryDisplayId() { |
| 307 return display::Screen::GetScreen()->GetPrimaryDisplay().id(); |
| 308 } |
| 309 |
306 private: | 310 private: |
307 DISALLOW_COPY_AND_ASSIGN(ShelfLayoutManagerTest); | 311 DISALLOW_COPY_AND_ASSIGN(ShelfLayoutManagerTest); |
308 }; | 312 }; |
309 | 313 |
310 void ShelfLayoutManagerTest::RunGestureDragTests(gfx::Vector2d delta) { | 314 void ShelfLayoutManagerTest::RunGestureDragTests(gfx::Vector2d delta) { |
311 WmShelf* shelf = GetPrimaryShelf(); | 315 WmShelf* shelf = GetPrimaryShelf(); |
312 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); | 316 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); |
313 | 317 |
314 views::Widget* widget = CreateTestWidget(); | 318 views::Widget* widget = CreateTestWidget(); |
315 widget->Maximize(); | 319 widget->Maximize(); |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 ShelfWidget* shelf_widget = GetShelfWidget(); | 677 ShelfWidget* shelf_widget = GetShelfWidget(); |
674 ASSERT_TRUE(shelf_widget); | 678 ASSERT_TRUE(shelf_widget); |
675 ASSERT_TRUE(shelf_widget->status_area_widget()); | 679 ASSERT_TRUE(shelf_widget->status_area_widget()); |
676 shelf_widget->status_area_widget()->SetBounds(gfx::Rect(0, 0, 200, 200)); | 680 shelf_widget->status_area_widget()->SetBounds(gfx::Rect(0, 0, 200, 200)); |
677 EXPECT_EQ(200, shelf_widget->GetContentsView()->width() - | 681 EXPECT_EQ(200, shelf_widget->GetContentsView()->width() - |
678 shelf->GetShelfViewForTesting()->width()); | 682 shelf->GetShelfViewForTesting()->width()); |
679 } | 683 } |
680 | 684 |
681 // Various assertions around auto-hide. | 685 // Various assertions around auto-hide. |
682 TEST_F(ShelfLayoutManagerTest, AutoHide) { | 686 TEST_F(ShelfLayoutManagerTest, AutoHide) { |
| 687 // TODO: investigate failure in mash, http://crbug.com/695686. |
| 688 if (WmShell::Get()->IsRunningInMash()) |
| 689 return; |
| 690 |
683 ui::test::EventGenerator& generator(GetEventGenerator()); | 691 ui::test::EventGenerator& generator(GetEventGenerator()); |
684 | 692 |
685 WmShelf* shelf = GetPrimaryShelf(); | 693 WmShelf* shelf = GetPrimaryShelf(); |
686 ShelfLayoutManager* layout_manager = GetShelfLayoutManager(); | 694 ShelfLayoutManager* layout_manager = GetShelfLayoutManager(); |
687 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); | 695 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); |
688 views::Widget* widget = CreateTestWidget(); | 696 views::Widget* widget = CreateTestWidget(); |
689 widget->Maximize(); | 697 widget->Maximize(); |
690 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); | 698 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); |
691 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState()); | 699 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState()); |
692 | 700 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->GetAutoHideState()); | 740 EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->GetAutoHideState()); |
733 generator.PressLeftButton(); | 741 generator.PressLeftButton(); |
734 generator.MoveMouseTo(1, display_bottom - 1); | 742 generator.MoveMouseTo(1, display_bottom - 1); |
735 UpdateAutoHideStateNow(); | 743 UpdateAutoHideStateNow(); |
736 EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->GetAutoHideState()); | 744 EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->GetAutoHideState()); |
737 } | 745 } |
738 | 746 |
739 // Test the behavior of the shelf when it is auto hidden and it is on the | 747 // Test the behavior of the shelf when it is auto hidden and it is on the |
740 // boundary between the primary and the secondary display. | 748 // boundary between the primary and the secondary display. |
741 TEST_F(ShelfLayoutManagerTest, AutoHideShelfOnScreenBoundary) { | 749 TEST_F(ShelfLayoutManagerTest, AutoHideShelfOnScreenBoundary) { |
| 750 // TODO: investigate failure in mash, http://crbug.com/695686. |
| 751 if (WmShell::Get()->IsRunningInMash()) |
| 752 return; |
| 753 |
742 UpdateDisplay("800x600,800x600"); | 754 UpdateDisplay("800x600,800x600"); |
743 Shell::GetInstance()->display_manager()->SetLayoutForCurrentDisplays( | 755 Shell::GetInstance()->display_manager()->SetLayoutForCurrentDisplays( |
744 display::test::CreateDisplayLayout(display_manager(), | 756 display::test::CreateDisplayLayout(display_manager(), |
745 display::DisplayPlacement::RIGHT, 0)); | 757 display::DisplayPlacement::RIGHT, 0)); |
746 // Put the primary monitor's shelf on the display boundary. | 758 // Put the primary monitor's shelf on the display boundary. |
747 WmShelf* shelf = GetPrimaryShelf(); | 759 WmShelf* shelf = GetPrimaryShelf(); |
748 shelf->SetAlignment(SHELF_ALIGNMENT_RIGHT); | 760 shelf->SetAlignment(SHELF_ALIGNMENT_RIGHT); |
749 | 761 |
750 // Create a window because the shelf is always shown when no windows are | 762 // Create a window because the shelf is always shown when no windows are |
751 // visible. | 763 // visible. |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
937 // The tested behavior relies on the app list presenter implementation. | 949 // The tested behavior relies on the app list presenter implementation. |
938 test::TestAppListViewPresenterImpl app_list_presenter_impl; | 950 test::TestAppListViewPresenterImpl app_list_presenter_impl; |
939 | 951 |
940 // Create a normal unmaximized window; the shelf should be visible. | 952 // Create a normal unmaximized window; the shelf should be visible. |
941 aura::Window* window = CreateTestWindow(); | 953 aura::Window* window = CreateTestWindow(); |
942 window->SetBounds(gfx::Rect(0, 0, 100, 100)); | 954 window->SetBounds(gfx::Rect(0, 0, 100, 100)); |
943 window->Show(); | 955 window->Show(); |
944 EXPECT_FALSE(app_list_presenter_impl.GetTargetVisibility()); | 956 EXPECT_FALSE(app_list_presenter_impl.GetTargetVisibility()); |
945 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState()); | 957 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState()); |
946 | 958 |
| 959 // TODO: fails in mash because of AppListPresenter. http://crbug.com/696028. |
| 960 if (WmShell::Get()->IsRunningInMash()) |
| 961 return; |
| 962 |
947 // Show the app list and the shelf stays visible. | 963 // Show the app list and the shelf stays visible. |
948 app_list_presenter_impl.Show(display_manager()->first_display_id()); | 964 app_list_presenter_impl.Show(GetPrimaryDisplayId()); |
949 EXPECT_TRUE(app_list_presenter_impl.GetTargetVisibility()); | 965 EXPECT_TRUE(app_list_presenter_impl.GetTargetVisibility()); |
950 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState()); | 966 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState()); |
951 | 967 |
952 // Hide the app list and the shelf stays visible. | 968 // Hide the app list and the shelf stays visible. |
953 app_list_presenter_impl.Dismiss(); | 969 app_list_presenter_impl.Dismiss(); |
954 EXPECT_FALSE(app_list_presenter_impl.GetTargetVisibility()); | 970 EXPECT_FALSE(app_list_presenter_impl.GetTargetVisibility()); |
955 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState()); | 971 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState()); |
956 } | 972 } |
957 | 973 |
958 // Ensure a SHELF_AUTO_HIDE shelf is shown temporarily (SHELF_AUTO_HIDE_SHOWN) | 974 // Ensure a SHELF_AUTO_HIDE shelf is shown temporarily (SHELF_AUTO_HIDE_SHOWN) |
959 // when the app list is shown, but the visibility state doesn't change. | 975 // when the app list is shown, but the visibility state doesn't change. |
960 TEST_F(ShelfLayoutManagerTest, OpenAppListWithShelfAutoHideState) { | 976 TEST_F(ShelfLayoutManagerTest, OpenAppListWithShelfAutoHideState) { |
961 WmShelf* shelf = GetPrimaryShelf(); | 977 WmShelf* shelf = GetPrimaryShelf(); |
962 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); | 978 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); |
963 | 979 |
964 // The tested behavior relies on the app list presenter implementation. | 980 // The tested behavior relies on the app list presenter implementation. |
965 test::TestAppListViewPresenterImpl app_list_presenter_impl; | 981 test::TestAppListViewPresenterImpl app_list_presenter_impl; |
966 | 982 |
967 // Create a normal unmaximized window; the shelf should be hidden. | 983 // Create a normal unmaximized window; the shelf should be hidden. |
968 aura::Window* window = CreateTestWindow(); | 984 aura::Window* window = CreateTestWindow(); |
969 window->SetBounds(gfx::Rect(0, 0, 100, 100)); | 985 window->SetBounds(gfx::Rect(0, 0, 100, 100)); |
970 window->Show(); | 986 window->Show(); |
971 EXPECT_FALSE(app_list_presenter_impl.GetTargetVisibility()); | 987 EXPECT_FALSE(app_list_presenter_impl.GetTargetVisibility()); |
972 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); | 988 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); |
973 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState()); | 989 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState()); |
974 | 990 |
| 991 // TODO: fails in mash because of AppListPresenter. http://crbug.com/696028. |
| 992 if (WmShell::Get()->IsRunningInMash()) |
| 993 return; |
| 994 |
975 // Show the app list and the shelf should be temporarily visible. | 995 // Show the app list and the shelf should be temporarily visible. |
976 app_list_presenter_impl.Show(display_manager()->first_display_id()); | 996 app_list_presenter_impl.Show(GetPrimaryDisplayId()); |
977 // The shelf's auto hide state won't be changed until the timer fires, so | 997 // The shelf's auto hide state won't be changed until the timer fires, so |
978 // force it to update now. | 998 // force it to update now. |
979 GetShelfLayoutManager()->UpdateVisibilityState(); | 999 GetShelfLayoutManager()->UpdateVisibilityState(); |
980 EXPECT_TRUE(app_list_presenter_impl.GetTargetVisibility()); | 1000 EXPECT_TRUE(app_list_presenter_impl.GetTargetVisibility()); |
981 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); | 1001 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); |
982 EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->GetAutoHideState()); | 1002 EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->GetAutoHideState()); |
983 | 1003 |
984 // Hide the app list and the shelf should be hidden again. | 1004 // Hide the app list and the shelf should be hidden again. |
985 app_list_presenter_impl.Dismiss(); | 1005 app_list_presenter_impl.Dismiss(); |
986 EXPECT_FALSE(app_list_presenter_impl.GetTargetVisibility()); | 1006 EXPECT_FALSE(app_list_presenter_impl.GetTargetVisibility()); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1029 // The tested behavior relies on the app list presenter implementation. | 1049 // The tested behavior relies on the app list presenter implementation. |
1030 test::TestAppListViewPresenterImpl app_list_presenter_impl; | 1050 test::TestAppListViewPresenterImpl app_list_presenter_impl; |
1031 | 1051 |
1032 Shell::GetInstance()->UpdateShelfVisibility(); | 1052 Shell::GetInstance()->UpdateShelfVisibility(); |
1033 EXPECT_FALSE(app_list_presenter_impl.GetTargetVisibility()); | 1053 EXPECT_FALSE(app_list_presenter_impl.GetTargetVisibility()); |
1034 EXPECT_EQ(SHELF_AUTO_HIDE, shelf_1->GetVisibilityState()); | 1054 EXPECT_EQ(SHELF_AUTO_HIDE, shelf_1->GetVisibilityState()); |
1035 EXPECT_EQ(SHELF_AUTO_HIDE, shelf_2->GetVisibilityState()); | 1055 EXPECT_EQ(SHELF_AUTO_HIDE, shelf_2->GetVisibilityState()); |
1036 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf_1->GetAutoHideState()); | 1056 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf_1->GetAutoHideState()); |
1037 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf_2->GetAutoHideState()); | 1057 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf_2->GetAutoHideState()); |
1038 | 1058 |
| 1059 // TODO: fails in mash because of AppListPresenter. http://crbug.com/696028. |
| 1060 if (WmShell::Get()->IsRunningInMash()) |
| 1061 return; |
| 1062 |
1039 // Show the app list; only the shelf on the same display should be shown. | 1063 // Show the app list; only the shelf on the same display should be shown. |
1040 app_list_presenter_impl.Show(display_manager()->first_display_id()); | 1064 app_list_presenter_impl.Show(GetPrimaryDisplayId()); |
1041 Shell::GetInstance()->UpdateShelfVisibility(); | 1065 Shell::GetInstance()->UpdateShelfVisibility(); |
1042 EXPECT_TRUE(app_list_presenter_impl.GetTargetVisibility()); | 1066 EXPECT_TRUE(app_list_presenter_impl.GetTargetVisibility()); |
1043 EXPECT_EQ(SHELF_AUTO_HIDE, shelf_1->GetVisibilityState()); | 1067 EXPECT_EQ(SHELF_AUTO_HIDE, shelf_1->GetVisibilityState()); |
1044 EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf_1->GetAutoHideState()); | 1068 EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf_1->GetAutoHideState()); |
1045 EXPECT_EQ(SHELF_AUTO_HIDE, shelf_2->GetVisibilityState()); | 1069 EXPECT_EQ(SHELF_AUTO_HIDE, shelf_2->GetVisibilityState()); |
1046 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf_2->GetAutoHideState()); | 1070 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf_2->GetAutoHideState()); |
1047 | 1071 |
1048 // Hide the app list, both shelves should be hidden. | 1072 // Hide the app list, both shelves should be hidden. |
1049 app_list_presenter_impl.Dismiss(); | 1073 app_list_presenter_impl.Dismiss(); |
1050 Shell::GetInstance()->UpdateShelfVisibility(); | 1074 Shell::GetInstance()->UpdateShelfVisibility(); |
(...skipping 14 matching lines...) Expand all Loading... |
1065 | 1089 |
1066 // Create a window and make it full screen; the shelf should be hidden. | 1090 // Create a window and make it full screen; the shelf should be hidden. |
1067 aura::Window* window = CreateTestWindow(); | 1091 aura::Window* window = CreateTestWindow(); |
1068 window->SetBounds(gfx::Rect(0, 0, 100, 100)); | 1092 window->SetBounds(gfx::Rect(0, 0, 100, 100)); |
1069 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); | 1093 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); |
1070 window->Show(); | 1094 window->Show(); |
1071 wm::ActivateWindow(window); | 1095 wm::ActivateWindow(window); |
1072 EXPECT_FALSE(app_list_presenter_impl.GetTargetVisibility()); | 1096 EXPECT_FALSE(app_list_presenter_impl.GetTargetVisibility()); |
1073 EXPECT_EQ(SHELF_HIDDEN, shelf->GetVisibilityState()); | 1097 EXPECT_EQ(SHELF_HIDDEN, shelf->GetVisibilityState()); |
1074 | 1098 |
| 1099 // TODO: fails in mash because of AppListPresenter. http://crbug.com/696028. |
| 1100 if (WmShell::Get()->IsRunningInMash()) |
| 1101 return; |
| 1102 |
1075 // Show the app list and the shelf should be temporarily visible. | 1103 // Show the app list and the shelf should be temporarily visible. |
1076 app_list_presenter_impl.Show(display_manager()->first_display_id()); | 1104 app_list_presenter_impl.Show(GetPrimaryDisplayId()); |
1077 EXPECT_TRUE(app_list_presenter_impl.GetTargetVisibility()); | 1105 EXPECT_TRUE(app_list_presenter_impl.GetTargetVisibility()); |
1078 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState()); | 1106 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState()); |
1079 | 1107 |
1080 // Hide the app list and the shelf should be hidden again. | 1108 // Hide the app list and the shelf should be hidden again. |
1081 app_list_presenter_impl.Dismiss(); | 1109 app_list_presenter_impl.Dismiss(); |
1082 EXPECT_FALSE(app_list_presenter_impl.GetTargetVisibility()); | 1110 EXPECT_FALSE(app_list_presenter_impl.GetTargetVisibility()); |
1083 EXPECT_EQ(SHELF_HIDDEN, shelf->GetVisibilityState()); | 1111 EXPECT_EQ(SHELF_HIDDEN, shelf->GetVisibilityState()); |
1084 } | 1112 } |
1085 | 1113 |
1086 // Tests the correct behavior of the shelf when there is a system modal window | 1114 // Tests the correct behavior of the shelf when there is a system modal window |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1208 EXPECT_EQ( | 1236 EXPECT_EQ( |
1209 SHELF_HIDDEN, | 1237 SHELF_HIDDEN, |
1210 root_window_controllers[0]->GetShelfLayoutManager()->visibility_state()); | 1238 root_window_controllers[0]->GetShelfLayoutManager()->visibility_state()); |
1211 EXPECT_EQ( | 1239 EXPECT_EQ( |
1212 SHELF_VISIBLE, | 1240 SHELF_VISIBLE, |
1213 root_window_controllers[1]->GetShelfLayoutManager()->visibility_state()); | 1241 root_window_controllers[1]->GetShelfLayoutManager()->visibility_state()); |
1214 } | 1242 } |
1215 | 1243 |
1216 // Test for Pinned mode. | 1244 // Test for Pinned mode. |
1217 TEST_F(ShelfLayoutManagerTest, PinnedWindowHidesShelf) { | 1245 TEST_F(ShelfLayoutManagerTest, PinnedWindowHidesShelf) { |
| 1246 // TODO: investigate failure in mash, http://crbug.com/695686. |
| 1247 if (WmShell::Get()->IsRunningInMash()) |
| 1248 return; |
| 1249 |
1218 WmShelf* shelf = GetPrimaryShelf(); | 1250 WmShelf* shelf = GetPrimaryShelf(); |
1219 | 1251 |
1220 aura::Window* window1 = CreateTestWindow(); | 1252 aura::Window* window1 = CreateTestWindow(); |
1221 window1->SetBounds(gfx::Rect(0, 0, 100, 100)); | 1253 window1->SetBounds(gfx::Rect(0, 0, 100, 100)); |
1222 window1->Show(); | 1254 window1->Show(); |
1223 | 1255 |
1224 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState()); | 1256 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState()); |
1225 | 1257 |
1226 wm::PinWindow(window1, /* trusted */ false); | 1258 wm::PinWindow(window1, /* trusted */ false); |
1227 EXPECT_EQ(SHELF_HIDDEN, shelf->GetVisibilityState()); | 1259 EXPECT_EQ(SHELF_HIDDEN, shelf->GetVisibilityState()); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1294 EXPECT_EQ(display.bounds().height(), shelf_bounds.height()); | 1326 EXPECT_EQ(display.bounds().height(), shelf_bounds.height()); |
1295 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); | 1327 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); |
1296 display = display::Screen::GetScreen()->GetPrimaryDisplay(); | 1328 display = display::Screen::GetScreen()->GetPrimaryDisplay(); |
1297 EXPECT_EQ(GetShelfConstant(SHELF_INSETS_FOR_AUTO_HIDE), | 1329 EXPECT_EQ(GetShelfConstant(SHELF_INSETS_FOR_AUTO_HIDE), |
1298 display.GetWorkAreaInsets().right()); | 1330 display.GetWorkAreaInsets().right()); |
1299 EXPECT_EQ(GetShelfConstant(SHELF_INSETS_FOR_AUTO_HIDE), | 1331 EXPECT_EQ(GetShelfConstant(SHELF_INSETS_FOR_AUTO_HIDE), |
1300 display.bounds().right() - display.work_area().right()); | 1332 display.bounds().right() - display.work_area().right()); |
1301 } | 1333 } |
1302 | 1334 |
1303 TEST_F(ShelfLayoutManagerTest, GestureDrag) { | 1335 TEST_F(ShelfLayoutManagerTest, GestureDrag) { |
| 1336 // TODO: investigate failure in mash, http://crbug.com/695686. |
| 1337 if (WmShell::Get()->IsRunningInMash()) |
| 1338 return; |
| 1339 |
1304 // Slop is an implementation detail of gesture recognition, and complicates | 1340 // Slop is an implementation detail of gesture recognition, and complicates |
1305 // these tests. Ignore it. | 1341 // these tests. Ignore it. |
1306 ui::GestureConfiguration::GetInstance() | 1342 ui::GestureConfiguration::GetInstance() |
1307 ->set_max_touch_move_in_pixels_for_click(0); | 1343 ->set_max_touch_move_in_pixels_for_click(0); |
1308 WmShelf* shelf = GetPrimaryShelf(); | 1344 WmShelf* shelf = GetPrimaryShelf(); |
1309 { | 1345 { |
1310 SCOPED_TRACE("BOTTOM"); | 1346 SCOPED_TRACE("BOTTOM"); |
1311 shelf->SetAlignment(SHELF_ALIGNMENT_BOTTOM); | 1347 shelf->SetAlignment(SHELF_ALIGNMENT_BOTTOM); |
1312 RunGestureDragTests(gfx::Vector2d(0, 120)); | 1348 RunGestureDragTests(gfx::Vector2d(0, 120)); |
1313 } | 1349 } |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1441 base::TimeDelta::FromMilliseconds(10), 1); | 1477 base::TimeDelta::FromMilliseconds(10), 1); |
1442 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); | 1478 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); |
1443 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState()); | 1479 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState()); |
1444 ShelfAnimationWaiter waiter2(auto_hidden_bounds); | 1480 ShelfAnimationWaiter waiter2(auto_hidden_bounds); |
1445 waiter2.WaitTillDoneAnimating(); | 1481 waiter2.WaitTillDoneAnimating(); |
1446 EXPECT_TRUE(waiter2.WasValidAnimation()); | 1482 EXPECT_TRUE(waiter2.WasValidAnimation()); |
1447 } | 1483 } |
1448 } | 1484 } |
1449 | 1485 |
1450 TEST_F(ShelfLayoutManagerTest, ShelfFlickerOnTrayActivation) { | 1486 TEST_F(ShelfLayoutManagerTest, ShelfFlickerOnTrayActivation) { |
| 1487 // TODO: investigate failure in mash, http://crbug.com/695686. |
| 1488 if (WmShell::Get()->IsRunningInMash()) |
| 1489 return; |
| 1490 |
1451 WmShelf* shelf = GetPrimaryShelf(); | 1491 WmShelf* shelf = GetPrimaryShelf(); |
1452 | 1492 |
1453 // Create a visible window so auto-hide behavior is enforced. | 1493 // Create a visible window so auto-hide behavior is enforced. |
1454 CreateTestWidget(); | 1494 CreateTestWidget(); |
1455 | 1495 |
1456 // Turn on auto-hide for the shelf. | 1496 // Turn on auto-hide for the shelf. |
1457 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); | 1497 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); |
1458 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); | 1498 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); |
1459 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState()); | 1499 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState()); |
1460 | 1500 |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1696 | 1736 |
1697 GetShelfWidget()->Shutdown(); | 1737 GetShelfWidget()->Shutdown(); |
1698 | 1738 |
1699 // Deleting a focused maximized window will switch focus to |window2|. This | 1739 // Deleting a focused maximized window will switch focus to |window2|. This |
1700 // would normally cause the ShelfLayoutManager to update its state. However | 1740 // would normally cause the ShelfLayoutManager to update its state. However |
1701 // during shutdown we want to handle this without crashing. | 1741 // during shutdown we want to handle this without crashing. |
1702 delete window1; | 1742 delete window1; |
1703 } | 1743 } |
1704 | 1744 |
1705 TEST_F(ShelfLayoutManagerTest, ShelfLayoutInUnifiedDesktop) { | 1745 TEST_F(ShelfLayoutManagerTest, ShelfLayoutInUnifiedDesktop) { |
| 1746 // TODO: requires unified desktop mode. http://crbug.com/581462. |
| 1747 if (WmShell::Get()->IsRunningInMash()) |
| 1748 return; |
| 1749 |
1706 Shell::GetInstance()->display_manager()->SetUnifiedDesktopEnabled(true); | 1750 Shell::GetInstance()->display_manager()->SetUnifiedDesktopEnabled(true); |
1707 UpdateDisplay("500x400, 500x400"); | 1751 UpdateDisplay("500x400, 500x400"); |
1708 | 1752 |
1709 StatusAreaWidget* status_area_widget = GetShelfWidget()->status_area_widget(); | 1753 StatusAreaWidget* status_area_widget = GetShelfWidget()->status_area_widget(); |
1710 EXPECT_TRUE(status_area_widget->IsVisible()); | 1754 EXPECT_TRUE(status_area_widget->IsVisible()); |
1711 // Shelf should be in the first display's area. | 1755 // Shelf should be in the first display's area. |
1712 gfx::Rect status_area_bounds(status_area_widget->GetWindowBoundsInScreen()); | 1756 gfx::Rect status_area_bounds(status_area_widget->GetWindowBoundsInScreen()); |
1713 EXPECT_TRUE(gfx::Rect(0, 0, 500, 400).Contains(status_area_bounds)); | 1757 EXPECT_TRUE(gfx::Rect(0, 0, 500, 400).Contains(status_area_bounds)); |
1714 EXPECT_EQ(gfx::Point(500, 400), status_area_bounds.bottom_right()); | 1758 EXPECT_EQ(gfx::Point(500, 400), status_area_bounds.bottom_right()); |
1715 } | 1759 } |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1819 // Open keyboard in sticky mode. | 1863 // Open keyboard in sticky mode. |
1820 kb_controller->ShowKeyboard(true); | 1864 kb_controller->ShowKeyboard(true); |
1821 layout_manager->OnKeyboardBoundsChanging(keyboard_bounds()); | 1865 layout_manager->OnKeyboardBoundsChanging(keyboard_bounds()); |
1822 | 1866 |
1823 // Work area should be changed. | 1867 // Work area should be changed. |
1824 EXPECT_NE(orig_work_area, | 1868 EXPECT_NE(orig_work_area, |
1825 display::Screen::GetScreen()->GetPrimaryDisplay().work_area()); | 1869 display::Screen::GetScreen()->GetPrimaryDisplay().work_area()); |
1826 } | 1870 } |
1827 | 1871 |
1828 } // namespace ash | 1872 } // namespace ash |
OLD | NEW |