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

Unified Diff: ui/aura/test/event_generator.cc

Issue 9241007: Fix the Windows implementation of EventGenerator::PressKey(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/aura/test/event_generator.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/test/event_generator.cc
diff --git a/ui/aura/test/event_generator.cc b/ui/aura/test/event_generator.cc
index 59d2854c1c3477e31dc98b4668381f705b078f85..83669159ea1443537bb2a343a9edc6b6b2d57e58 100644
--- a/ui/aura/test/event_generator.cc
+++ b/ui/aura/test/event_generator.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -15,6 +15,14 @@
namespace {
+class TestKeyEvent : public aura::KeyEvent {
+ public:
+ TestKeyEvent(const base::NativeEvent& native_event, int flags)
+ : KeyEvent(native_event, false /* is_char */) {
+ set_flags(flags);
+ }
+};
+
gfx::Point CenterOfWindowInRootWindowCoordinate(aura::Window* window) {
gfx::Point center = window->bounds().CenterPoint();
aura::RootWindow* root_window = aura::RootWindow::GetInstance();
@@ -169,14 +177,14 @@ void EventGenerator::DispatchKeyEvent(bool is_press,
int flags) {
#if defined(OS_WIN)
MSG native_event =
- { NULL, (is_press ? WM_KEYDOWN : WM_KEYUP), key_code, flags };
- KeyEvent keyev(native_event, false /* is_char */);
+ { NULL, (is_press ? WM_KEYDOWN : WM_KEYUP), key_code, 0 };
+ TestKeyEvent keyev(native_event, flags);
#else
ui::EventType type = is_press ? ui::ET_KEY_PRESSED : ui::ET_KEY_RELEASED;
#if defined(USE_X11)
scoped_ptr<XEvent> native_event(new XEvent);
ui::InitXKeyEventForTesting(type, key_code, flags, native_event.get());
- KeyEvent keyev(native_event.get(), false);
+ TestKeyEvent keyev(native_event.get(), flags);
#else
KeyEvent keyev(type, key_code, flags);
#endif // USE_X11
« no previous file with comments | « ui/aura/test/event_generator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698