OLD | NEW |
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 "content/shell/renderer/test_runner/event_sender.h" | 5 #include "content/shell/renderer/test_runner/event_sender.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "content/shell/renderer/test_runner/MockSpellCheck.h" | 10 #include "content/shell/renderer/test_runner/MockSpellCheck.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "third_party/WebKit/public/web/WebKit.h" | 22 #include "third_party/WebKit/public/web/WebKit.h" |
23 #include "third_party/WebKit/public/web/WebView.h" | 23 #include "third_party/WebKit/public/web/WebView.h" |
24 #include "v8/include/v8.h" | 24 #include "v8/include/v8.h" |
25 | 25 |
26 #if defined(OS_WIN) | 26 #if defined(OS_WIN) |
27 #include "third_party/WebKit/public/web/win/WebInputEventFactory.h" | 27 #include "third_party/WebKit/public/web/win/WebInputEventFactory.h" |
28 #elif defined(OS_MACOSX) | 28 #elif defined(OS_MACOSX) |
29 #include "third_party/WebKit/public/web/mac/WebInputEventFactory.h" | 29 #include "third_party/WebKit/public/web/mac/WebInputEventFactory.h" |
30 #elif defined(OS_ANDROID) | 30 #elif defined(OS_ANDROID) |
31 #include "third_party/WebKit/public/web/android/WebInputEventFactory.h" | 31 #include "third_party/WebKit/public/web/android/WebInputEventFactory.h" |
32 #elif defined(TOOLKIT_GTK) | |
33 #include "third_party/WebKit/public/web/gtk/WebInputEventFactory.h" | |
34 #endif | 32 #endif |
35 | 33 |
36 using blink::WebContextMenuData; | 34 using blink::WebContextMenuData; |
37 using blink::WebDragData; | 35 using blink::WebDragData; |
38 using blink::WebDragOperationsMask; | 36 using blink::WebDragOperationsMask; |
39 using blink::WebFloatPoint; | 37 using blink::WebFloatPoint; |
40 using blink::WebFrame; | 38 using blink::WebFrame; |
41 using blink::WebGestureEvent; | 39 using blink::WebGestureEvent; |
42 using blink::WebInputEvent; | 40 using blink::WebInputEvent; |
43 using blink::WebKeyboardEvent; | 41 using blink::WebKeyboardEvent; |
44 using blink::WebMouseEvent; | 42 using blink::WebMouseEvent; |
45 using blink::WebMouseWheelEvent; | 43 using blink::WebMouseWheelEvent; |
46 using blink::WebPoint; | 44 using blink::WebPoint; |
47 using blink::WebString; | 45 using blink::WebString; |
48 using blink::WebTouchEvent; | 46 using blink::WebTouchEvent; |
49 using blink::WebTouchPoint; | 47 using blink::WebTouchPoint; |
50 using blink::WebVector; | 48 using blink::WebVector; |
51 using blink::WebView; | 49 using blink::WebView; |
52 | 50 |
53 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_ANDROID) || \ | 51 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_ANDROID) |
54 defined(TOOLKIT_GTK) | |
55 using blink::WebInputEventFactory; | 52 using blink::WebInputEventFactory; |
56 #endif | 53 #endif |
57 | 54 |
58 namespace content { | 55 namespace content { |
59 | 56 |
60 namespace { | 57 namespace { |
61 | 58 |
62 void InitMouseEvent(WebInputEvent::Type t, | 59 void InitMouseEvent(WebInputEvent::Type t, |
63 WebMouseEvent::Button b, | 60 WebMouseEvent::Button b, |
64 const WebPoint& pos, | 61 const WebPoint& pos, |
(...skipping 1171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1236 // For one generated keyboard event, we need to generate a keyDown/keyUp | 1233 // For one generated keyboard event, we need to generate a keyDown/keyUp |
1237 // pair; | 1234 // pair; |
1238 // On Windows, we might also need to generate a char event to mimic the | 1235 // On Windows, we might also need to generate a char event to mimic the |
1239 // Windows event flow; on other platforms we create a merged event and test | 1236 // Windows event flow; on other platforms we create a merged event and test |
1240 // the event flow that that platform provides. | 1237 // the event flow that that platform provides. |
1241 WebKeyboardEvent event_down; | 1238 WebKeyboardEvent event_down; |
1242 event_down.type = WebInputEvent::RawKeyDown; | 1239 event_down.type = WebInputEvent::RawKeyDown; |
1243 event_down.modifiers = modifiers; | 1240 event_down.modifiers = modifiers; |
1244 event_down.windowsKeyCode = code; | 1241 event_down.windowsKeyCode = code; |
1245 | 1242 |
1246 #if defined(OS_LINUX) && defined(TOOLKIT_GTK) | |
1247 event_down.nativeKeyCode = NativeKeyCodeForWindowsKeyCode(code); | |
1248 #endif | |
1249 | |
1250 if (generate_char) { | 1243 if (generate_char) { |
1251 event_down.text[0] = text; | 1244 event_down.text[0] = text; |
1252 event_down.unmodifiedText[0] = text; | 1245 event_down.unmodifiedText[0] = text; |
1253 } | 1246 } |
1254 | 1247 |
1255 event_down.setKeyIdentifierFromWindowsKeyCode(); | 1248 event_down.setKeyIdentifierFromWindowsKeyCode(); |
1256 | 1249 |
1257 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_ANDROID) || \ | 1250 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_ANDROID) |
1258 defined(TOOLKIT_GTK) | |
1259 if (event_down.modifiers != 0) | 1251 if (event_down.modifiers != 0) |
1260 event_down.isSystemKey = WebInputEventFactory::isSystemKeyEvent(event_down); | 1252 event_down.isSystemKey = WebInputEventFactory::isSystemKeyEvent(event_down); |
1261 #endif | 1253 #endif |
1262 | 1254 |
1263 if (needs_shift_key_modifier) | 1255 if (needs_shift_key_modifier) |
1264 event_down.modifiers |= WebInputEvent::ShiftKey; | 1256 event_down.modifiers |= WebInputEvent::ShiftKey; |
1265 | 1257 |
1266 // See if KeyLocation argument is given. | 1258 // See if KeyLocation argument is given. |
1267 if (location == DOMKeyLocationNumpad) | 1259 if (location == DOMKeyLocationNumpad) |
1268 event_down.modifiers |= WebInputEvent::IsKeyPad; | 1260 event_down.modifiers |= WebInputEvent::IsKeyPad; |
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2148 } | 2140 } |
2149 default: | 2141 default: |
2150 NOTREACHED(); | 2142 NOTREACHED(); |
2151 } | 2143 } |
2152 } | 2144 } |
2153 | 2145 |
2154 replaying_saved_events_ = false; | 2146 replaying_saved_events_ = false; |
2155 } | 2147 } |
2156 | 2148 |
2157 } // namespace content | 2149 } // namespace content |
OLD | NEW |