Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Side by Side Diff: ash/app_list/app_list_presenter_delegate_unittest.cc

Issue 2952763002: SearchBoxView now enables/disables cursor based on user interaction. (Closed)
Patch Set: rebased. Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | testing/buildbot/filters/ash_unittests_mash.filter » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/shelf_types.h" 9 #include "ash/public/cpp/shelf_types.h"
10 #include "ash/public/cpp/shell_window_ids.h" 10 #include "ash/public/cpp/shell_window_ids.h"
11 #include "ash/shelf/shelf.h" 11 #include "ash/shelf/shelf.h"
12 #include "ash/shelf/shelf_layout_manager.h" 12 #include "ash/shelf/shelf_layout_manager.h"
13 #include "ash/shell.h" 13 #include "ash/shell.h"
14 #include "ash/shell_port.h" 14 #include "ash/shell_port.h"
15 #include "ash/test/ash_test_base.h" 15 #include "ash/test/ash_test_base.h"
16 #include "ash/test/test_app_list_view_presenter_impl.h" 16 #include "ash/test/test_app_list_view_presenter_impl.h"
17 #include "ash/wm/maximize_mode/maximize_mode_controller.h" 17 #include "ash/wm/maximize_mode/maximize_mode_controller.h"
18 #include "ash/wm/window_util.h" 18 #include "ash/wm/window_util.h"
19 #include "base/command_line.h" 19 #include "base/command_line.h"
20 #include "base/macros.h" 20 #include "base/macros.h"
21 #include "base/test/scoped_feature_list.h" 21 #include "base/test/scoped_feature_list.h"
22 #include "ui/app_list/app_list_features.h" 22 #include "ui/app_list/app_list_features.h"
23 #include "ui/app_list/app_list_switches.h" 23 #include "ui/app_list/app_list_switches.h"
24 #include "ui/app_list/views/app_list_main_view.h" 24 #include "ui/app_list/views/app_list_main_view.h"
25 #include "ui/app_list/views/app_list_view.h" 25 #include "ui/app_list/views/app_list_view.h"
26 #include "ui/app_list/views/search_box_view.h"
26 #include "ui/aura/test/test_windows.h" 27 #include "ui/aura/test/test_windows.h"
27 #include "ui/aura/window.h" 28 #include "ui/aura/window.h"
28 #include "ui/display/display.h" 29 #include "ui/display/display.h"
29 #include "ui/display/screen.h" 30 #include "ui/display/screen.h"
30 #include "ui/events/test/event_generator.h" 31 #include "ui/events/test/event_generator.h"
32 #include "ui/views/controls/textfield/textfield.h"
31 33
32 namespace ash { 34 namespace ash {
33 namespace { 35 namespace {
34 36
35 int64_t GetPrimaryDisplayId() { 37 int64_t GetPrimaryDisplayId() {
36 return display::Screen::GetScreen()->GetPrimaryDisplay().id(); 38 return display::Screen::GetScreen()->GetPrimaryDisplay().id();
37 } 39 }
38 40
39 void SetShelfAlignment(ShelfAlignment alignment) { 41 void SetShelfAlignment(ShelfAlignment alignment) {
40 test::AshTestBase::GetPrimaryShelf()->SetAlignment(alignment); 42 test::AshTestBase::GetPrimaryShelf()->SetAlignment(alignment);
(...skipping 13 matching lines...) Expand all
54 ~AppListPresenterDelegateTest() override {} 56 ~AppListPresenterDelegateTest() override {}
55 57
56 app_list::AppListPresenterImpl* app_list_presenter_impl() { 58 app_list::AppListPresenterImpl* app_list_presenter_impl() {
57 return &app_list_presenter_impl_; 59 return &app_list_presenter_impl_;
58 } 60 }
59 61
60 // testing::Test: 62 // testing::Test:
61 void SetUp() override { 63 void SetUp() override {
62 AshTestBase::SetUp(); 64 AshTestBase::SetUp();
63 65
64 // If the current test is parameterized. 66 if (testing::UnitTest::GetInstance()->current_test_info()->value_param() &&
65 if (testing::UnitTest::GetInstance()->current_test_info()->value_param()) { 67 GetParam()) {
66 test_with_fullscreen_ = GetParam(); 68 EnableFullscreenAppList();
67 if (test_with_fullscreen_)
68 EnableFullscreenAppList();
69 } 69 }
70
70 // Make the display big enough to hold the app list. 71 // Make the display big enough to hold the app list.
71 UpdateDisplay("1024x768"); 72 UpdateDisplay("1024x768");
72 } 73 }
73 74
74 void EnableFullscreenAppList() { 75 void EnableFullscreenAppList() {
75 scoped_feature_list_.InitAndEnableFeature( 76 scoped_feature_list_.InitAndEnableFeature(
76 app_list::features::kEnableFullscreenAppList); 77 app_list::features::kEnableFullscreenAppList);
77 } 78 }
78 79
79 private: 80 private:
80 test::TestAppListViewPresenterImpl app_list_presenter_impl_; 81 test::TestAppListViewPresenterImpl app_list_presenter_impl_;
81 bool test_with_fullscreen_;
82 base::test::ScopedFeatureList scoped_feature_list_; 82 base::test::ScopedFeatureList scoped_feature_list_;
83 83
84 DISALLOW_COPY_AND_ASSIGN(AppListPresenterDelegateTest); 84 DISALLOW_COPY_AND_ASSIGN(AppListPresenterDelegateTest);
85 }; 85 };
86 86
87 // TODO(Newcomer): Remove FullscreenAppListPresenterDelegateTest when the
88 // fullscreen app list becomes default.
89 class FullscreenAppListPresenterDelegateTest
90 : public test::AshTestBase,
91 public testing::WithParamInterface<bool> {
92 public:
93 FullscreenAppListPresenterDelegateTest() {}
94 ~FullscreenAppListPresenterDelegateTest() override {}
95
96 app_list::AppListPresenterImpl* app_list_presenter_impl() {
97 return &app_list_presenter_impl_;
98 }
99
100 // testing::Test:
101 void SetUp() override {
102 AshTestBase::SetUp();
103
104 scoped_feature_list_.InitAndEnableFeature(
105 app_list::features::kEnableFullscreenAppList);
106
107 // Make the display big enough to hold the app list.
108 UpdateDisplay("1024x768");
109 }
110
111 // Whether to run the test with mouse or gesture events.
112 bool TestMouseEventParam() { return GetParam(); }
113
114 gfx::Point GetPointOutsideSearchbox() {
115 return app_list_presenter_impl()->GetView()->GetBoundsInScreen().origin();
116 }
117
118 gfx::Point GetPointInsideSearchbox() {
119 return app_list_presenter_impl_.GetView()
120 ->search_box_view()
121 ->GetBoundsInScreen()
122 .origin();
123 }
124
125 private:
126 test::TestAppListViewPresenterImpl app_list_presenter_impl_;
127 base::test::ScopedFeatureList scoped_feature_list_;
128
129 DISALLOW_COPY_AND_ASSIGN(FullscreenAppListPresenterDelegateTest);
130 };
131
87 // Instantiate the Boolean which is used to toggle the Fullscreen app list in 132 // Instantiate the Boolean which is used to toggle the Fullscreen app list in
88 // the parameterized tests. 133 // the parameterized tests.
89 INSTANTIATE_TEST_CASE_P(, AppListPresenterDelegateTest, testing::Bool()); 134 INSTANTIATE_TEST_CASE_P(, AppListPresenterDelegateTest, testing::Bool());
90 135
136 // Instantiate the Boolean which is used to toggle mouse and touch events in
137 // the parameterized tests.
138 INSTANTIATE_TEST_CASE_P(,
139 FullscreenAppListPresenterDelegateTest,
140 testing::Bool());
141
91 // Tests that app list hides when focus moves to a normal window. 142 // Tests that app list hides when focus moves to a normal window.
92 TEST_P(AppListPresenterDelegateTest, HideOnFocusOut) { 143 TEST_P(AppListPresenterDelegateTest, HideOnFocusOut) {
93 app_list_presenter_impl()->Show(GetPrimaryDisplayId()); 144 app_list_presenter_impl()->Show(GetPrimaryDisplayId());
94 EXPECT_TRUE(app_list_presenter_impl()->GetTargetVisibility()); 145 EXPECT_TRUE(app_list_presenter_impl()->GetTargetVisibility());
95 146
96 std::unique_ptr<aura::Window> window(CreateTestWindowInShellWithId(0)); 147 std::unique_ptr<aura::Window> window(CreateTestWindowInShellWithId(0));
97 wm::ActivateWindow(window.get()); 148 wm::ActivateWindow(window.get());
98 149
99 EXPECT_FALSE(app_list_presenter_impl()->GetTargetVisibility()); 150 EXPECT_FALSE(app_list_presenter_impl()->GetTargetVisibility());
100 } 151 }
(...skipping 28 matching lines...) Expand all
129 // Click outside the bubble. This should close it. 180 // Click outside the bubble. This should close it.
130 gfx::Rect app_window_bounds = app_window->GetBoundsInRootWindow(); 181 gfx::Rect app_window_bounds = app_window->GetBoundsInRootWindow();
131 gfx::Point point_outside = 182 gfx::Point point_outside =
132 gfx::Point(app_window_bounds.right(), app_window_bounds.y()) + 183 gfx::Point(app_window_bounds.right(), app_window_bounds.y()) +
133 gfx::Vector2d(10, 0); 184 gfx::Vector2d(10, 0);
134 generator.MoveMouseToInHost(point_outside); 185 generator.MoveMouseToInHost(point_outside);
135 generator.ClickLeftButton(); 186 generator.ClickLeftButton();
136 EXPECT_FALSE(app_list_presenter_impl()->GetTargetVisibility()); 187 EXPECT_FALSE(app_list_presenter_impl()->GetTargetVisibility());
137 } 188 }
138 189
139 // Tests that clicking outside the app-list bubble closes it. 190 // Tests that tapping outside the app-list bubble closes it.
140 TEST_F(AppListPresenterDelegateTest, TapOutsideBubbleClosesBubble) { 191 TEST_F(AppListPresenterDelegateTest, TapOutsideBubbleClosesBubble) {
141 app_list_presenter_impl()->Show(GetPrimaryDisplayId()); 192 app_list_presenter_impl()->Show(GetPrimaryDisplayId());
142 193
143 aura::Window* app_window = app_list_presenter_impl()->GetWindow(); 194 aura::Window* app_window = app_list_presenter_impl()->GetWindow();
144 ASSERT_TRUE(app_window); 195 ASSERT_TRUE(app_window);
145 gfx::Rect app_window_bounds = app_window->GetBoundsInRootWindow(); 196 gfx::Rect app_window_bounds = app_window->GetBoundsInRootWindow();
146 197
147 ui::test::EventGenerator& generator = GetEventGenerator(); 198 ui::test::EventGenerator& generator = GetEventGenerator();
148 // Click on the bubble itself. The bubble should remain visible. 199 // Click on the bubble itself. The bubble should remain visible.
149 generator.GestureTapAt(app_window_bounds.CenterPoint()); 200 generator.GestureTapAt(app_window_bounds.CenterPoint());
150 EXPECT_TRUE(app_list_presenter_impl()->GetTargetVisibility()); 201 EXPECT_TRUE(app_list_presenter_impl()->GetTargetVisibility());
151 202
152 // Click outside the bubble. This should close it. 203 // Tap outside the bubble. This should close it.
153 gfx::Point point_outside = 204 gfx::Point point_outside =
154 gfx::Point(app_window_bounds.right(), app_window_bounds.y()) + 205 gfx::Point(app_window_bounds.right(), app_window_bounds.y()) +
155 gfx::Vector2d(10, 0); 206 gfx::Vector2d(10, 0);
156 generator.GestureTapAt(point_outside); 207 generator.GestureTapAt(point_outside);
157 EXPECT_FALSE(app_list_presenter_impl()->GetTargetVisibility()); 208 EXPECT_FALSE(app_list_presenter_impl()->GetTargetVisibility());
158 } 209 }
159 210
160 // Tests opening the app list on a non-primary display, then deleting the 211 // Tests opening the app list on a non-primary display, then deleting the
161 // display. 212 // display.
162 TEST_P(AppListPresenterDelegateTest, NonPrimaryDisplay) { 213 TEST_P(AppListPresenterDelegateTest, NonPrimaryDisplay) {
(...skipping 26 matching lines...) Expand all
189 app_list_presenter_impl()->Show(GetPrimaryDisplayId()); 240 app_list_presenter_impl()->Show(GetPrimaryDisplayId());
190 EXPECT_TRUE(app_list_presenter_impl()->GetTargetVisibility()); 241 EXPECT_TRUE(app_list_presenter_impl()->GetTargetVisibility());
191 242
192 // The top of the app list should be on-screen (even if the bottom is not). 243 // The top of the app list should be on-screen (even if the bottom is not).
193 // We need to manually calculate the Y coordinate of the top of the app list 244 // We need to manually calculate the Y coordinate of the top of the app list
194 // from the anchor (center) and height. There isn't a bounds rect that gives 245 // from the anchor (center) and height. There isn't a bounds rect that gives
195 // the actual app list position (the widget bounds include the bubble border 246 // the actual app list position (the widget bounds include the bubble border
196 // which is much bigger than the actual app list size). 247 // which is much bigger than the actual app list size).
197 248
198 app_list::AppListView* app_list = app_list_presenter_impl()->GetView(); 249 app_list::AppListView* app_list = app_list_presenter_impl()->GetView();
199 int app_list_view_top = 250 const int app_list_view_top =
200 app_list->anchor_rect().y() - app_list->bounds().height() / 2; 251 app_list->anchor_rect().y() - app_list->bounds().height() / 2;
201 const int kMinimalAppListMargin = 10; 252 const int kMinimalAppListMargin = 10;
202 253
203 EXPECT_GE(app_list_view_top, kMinimalAppListMargin); 254 EXPECT_GE(app_list_view_top, kMinimalAppListMargin);
204 } 255 }
205 256
206 // Tests that the app list initializes in fullscreen with side shelf alignment 257 // Tests that the app list initializes in fullscreen with side shelf alignment
207 // and that the state transitions via text input act properly. 258 // and that the state transitions via text input act properly.
208 TEST_F(AppListPresenterDelegateTest, SideShelfAlignmentTextStateTransitions) { 259 TEST_F(FullscreenAppListPresenterDelegateTest,
260 SideShelfAlignmentTextStateTransitions) {
209 // TODO(newcomer): Investigate mash failures crbug.com/726838 261 // TODO(newcomer): Investigate mash failures crbug.com/726838
210 EnableFullscreenAppList();
211 SetShelfAlignment(ShelfAlignment::SHELF_ALIGNMENT_LEFT); 262 SetShelfAlignment(ShelfAlignment::SHELF_ALIGNMENT_LEFT);
212 263
213 // Open the app list with side shelf alignment, then check that it is in 264 // Open the app list with side shelf alignment, then check that it is in
214 // fullscreen mode. 265 // fullscreen mode.
215 app_list_presenter_impl()->Show(GetPrimaryDisplayId()); 266 app_list_presenter_impl()->Show(GetPrimaryDisplayId());
216 app_list::AppListView* app_list = app_list_presenter_impl()->GetView(); 267 app_list::AppListView* app_list = app_list_presenter_impl()->GetView();
217 EXPECT_TRUE(app_list->is_fullscreen()); 268 EXPECT_TRUE(app_list->is_fullscreen());
218 EXPECT_EQ(app_list->app_list_state(), 269 EXPECT_EQ(app_list->app_list_state(),
219 app_list::AppListView::FULLSCREEN_ALL_APPS); 270 app_list::AppListView::FULLSCREEN_ALL_APPS);
220 271
221 // Enter text in the searchbox, the app list should transition to fullscreen 272 // Enter text in the searchbox, the app list should transition to fullscreen
222 // search. 273 // search.
223 ui::test::EventGenerator& generator = GetEventGenerator(); 274 ui::test::EventGenerator& generator = GetEventGenerator();
224 generator.PressKey(ui::KeyboardCode::VKEY_0, 0); 275 generator.PressKey(ui::KeyboardCode::VKEY_0, 0);
225 EXPECT_EQ(app_list->app_list_state(), 276 EXPECT_EQ(app_list->app_list_state(),
226 app_list::AppListView::FULLSCREEN_SEARCH); 277 app_list::AppListView::FULLSCREEN_SEARCH);
227 278
228 // Delete the text in the searchbox, the app list should transition to 279 // Delete the text in the searchbox, the app list should transition to
229 // fullscreen all apps. 280 // fullscreen all apps.
230 generator.PressKey(ui::KeyboardCode::VKEY_BACK, 0); 281 generator.PressKey(ui::KeyboardCode::VKEY_BACK, 0);
231 EXPECT_EQ(app_list->app_list_state(), 282 EXPECT_EQ(app_list->app_list_state(),
232 app_list::AppListView::FULLSCREEN_ALL_APPS); 283 app_list::AppListView::FULLSCREEN_ALL_APPS);
233 } 284 }
234 285
235 // Tests that the app list initializes in peeking with bottom shelf alignment 286 // Tests that the app list initializes in peeking with bottom shelf alignment
236 // and that the state transitions via text input act properly. 287 // and that the state transitions via text input act properly.
237 TEST_F(AppListPresenterDelegateTest, BottomShelfAlignmentTextStateTransitions) { 288 TEST_F(FullscreenAppListPresenterDelegateTest,
289 BottomShelfAlignmentTextStateTransitions) {
238 // TODO(newcomer): Investigate mash failures crbug.com/726838 290 // TODO(newcomer): Investigate mash failures crbug.com/726838
239 EnableFullscreenAppList();
240 app_list_presenter_impl()->Show(GetPrimaryDisplayId()); 291 app_list_presenter_impl()->Show(GetPrimaryDisplayId());
241 app_list::AppListView* app_list = app_list_presenter_impl()->GetView(); 292 app_list::AppListView* app_list = app_list_presenter_impl()->GetView();
242 EXPECT_FALSE(app_list->is_fullscreen()); 293 EXPECT_FALSE(app_list->is_fullscreen());
243 EXPECT_EQ(app_list->app_list_state(), app_list::AppListView::PEEKING); 294 EXPECT_EQ(app_list->app_list_state(), app_list::AppListView::PEEKING);
244 295
245 // Enter text in the searchbox, this should transition the app list to half 296 // Enter text in the searchbox, this should transition the app list to half
246 // state. 297 // state.
247 ui::test::EventGenerator& generator = GetEventGenerator(); 298 ui::test::EventGenerator& generator = GetEventGenerator();
248 generator.PressKey(ui::KeyboardCode::VKEY_0, 0); 299 generator.PressKey(ui::KeyboardCode::VKEY_0, 0);
249 EXPECT_EQ(app_list->app_list_state(), app_list::AppListView::HALF); 300 EXPECT_EQ(app_list->app_list_state(), app_list::AppListView::HALF);
250 301
251 // Empty the searchbox, this should transition the app list to it's previous 302 // Empty the searchbox, this should transition the app list to it's previous
252 // state. 303 // state.
253 generator.PressKey(ui::KeyboardCode::VKEY_BACK, 0); 304 generator.PressKey(ui::KeyboardCode::VKEY_BACK, 0);
254 EXPECT_EQ(app_list->app_list_state(), app_list::AppListView::PEEKING); 305 EXPECT_EQ(app_list->app_list_state(), app_list::AppListView::PEEKING);
255 } 306 }
256 307
257 // Tests that the app list initializes in fullscreen with maximize mode active 308 // Tests that the app list initializes in fullscreen with maximize mode active
258 // and that the state transitions via text input act properly. 309 // and that the state transitions via text input act properly.
259 TEST_F(AppListPresenterDelegateTest, MaximizeModeTextStateTransitions) { 310 TEST_F(FullscreenAppListPresenterDelegateTest,
311 MaximizeModeTextStateTransitions) {
260 // TODO(newcomer): Investigate mash failures crbug.com/726838 312 // TODO(newcomer): Investigate mash failures crbug.com/726838
261 EnableFullscreenAppList();
262 EnableMaximizeMode(true); 313 EnableMaximizeMode(true);
263 app_list_presenter_impl()->Show(GetPrimaryDisplayId()); 314 app_list_presenter_impl()->Show(GetPrimaryDisplayId());
264 app_list::AppListView* app_list = app_list_presenter_impl()->GetView(); 315 app_list::AppListView* app_list = app_list_presenter_impl()->GetView();
265 EXPECT_EQ(app_list->app_list_state(), 316 EXPECT_EQ(app_list->app_list_state(),
266 app_list::AppListView::FULLSCREEN_ALL_APPS); 317 app_list::AppListView::FULLSCREEN_ALL_APPS);
267 318
268 // Enter text in the searchbox, the app list should transition to fullscreen 319 // Enter text in the searchbox, the app list should transition to fullscreen
269 // search. 320 // search.
270 ui::test::EventGenerator& generator = GetEventGenerator(); 321 ui::test::EventGenerator& generator = GetEventGenerator();
271 generator.PressKey(ui::KeyboardCode::VKEY_0, 0); 322 generator.PressKey(ui::KeyboardCode::VKEY_0, 0);
272 EXPECT_EQ(app_list->app_list_state(), 323 EXPECT_EQ(app_list->app_list_state(),
273 app_list::AppListView::FULLSCREEN_SEARCH); 324 app_list::AppListView::FULLSCREEN_SEARCH);
274 325
275 // Delete the text in the searchbox, the app list should transition to 326 // Delete the text in the searchbox, the app list should transition to
276 // fullscreen all apps. generator.PressKey(ui::KeyboardCode::VKEY_BACK, 0); 327 // fullscreen all apps. generator.PressKey(ui::KeyboardCode::VKEY_BACK, 0);
277 generator.PressKey(ui::KeyboardCode::VKEY_BACK, 0); 328 generator.PressKey(ui::KeyboardCode::VKEY_BACK, 0);
278 EXPECT_EQ(app_list->app_list_state(), 329 EXPECT_EQ(app_list->app_list_state(),
279 app_list::AppListView::FULLSCREEN_ALL_APPS); 330 app_list::AppListView::FULLSCREEN_ALL_APPS);
280 } 331 }
281 332
282 // Tests that the app list state responds correctly to maximize mode being 333 // Tests that the app list state responds correctly to maximize mode being
283 // enabled while the app list is being shown. 334 // enabled while the app list is being shown.
284 TEST_F(AppListPresenterDelegateTest, 335 TEST_F(FullscreenAppListPresenterDelegateTest,
285 PeekingToFullscreenWhenMaximizeModeIsActive) { 336 PeekingToFullscreenWhenMaximizeModeIsActive) {
286 // TODO(newcomer): Investigate mash failures crbug.com/726838 337 // TODO(newcomer): Investigate mash failures crbug.com/726838
287 EnableFullscreenAppList();
288 app_list_presenter_impl()->Show(GetPrimaryDisplayId()); 338 app_list_presenter_impl()->Show(GetPrimaryDisplayId());
289 app_list::AppListView* app_list = app_list_presenter_impl()->GetView(); 339 app_list::AppListView* app_list = app_list_presenter_impl()->GetView();
290 EXPECT_EQ(app_list->app_list_state(), app_list::AppListView::PEEKING); 340 EXPECT_EQ(app_list->app_list_state(), app_list::AppListView::PEEKING);
291 // Enable maximize mode, this should force the app list to switch to the 341 // Enable maximize mode, this should force the app list to switch to the
292 // fullscreen equivalent of the current state. 342 // fullscreen equivalent of the current state.
293 EnableMaximizeMode(true); 343 EnableMaximizeMode(true);
294 EXPECT_EQ(app_list->app_list_state(), 344 EXPECT_EQ(app_list->app_list_state(),
295 app_list::AppListView::FULLSCREEN_ALL_APPS); 345 app_list::AppListView::FULLSCREEN_ALL_APPS);
296 // Disable maximize mode, the state of the app list should not change. 346 // Disable maximize mode, the state of the app list should not change.
297 EnableMaximizeMode(false); 347 EnableMaximizeMode(false);
298 EXPECT_EQ(app_list->app_list_state(), 348 EXPECT_EQ(app_list->app_list_state(),
299 app_list::AppListView::FULLSCREEN_ALL_APPS); 349 app_list::AppListView::FULLSCREEN_ALL_APPS);
300 // Enter text in the searchbox, the app list should transition to fullscreen 350 // Enter text in the searchbox, the app list should transition to fullscreen
301 // search. 351 // search.
302 ui::test::EventGenerator& generator = GetEventGenerator(); 352 ui::test::EventGenerator& generator = GetEventGenerator();
303 generator.PressKey(ui::KeyboardCode::VKEY_0, 0); 353 generator.PressKey(ui::KeyboardCode::VKEY_0, 0);
304 EXPECT_EQ(app_list->app_list_state(), 354 EXPECT_EQ(app_list->app_list_state(),
305 app_list::AppListView::FULLSCREEN_SEARCH); 355 app_list::AppListView::FULLSCREEN_SEARCH);
306 356
307 // Delete the text in the searchbox, the app list should transition to 357 // Delete the text in the searchbox, the app list should transition to
308 // fullscreen all apps. generator.PressKey(ui::KeyboardCode::VKEY_BACK, 0); 358 // fullscreen all apps. generator.PressKey(ui::KeyboardCode::VKEY_BACK, 0);
309 generator.PressKey(ui::KeyboardCode::VKEY_BACK, 0); 359 generator.PressKey(ui::KeyboardCode::VKEY_BACK, 0);
310 EXPECT_EQ(app_list->app_list_state(), 360 EXPECT_EQ(app_list->app_list_state(),
311 app_list::AppListView::FULLSCREEN_ALL_APPS); 361 app_list::AppListView::FULLSCREEN_ALL_APPS);
312 } 362 }
313 363
314 // Tests that the app list state responds correctly to maximize mode being 364 // Tests that the app list state responds correctly to maximize mode being
315 // enabled while the app list is being shown with half launcher. 365 // enabled while the app list is being shown with half launcher.
316 TEST_F(AppListPresenterDelegateTest, HalfToFullscreenWhenMaximizeModeIsActive) { 366 TEST_F(FullscreenAppListPresenterDelegateTest,
367 HalfToFullscreenWhenMaximizeModeIsActive) {
317 // TODO(newcomer): Investigate mash failures crbug.com/726838 368 // TODO(newcomer): Investigate mash failures crbug.com/726838
318 EnableFullscreenAppList();
319 app_list_presenter_impl()->Show(GetPrimaryDisplayId()); 369 app_list_presenter_impl()->Show(GetPrimaryDisplayId());
320 app_list::AppListView* app_list = app_list_presenter_impl()->GetView(); 370 app_list::AppListView* app_list = app_list_presenter_impl()->GetView();
321 EXPECT_EQ(app_list->app_list_state(), app_list::AppListView::PEEKING); 371 EXPECT_EQ(app_list->app_list_state(), app_list::AppListView::PEEKING);
322 372
323 // Enter text in the search box to transition to half app list. 373 // Enter text in the search box to transition to half app list.
324 ui::test::EventGenerator& generator = GetEventGenerator(); 374 ui::test::EventGenerator& generator = GetEventGenerator();
325 generator.PressKey(ui::KeyboardCode::VKEY_0, 0); 375 generator.PressKey(ui::KeyboardCode::VKEY_0, 0);
326 EXPECT_EQ(app_list->app_list_state(), app_list::AppListView::HALF); 376 EXPECT_EQ(app_list->app_list_state(), app_list::AppListView::HALF);
327 377
328 // Enable maximize mode and force the app list to transition to the fullscreen 378 // Enable maximize mode and force the app list to transition to the fullscreen
329 // equivalent of the current state. 379 // equivalent of the current state.
330 EnableMaximizeMode(true); 380 EnableMaximizeMode(true);
331 EXPECT_EQ(app_list->app_list_state(), 381 EXPECT_EQ(app_list->app_list_state(),
332 app_list::AppListView::FULLSCREEN_SEARCH); 382 app_list::AppListView::FULLSCREEN_SEARCH);
333 generator.PressKey(ui::KeyboardCode::VKEY_BACK, 0); 383 generator.PressKey(ui::KeyboardCode::VKEY_BACK, 0);
334 EXPECT_EQ(app_list->app_list_state(), 384 EXPECT_EQ(app_list->app_list_state(),
335 app_list::AppListView::FULLSCREEN_ALL_APPS); 385 app_list::AppListView::FULLSCREEN_ALL_APPS);
336 } 386 }
337 387
338 // Tests that the app list view handles drag properly in laptop mode. 388 // Tests that the app list view handles drag properly in laptop mode.
339 TEST_F(AppListPresenterDelegateTest, AppListViewDragHandler) { 389 TEST_F(FullscreenAppListPresenterDelegateTest, AppListViewDragHandler) {
340 // TODO(newcomer): Investigate mash failures crbug.com/726838 390 // TODO(newcomer): Investigate mash failures crbug.com/726838
341 EnableFullscreenAppList();
342 app_list_presenter_impl()->Show(GetPrimaryDisplayId()); 391 app_list_presenter_impl()->Show(GetPrimaryDisplayId());
343 app_list::AppListView* app_list = app_list_presenter_impl()->GetView(); 392 app_list::AppListView* app_list = app_list_presenter_impl()->GetView();
344 EXPECT_EQ(app_list->app_list_state(), app_list::AppListView::PEEKING); 393 EXPECT_EQ(app_list->app_list_state(), app_list::AppListView::PEEKING);
345 394
346 ui::test::EventGenerator& generator = GetEventGenerator(); 395 ui::test::EventGenerator& generator = GetEventGenerator();
347 // Execute a slow short upwards drag this should fail to transition the app 396 // Execute a slow short upwards drag this should fail to transition the app
348 // list. 397 // list.
349 int top_of_app_list = app_list_presenter_impl() 398 int top_of_app_list = app_list_presenter_impl()
350 ->GetView() 399 ->GetView()
351 ->GetWidget() 400 ->GetWidget()
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 EXPECT_EQ(app_list->app_list_state(), 441 EXPECT_EQ(app_list->app_list_state(),
393 app_list::AppListView::FULLSCREEN_SEARCH); 442 app_list::AppListView::FULLSCREEN_SEARCH);
394 443
395 // Execute a long downward drag, this should close the app list. 444 // Execute a long downward drag, this should close the app list.
396 generator.GestureScrollSequence(gfx::Point(10, 10), gfx::Point(10, 900), 445 generator.GestureScrollSequence(gfx::Point(10, 10), gfx::Point(10, 900),
397 base::TimeDelta::FromMilliseconds(100), 10); 446 base::TimeDelta::FromMilliseconds(100), 10);
398 EXPECT_EQ(app_list->app_list_state(), app_list::AppListView::CLOSED); 447 EXPECT_EQ(app_list->app_list_state(), app_list::AppListView::CLOSED);
399 } 448 }
400 449
401 // Tests that the app list view handles drag properly in maximize mode. 450 // Tests that the app list view handles drag properly in maximize mode.
402 TEST_F(AppListPresenterDelegateTest, 451 TEST_F(FullscreenAppListPresenterDelegateTest,
403 AppListViewDragHandlerMaximizeModeFromAllApps) { 452 AppListViewDragHandlerMaximizeModeFromAllApps) {
404 // TODO(newcomer): Investigate mash failures crbug.com/726838 453 // TODO(newcomer): Investigate mash failures crbug.com/726838
405 EnableFullscreenAppList();
406 EnableMaximizeMode(true); 454 EnableMaximizeMode(true);
407 app_list_presenter_impl()->Show(GetPrimaryDisplayId()); 455 app_list_presenter_impl()->Show(GetPrimaryDisplayId());
408 app_list::AppListView* app_list = app_list_presenter_impl()->GetView(); 456 app_list::AppListView* app_list = app_list_presenter_impl()->GetView();
409 EXPECT_EQ(app_list->app_list_state(), 457 EXPECT_EQ(app_list->app_list_state(),
410 app_list::AppListView::FULLSCREEN_ALL_APPS); 458 app_list::AppListView::FULLSCREEN_ALL_APPS);
411 459
412 ui::test::EventGenerator& generator = GetEventGenerator(); 460 ui::test::EventGenerator& generator = GetEventGenerator();
413 // Drag down. 461 // Drag down.
414 generator.GestureScrollSequence(gfx::Point(0, 0), gfx::Point(0, 720), 462 generator.GestureScrollSequence(gfx::Point(0, 0), gfx::Point(0, 720),
415 base::TimeDelta::FromMilliseconds(100), 10); 463 base::TimeDelta::FromMilliseconds(100), 10);
416 EXPECT_EQ(app_list->app_list_state(), app_list::AppListView::CLOSED); 464 EXPECT_EQ(app_list->app_list_state(), app_list::AppListView::CLOSED);
417 } 465 }
418 466
419 // Tests that the state of the app list changes properly with drag input from 467 // Tests that the state of the app list changes properly with drag input from
420 // fullscreen search. 468 // fullscreen search.
421 TEST_F(AppListPresenterDelegateTest, 469 TEST_F(FullscreenAppListPresenterDelegateTest,
422 AppListViewDragHandlerMaximizeModeFromSearch) { 470 AppListViewDragHandlerMaximizeModeFromSearch) {
423 // TODO(newcomer): Investigate mash failures crbug.com/726838 471 // TODO(newcomer): Investigate mash failures crbug.com/726838
424 // Reset the app list.
425 EnableFullscreenAppList();
426 EnableMaximizeMode(true); 472 EnableMaximizeMode(true);
427 app_list_presenter_impl()->Show(GetPrimaryDisplayId()); 473 app_list_presenter_impl()->Show(GetPrimaryDisplayId());
428 app_list::AppListView* app_list = app_list_presenter_impl()->GetView(); 474 app_list::AppListView* app_list = app_list_presenter_impl()->GetView();
429 EXPECT_EQ(app_list->app_list_state(), 475 EXPECT_EQ(app_list->app_list_state(),
430 app_list::AppListView::FULLSCREEN_ALL_APPS); 476 app_list::AppListView::FULLSCREEN_ALL_APPS);
431 // Type in the search box to transition to |FULLSCREEN_SEARCH|. 477 // Type in the search box to transition to |FULLSCREEN_SEARCH|.
432 ui::test::EventGenerator& generator = GetEventGenerator(); 478 ui::test::EventGenerator& generator = GetEventGenerator();
433 generator.PressKey(ui::KeyboardCode::VKEY_0, 0); 479 generator.PressKey(ui::KeyboardCode::VKEY_0, 0);
434 EXPECT_EQ(app_list->app_list_state(), 480 EXPECT_EQ(app_list->app_list_state(),
435 app_list::AppListView::FULLSCREEN_SEARCH); 481 app_list::AppListView::FULLSCREEN_SEARCH);
436 // Drag down, this should close the app list. 482 // Drag down, this should close the app list.
437 generator.GestureScrollSequence(gfx::Point(0, 0), gfx::Point(0, 720), 483 generator.GestureScrollSequence(gfx::Point(0, 0), gfx::Point(0, 720),
438 base::TimeDelta::FromMilliseconds(100), 10); 484 base::TimeDelta::FromMilliseconds(100), 10);
439 EXPECT_EQ(app_list->app_list_state(), app_list::AppListView::CLOSED); 485 EXPECT_EQ(app_list->app_list_state(), app_list::AppListView::CLOSED);
440 } 486 }
441 487
442 // Tests that the bottom shelf background is hidden when the app list is shown 488 // Tests that the bottom shelf background is hidden when the app list is shown
443 // in laptop mode. 489 // in laptop mode.
444 TEST_F(AppListPresenterDelegateTest, 490 TEST_F(FullscreenAppListPresenterDelegateTest,
445 ShelfBackgroundIsHiddenWhenAppListIsShown) { 491 ShelfBackgroundIsHiddenWhenAppListIsShown) {
446 EnableFullscreenAppList();
447 app_list_presenter_impl()->Show(GetPrimaryDisplayId()); 492 app_list_presenter_impl()->Show(GetPrimaryDisplayId());
448 ShelfLayoutManager* shelf_layout_manager = 493 ShelfLayoutManager* shelf_layout_manager =
449 Shelf::ForWindow(Shell::GetRootWindowForDisplayId(GetPrimaryDisplayId())) 494 Shelf::ForWindow(Shell::GetRootWindowForDisplayId(GetPrimaryDisplayId()))
450 ->shelf_layout_manager(); 495 ->shelf_layout_manager();
451 EXPECT_TRUE(shelf_layout_manager->GetShelfBackgroundType() == 496 EXPECT_TRUE(shelf_layout_manager->GetShelfBackgroundType() ==
452 ShelfBackgroundType::SHELF_BACKGROUND_DEFAULT); 497 ShelfBackgroundType::SHELF_BACKGROUND_DEFAULT);
453 } 498 }
454 499
455 // Tests that the peeking app list closes if the user taps outside its 500 // Tests that the peeking app list closes if the user taps or clicks outside
456 // bounds. 501 // its bounds.
457 TEST_F(AppListPresenterDelegateTest, TapAndClickOutsideClosesPeekingAppList) { 502 TEST_P(FullscreenAppListPresenterDelegateTest,
458 // TODO(newcomer): Investigate mash failures crbug.com/726838 503 TapAndClickOutsideClosesPeekingAppList) {
459 EnableFullscreenAppList(); 504 const bool test_mouse_event = TestMouseEventParam();
460 app_list_presenter_impl()->Show(GetPrimaryDisplayId()); 505 app_list_presenter_impl()->Show(GetPrimaryDisplayId());
461 EXPECT_TRUE(app_list_presenter_impl()->GetTargetVisibility()); 506 EXPECT_EQ(app_list_presenter_impl()->GetView()->app_list_state(),
507 app_list::AppListView::PEEKING);
462 ui::test::EventGenerator& generator = GetEventGenerator(); 508 ui::test::EventGenerator& generator = GetEventGenerator();
463 509
464 // Grab the bounds of the search box, 510 // Tapping outside the bounds closes the app list.
465 // which is guaranteed to be inside the app list. 511 gfx::Point tap_point =
466 gfx::Point tap_point = app_list_presenter_impl() 512 app_list_presenter_impl()->GetView()->bounds().origin();
467 ->GetView() 513 tap_point.Offset(0, -10);
468 ->search_box_widget() 514 if (test_mouse_event) {
469 ->GetContentsView() 515 generator.MoveMouseTo(tap_point);
470 ->GetBoundsInScreen() 516 generator.ClickLeftButton();
471 .CenterPoint(); 517 generator.ReleaseLeftButton();
518 } else {
519 generator.GestureTapAt(tap_point);
520 }
521 EXPECT_FALSE(app_list_presenter_impl()->IsVisible());
522 }
472 523
473 // Tapping inside the bounds doesn't close the app list. 524 // Tests that a keypress activates the searchbox and that clearing the
474 generator.GestureTapAt(tap_point); 525 // searchbox deactivates the searchbox.
475 EXPECT_TRUE(app_list_presenter_impl()->GetTargetVisibility()); 526 TEST_F(FullscreenAppListPresenterDelegateTest, KeyPressEnablesSearchBox) {
527 app_list_presenter_impl()->Show(GetPrimaryDisplayId());
528 ui::test::EventGenerator& generator = GetEventGenerator();
529 app_list::SearchBoxView* search_box_view =
530 app_list_presenter_impl()->GetView()->search_box_view();
531 EXPECT_FALSE(search_box_view->is_search_box_active());
476 532
477 // Clicking inside the bounds doesn't close the app list. 533 // Press any key, the search box should be active.
478 generator.MoveMouseTo(tap_point); 534 generator.PressKey(ui::VKEY_0, 0);
479 generator.ClickLeftButton(); 535 EXPECT_TRUE(search_box_view->is_search_box_active());
480 EXPECT_TRUE(app_list_presenter_impl()->GetTargetVisibility());
481 536
482 // Tapping outside the bounds closes the app list. 537 // Delete the text, the search box should be inactive.
483 tap_point.set_x(tap_point.x() + 750); 538 search_box_view->ClearSearch();
484 generator.GestureTapAt(tap_point); 539 EXPECT_FALSE(search_box_view->is_search_box_active());
485 EXPECT_FALSE(app_list_presenter_impl()->GetTargetVisibility()); 540 }
486 541
542 // Tests that a tap/click on the AppListView from half launcher returns the
543 // AppListView to Peeking, and that a tap/click on the AppListView from
544 // Peeking closes the app list.
545 TEST_P(FullscreenAppListPresenterDelegateTest,
546 StateTransitionsByTapAndClickingAppListBodyFromHalf) {
547 const bool test_mouse_event = TestMouseEventParam();
487 app_list_presenter_impl()->Show(GetPrimaryDisplayId()); 548 app_list_presenter_impl()->Show(GetPrimaryDisplayId());
488 EXPECT_TRUE(app_list_presenter_impl()->GetTargetVisibility()); 549 app_list::AppListView* app_list_view = app_list_presenter_impl()->GetView();
550 app_list::SearchBoxView* search_box_view = app_list_view->search_box_view();
551 ui::test::EventGenerator& generator = GetEventGenerator();
552 EXPECT_EQ(app_list_view->app_list_state(),
553 app_list::AppListView::AppListState::PEEKING);
489 554
490 // Clicking outside the bounds closes the app list. 555 // Press a key, the AppListView should transition to half.
491 generator.MoveMouseTo(tap_point); 556 generator.PressKey(ui::KeyboardCode::VKEY_0, 0);
492 generator.ClickLeftButton(); 557 EXPECT_EQ(app_list_view->app_list_state(),
493 EXPECT_FALSE(app_list_presenter_impl()->GetTargetVisibility()); 558 app_list::AppListView::AppListState::HALF);
559 EXPECT_TRUE(search_box_view->is_search_box_active());
560
561 // Tap outside the search box, the AppListView should transition to Peeking
562 // and the search box should be inactive.
563
564 if (test_mouse_event) {
565 generator.MoveMouseTo(GetPointOutsideSearchbox());
566 generator.ClickLeftButton();
567 generator.ReleaseLeftButton();
568 } else {
569 generator.GestureTapDownAndUp(GetPointOutsideSearchbox());
570 }
571 EXPECT_EQ(app_list_view->app_list_state(), app_list::AppListView::PEEKING);
572 EXPECT_FALSE(search_box_view->is_search_box_active());
573
574 // Tap outside the search box again, the AppListView should hide.
575 if (test_mouse_event) {
576 generator.MoveMouseTo(GetPointOutsideSearchbox());
577 generator.ClickLeftButton();
578 generator.ReleaseLeftButton();
579 } else {
580 generator.GestureTapDownAndUp(GetPointOutsideSearchbox());
581 }
582 EXPECT_EQ(app_list_presenter_impl()->GetView()->app_list_state(),
583 app_list::AppListView::CLOSED);
584 }
585
586 // Tests that a tap/click on the AppListView from Fullscreen search returns
587 // the AppListView to fullscreen all apps, and that a tap/click on the
588 // AppListView from fullscreen all apps closes the app list.
589 TEST_P(FullscreenAppListPresenterDelegateTest,
590 StateTransitionsByTappingAppListBodyFromFullscreen) {
591 const bool test_mouse_event = TestMouseEventParam();
592 app_list_presenter_impl()->Show(GetPrimaryDisplayId());
593 app_list::AppListView* app_list_view = app_list_presenter_impl()->GetView();
594 app_list::SearchBoxView* search_box_view = app_list_view->search_box_view();
595 ui::test::EventGenerator& generator = GetEventGenerator();
596
597 // Execute a long upwards drag, this should transition the app list to
598 // fullscreen.
599 const int top_of_app_list =
600 app_list_view->GetWidget()->GetWindowBoundsInScreen().y();
601 generator.GestureScrollSequence(gfx::Point(10, top_of_app_list + 20),
602 gfx::Point(10, 10),
603 base::TimeDelta::FromMilliseconds(100), 10);
604 EXPECT_EQ(app_list_view->app_list_state(),
605 app_list::AppListView::FULLSCREEN_ALL_APPS);
606
607 // Press a key, this should activate the searchbox and transition to
608 // fullscreen search.
609 generator.PressKey(ui::KeyboardCode::VKEY_0, 0);
610 EXPECT_EQ(app_list_view->app_list_state(),
611 app_list::AppListView::FULLSCREEN_SEARCH);
612 EXPECT_TRUE(search_box_view->is_search_box_active());
613
614 // Tap outside the searchbox, this should deactivate the searchbox and the
615 // applistview should return to fullscreen all apps.
616 if (test_mouse_event) {
617 generator.MoveMouseTo(GetPointOutsideSearchbox());
618 generator.ClickLeftButton();
619 } else {
620 generator.GestureTapDownAndUp(GetPointOutsideSearchbox());
621 }
622 EXPECT_EQ(app_list_view->app_list_state(),
623 app_list::AppListView::FULLSCREEN_ALL_APPS);
624 EXPECT_FALSE(search_box_view->is_search_box_active());
625
626 // Tap outside the searchbox again, this should close the applistview.
627 if (test_mouse_event) {
628 generator.MoveMouseTo(GetPointOutsideSearchbox());
629 generator.ClickLeftButton();
630 } else {
631 generator.GestureTapDownAndUp(GetPointOutsideSearchbox());
632 }
633 EXPECT_EQ(app_list_view->app_list_state(), app_list::AppListView::CLOSED);
634 }
635
636 // Tests that the searchbox activates when it is tapped and that the widget is
637 // closed after tapping outside the searchbox.
638 TEST_P(FullscreenAppListPresenterDelegateTest, TapAndClickEnablesSearchBox) {
639 const bool test_mouse_event = TestMouseEventParam();
640 app_list_presenter_impl()->Show(GetPrimaryDisplayId());
641 app_list::SearchBoxView* search_box_view =
642 app_list_presenter_impl()->GetView()->search_box_view();
643
644 // Tap/Click the search box, it should activate.
645 ui::test::EventGenerator& generator = GetEventGenerator();
646 if (test_mouse_event) {
647 generator.MoveMouseTo(GetPointInsideSearchbox());
648 generator.PressLeftButton();
649 generator.ReleaseLeftButton();
650 } else {
651 generator.GestureTapAt(GetPointInsideSearchbox());
652 }
653
654 EXPECT_TRUE(search_box_view->is_search_box_active());
655
656 // Tap on the body of the app list, the search box should deactivate.
657 if (test_mouse_event) {
658 generator.MoveMouseTo(GetPointOutsideSearchbox());
659 generator.PressLeftButton();
660 generator.ReleaseLeftButton();
661 } else {
662 generator.GestureTapAt(GetPointOutsideSearchbox());
663 }
664 EXPECT_FALSE(search_box_view->is_search_box_active());
665 EXPECT_TRUE(app_list_presenter_impl()->IsVisible());
666
667 // Tap on the body of the app list again, the app list should hide.
668 if (test_mouse_event) {
669 generator.PressLeftButton();
670 generator.ReleaseLeftButton();
671 } else {
672 generator.GestureTapAt(GetPointOutsideSearchbox());
673 }
674 EXPECT_EQ(app_list_presenter_impl()->GetView()->app_list_state(),
675 app_list::AppListView::AppListState::CLOSED);
494 } 676 }
495 677
496 // Tests that the shelf background displays/hides with bottom shelf 678 // Tests that the shelf background displays/hides with bottom shelf
497 // alignment. 679 // alignment.
498 TEST_F(AppListPresenterDelegateTest, 680 TEST_F(AppListPresenterDelegateTest,
499 ShelfBackgroundRespondsToAppListBeingShown) { 681 ShelfBackgroundRespondsToAppListBeingShown) {
500 // TODO(newcomer): Investigate mash failures crbug.com/726838 682 // TODO(newcomer): Investigate mash failures crbug.com/726838
501 if (Shell::GetAshConfig() == Config::MASH) 683 if (Shell::GetAshConfig() == Config::MASH)
502 return; 684 return;
503 EnableFullscreenAppList(); 685 EnableFullscreenAppList();
504 GetPrimaryShelf()->SetAlignment(SHELF_ALIGNMENT_BOTTOM); 686 GetPrimaryShelf()->SetAlignment(SHELF_ALIGNMENT_BOTTOM);
505 687
506 // Show the app list, the shelf background should be transparent. 688 // Show the app list, the shelf background should be transparent.
507 app_list_presenter_impl()->Show(GetPrimaryDisplayId()); 689 app_list_presenter_impl()->Show(GetPrimaryDisplayId());
508 ShelfLayoutManager* shelf_layout_manager = 690 ShelfLayoutManager* shelf_layout_manager =
509 GetPrimaryShelf()->shelf_layout_manager(); 691 GetPrimaryShelf()->shelf_layout_manager();
510 EXPECT_EQ(shelf_layout_manager->GetShelfBackgroundType(), 692 EXPECT_EQ(shelf_layout_manager->GetShelfBackgroundType(),
511 SHELF_BACKGROUND_DEFAULT); 693 SHELF_BACKGROUND_DEFAULT);
512 app_list_presenter_impl()->Dismiss(); 694 app_list_presenter_impl()->Dismiss();
513 695
514 // Set the alignment to the side and show the app list. The background should 696 // Set the alignment to the side and show the app list. The background
515 // show. 697 // should show.
516 GetPrimaryShelf()->SetAlignment(ShelfAlignment::SHELF_ALIGNMENT_LEFT); 698 GetPrimaryShelf()->SetAlignment(ShelfAlignment::SHELF_ALIGNMENT_LEFT);
517 app_list_presenter_impl()->Show(GetPrimaryDisplayId()); 699 app_list_presenter_impl()->Show(GetPrimaryDisplayId());
518 EXPECT_TRUE(app_list::features::IsFullscreenAppListEnabled()); 700 EXPECT_TRUE(app_list::features::IsFullscreenAppListEnabled());
519 EXPECT_FALSE(GetPrimaryShelf()->IsHorizontalAlignment()); 701 EXPECT_FALSE(GetPrimaryShelf()->IsHorizontalAlignment());
520 EXPECT_EQ(GetPrimaryShelf()->shelf_layout_manager()-> 702 EXPECT_EQ(GetPrimaryShelf()->shelf_layout_manager()->GetShelfBackgroundType(),
521 GetShelfBackgroundType(),
522 SHELF_BACKGROUND_DEFAULT); 703 SHELF_BACKGROUND_DEFAULT);
523 } 704 }
524 705
525 // Tests that the half app list closes if the user taps outside its bounds. 706 // Tests that the half app list closes if the user taps outside its bounds.
526 TEST_F(AppListPresenterDelegateTest, TapAndClickOutsideClosesHalfAppList) { 707 TEST_F(FullscreenAppListPresenterDelegateTest,
708 TapAndClickOutsideClosesHalfAppList) {
527 // TODO(newcomer): Investigate mash failures crbug.com/726838 709 // TODO(newcomer): Investigate mash failures crbug.com/726838
528 EnableFullscreenAppList();
529 app_list_presenter_impl()->Show(GetPrimaryDisplayId()); 710 app_list_presenter_impl()->Show(GetPrimaryDisplayId());
530 ui::test::EventGenerator& generator = GetEventGenerator(); 711 ui::test::EventGenerator& generator = GetEventGenerator();
531 712
532 // Transition to half app list by entering text. 713 // Transition to half app list by entering text.
533 generator.PressKey(ui::KeyboardCode::VKEY_0, 0); 714 generator.PressKey(ui::KeyboardCode::VKEY_0, 0);
534 app_list::AppListView* app_list = app_list_presenter_impl()->GetView(); 715 app_list::AppListView* app_list = app_list_presenter_impl()->GetView();
535 EXPECT_EQ(app_list->app_list_state(), app_list::AppListView::HALF); 716 EXPECT_EQ(app_list->app_list_state(), app_list::AppListView::HALF);
536 717
537 // Grab the bounds of the search box, 718 // Grab the bounds of the search box,
538 // which is guaranteed to be inside the app list. 719 // which is guaranteed to be inside the app list.
(...skipping 24 matching lines...) Expand all
563 generator.PressKey(ui::KeyboardCode::VKEY_0, 0); 744 generator.PressKey(ui::KeyboardCode::VKEY_0, 0);
564 EXPECT_EQ(app_list->app_list_state(), app_list::AppListView::HALF); 745 EXPECT_EQ(app_list->app_list_state(), app_list::AppListView::HALF);
565 746
566 // Clicking outside the bounds closes the app list. 747 // Clicking outside the bounds closes the app list.
567 generator.MoveMouseTo(gfx::Point(10, 10)); 748 generator.MoveMouseTo(gfx::Point(10, 10));
568 generator.ClickLeftButton(); 749 generator.ClickLeftButton();
569 EXPECT_FALSE(app_list_presenter_impl()->IsVisible()); 750 EXPECT_FALSE(app_list_presenter_impl()->IsVisible());
570 } 751 }
571 752
572 } // namespace ash 753 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | testing/buildbot/filters/ash_unittests_mash.filter » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698