OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <memory> | 5 #include <memory> |
6 | 6 |
7 #include "ash/public/cpp/shell_window_ids.h" | 7 #include "ash/public/cpp/shell_window_ids.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ash/shell_port.h" |
9 #include "ash/test/ash_test_base.h" | 10 #include "ash/test/ash_test_base.h" |
10 #include "ash/test/test_app_list_view_presenter_impl.h" | 11 #include "ash/test/test_app_list_view_presenter_impl.h" |
11 #include "ash/wm/window_util.h" | 12 #include "ash/wm/window_util.h" |
12 #include "ash/wm_shell.h" | |
13 #include "ash/wm_window.h" | 13 #include "ash/wm_window.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "ui/app_list/views/app_list_view.h" | 15 #include "ui/app_list/views/app_list_view.h" |
16 #include "ui/aura/test/test_windows.h" | 16 #include "ui/aura/test/test_windows.h" |
17 #include "ui/aura/window.h" | 17 #include "ui/aura/window.h" |
18 #include "ui/display/display.h" | 18 #include "ui/display/display.h" |
19 #include "ui/display/screen.h" | 19 #include "ui/display/screen.h" |
20 #include "ui/events/test/event_generator.h" | 20 #include "ui/events/test/event_generator.h" |
21 | 21 |
22 namespace ash { | 22 namespace ash { |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 generator.GestureTapAt(point_outside); | 119 generator.GestureTapAt(point_outside); |
120 EXPECT_FALSE(app_list_presenter_impl()->GetTargetVisibility()); | 120 EXPECT_FALSE(app_list_presenter_impl()->GetTargetVisibility()); |
121 } | 121 } |
122 | 122 |
123 // Tests opening the app launcher on a non-primary display, then deleting the | 123 // Tests opening the app launcher on a non-primary display, then deleting the |
124 // display. | 124 // display. |
125 TEST_F(AppListPresenterDelegateTest, NonPrimaryDisplay) { | 125 TEST_F(AppListPresenterDelegateTest, NonPrimaryDisplay) { |
126 // Set up a screen with two displays (horizontally adjacent). | 126 // Set up a screen with two displays (horizontally adjacent). |
127 UpdateDisplay("1024x768,1024x768"); | 127 UpdateDisplay("1024x768,1024x768"); |
128 | 128 |
129 std::vector<WmWindow*> root_windows = WmShell::Get()->GetAllRootWindows(); | 129 std::vector<WmWindow*> root_windows = ShellPort::Get()->GetAllRootWindows(); |
130 ASSERT_EQ(2u, root_windows.size()); | 130 ASSERT_EQ(2u, root_windows.size()); |
131 WmWindow* secondary_root = root_windows[1]; | 131 WmWindow* secondary_root = root_windows[1]; |
132 EXPECT_EQ("1024,0 1024x768", secondary_root->GetBoundsInScreen().ToString()); | 132 EXPECT_EQ("1024,0 1024x768", secondary_root->GetBoundsInScreen().ToString()); |
133 | 133 |
134 app_list_presenter_impl()->Show( | 134 app_list_presenter_impl()->Show( |
135 secondary_root->GetDisplayNearestWindow().id()); | 135 secondary_root->GetDisplayNearestWindow().id()); |
136 EXPECT_TRUE(app_list_presenter_impl()->GetTargetVisibility()); | 136 EXPECT_TRUE(app_list_presenter_impl()->GetTargetVisibility()); |
137 | 137 |
138 // Remove the secondary display. Shouldn't crash (http://crbug.com/368990). | 138 // Remove the secondary display. Shouldn't crash (http://crbug.com/368990). |
139 UpdateDisplay("1024x768"); | 139 UpdateDisplay("1024x768"); |
(...skipping 17 matching lines...) Expand all Loading... |
157 // the actual app list position (the widget bounds include the bubble border | 157 // the actual app list position (the widget bounds include the bubble border |
158 // which is much bigger than the actual app list size). | 158 // which is much bigger than the actual app list size). |
159 app_list::AppListView* app_list = app_list_presenter_impl()->GetView(); | 159 app_list::AppListView* app_list = app_list_presenter_impl()->GetView(); |
160 int app_list_view_top = | 160 int app_list_view_top = |
161 app_list->anchor_rect().y() - app_list->bounds().height() / 2; | 161 app_list->anchor_rect().y() - app_list->bounds().height() / 2; |
162 const int kMinimalAppListMargin = 10; | 162 const int kMinimalAppListMargin = 10; |
163 EXPECT_GE(app_list_view_top, kMinimalAppListMargin); | 163 EXPECT_GE(app_list_view_top, kMinimalAppListMargin); |
164 } | 164 } |
165 | 165 |
166 } // namespace ash | 166 } // namespace ash |
OLD | NEW |