Revert of Add button to add new FSP services to Files app. (patchset #8 id:140001...
[chromium-blink-merge.git] / chrome / browser / ui / ash / accelerator_controller_browsertest.cc
blobea25bcdadd95ab8df95e23303c11e21a2ed8411a
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
3 // found in the LICENSE file.
5 #include "ash/accelerators/accelerator_controller.h"
7 #include "ash/shell.h"
8 #include "ash/wm/window_state.h"
9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/browser_window.h"
11 #include "chrome/test/base/in_process_browser_test.h"
12 #include "ui/events/test/event_generator.h"
14 #if defined(USE_X11)
15 #include "ui/events/test/events_test_utils_x11.h"
16 #endif
18 #if defined(OS_CHROMEOS) && defined(USE_X11)
19 typedef InProcessBrowserTest AcceleratorControllerBrowserTest;
21 // Test that pressing and holding Alt+ toggles the maximized state exactly once.
22 // This test is a browser test to test that the EF_IS_REPEAT flag is correctly
23 // passed down to AcceleratorController (via a conversion to WebInputEvent).
24 // See crbug.com/434743
25 IN_PROC_BROWSER_TEST_F(AcceleratorControllerBrowserTest,
26 RepeatedToggleMaximizeViaAccelerator) {
27 ASSERT_TRUE(ash::Shell::HasInstance()) << "No Instance";
28 AddTabAtIndex(0,
29 GURL("data:text/html;base64,<html></html>"),
30 ui::PAGE_TRANSITION_TYPED);
31 browser()->window()->Show();
33 ui::Accelerator accelerator(ui::VKEY_OEM_PLUS, ui::EF_ALT_DOWN);
34 ash::AcceleratorController* accelerator_controller =
35 ash::Shell::GetInstance()->accelerator_controller();
36 ASSERT_TRUE(accelerator_controller->IsRegistered(accelerator));
38 ash::wm::WindowState* window_state = ash::wm::GetActiveWindowState();
39 EXPECT_FALSE(window_state->IsMaximized());
41 ui::test::EventGenerator generator(ash::Shell::GetPrimaryRootWindow());
42 generator.PressKey(ui::VKEY_OEM_PLUS, ui::EF_ALT_DOWN);
43 EXPECT_TRUE(window_state->IsMaximized());
45 generator.PressKey(ui::VKEY_OEM_PLUS, ui::EF_ALT_DOWN);
47 generator.ReleaseKey(ui::VKEY_OEM_PLUS, ui::EF_ALT_DOWN);
48 EXPECT_TRUE(window_state->IsMaximized());
50 #endif