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

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

Issue 1017323002: make IsRepeated work even when a KeyEvent is created from the same native event. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 | « no previous file | ui/events/event.cc » ('j') | ui/events/event_unittest.cc » ('J')
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/accelerators/accelerator_controller.h" 5 #include "ash/accelerators/accelerator_controller.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/wm/window_state.h" 8 #include "ash/wm/window_state.h"
9 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/browser_window.h" 10 #include "chrome/browser/ui/browser_window.h"
(...skipping 20 matching lines...) Expand all
31 browser()->window()->Show(); 31 browser()->window()->Show();
32 32
33 ui::Accelerator accelerator(ui::VKEY_OEM_PLUS, ui::EF_ALT_DOWN); 33 ui::Accelerator accelerator(ui::VKEY_OEM_PLUS, ui::EF_ALT_DOWN);
34 ash::AcceleratorController* accelerator_controller = 34 ash::AcceleratorController* accelerator_controller =
35 ash::Shell::GetInstance()->accelerator_controller(); 35 ash::Shell::GetInstance()->accelerator_controller();
36 ASSERT_TRUE(accelerator_controller->IsRegistered(accelerator)); 36 ASSERT_TRUE(accelerator_controller->IsRegistered(accelerator));
37 37
38 ash::wm::WindowState* window_state = ash::wm::GetActiveWindowState(); 38 ash::wm::WindowState* window_state = ash::wm::GetActiveWindowState();
39 EXPECT_FALSE(window_state->IsMaximized()); 39 EXPECT_FALSE(window_state->IsMaximized());
40 40
41 // Construct the key events from XEvents because RenderWidgetHostViewAura
42 // drops the ui::EF_IS_REPEAT flag otherwise.
oshima 2015/03/19 00:46:04 EventGenerator creates KeyEvent using native event
43 ui::ScopedXI2Event xi2_down1;
44 xi2_down1.InitKeyEvent(ui::ET_KEY_PRESSED,
45 ui::VKEY_OEM_PLUS,
46 ui::EF_ALT_DOWN);
47 ui::KeyEvent down1(xi2_down1);
48 ui::test::EventGenerator generator(ash::Shell::GetPrimaryRootWindow()); 41 ui::test::EventGenerator generator(ash::Shell::GetPrimaryRootWindow());
49 generator.Dispatch(&down1); 42 generator.PressKey(ui::VKEY_OEM_PLUS, ui::EF_ALT_DOWN);
50 EXPECT_TRUE(window_state->IsMaximized()); 43 EXPECT_TRUE(window_state->IsMaximized());
51 44
52 ui::ScopedXI2Event xi2_down2; 45 generator.PressKey(ui::VKEY_OEM_PLUS, ui::EF_ALT_DOWN);
53 xi2_down2.InitKeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_OEM_PLUS,
54 ui::EF_ALT_DOWN);
55 ui::KeyEvent down2(xi2_down2);
56 generator.Dispatch(&down2);
57 46
58 ui::ScopedXI2Event xi2_up; 47 generator.ReleaseKey(ui::VKEY_OEM_PLUS, ui::EF_ALT_DOWN);
59 xi2_up.InitKeyEvent(ui::ET_KEY_RELEASED, ui::VKEY_OEM_PLUS, ui::EF_ALT_DOWN);
60 ui::KeyEvent up(xi2_up);
61 generator.Dispatch(&up);
62 EXPECT_TRUE(window_state->IsMaximized()); 48 EXPECT_TRUE(window_state->IsMaximized());
63 } 49 }
64 #endif 50 #endif
OLDNEW
« no previous file with comments | « no previous file | ui/events/event.cc » ('j') | ui/events/event_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698