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/common/shell_window_ids.h" | 7 #include "ash/common/shell_window_ids.h" |
8 #include "ash/common/wm_shell.h" | 8 #include "ash/common/wm_shell.h" |
9 #include "ash/common/wm_window.h" | 9 #include "ash/common/wm_window.h" |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 // Remove the secondary display. Shouldn't crash (http://crbug.com/368990). | 143 // Remove the secondary display. Shouldn't crash (http://crbug.com/368990). |
144 UpdateDisplay("1024x768"); | 144 UpdateDisplay("1024x768"); |
145 | 145 |
146 // Updating the displays should close the app list. | 146 // Updating the displays should close the app list. |
147 EXPECT_FALSE(WmShell::Get()->GetAppListTargetVisibility()); | 147 EXPECT_FALSE(WmShell::Get()->GetAppListTargetVisibility()); |
148 } | 148 } |
149 | 149 |
150 // Tests opening the app launcher on a tiny display that is too small to contain | 150 // Tests opening the app launcher on a tiny display that is too small to contain |
151 // it. | 151 // it. |
152 TEST_F(AppListPresenterDelegateTest, TinyDisplay) { | 152 TEST_F(AppListPresenterDelegateTest, TinyDisplay) { |
153 // UpdateDisplay is not supported in this case, so just skip the test. | |
154 if (!SupportsHostWindowResize()) | |
155 return; | |
156 | |
157 // Set up a screen with a tiny display (height smaller than the app list). | 153 // Set up a screen with a tiny display (height smaller than the app list). |
158 UpdateDisplay("400x300"); | 154 UpdateDisplay("400x300"); |
159 | 155 |
160 WmShell::Get()->ShowAppList(); | 156 WmShell::Get()->ShowAppList(); |
161 EXPECT_TRUE(WmShell::Get()->GetAppListTargetVisibility()); | 157 EXPECT_TRUE(WmShell::Get()->GetAppListTargetVisibility()); |
162 | 158 |
163 // The top of the app list should be on-screen (even if the bottom is not). | 159 // The top of the app list should be on-screen (even if the bottom is not). |
164 // We need to manually calculate the Y coordinate of the top of the app list | 160 // We need to manually calculate the Y coordinate of the top of the app list |
165 // from the anchor (center) and height. There isn't a bounds rect that gives | 161 // from the anchor (center) and height. There isn't a bounds rect that gives |
166 // the actual app list position (the widget bounds include the bubble border | 162 // the actual app list position (the widget bounds include the bubble border |
167 // which is much bigger than the actual app list size). | 163 // which is much bigger than the actual app list size). |
168 app_list::AppListView* app_list = GetAppListPresenter()->GetView(); | 164 app_list::AppListView* app_list = GetAppListPresenter()->GetView(); |
169 int app_list_view_top = | 165 int app_list_view_top = |
170 app_list->anchor_rect().y() - app_list->bounds().height() / 2; | 166 app_list->anchor_rect().y() - app_list->bounds().height() / 2; |
171 EXPECT_GE(app_list_view_top, kMinimalAppListMargin); | 167 EXPECT_GE(app_list_view_top, kMinimalAppListMargin); |
172 } | 168 } |
173 | 169 |
174 } // namespace ash | 170 } // namespace ash |
OLD | NEW |