Chromium Code Reviews| 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/app_list/app_list_presenter_delegate_factory.h" | |
| 7 #include "ash/aura/wm_shelf_aura.h" | 8 #include "ash/aura/wm_shelf_aura.h" |
| 8 #include "ash/aura/wm_window_aura.h" | 9 #include "ash/aura/wm_window_aura.h" |
| 9 #include "ash/common/accelerators/accelerator_controller.h" | 10 #include "ash/common/accelerators/accelerator_controller.h" |
| 10 #include "ash/common/accelerators/accelerator_table.h" | 11 #include "ash/common/accelerators/accelerator_table.h" |
| 11 #include "ash/common/focus_cycler.h" | 12 #include "ash/common/focus_cycler.h" |
| 12 #include "ash/common/material_design/material_design_controller.h" | 13 #include "ash/common/material_design/material_design_controller.h" |
| 13 #include "ash/common/session/session_state_delegate.h" | 14 #include "ash/common/session/session_state_delegate.h" |
| 14 #include "ash/common/shelf/shelf_constants.h" | 15 #include "ash/common/shelf/shelf_constants.h" |
| 15 #include "ash/common/shelf/shelf_layout_manager_observer.h" | 16 #include "ash/common/shelf/shelf_layout_manager_observer.h" |
| 16 #include "ash/common/shelf/shelf_view.h" | 17 #include "ash/common/shelf/shelf_view.h" |
| 17 #include "ash/common/shelf/shelf_widget.h" | 18 #include "ash/common/shelf/shelf_widget.h" |
| 18 #include "ash/common/shelf/wm_shelf.h" | 19 #include "ash/common/shelf/wm_shelf.h" |
| 19 #include "ash/common/system/status_area_widget.h" | 20 #include "ash/common/system/status_area_widget.h" |
| 20 #include "ash/common/system/tray/system_tray.h" | 21 #include "ash/common/system/tray/system_tray.h" |
| 21 #include "ash/common/system/tray/system_tray_item.h" | 22 #include "ash/common/system/tray/system_tray_item.h" |
| 22 #include "ash/common/wm/window_state.h" | 23 #include "ash/common/wm/window_state.h" |
| 23 #include "ash/common/wm_shell.h" | 24 #include "ash/common/wm_shell.h" |
| 24 #include "ash/public/cpp/shell_window_ids.h" | 25 #include "ash/public/cpp/shell_window_ids.h" |
| 25 #include "ash/root_window_controller.h" | 26 #include "ash/root_window_controller.h" |
| 26 #include "ash/shell.h" | 27 #include "ash/shell.h" |
| 27 #include "ash/test/ash_test_base.h" | 28 #include "ash/test/ash_test_base.h" |
| 28 #include "ash/test/test_system_tray_item.h" | 29 #include "ash/test/test_system_tray_item.h" |
| 29 #include "ash/wm/window_state_aura.h" | 30 #include "ash/wm/window_state_aura.h" |
| 30 #include "ash/wm/window_util.h" | 31 #include "ash/wm/window_util.h" |
| 31 #include "base/command_line.h" | 32 #include "base/command_line.h" |
| 32 #include "base/run_loop.h" | 33 #include "base/run_loop.h" |
| 34 #include "ui/app_list/presenter/app_list_presenter_impl.h" | |
| 35 #include "ui/app_list/presenter/test/test_app_list_view_delegate_factory.h" | |
| 33 #include "ui/aura/client/aura_constants.h" | 36 #include "ui/aura/client/aura_constants.h" |
| 34 #include "ui/aura/client/window_parenting_client.h" | 37 #include "ui/aura/client/window_parenting_client.h" |
| 35 #include "ui/aura/window.h" | 38 #include "ui/aura/window.h" |
| 36 #include "ui/aura/window_event_dispatcher.h" | 39 #include "ui/aura/window_event_dispatcher.h" |
| 37 #include "ui/base/ui_base_switches.h" | 40 #include "ui/base/ui_base_switches.h" |
| 38 #include "ui/compositor/layer.h" | 41 #include "ui/compositor/layer.h" |
| 39 #include "ui/compositor/layer_animator.h" | 42 #include "ui/compositor/layer_animator.h" |
| 40 #include "ui/compositor/scoped_animation_duration_scale_mode.h" | 43 #include "ui/compositor/scoped_animation_duration_scale_mode.h" |
| 41 #include "ui/display/display.h" | 44 #include "ui/display/display.h" |
| 42 #include "ui/display/display_layout.h" | 45 #include "ui/display/display_layout.h" |
| (...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 940 | 943 |
| 941 // Trying to activate the status should fail, since we only allow activating | 944 // Trying to activate the status should fail, since we only allow activating |
| 942 // it when the user is using the keyboard (i.e. through FocusCycler). | 945 // it when the user is using the keyboard (i.e. through FocusCycler). |
| 943 GetShelfWidget()->status_area_widget()->Activate(); | 946 GetShelfWidget()->status_area_widget()->Activate(); |
| 944 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState()); | 947 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState()); |
| 945 | 948 |
| 946 GetShelfWidget()->GetFocusCycler()->RotateFocus(FocusCycler::FORWARD); | 949 GetShelfWidget()->GetFocusCycler()->RotateFocus(FocusCycler::FORWARD); |
| 947 EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->GetAutoHideState()); | 950 EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->GetAutoHideState()); |
| 948 } | 951 } |
| 949 | 952 |
| 950 // Makes sure shelf will be visible when app list opens as shelf is in | 953 // Ensure a SHELF_VISIBLE shelf stays visible when the app list is shown. |
| 951 // SHELF_VISIBLE state,and toggling app list won't change shelf | |
| 952 // visibility state. | |
| 953 TEST_F(ShelfLayoutManagerTest, OpenAppListWithShelfVisibleState) { | 954 TEST_F(ShelfLayoutManagerTest, OpenAppListWithShelfVisibleState) { |
| 954 WmShell* shell = WmShell::Get(); | |
| 955 WmShelf* shelf = GetPrimaryShelf(); | 955 WmShelf* shelf = GetPrimaryShelf(); |
| 956 ShelfLayoutManager* layout_manager = GetShelfLayoutManager(); | |
| 957 layout_manager->LayoutShelf(); | |
| 958 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); | 956 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); |
| 959 | 957 |
| 960 // Create a normal unmaximized window, shelf should be visible. | 958 // The tested behavior relies on the app list presenter implementation. |
| 959 AppListPresenterDelegateFactory app_list_presenter_delegate_factory( | |
|
mfomitchev
2016/12/22 03:17:45
This repeats in a bunch of places (and not just in
msw
2016/12/22 16:31:52
Yup, unfortunately, some tests depend on the prese
| |
| 960 base::MakeUnique<app_list::TestAppListViewDelegateFactory>()); | |
| 961 app_list::AppListPresenterImpl app_list_presenter_impl( | |
| 962 &app_list_presenter_delegate_factory); | |
| 963 | |
| 964 // Create a normal unmaximized window; the shelf should be visible. | |
| 961 aura::Window* window = CreateTestWindow(); | 965 aura::Window* window = CreateTestWindow(); |
| 962 window->SetBounds(gfx::Rect(0, 0, 100, 100)); | 966 window->SetBounds(gfx::Rect(0, 0, 100, 100)); |
| 963 window->Show(); | 967 window->Show(); |
| 964 EXPECT_FALSE(shell->GetAppListTargetVisibility()); | 968 GetShelfLayoutManager()->UpdateVisibilityState(); |
|
mfomitchev
2016/12/22 03:17:45
Why is this necessary? If everything is set up pro
msw
2016/12/22 16:31:52
Done (I left in the one originally at line 996 wit
| |
| 969 EXPECT_FALSE(app_list_presenter_impl.GetTargetVisibility()); | |
| 965 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState()); | 970 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState()); |
| 966 | 971 |
| 967 // Show app list and the shelf stays visible. | 972 // Show the app list and the shelf stays visible. |
| 968 shell->ShowAppList(); | 973 app_list_presenter_impl.Show(display_manager()->first_display_id()); |
| 969 EXPECT_TRUE(shell->GetAppListTargetVisibility()); | 974 GetShelfLayoutManager()->UpdateVisibilityState(); |
| 975 EXPECT_TRUE(app_list_presenter_impl.GetTargetVisibility()); | |
| 970 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState()); | 976 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState()); |
| 971 | 977 |
| 972 // Hide app list and the shelf stays visible. | 978 // Hide the app list and the shelf stays visible. |
| 973 shell->DismissAppList(); | 979 app_list_presenter_impl.Dismiss(); |
| 974 EXPECT_FALSE(shell->GetAppListTargetVisibility()); | 980 GetShelfLayoutManager()->UpdateVisibilityState(); |
| 981 EXPECT_FALSE(app_list_presenter_impl.GetTargetVisibility()); | |
| 975 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState()); | 982 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState()); |
| 976 } | 983 } |
| 977 | 984 |
| 978 // Makes sure shelf will be shown with SHELF_AUTO_HIDE_SHOWN state | 985 // Ensure a SHELF_AUTO_HIDE shelf is shown temporarily (SHELF_AUTO_HIDE_SHOWN) |
| 979 // when app list opens as shelf is in SHELF_AUTO_HIDE state, and | 986 // when the app list is shown, but the visibility state doesn't change. |
| 980 // toggling app list won't change shelf visibility state. | |
| 981 TEST_F(ShelfLayoutManagerTest, OpenAppListWithShelfAutoHideState) { | 987 TEST_F(ShelfLayoutManagerTest, OpenAppListWithShelfAutoHideState) { |
| 982 WmShell* shell = WmShell::Get(); | |
| 983 WmShelf* shelf = GetPrimaryShelf(); | 988 WmShelf* shelf = GetPrimaryShelf(); |
| 984 ShelfLayoutManager* layout_manager = GetShelfLayoutManager(); | |
| 985 layout_manager->LayoutShelf(); | |
| 986 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); | 989 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); |
| 987 | 990 |
| 988 EXPECT_FALSE(shell->GetAppListTargetVisibility()); | 991 // The tested behavior relies on the app list presenter implementation. |
| 992 AppListPresenterDelegateFactory app_list_presenter_delegate_factory( | |
| 993 base::MakeUnique<app_list::TestAppListViewDelegateFactory>()); | |
| 994 app_list::AppListPresenterImpl app_list_presenter_impl( | |
| 995 &app_list_presenter_delegate_factory); | |
| 996 | |
| 997 // Create a normal unmaximized window; the shelf should be hidden. | |
| 998 aura::Window* window = CreateTestWindow(); | |
| 999 window->SetBounds(gfx::Rect(0, 0, 100, 100)); | |
| 1000 window->Show(); | |
| 1001 GetShelfLayoutManager()->UpdateVisibilityState(); | |
| 1002 EXPECT_FALSE(app_list_presenter_impl.GetTargetVisibility()); | |
| 1003 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); | |
| 1004 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState()); | |
| 1005 | |
| 1006 // Show the app list and the shelf should be temporarily visible. | |
| 1007 app_list_presenter_impl.Show(display_manager()->first_display_id()); | |
| 1008 GetShelfLayoutManager()->UpdateVisibilityState(); | |
| 1009 EXPECT_TRUE(app_list_presenter_impl.GetTargetVisibility()); | |
| 989 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); | 1010 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); |
| 990 EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->GetAutoHideState()); | 1011 EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->GetAutoHideState()); |
| 991 | 1012 |
| 992 // Show app list. | 1013 // Hide the app list and the shelf should be hidden again. |
| 993 shell->ShowAppList(); | 1014 app_list_presenter_impl.Dismiss(); |
| 994 // The shelf's auto hide state won't be changed until the timer fires, so | 1015 GetShelfLayoutManager()->UpdateVisibilityState(); |
| 995 // force it to update now. | 1016 EXPECT_FALSE(app_list_presenter_impl.GetTargetVisibility()); |
| 996 layout_manager->UpdateVisibilityState(); | |
| 997 EXPECT_TRUE(shell->GetAppListTargetVisibility()); | |
| 998 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); | 1017 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); |
| 999 EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->GetAutoHideState()); | 1018 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState()); |
| 1000 | |
| 1001 // Hide app list. | |
| 1002 shell->DismissAppList(); | |
| 1003 EXPECT_FALSE(shell->GetAppListTargetVisibility()); | |
| 1004 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); | |
| 1005 EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->GetAutoHideState()); | |
| 1006 } | 1019 } |
| 1007 | 1020 |
| 1008 // Makes sure that when we have dual displays, with one or both shelves are set | 1021 // Makes sure that when we have dual displays, with one or both shelves are set |
| 1009 // to AutoHide, viewing the AppList on one of them doesn't unhide the other | 1022 // to AutoHide, viewing the AppList on one of them doesn't unhide the other |
| 1010 // hidden shelf. | 1023 // hidden shelf. |
| 1011 TEST_F(ShelfLayoutManagerTest, DualDisplayOpenAppListWithShelfAutoHideState) { | 1024 TEST_F(ShelfLayoutManagerTest, DualDisplayOpenAppListWithShelfAutoHideState) { |
| 1012 if (!SupportsMultipleDisplays()) | 1025 if (!SupportsMultipleDisplays()) |
| 1013 return; | 1026 return; |
| 1014 | 1027 |
| 1015 // Create two displays. | 1028 // Create two displays. |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 1036 aura::Window* window_2 = CreateTestWindowInParent(root_windows[1]); | 1049 aura::Window* window_2 = CreateTestWindowInParent(root_windows[1]); |
| 1037 window_2->SetBounds(gfx::Rect(201, 0, 100, 100)); | 1050 window_2->SetBounds(gfx::Rect(201, 0, 100, 100)); |
| 1038 window_2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); | 1051 window_2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
| 1039 window_2->Show(); | 1052 window_2->Show(); |
| 1040 | 1053 |
| 1041 EXPECT_EQ(shelf_1->GetWindow()->GetRootWindow(), | 1054 EXPECT_EQ(shelf_1->GetWindow()->GetRootWindow(), |
| 1042 WmWindowAura::Get(window_1)->GetRootWindow()); | 1055 WmWindowAura::Get(window_1)->GetRootWindow()); |
| 1043 EXPECT_EQ(shelf_2->GetWindow()->GetRootWindow(), | 1056 EXPECT_EQ(shelf_2->GetWindow()->GetRootWindow(), |
| 1044 WmWindowAura::Get(window_2)->GetRootWindow()); | 1057 WmWindowAura::Get(window_2)->GetRootWindow()); |
| 1045 | 1058 |
| 1046 // Activate one window in one display and manually trigger the update of shelf | 1059 // Activate one window in one display. |
| 1047 // visibility. | |
| 1048 wm::ActivateWindow(window_1); | 1060 wm::ActivateWindow(window_1); |
| 1061 | |
| 1062 // The tested behavior relies on the app list presenter implementation. | |
| 1063 AppListPresenterDelegateFactory app_list_presenter_delegate_factory( | |
| 1064 base::MakeUnique<app_list::TestAppListViewDelegateFactory>()); | |
| 1065 app_list::AppListPresenterImpl app_list_presenter_impl( | |
| 1066 &app_list_presenter_delegate_factory); | |
| 1067 | |
| 1049 Shell::GetInstance()->UpdateShelfVisibility(); | 1068 Shell::GetInstance()->UpdateShelfVisibility(); |
| 1050 | 1069 EXPECT_FALSE(app_list_presenter_impl.GetTargetVisibility()); |
| 1051 EXPECT_FALSE(WmShell::Get()->GetAppListTargetVisibility()); | |
| 1052 EXPECT_EQ(SHELF_AUTO_HIDE, shelf_1->GetVisibilityState()); | 1070 EXPECT_EQ(SHELF_AUTO_HIDE, shelf_1->GetVisibilityState()); |
| 1053 EXPECT_EQ(SHELF_AUTO_HIDE, shelf_2->GetVisibilityState()); | 1071 EXPECT_EQ(SHELF_AUTO_HIDE, shelf_2->GetVisibilityState()); |
| 1054 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf_1->GetAutoHideState()); | 1072 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf_1->GetAutoHideState()); |
| 1055 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf_2->GetAutoHideState()); | 1073 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf_2->GetAutoHideState()); |
| 1056 | 1074 |
| 1057 // Show app list. | 1075 // Show the app list; only the shelf on the same display should be shown. |
| 1058 WmShell::Get()->ShowAppList(); | 1076 app_list_presenter_impl.Show(display_manager()->first_display_id()); |
| 1059 Shell::GetInstance()->UpdateShelfVisibility(); | 1077 Shell::GetInstance()->UpdateShelfVisibility(); |
| 1060 | 1078 EXPECT_TRUE(app_list_presenter_impl.GetTargetVisibility()); |
| 1061 // Only the shelf in the active display should be shown, the other is hidden. | |
| 1062 EXPECT_TRUE(WmShell::Get()->GetAppListTargetVisibility()); | |
| 1063 EXPECT_EQ(SHELF_AUTO_HIDE, shelf_1->GetVisibilityState()); | 1079 EXPECT_EQ(SHELF_AUTO_HIDE, shelf_1->GetVisibilityState()); |
| 1064 EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf_1->GetAutoHideState()); | 1080 EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf_1->GetAutoHideState()); |
| 1065 EXPECT_EQ(SHELF_AUTO_HIDE, shelf_2->GetVisibilityState()); | 1081 EXPECT_EQ(SHELF_AUTO_HIDE, shelf_2->GetVisibilityState()); |
| 1066 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf_2->GetAutoHideState()); | 1082 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf_2->GetAutoHideState()); |
| 1067 | 1083 |
| 1068 // Hide app list, both shelves should be hidden. | 1084 // Hide the app list, both shelves should be hidden. |
| 1069 WmShell::Get()->DismissAppList(); | 1085 app_list_presenter_impl.Dismiss(); |
| 1070 EXPECT_FALSE(WmShell::Get()->GetAppListTargetVisibility()); | 1086 Shell::GetInstance()->UpdateShelfVisibility(); |
| 1087 EXPECT_FALSE(app_list_presenter_impl.GetTargetVisibility()); | |
| 1071 EXPECT_EQ(SHELF_AUTO_HIDE, shelf_1->GetVisibilityState()); | 1088 EXPECT_EQ(SHELF_AUTO_HIDE, shelf_1->GetVisibilityState()); |
| 1072 EXPECT_EQ(SHELF_AUTO_HIDE, shelf_2->GetVisibilityState()); | 1089 EXPECT_EQ(SHELF_AUTO_HIDE, shelf_2->GetVisibilityState()); |
| 1073 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf_1->GetAutoHideState()); | 1090 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf_1->GetAutoHideState()); |
| 1074 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf_2->GetAutoHideState()); | 1091 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf_2->GetAutoHideState()); |
| 1075 } | 1092 } |
| 1076 | 1093 |
| 1077 // Makes sure the shelf will be hidden when we have a fullscreen window, and it | 1094 // Ensure a SHELF_HIDDEN shelf (for a fullscreen window) is shown temporarily |
| 1078 // will unhide when we open the app list. | 1095 // when the app list is shown, and hidden again when the app list is dismissed. |
| 1079 TEST_F(ShelfLayoutManagerTest, OpenAppListWithShelfHiddenState) { | 1096 TEST_F(ShelfLayoutManagerTest, OpenAppListWithShelfHiddenState) { |
| 1080 WmShell* shell = WmShell::Get(); | |
| 1081 WmShelf* shelf = GetPrimaryShelf(); | 1097 WmShelf* shelf = GetPrimaryShelf(); |
| 1082 ShelfLayoutManager* layout_manager = GetShelfLayoutManager(); | |
| 1083 // For shelf to be visible, app list is not open in initial state. | |
| 1084 layout_manager->LayoutShelf(); | |
| 1085 | 1098 |
| 1086 // Create a window and make it full screen. | 1099 // The tested behavior relies on the app list presenter implementation. |
| 1100 AppListPresenterDelegateFactory app_list_presenter_delegate_factory( | |
| 1101 base::MakeUnique<app_list::TestAppListViewDelegateFactory>()); | |
| 1102 app_list::AppListPresenterImpl app_list_presenter_impl( | |
| 1103 &app_list_presenter_delegate_factory); | |
| 1104 | |
| 1105 // Create a window and make it full screen; the shelf should be hidden. | |
| 1087 aura::Window* window = CreateTestWindow(); | 1106 aura::Window* window = CreateTestWindow(); |
| 1088 window->SetBounds(gfx::Rect(0, 0, 100, 100)); | 1107 window->SetBounds(gfx::Rect(0, 0, 100, 100)); |
| 1089 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); | 1108 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); |
| 1090 window->Show(); | 1109 window->Show(); |
| 1091 wm::ActivateWindow(window); | 1110 wm::ActivateWindow(window); |
| 1092 | 1111 GetShelfLayoutManager()->UpdateVisibilityState(); |
| 1093 // App list and shelf is not shown. | 1112 EXPECT_FALSE(app_list_presenter_impl.GetTargetVisibility()); |
| 1094 EXPECT_FALSE(shell->GetAppListTargetVisibility()); | |
| 1095 EXPECT_EQ(SHELF_HIDDEN, shelf->GetVisibilityState()); | 1113 EXPECT_EQ(SHELF_HIDDEN, shelf->GetVisibilityState()); |
| 1096 | 1114 |
| 1097 // Show app list. | 1115 // Show the app list and the shelf should be temporarily visible. |
| 1098 shell->ShowAppList(); | 1116 app_list_presenter_impl.Show(display_manager()->first_display_id()); |
| 1099 EXPECT_TRUE(shell->GetAppListTargetVisibility()); | 1117 GetShelfLayoutManager()->UpdateVisibilityState(); |
| 1118 EXPECT_TRUE(app_list_presenter_impl.GetTargetVisibility()); | |
| 1100 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState()); | 1119 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState()); |
| 1101 | 1120 |
| 1102 // Hide app list. | 1121 // Hide the app list and the shelf should be hidden again. |
| 1103 shell->DismissAppList(); | 1122 app_list_presenter_impl.Dismiss(); |
| 1104 EXPECT_FALSE(shell->GetAppListTargetVisibility()); | 1123 GetShelfLayoutManager()->UpdateVisibilityState(); |
| 1124 EXPECT_FALSE(app_list_presenter_impl.GetTargetVisibility()); | |
| 1105 EXPECT_EQ(SHELF_HIDDEN, shelf->GetVisibilityState()); | 1125 EXPECT_EQ(SHELF_HIDDEN, shelf->GetVisibilityState()); |
| 1106 } | 1126 } |
| 1107 | 1127 |
| 1108 // Tests the correct behavior of the shelf when there is a system modal window | 1128 // Tests the correct behavior of the shelf when there is a system modal window |
| 1109 // open when we have a single display. | 1129 // open when we have a single display. |
| 1110 TEST_F(ShelfLayoutManagerTest, ShelfWithSystemModalWindowSingleDisplay) { | 1130 TEST_F(ShelfLayoutManagerTest, ShelfWithSystemModalWindowSingleDisplay) { |
| 1111 WmShelf* shelf = GetPrimaryShelf(); | 1131 WmShelf* shelf = GetPrimaryShelf(); |
| 1112 ShelfLayoutManager* layout_manager = GetShelfLayoutManager(); | 1132 ShelfLayoutManager* layout_manager = GetShelfLayoutManager(); |
| 1113 layout_manager->LayoutShelf(); | 1133 layout_manager->LayoutShelf(); |
| 1114 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); | 1134 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); |
| (...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1849 // Open keyboard in sticky mode. | 1869 // Open keyboard in sticky mode. |
| 1850 kb_controller->ShowKeyboard(true); | 1870 kb_controller->ShowKeyboard(true); |
| 1851 layout_manager->OnKeyboardBoundsChanging(keyboard_bounds()); | 1871 layout_manager->OnKeyboardBoundsChanging(keyboard_bounds()); |
| 1852 | 1872 |
| 1853 // Work area should be changed. | 1873 // Work area should be changed. |
| 1854 EXPECT_NE(orig_work_area, | 1874 EXPECT_NE(orig_work_area, |
| 1855 display::Screen::GetScreen()->GetPrimaryDisplay().work_area()); | 1875 display::Screen::GetScreen()->GetPrimaryDisplay().work_area()); |
| 1856 } | 1876 } |
| 1857 | 1877 |
| 1858 } // namespace ash | 1878 } // namespace ash |
| OLD | NEW |