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

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

Issue 23460052: Move XID, XDisplay, GetXDisplay and a few other types to ui/gfx/x/x11_types.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sdf Created 7 years, 3 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 | « content/browser/renderer_host/gtk_window_utils.cc ('k') | content/plugin/webplugin_proxy.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 (c) 2012 The Chromium Authors. All rights reserved. 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 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 "content/browser/renderer_host/web_input_event_aura.h" 5 #include "content/browser/renderer_host/web_input_event_aura.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "ui/events/event.h" 9 #include "ui/events/event.h"
10 10
11 #if defined(USE_X11) 11 #if defined(USE_X11)
12 #include <X11/keysym.h> 12 #include <X11/keysym.h>
13 #include <X11/Xlib.h> 13 #include <X11/Xlib.h>
14 #include "ui/base/x/x11_util.h" 14 #include "ui/gfx/x/x11_types.h"
15 #endif 15 #endif
16 16
17 namespace content { 17 namespace content {
18 18
19 // Checks that MakeWebKeyboardEvent makes a DOM3 spec compliant key event. 19 // Checks that MakeWebKeyboardEvent makes a DOM3 spec compliant key event.
20 // crbug.com/127142 20 // crbug.com/127142
21 TEST(WebInputEventAuraTest, TestMakeWebKeyboardEvent) { 21 TEST(WebInputEventAuraTest, TestMakeWebKeyboardEvent) {
22 #if defined(USE_X11) 22 #if defined(USE_X11)
23 XEvent xev; 23 XEvent xev;
24 { 24 {
(...skipping 24 matching lines...) Expand all
49 // Checks that MakeWebKeyboardEvent returns a correct windowsKeyCode. 49 // Checks that MakeWebKeyboardEvent returns a correct windowsKeyCode.
50 TEST(WebInputEventAuraTest, TestMakeWebKeyboardEventWindowsKeyCode) { 50 TEST(WebInputEventAuraTest, TestMakeWebKeyboardEventWindowsKeyCode) {
51 #if defined(USE_X11) 51 #if defined(USE_X11)
52 XEvent xev; 52 XEvent xev;
53 { 53 {
54 // Press left Ctrl. 54 // Press left Ctrl.
55 ui::InitXKeyEventForTesting(ui::ET_KEY_PRESSED, 55 ui::InitXKeyEventForTesting(ui::ET_KEY_PRESSED,
56 ui::VKEY_CONTROL, 56 ui::VKEY_CONTROL,
57 0, // X does not set ControlMask for KeyPress. 57 0, // X does not set ControlMask for KeyPress.
58 &xev); 58 &xev);
59 xev.xkey.keycode = XKeysymToKeycode(ui::GetXDisplay(), XK_Control_L); 59 xev.xkey.keycode = XKeysymToKeycode(gfx::GetXDisplay(), XK_Control_L);
60 ui::KeyEvent event(&xev, false /* is_char */); 60 ui::KeyEvent event(&xev, false /* is_char */);
61 WebKit::WebKeyboardEvent webkit_event = MakeWebKeyboardEvent(&event); 61 WebKit::WebKeyboardEvent webkit_event = MakeWebKeyboardEvent(&event);
62 // ui::VKEY_LCONTROL, instead of ui::VKEY_CONTROL, should be filled. 62 // ui::VKEY_LCONTROL, instead of ui::VKEY_CONTROL, should be filled.
63 EXPECT_EQ(ui::VKEY_LCONTROL, webkit_event.windowsKeyCode); 63 EXPECT_EQ(ui::VKEY_LCONTROL, webkit_event.windowsKeyCode);
64 } 64 }
65 { 65 {
66 // Press right Ctrl. 66 // Press right Ctrl.
67 ui::InitXKeyEventForTesting(ui::ET_KEY_PRESSED, 67 ui::InitXKeyEventForTesting(ui::ET_KEY_PRESSED,
68 ui::VKEY_CONTROL, 68 ui::VKEY_CONTROL,
69 0, // X does not set ControlMask for KeyPress. 69 0, // X does not set ControlMask for KeyPress.
70 &xev); 70 &xev);
71 xev.xkey.keycode = XKeysymToKeycode(ui::GetXDisplay(), XK_Control_R); 71 xev.xkey.keycode = XKeysymToKeycode(gfx::GetXDisplay(), XK_Control_R);
72 ui::KeyEvent event(&xev, false /* is_char */); 72 ui::KeyEvent event(&xev, false /* is_char */);
73 WebKit::WebKeyboardEvent webkit_event = MakeWebKeyboardEvent(&event); 73 WebKit::WebKeyboardEvent webkit_event = MakeWebKeyboardEvent(&event);
74 // ui::VKEY_RCONTROL, instead of ui::VKEY_CONTROL, should be filled. 74 // ui::VKEY_RCONTROL, instead of ui::VKEY_CONTROL, should be filled.
75 EXPECT_EQ(ui::VKEY_RCONTROL, webkit_event.windowsKeyCode); 75 EXPECT_EQ(ui::VKEY_RCONTROL, webkit_event.windowsKeyCode);
76 } 76 }
77 #elif defined(OS_WIN) 77 #elif defined(OS_WIN)
78 // TODO(yusukes): Add tests for win_aura once keyboardEvent() in 78 // TODO(yusukes): Add tests for win_aura once keyboardEvent() in
79 // third_party/WebKit/Source/web/win/WebInputEventFactory.cpp is modified 79 // third_party/WebKit/Source/web/win/WebInputEventFactory.cpp is modified
80 // to return VKEY_[LR]XXX instead of VKEY_XXX. 80 // to return VKEY_[LR]XXX instead of VKEY_XXX.
81 // https://bugs.webkit.org/show_bug.cgi?id=86694 81 // https://bugs.webkit.org/show_bug.cgi?id=86694
82 #endif 82 #endif
83 } 83 }
84 84
85 } // namespace content 85 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/gtk_window_utils.cc ('k') | content/plugin/webplugin_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698