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

Side by Side Diff: chrome/browser/ui/ash/accelerator_controller_browsertest.cc

Issue 2752593008: Move AcceleratorController from WmShell to Shell (Closed)
Patch Set: fix include Created 3 years, 9 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 | « chrome/browser/policy/policy_browsertest.cc ('k') | chrome/browser/ui/ash/ash_init.cc » ('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 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/accelerators/accelerator_controller.h" 5 #include "ash/common/accelerators/accelerator_controller.h"
6 6
7 #include "ash/common/wm/window_state.h" 7 #include "ash/common/wm/window_state.h"
8 #include "ash/common/wm_shell.h"
9 #include "ash/shell.h" 8 #include "ash/shell.h"
10 #include "ash/wm/window_state_aura.h" 9 #include "ash/wm/window_state_aura.h"
11 #include "build/build_config.h" 10 #include "build/build_config.h"
12 #include "chrome/browser/ui/browser.h" 11 #include "chrome/browser/ui/browser.h"
13 #include "chrome/browser/ui/browser_window.h" 12 #include "chrome/browser/ui/browser_window.h"
14 #include "chrome/test/base/in_process_browser_test.h" 13 #include "chrome/test/base/in_process_browser_test.h"
15 #include "ui/events/test/event_generator.h" 14 #include "ui/events/test/event_generator.h"
16 15
17 #if defined(USE_X11) 16 #if defined(USE_X11)
18 #include "ui/events/test/events_test_utils_x11.h" 17 #include "ui/events/test/events_test_utils_x11.h"
19 #endif 18 #endif
20 19
21 #if defined(USE_X11) 20 #if defined(USE_X11)
22 typedef InProcessBrowserTest AcceleratorControllerBrowserTest; 21 typedef InProcessBrowserTest AcceleratorControllerBrowserTest;
23 22
24 // Test that pressing and holding Alt+ toggles the maximized state exactly once. 23 // Test that pressing and holding Alt+ toggles the maximized state exactly once.
25 // This test is a browser test to test that the EF_IS_REPEAT flag is correctly 24 // This test is a browser test to test that the EF_IS_REPEAT flag is correctly
26 // passed down to AcceleratorController (via a conversion to WebInputEvent). 25 // passed down to AcceleratorController (via a conversion to WebInputEvent).
27 // See crbug.com/434743 26 // See crbug.com/434743
28 IN_PROC_BROWSER_TEST_F(AcceleratorControllerBrowserTest, 27 IN_PROC_BROWSER_TEST_F(AcceleratorControllerBrowserTest,
29 RepeatedToggleMaximizeViaAccelerator) { 28 RepeatedToggleMaximizeViaAccelerator) {
30 ASSERT_TRUE(ash::Shell::HasInstance()) << "No Instance"; 29 ASSERT_TRUE(ash::Shell::HasInstance()) << "No Instance";
31 AddTabAtIndex(0, 30 AddTabAtIndex(0,
32 GURL("data:text/html;base64,<html></html>"), 31 GURL("data:text/html;base64,<html></html>"),
33 ui::PAGE_TRANSITION_TYPED); 32 ui::PAGE_TRANSITION_TYPED);
34 browser()->window()->Show(); 33 browser()->window()->Show();
35 34
36 ui::Accelerator accelerator(ui::VKEY_OEM_PLUS, ui::EF_ALT_DOWN); 35 ui::Accelerator accelerator(ui::VKEY_OEM_PLUS, ui::EF_ALT_DOWN);
37 ash::AcceleratorController* accelerator_controller = 36 ash::AcceleratorController* accelerator_controller =
38 ash::WmShell::Get()->accelerator_controller(); 37 ash::Shell::Get()->accelerator_controller();
39 ASSERT_TRUE(accelerator_controller->IsRegistered(accelerator)); 38 ASSERT_TRUE(accelerator_controller->IsRegistered(accelerator));
40 39
41 ash::wm::WindowState* window_state = ash::wm::GetActiveWindowState(); 40 ash::wm::WindowState* window_state = ash::wm::GetActiveWindowState();
42 EXPECT_FALSE(window_state->IsMaximized()); 41 EXPECT_FALSE(window_state->IsMaximized());
43 42
44 ui::test::EventGenerator generator(ash::Shell::GetPrimaryRootWindow()); 43 ui::test::EventGenerator generator(ash::Shell::GetPrimaryRootWindow());
45 generator.PressKey(ui::VKEY_OEM_PLUS, ui::EF_ALT_DOWN); 44 generator.PressKey(ui::VKEY_OEM_PLUS, ui::EF_ALT_DOWN);
46 EXPECT_TRUE(window_state->IsMaximized()); 45 EXPECT_TRUE(window_state->IsMaximized());
47 46
48 generator.PressKey(ui::VKEY_OEM_PLUS, ui::EF_ALT_DOWN); 47 generator.PressKey(ui::VKEY_OEM_PLUS, ui::EF_ALT_DOWN);
49 48
50 generator.ReleaseKey(ui::VKEY_OEM_PLUS, ui::EF_ALT_DOWN); 49 generator.ReleaseKey(ui::VKEY_OEM_PLUS, ui::EF_ALT_DOWN);
51 EXPECT_TRUE(window_state->IsMaximized()); 50 EXPECT_TRUE(window_state->IsMaximized());
52 } 51 }
53 #endif 52 #endif
OLDNEW
« no previous file with comments | « chrome/browser/policy/policy_browsertest.cc ('k') | chrome/browser/ui/ash/ash_init.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698