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/ash_switches.h" | 7 #include "ash/ash_switches.h" |
8 #include "ash/public/cpp/config.h" | 8 #include "ash/public/cpp/config.h" |
9 #include "ash/public/cpp/shell_window_ids.h" | 9 #include "ash/public/cpp/shell_window_ids.h" |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 // which is much bigger than the actual app list size). | 182 // which is much bigger than the actual app list size). |
183 | 183 |
184 app_list::AppListView* app_list = app_list_presenter_impl()->GetView(); | 184 app_list::AppListView* app_list = app_list_presenter_impl()->GetView(); |
185 int app_list_view_top = | 185 int app_list_view_top = |
186 app_list->anchor_rect().y() - app_list->bounds().height() / 2; | 186 app_list->anchor_rect().y() - app_list->bounds().height() / 2; |
187 const int kMinimalAppListMargin = 10; | 187 const int kMinimalAppListMargin = 10; |
188 | 188 |
189 EXPECT_GE(app_list_view_top, kMinimalAppListMargin); | 189 EXPECT_GE(app_list_view_top, kMinimalAppListMargin); |
190 } | 190 } |
191 | 191 |
192 // Tests that the peeking app list is enlarged to fullscreen after the user | |
193 // types in the search box. | |
194 TEST_F(AppListPresenterDelegateTest, SnapToFullscreenAfterSearchboxInput) { | |
195 // TODO(newcomer): investigate failure in mash. http://crbug.com/726838. | |
196 if (Shell::GetAshConfig() == Config::MASH) | |
197 return; | |
198 | |
199 EnableFullscreenAppList(); | |
200 UpdateDisplay("1024x768"); | |
201 EXPECT_TRUE(app_list::features::IsFullscreenAppListEnabled()); | |
202 app_list_presenter_impl()->Show(GetPrimaryDisplayId()); | |
203 app_list::AppListView* app_list = app_list_presenter_impl()->GetView(); | |
204 // Check that it is in peeking mode. | |
205 EXPECT_FALSE(app_list->is_fullscreen()); | |
206 | |
207 // Dummy key event to search box. | |
208 ui::test::EventGenerator& generator = GetEventGenerator(); | |
209 generator.PressKey(ui::KeyboardCode::VKEY_0, 0); | |
210 // Check that it is in fullscreen mode. | |
211 EXPECT_TRUE(app_list->is_fullscreen()); | |
212 } | |
213 | |
214 // Tests that the peeking app list closes if the user taps outside its | 192 // Tests that the peeking app list closes if the user taps outside its |
215 // bounds. | 193 // bounds. |
216 TEST_F(AppListPresenterDelegateTest, TapAndClickOutsideClosesPeekingAppList) { | 194 TEST_F(AppListPresenterDelegateTest, TapAndClickOutsideClosesPeekingAppList) { |
217 EnableFullscreenAppList(); | 195 EnableFullscreenAppList(); |
218 | 196 |
219 app_list_presenter_impl()->Show(GetPrimaryDisplayId()); | 197 app_list_presenter_impl()->Show(GetPrimaryDisplayId()); |
220 EXPECT_TRUE(app_list_presenter_impl()->GetTargetVisibility()); | 198 EXPECT_TRUE(app_list_presenter_impl()->GetTargetVisibility()); |
221 ui::test::EventGenerator& generator = GetEventGenerator(); | 199 ui::test::EventGenerator& generator = GetEventGenerator(); |
222 | 200 |
223 // Grab the bounds of the search box, | 201 // Grab the bounds of the search box, |
(...skipping 22 matching lines...) Expand all Loading... |
246 app_list_presenter_impl()->Show(GetPrimaryDisplayId()); | 224 app_list_presenter_impl()->Show(GetPrimaryDisplayId()); |
247 EXPECT_TRUE(app_list_presenter_impl()->GetTargetVisibility()); | 225 EXPECT_TRUE(app_list_presenter_impl()->GetTargetVisibility()); |
248 | 226 |
249 // Clicking outside the bounds closes the app list. | 227 // Clicking outside the bounds closes the app list. |
250 generator.MoveMouseTo(tap_point); | 228 generator.MoveMouseTo(tap_point); |
251 generator.ClickLeftButton(); | 229 generator.ClickLeftButton(); |
252 EXPECT_FALSE(app_list_presenter_impl()->GetTargetVisibility()); | 230 EXPECT_FALSE(app_list_presenter_impl()->GetTargetVisibility()); |
253 } | 231 } |
254 | 232 |
255 } // namespace ash | 233 } // namespace ash |
OLD | NEW |