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

Side by Side Diff: ash/wm/window_cycle_controller_unittest.cc

Issue 2576913002: Use mojo app list interfaces for mash and classic ash. (Closed)
Patch Set: Fix test name. Created 4 years 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/wm/window_cycle_controller.h" 5 #include "ash/common/wm/window_cycle_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <memory> 8 #include <memory>
9 9
10 #include "ash/app_list/app_list_presenter_delegate_factory.h"
10 #include "ash/aura/wm_window_aura.h" 11 #include "ash/aura/wm_window_aura.h"
11 #include "ash/common/focus_cycler.h" 12 #include "ash/common/focus_cycler.h"
12 #include "ash/common/scoped_root_window_for_new_windows.h" 13 #include "ash/common/scoped_root_window_for_new_windows.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_widget.h" 15 #include "ash/common/shelf/shelf_widget.h"
15 #include "ash/common/shelf/wm_shelf.h" 16 #include "ash/common/shelf/wm_shelf.h"
16 #include "ash/common/test/test_shelf_delegate.h" 17 #include "ash/common/test/test_shelf_delegate.h"
17 #include "ash/common/wm/window_cycle_list.h" 18 #include "ash/common/wm/window_cycle_list.h"
18 #include "ash/common/wm/window_state.h" 19 #include "ash/common/wm/window_state.h"
19 #include "ash/common/wm/wm_event.h" 20 #include "ash/common/wm/wm_event.h"
20 #include "ash/common/wm_shell.h" 21 #include "ash/common/wm_shell.h"
21 #include "ash/public/cpp/shell_window_ids.h" 22 #include "ash/public/cpp/shell_window_ids.h"
22 #include "ash/shell.h" 23 #include "ash/shell.h"
23 #include "ash/test/ash_test_base.h" 24 #include "ash/test/ash_test_base.h"
24 #include "ash/test/shelf_view_test_api.h" 25 #include "ash/test/shelf_view_test_api.h"
25 #include "ash/test/test_shell_delegate.h" 26 #include "ash/test/test_shell_delegate.h"
26 #include "ash/wm/window_state_aura.h" 27 #include "ash/wm/window_state_aura.h"
27 #include "ash/wm/window_util.h" 28 #include "ash/wm/window_util.h"
29 #include "ui/app_list/presenter/app_list_presenter_impl.h"
30 #include "ui/app_list/presenter/test/test_app_list_view_delegate_factory.h"
28 #include "ui/aura/client/aura_constants.h" 31 #include "ui/aura/client/aura_constants.h"
29 #include "ui/aura/client/screen_position_client.h" 32 #include "ui/aura/client/screen_position_client.h"
30 #include "ui/aura/env.h" 33 #include "ui/aura/env.h"
31 #include "ui/aura/test/test_windows.h" 34 #include "ui/aura/test/test_windows.h"
32 #include "ui/aura/window.h" 35 #include "ui/aura/window.h"
33 #include "ui/aura/window_event_dispatcher.h" 36 #include "ui/aura/window_event_dispatcher.h"
37 #include "ui/display/manager/display_manager.h"
34 #include "ui/events/event_handler.h" 38 #include "ui/events/event_handler.h"
35 #include "ui/events/test/event_generator.h" 39 #include "ui/events/test/event_generator.h"
36 #include "ui/gfx/geometry/rect.h" 40 #include "ui/gfx/geometry/rect.h"
37 41
38 namespace ash { 42 namespace ash {
39 43
40 namespace { 44 namespace {
41 45
42 class EventCounter : public ui::EventHandler { 46 class EventCounter : public ui::EventHandler {
43 public: 47 public:
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 EXPECT_FALSE(wm::IsActiveWindow(window0.get())); 465 EXPECT_FALSE(wm::IsActiveWindow(window0.get()));
462 466
463 // Showing the Alt+Tab UI does however deactivate the erstwhile active window. 467 // Showing the Alt+Tab UI does however deactivate the erstwhile active window.
464 EXPECT_FALSE(wm::IsActiveWindow(window1.get())); 468 EXPECT_FALSE(wm::IsActiveWindow(window1.get()));
465 469
466 controller->StopCycling(); 470 controller->StopCycling();
467 } 471 }
468 472
469 // Tests that beginning window selection hides the app list. 473 // Tests that beginning window selection hides the app list.
470 TEST_F(WindowCycleControllerTest, SelectingHidesAppList) { 474 TEST_F(WindowCycleControllerTest, SelectingHidesAppList) {
475 // The tested behavior relies on the app list presenter implementation.
476 AppListPresenterDelegateFactory app_list_presenter_delegate_factory(
477 base::MakeUnique<app_list::TestAppListViewDelegateFactory>());
478 app_list::AppListPresenterImpl app_list_presenter_impl(
479 &app_list_presenter_delegate_factory);
480
471 WindowCycleController* controller = WmShell::Get()->window_cycle_controller(); 481 WindowCycleController* controller = WmShell::Get()->window_cycle_controller();
472 482
473 std::unique_ptr<aura::Window> window0(CreateTestWindowInShellWithId(0)); 483 std::unique_ptr<aura::Window> window0(CreateTestWindowInShellWithId(0));
474 std::unique_ptr<aura::Window> window1(CreateTestWindowInShellWithId(1)); 484 std::unique_ptr<aura::Window> window1(CreateTestWindowInShellWithId(1));
475 WmShell::Get()->ShowAppList(); 485 app_list_presenter_impl.Show(display_manager()->first_display_id());
476 EXPECT_TRUE(WmShell::Get()->GetAppListTargetVisibility()); 486 EXPECT_TRUE(app_list_presenter_impl.IsVisible());
477 controller->HandleCycleWindow(WindowCycleController::FORWARD); 487 controller->HandleCycleWindow(WindowCycleController::FORWARD);
478 EXPECT_FALSE(WmShell::Get()->GetAppListTargetVisibility()); 488 EXPECT_FALSE(app_list_presenter_impl.IsVisible());
479 489
480 // Make sure that dismissing the app list this way doesn't pass activation 490 // Make sure that dismissing the app list this way doesn't pass activation
481 // to a different window. 491 // to a different window.
482 EXPECT_FALSE(wm::IsActiveWindow(window0.get())); 492 EXPECT_FALSE(wm::IsActiveWindow(window0.get()));
483 EXPECT_FALSE(wm::IsActiveWindow(window1.get())); 493 EXPECT_FALSE(wm::IsActiveWindow(window1.get()));
484 494
485 controller->StopCycling(); 495 controller->StopCycling();
486 } 496 }
487 497
488 // Tests that cycling through windows doesn't change their minimized state. 498 // Tests that cycling through windows doesn't change their minimized state.
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 // without the new alt+tab selector we check for the event on either 702 // without the new alt+tab selector we check for the event on either
693 // fullscreen window. 703 // fullscreen window.
694 EventCounter event_count; 704 EventCounter event_count;
695 w0->AddPreTargetHandler(&event_count); 705 w0->AddPreTargetHandler(&event_count);
696 w1->AddPreTargetHandler(&event_count); 706 w1->AddPreTargetHandler(&event_count);
697 generator.PressKey(ui::VKEY_TAB, ui::EF_ALT_DOWN); 707 generator.PressKey(ui::VKEY_TAB, ui::EF_ALT_DOWN);
698 EXPECT_EQ(1, event_count.GetKeyEventCountAndReset()); 708 EXPECT_EQ(1, event_count.GetKeyEventCountAndReset());
699 } 709 }
700 710
701 } // namespace ash 711 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698