| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 #ifndef EventSender_h | 37 #ifndef EventSender_h |
| 38 #define EventSender_h | 38 #define EventSender_h |
| 39 | 39 |
| 40 #include "CppBoundClass.h" | 40 #include "CppBoundClass.h" |
| 41 #include "public/platform/WebPoint.h" | 41 #include "public/platform/WebPoint.h" |
| 42 #include "public/testing/WebTask.h" | 42 #include "public/testing/WebTask.h" |
| 43 #include "public/web/WebDragOperation.h" | 43 #include "public/web/WebDragOperation.h" |
| 44 #include "public/web/WebInputEvent.h" | 44 #include "public/web/WebInputEvent.h" |
| 45 #include <memory> | 45 #include <memory> |
| 46 | 46 |
| 47 namespace WebKit { | 47 namespace blink { |
| 48 class WebDragData; | 48 class WebDragData; |
| 49 class WebView; | 49 class WebView; |
| 50 struct WebContextMenuData; | 50 struct WebContextMenuData; |
| 51 } | 51 } |
| 52 | 52 |
| 53 namespace WebTestRunner { | 53 namespace WebTestRunner { |
| 54 | 54 |
| 55 class TestInterfaces; | 55 class TestInterfaces; |
| 56 class WebTestDelegate; | 56 class WebTestDelegate; |
| 57 | 57 |
| 58 class EventSender : public CppBoundClass { | 58 class EventSender : public CppBoundClass { |
| 59 public: | 59 public: |
| 60 explicit EventSender(TestInterfaces*); | 60 explicit EventSender(TestInterfaces*); |
| 61 ~EventSender(); | 61 ~EventSender(); |
| 62 | 62 |
| 63 void setDelegate(WebTestDelegate* delegate) { m_delegate = delegate; } | 63 void setDelegate(WebTestDelegate* delegate) { m_delegate = delegate; } |
| 64 void setWebView(WebKit::WebView* webView) { m_webView = webView; } | 64 void setWebView(blink::WebView* webView) { m_webView = webView; } |
| 65 | 65 |
| 66 void setContextMenuData(const WebKit::WebContextMenuData&); | 66 void setContextMenuData(const blink::WebContextMenuData&); |
| 67 | 67 |
| 68 // Resets some static variable state. | 68 // Resets some static variable state. |
| 69 void reset(); | 69 void reset(); |
| 70 | 70 |
| 71 // Simulate drag&drop system call. | 71 // Simulate drag&drop system call. |
| 72 void doDragDrop(const WebKit::WebDragData&, WebKit::WebDragOperationsMask); | 72 void doDragDrop(const blink::WebDragData&, blink::WebDragOperationsMask); |
| 73 | 73 |
| 74 // Test helper for dragging out images. | 74 // Test helper for dragging out images. |
| 75 void dumpFilenameBeingDragged(const CppArgumentList&, CppVariant*); | 75 void dumpFilenameBeingDragged(const CppArgumentList&, CppVariant*); |
| 76 | 76 |
| 77 // JS callback methods. | 77 // JS callback methods. |
| 78 void contextClick(const CppArgumentList&, CppVariant*); | 78 void contextClick(const CppArgumentList&, CppVariant*); |
| 79 void mouseDown(const CppArgumentList&, CppVariant*); | 79 void mouseDown(const CppArgumentList&, CppVariant*); |
| 80 void mouseUp(const CppArgumentList&, CppVariant*); | 80 void mouseUp(const CppArgumentList&, CppVariant*); |
| 81 void mouseMoveTo(const CppArgumentList&, CppVariant*); | 81 void mouseMoveTo(const CppArgumentList&, CppVariant*); |
| 82 void leapForward(const CppArgumentList&, CppVariant*); | 82 void leapForward(const CppArgumentList&, CppVariant*); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 void gestureScrollFirstPoint(const CppArgumentList&, CppVariant*); | 119 void gestureScrollFirstPoint(const CppArgumentList&, CppVariant*); |
| 120 void gestureScrollUpdate(const CppArgumentList&, CppVariant*); | 120 void gestureScrollUpdate(const CppArgumentList&, CppVariant*); |
| 121 void gestureScrollUpdateWithoutPropagation(const CppArgumentList&, CppVarian
t*); | 121 void gestureScrollUpdateWithoutPropagation(const CppArgumentList&, CppVarian
t*); |
| 122 void gestureTap(const CppArgumentList&, CppVariant*); | 122 void gestureTap(const CppArgumentList&, CppVariant*); |
| 123 void gestureTapDown(const CppArgumentList&, CppVariant*); | 123 void gestureTapDown(const CppArgumentList&, CppVariant*); |
| 124 void gestureShowPress(const CppArgumentList&, CppVariant*); | 124 void gestureShowPress(const CppArgumentList&, CppVariant*); |
| 125 void gestureTapCancel(const CppArgumentList&, CppVariant*); | 125 void gestureTapCancel(const CppArgumentList&, CppVariant*); |
| 126 void gestureLongPress(const CppArgumentList&, CppVariant*); | 126 void gestureLongPress(const CppArgumentList&, CppVariant*); |
| 127 void gestureLongTap(const CppArgumentList&, CppVariant*); | 127 void gestureLongTap(const CppArgumentList&, CppVariant*); |
| 128 void gestureTwoFingerTap(const CppArgumentList&, CppVariant*); | 128 void gestureTwoFingerTap(const CppArgumentList&, CppVariant*); |
| 129 void gestureEvent(WebKit::WebInputEvent::Type, const CppArgumentList&); | 129 void gestureEvent(blink::WebInputEvent::Type, const CppArgumentList&); |
| 130 | 130 |
| 131 // Setting this to false makes EventSender not force layout() calls. | 131 // Setting this to false makes EventSender not force layout() calls. |
| 132 // This makes it possible to test the standard WebCore event dispatch. | 132 // This makes it possible to test the standard WebCore event dispatch. |
| 133 CppVariant forceLayoutOnEvents; | 133 CppVariant forceLayoutOnEvents; |
| 134 | 134 |
| 135 // Unimplemented stubs | 135 // Unimplemented stubs |
| 136 void enableDOMUIEventLogging(const CppArgumentList&, CppVariant*); | 136 void enableDOMUIEventLogging(const CppArgumentList&, CppVariant*); |
| 137 void fireKeyboardEventsToElement(const CppArgumentList&, CppVariant*); | 137 void fireKeyboardEventsToElement(const CppArgumentList&, CppVariant*); |
| 138 void clearKillRing(const CppArgumentList&, CppVariant*); | 138 void clearKillRing(const CppArgumentList&, CppVariant*); |
| 139 | 139 |
| 140 // Properties used in layout tests. | 140 // Properties used in layout tests. |
| 141 #if defined(OS_WIN) | 141 #if defined(OS_WIN) |
| 142 CppVariant wmKeyDown; | 142 CppVariant wmKeyDown; |
| 143 CppVariant wmKeyUp; | 143 CppVariant wmKeyUp; |
| 144 CppVariant wmChar; | 144 CppVariant wmChar; |
| 145 CppVariant wmDeadChar; | 145 CppVariant wmDeadChar; |
| 146 CppVariant wmSysKeyDown; | 146 CppVariant wmSysKeyDown; |
| 147 CppVariant wmSysKeyUp; | 147 CppVariant wmSysKeyUp; |
| 148 CppVariant wmSysChar; | 148 CppVariant wmSysChar; |
| 149 CppVariant wmSysDeadChar; | 149 CppVariant wmSysDeadChar; |
| 150 #endif | 150 #endif |
| 151 | 151 |
| 152 WebTaskList* taskList() { return &m_taskList; } | 152 WebTaskList* taskList() { return &m_taskList; } |
| 153 | 153 |
| 154 private: | 154 private: |
| 155 WebKit::WebView* webview() { return m_webView; } | 155 blink::WebView* webview() { return m_webView; } |
| 156 | 156 |
| 157 // Returns true if dragMode is true. | 157 // Returns true if dragMode is true. |
| 158 bool isDragMode() { return dragMode.isBool() && dragMode.toBoolean(); } | 158 bool isDragMode() { return dragMode.isBool() && dragMode.toBoolean(); } |
| 159 | 159 |
| 160 bool shouldForceLayoutOnEvents() const { return forceLayoutOnEvents.isBool()
&& forceLayoutOnEvents.toBoolean(); } | 160 bool shouldForceLayoutOnEvents() const { return forceLayoutOnEvents.isBool()
&& forceLayoutOnEvents.toBoolean(); } |
| 161 | 161 |
| 162 // Sometimes we queue up mouse move and mouse up events for drag drop | 162 // Sometimes we queue up mouse move and mouse up events for drag drop |
| 163 // handling purposes. These methods dispatch the event. | 163 // handling purposes. These methods dispatch the event. |
| 164 void doMouseMove(const WebKit::WebMouseEvent&); | 164 void doMouseMove(const blink::WebMouseEvent&); |
| 165 void doMouseUp(const WebKit::WebMouseEvent&); | 165 void doMouseUp(const blink::WebMouseEvent&); |
| 166 static void doLeapForward(int milliseconds); | 166 static void doLeapForward(int milliseconds); |
| 167 void replaySavedEvents(); | 167 void replaySavedEvents(); |
| 168 | 168 |
| 169 // Helper to return the button type given a button code | 169 // Helper to return the button type given a button code |
| 170 static WebKit::WebMouseEvent::Button getButtonTypeFromButtonNumber(int); | 170 static blink::WebMouseEvent::Button getButtonTypeFromButtonNumber(int); |
| 171 | 171 |
| 172 // Helper to extract the button number from the optional argument in | 172 // Helper to extract the button number from the optional argument in |
| 173 // mouseDown and mouseUp | 173 // mouseDown and mouseUp |
| 174 static int getButtonNumberFromSingleArg(const CppArgumentList&); | 174 static int getButtonNumberFromSingleArg(const CppArgumentList&); |
| 175 | 175 |
| 176 // Returns true if the specified key code passed in needs a shift key | 176 // Returns true if the specified key code passed in needs a shift key |
| 177 // modifier to be passed into the generated event. | 177 // modifier to be passed into the generated event. |
| 178 bool needsShiftModifier(int); | 178 bool needsShiftModifier(int); |
| 179 | 179 |
| 180 void finishDragAndDrop(const WebKit::WebMouseEvent&, WebKit::WebDragOperatio
n); | 180 void finishDragAndDrop(const blink::WebMouseEvent&, blink::WebDragOperation)
; |
| 181 void updateClickCountForButton(WebKit::WebMouseEvent::Button); | 181 void updateClickCountForButton(blink::WebMouseEvent::Button); |
| 182 | 182 |
| 183 // Compose a touch event from the current touch points and send it. | 183 // Compose a touch event from the current touch points and send it. |
| 184 void sendCurrentTouchEvent(const WebKit::WebInputEvent::Type); | 184 void sendCurrentTouchEvent(const blink::WebInputEvent::Type); |
| 185 | 185 |
| 186 // Init a mouse wheel event from the given args. | 186 // Init a mouse wheel event from the given args. |
| 187 void initMouseWheelEvent(const CppArgumentList&, CppVariant*, bool continuou
s, WebKit::WebMouseWheelEvent*); | 187 void initMouseWheelEvent(const CppArgumentList&, CppVariant*, bool continuou
s, blink::WebMouseWheelEvent*); |
| 188 | 188 |
| 189 WebTaskList m_taskList; | 189 WebTaskList m_taskList; |
| 190 | 190 |
| 191 TestInterfaces* m_testInterfaces; | 191 TestInterfaces* m_testInterfaces; |
| 192 WebTestDelegate* m_delegate; | 192 WebTestDelegate* m_delegate; |
| 193 WebKit::WebView* m_webView; | 193 blink::WebView* m_webView; |
| 194 | 194 |
| 195 std::auto_ptr<WebKit::WebContextMenuData> m_lastContextMenuData; | 195 std::auto_ptr<blink::WebContextMenuData> m_lastContextMenuData; |
| 196 | 196 |
| 197 // Location of the touch point that initiated a gesture. | 197 // Location of the touch point that initiated a gesture. |
| 198 WebKit::WebPoint m_currentGestureLocation; | 198 blink::WebPoint m_currentGestureLocation; |
| 199 | 199 |
| 200 // Location of last mouseMoveTo event. | 200 // Location of last mouseMoveTo event. |
| 201 static WebKit::WebPoint lastMousePos; | 201 static blink::WebPoint lastMousePos; |
| 202 | 202 |
| 203 // Currently pressed mouse button (Left/Right/Middle or None) | 203 // Currently pressed mouse button (Left/Right/Middle or None) |
| 204 static WebKit::WebMouseEvent::Button pressedButton; | 204 static blink::WebMouseEvent::Button pressedButton; |
| 205 | 205 |
| 206 // The last button number passed to mouseDown and mouseUp. | 206 // The last button number passed to mouseDown and mouseUp. |
| 207 // Used to determine whether the click count continues to | 207 // Used to determine whether the click count continues to |
| 208 // increment or not. | 208 // increment or not. |
| 209 static WebKit::WebMouseEvent::Button lastButtonType; | 209 static blink::WebMouseEvent::Button lastButtonType; |
| 210 }; | 210 }; |
| 211 | 211 |
| 212 } | 212 } |
| 213 | 213 |
| 214 #endif // EventSender_h | 214 #endif // EventSender_h |
| OLD | NEW |