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

Side by Side Diff: content/browser/renderer_host/web_input_event_aura_unittest.cc

Issue 10541139: Improve MakeWebKeyboardEventFromAuraEvent() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix linux_chromeos_clang shared build Created 8 years, 6 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 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.
4
5 #include "content/browser/renderer_host/web_input_event_aura.h"
6
7 #include "base/basictypes.h"
8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "ui/aura/event.h"
10
11 #if defined(USE_X11)
12 #include <X11/Xlib.h>
13 #include "ui/base/x/x11_util.h"
14 #endif
15
16 namespace content {
17
18 // Checks that MakeWebKeyboardEvent makes a DOM3 spec compliant key event.
19 // crbug.com/127142
20 TEST(WebInputEventAuraTest, TestMakeWebKeyboardEvent) {
21 #if defined(USE_X11)
22 XEvent xev;
23 {
24 // Press Ctrl.
25 ui::InitXKeyEventForTesting(ui::ET_KEY_PRESSED,
26 ui::VKEY_CONTROL,
27 0, // X does not set ControlMask for KeyPress.
28 &xev);
29 aura::KeyEvent event(&xev, false /* is_char */);
30 WebKit::WebKeyboardEvent webkit_event = MakeWebKeyboardEvent(&event);
31 // However, modifier bit for Control in |webkit_event| should be set.
32 EXPECT_EQ(webkit_event.modifiers, WebKit::WebInputEvent::ControlKey);
33 }
34 {
35 // Release Ctrl.
36 ui::InitXKeyEventForTesting(ui::ET_KEY_RELEASED,
37 ui::VKEY_CONTROL,
38 ControlMask, // X sets the mask for KeyRelease.
39 &xev);
40 aura::KeyEvent event(&xev, false /* is_char */);
41 WebKit::WebKeyboardEvent webkit_event = MakeWebKeyboardEvent(&event);
42 // However, modifier bit for Control in |webkit_event| shouldn't be set.
43 EXPECT_EQ(webkit_event.modifiers, 0);
44 }
45 #endif
46 }
47
48 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/web_input_event_aura.h ('k') | content/browser/renderer_host/web_input_event_aurax11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698