OLD | NEW |
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 #include "ui/events/event_utils.h" | 10 #include "ui/events/event_utils.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 #elif defined(OS_WIN) | 128 #elif defined(OS_WIN) |
129 // TODO(yusukes): Add tests for win_aura once keyboardEvent() in | 129 // TODO(yusukes): Add tests for win_aura once keyboardEvent() in |
130 // third_party/WebKit/Source/web/win/WebInputEventFactory.cpp is modified | 130 // third_party/WebKit/Source/web/win/WebInputEventFactory.cpp is modified |
131 // to return VKEY_[LR]XXX instead of VKEY_XXX. | 131 // to return VKEY_[LR]XXX instead of VKEY_XXX. |
132 // https://bugs.webkit.org/show_bug.cgi?id=86694 | 132 // https://bugs.webkit.org/show_bug.cgi?id=86694 |
133 #endif | 133 #endif |
134 { | 134 { |
135 // Press left Ctrl. | 135 // Press left Ctrl. |
136 ui::KeyEvent event(ui::ET_KEY_PRESSED, ui::VKEY_CONTROL, | 136 ui::KeyEvent event(ui::ET_KEY_PRESSED, ui::VKEY_CONTROL, |
137 ui::DomCode::CONTROL_LEFT, ui::EF_CONTROL_DOWN, | 137 ui::DomCode::CONTROL_LEFT, ui::EF_CONTROL_DOWN, |
138 ui::DomKey::CONTROL, 0, ui::EventTimeForNow()); | 138 ui::DomKey::CONTROL, ui::EventTimeForNow()); |
139 blink::WebKeyboardEvent webkit_event = MakeWebKeyboardEvent(event); | 139 blink::WebKeyboardEvent webkit_event = MakeWebKeyboardEvent(event); |
140 // ui::VKEY_LCONTROL, instead of ui::VKEY_CONTROL, should be filled. | 140 // ui::VKEY_LCONTROL, instead of ui::VKEY_CONTROL, should be filled. |
141 EXPECT_EQ(ui::VKEY_LCONTROL, webkit_event.windowsKeyCode); | 141 EXPECT_EQ(ui::VKEY_LCONTROL, webkit_event.windowsKeyCode); |
142 } | 142 } |
143 { | 143 { |
144 // Press right Ctrl. | 144 // Press right Ctrl. |
145 ui::KeyEvent event(ui::ET_KEY_PRESSED, ui::VKEY_CONTROL, | 145 ui::KeyEvent event(ui::ET_KEY_PRESSED, ui::VKEY_CONTROL, |
146 ui::DomCode::CONTROL_RIGHT, ui::EF_CONTROL_DOWN, | 146 ui::DomCode::CONTROL_RIGHT, ui::EF_CONTROL_DOWN, |
147 ui::DomKey::CONTROL, 0, ui::EventTimeForNow()); | 147 ui::DomKey::CONTROL, ui::EventTimeForNow()); |
148 blink::WebKeyboardEvent webkit_event = MakeWebKeyboardEvent(event); | 148 blink::WebKeyboardEvent webkit_event = MakeWebKeyboardEvent(event); |
149 // ui::VKEY_RCONTROL, instead of ui::VKEY_CONTROL, should be filled. | 149 // ui::VKEY_RCONTROL, instead of ui::VKEY_CONTROL, should be filled. |
150 EXPECT_EQ(ui::VKEY_RCONTROL, webkit_event.windowsKeyCode); | 150 EXPECT_EQ(ui::VKEY_RCONTROL, webkit_event.windowsKeyCode); |
151 } | 151 } |
152 } | 152 } |
153 | 153 |
154 // Checks that MakeWebKeyboardEvent fills a correct keypad modifier. | 154 // Checks that MakeWebKeyboardEvent fills a correct keypad modifier. |
155 TEST(WebInputEventAuraTest, TestMakeWebKeyboardEventKeyPadKeyCode) { | 155 TEST(WebInputEventAuraTest, TestMakeWebKeyboardEventKeyPadKeyCode) { |
156 #if defined(USE_X11) | 156 #if defined(USE_X11) |
157 #define XK(x) XK_##x | 157 #define XK(x) XK_##x |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 << "{dom_code:" | 240 << "{dom_code:" |
241 << ui::KeycodeConverter::DomCodeToCodeString(test_case.dom_code) | 241 << ui::KeycodeConverter::DomCodeToCodeString(test_case.dom_code) |
242 << ", ui_keycode:" << test_case.ui_keycode | 242 << ", ui_keycode:" << test_case.ui_keycode |
243 << ", x_keysym:" << test_case.x_keysym | 243 << ", x_keysym:" << test_case.x_keysym |
244 << "}, expect: " << test_case.expected_result; | 244 << "}, expect: " << test_case.expected_result; |
245 } | 245 } |
246 #endif | 246 #endif |
247 } | 247 } |
248 | 248 |
249 } // namespace content | 249 } // namespace content |
OLD | NEW |