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

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: Sync and rebase Created 3 years, 11 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
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/aura/wm_window_aura.h" 10 #include "ash/aura/wm_window_aura.h"
11 #include "ash/common/focus_cycler.h" 11 #include "ash/common/focus_cycler.h"
12 #include "ash/common/scoped_root_window_for_new_windows.h" 12 #include "ash/common/scoped_root_window_for_new_windows.h"
13 #include "ash/common/session/session_state_delegate.h" 13 #include "ash/common/session/session_state_delegate.h"
14 #include "ash/common/shelf/shelf_widget.h" 14 #include "ash/common/shelf/shelf_widget.h"
15 #include "ash/common/shelf/wm_shelf.h" 15 #include "ash/common/shelf/wm_shelf.h"
16 #include "ash/common/test/test_shelf_delegate.h" 16 #include "ash/common/test/test_shelf_delegate.h"
17 #include "ash/common/wm/window_cycle_list.h" 17 #include "ash/common/wm/window_cycle_list.h"
18 #include "ash/common/wm/window_state.h" 18 #include "ash/common/wm/window_state.h"
19 #include "ash/common/wm/wm_event.h" 19 #include "ash/common/wm/wm_event.h"
20 #include "ash/common/wm_shell.h" 20 #include "ash/common/wm_shell.h"
21 #include "ash/public/cpp/shell_window_ids.h" 21 #include "ash/public/cpp/shell_window_ids.h"
22 #include "ash/shell.h" 22 #include "ash/shell.h"
23 #include "ash/test/ash_test_base.h" 23 #include "ash/test/ash_test_base.h"
24 #include "ash/test/shelf_view_test_api.h" 24 #include "ash/test/shelf_view_test_api.h"
25 #include "ash/test/test_app_list_view_presenter_impl.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"
28 #include "ui/aura/client/aura_constants.h" 29 #include "ui/aura/client/aura_constants.h"
29 #include "ui/aura/client/screen_position_client.h" 30 #include "ui/aura/client/screen_position_client.h"
30 #include "ui/aura/env.h" 31 #include "ui/aura/env.h"
31 #include "ui/aura/test/test_windows.h" 32 #include "ui/aura/test/test_windows.h"
32 #include "ui/aura/window.h" 33 #include "ui/aura/window.h"
33 #include "ui/aura/window_event_dispatcher.h" 34 #include "ui/aura/window_event_dispatcher.h"
35 #include "ui/display/manager/display_manager.h"
34 #include "ui/events/event_handler.h" 36 #include "ui/events/event_handler.h"
35 #include "ui/events/test/event_generator.h" 37 #include "ui/events/test/event_generator.h"
36 #include "ui/gfx/geometry/rect.h" 38 #include "ui/gfx/geometry/rect.h"
37 39
38 namespace ash { 40 namespace ash {
39 41
40 namespace { 42 namespace {
41 43
42 class EventCounter : public ui::EventHandler { 44 class EventCounter : public ui::EventHandler {
43 public: 45 public:
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 EXPECT_FALSE(wm::IsActiveWindow(window0.get())); 468 EXPECT_FALSE(wm::IsActiveWindow(window0.get()));
467 469
468 // Showing the Alt+Tab UI does however deactivate the erstwhile active window. 470 // Showing the Alt+Tab UI does however deactivate the erstwhile active window.
469 EXPECT_FALSE(wm::IsActiveWindow(window1.get())); 471 EXPECT_FALSE(wm::IsActiveWindow(window1.get()));
470 472
471 controller->CompleteCycling(); 473 controller->CompleteCycling();
472 } 474 }
473 475
474 // Tests that beginning window selection hides the app list. 476 // Tests that beginning window selection hides the app list.
475 TEST_F(WindowCycleControllerTest, SelectingHidesAppList) { 477 TEST_F(WindowCycleControllerTest, SelectingHidesAppList) {
478 // The tested behavior relies on the app list presenter implementation.
479 test::TestAppListViewPresenterImpl app_list_presenter_impl;
480
476 WindowCycleController* controller = WmShell::Get()->window_cycle_controller(); 481 WindowCycleController* controller = WmShell::Get()->window_cycle_controller();
477 482
478 std::unique_ptr<aura::Window> window0(CreateTestWindowInShellWithId(0)); 483 std::unique_ptr<aura::Window> window0(CreateTestWindowInShellWithId(0));
479 std::unique_ptr<aura::Window> window1(CreateTestWindowInShellWithId(1)); 484 std::unique_ptr<aura::Window> window1(CreateTestWindowInShellWithId(1));
480 WmShell::Get()->ShowAppList(); 485 app_list_presenter_impl.Show(display_manager()->first_display_id());
481 EXPECT_TRUE(WmShell::Get()->GetAppListTargetVisibility()); 486 EXPECT_TRUE(app_list_presenter_impl.IsVisible());
482 controller->HandleCycleWindow(WindowCycleController::FORWARD); 487 controller->HandleCycleWindow(WindowCycleController::FORWARD);
483 EXPECT_FALSE(WmShell::Get()->GetAppListTargetVisibility()); 488 EXPECT_FALSE(app_list_presenter_impl.IsVisible());
484 489
485 // 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
486 // to a different window. 491 // to a different window.
487 EXPECT_FALSE(wm::IsActiveWindow(window0.get())); 492 EXPECT_FALSE(wm::IsActiveWindow(window0.get()));
488 EXPECT_FALSE(wm::IsActiveWindow(window1.get())); 493 EXPECT_FALSE(wm::IsActiveWindow(window1.get()));
489 494
490 controller->CompleteCycling(); 495 controller->CompleteCycling();
491 } 496 }
492 497
493 // 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
697 // 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
698 // fullscreen window. 703 // fullscreen window.
699 EventCounter event_count; 704 EventCounter event_count;
700 w0->AddPreTargetHandler(&event_count); 705 w0->AddPreTargetHandler(&event_count);
701 w1->AddPreTargetHandler(&event_count); 706 w1->AddPreTargetHandler(&event_count);
702 generator.PressKey(ui::VKEY_TAB, ui::EF_ALT_DOWN); 707 generator.PressKey(ui::VKEY_TAB, ui::EF_ALT_DOWN);
703 EXPECT_EQ(1, event_count.GetKeyEventCountAndReset()); 708 EXPECT_EQ(1, event_count.GetKeyEventCountAndReset());
704 } 709 }
705 710
706 } // namespace ash 711 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/overview/window_selector_unittest.cc ('k') | chrome/browser/ui/app_list/app_list_service_interactive_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698