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

Side by Side Diff: webkit/tools/test_shell/event_sending_controller.h

Issue 6296015: Remove eventSender, accessibilityController, plainText and (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/webkit/tools/test_shell
Patch Set: Created 9 years, 11 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) 2006-2008 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
6 /*
7 EventSendingController class:
8 Bound to a JavaScript window.eventSender object using
9 CppBoundClass::BindToJavascript(), this allows layout tests that are run in
10 the test_shell to fire DOM events.
11
12 The OSX reference file is in
13 WebKit/Tools/DumpRenderTree/EventSendingController.m
14 */
15
16 #ifndef WEBKIT_TOOLS_TEST_SHELL_EVENT_SENDING_CONTROLLER_H_
17 #define WEBKIT_TOOLS_TEST_SHELL_EVENT_SENDING_CONTROLLER_H_
18
19 #include "build/build_config.h"
20 #include "gfx/point.h"
21 #include "base/task.h"
22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h"
23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
24 #include "webkit/glue/cpp_bound_class.h"
25
26 class TestShell;
27
28 namespace WebKit {
29 class WebDragData;
30 class WebView;
31 struct WebPoint;
32 }
33
34 class EventSendingController : public CppBoundClass {
35 public:
36 // Builds the property and method lists needed to bind this class to a JS
37 // object.
38 EventSendingController(TestShell* shell);
39 ~EventSendingController();
40
41 // Resets some static variable state.
42 void Reset();
43
44 // Simulate drag&drop system call.
45 void DoDragDrop(const WebKit::WebDragData& drag_data,
46 WebKit::WebDragOperationsMask operations_mask);
47
48 // JS callback methods.
49 void mouseDown(const CppArgumentList& args, CppVariant* result);
50 void mouseUp(const CppArgumentList& args, CppVariant* result);
51 void mouseMoveTo(const CppArgumentList& args, CppVariant* result);
52 void leapForward(const CppArgumentList& args, CppVariant* result);
53 void keyDown(const CppArgumentList& args, CppVariant* result);
54 void dispatchMessage(const CppArgumentList& args, CppVariant* result);
55 void textZoomIn(const CppArgumentList& args, CppVariant* result);
56 void textZoomOut(const CppArgumentList& args, CppVariant* result);
57 void zoomPageIn(const CppArgumentList& args, CppVariant* result);
58 void zoomPageOut(const CppArgumentList& args, CppVariant* result);
59 void mouseScrollBy(const CppArgumentList& args, CppVariant* result);
60 void continuousMouseScrollBy(const CppArgumentList& args, CppVariant* result);
61 void scheduleAsynchronousClick(const CppArgumentList& args,
62 CppVariant* result);
63 void beginDragWithFiles(const CppArgumentList& args, CppVariant* result);
64 CppVariant dragMode;
65
66 void addTouchPoint(const CppArgumentList& args, CppVariant* result);
67 void cancelTouchPoint(const CppArgumentList& args, CppVariant* result);
68 void clearTouchPoints(const CppArgumentList& args, CppVariant* result);
69 void releaseTouchPoint(const CppArgumentList& args, CppVariant* result);
70 void setTouchModifier(const CppArgumentList& args, CppVariant* result);
71 void touchCancel(const CppArgumentList& args, CppVariant* result);
72 void touchEnd(const CppArgumentList& args, CppVariant* result);
73 void touchMove(const CppArgumentList& args, CppVariant* result);
74 void touchStart(const CppArgumentList& args, CppVariant* result);
75 void updateTouchPoint(const CppArgumentList& args, CppVariant* result);
76
77 // Unimplemented stubs
78 void contextClick(const CppArgumentList& args, CppVariant* result);
79 void enableDOMUIEventLogging(const CppArgumentList& args, CppVariant* result);
80 void fireKeyboardEventsToElement(const CppArgumentList& args,
81 CppVariant* result);
82 void clearKillRing(const CppArgumentList& args, CppVariant* result);
83
84 // Properties used in layout tests.
85 #if defined(OS_WIN)
86 CppVariant wmKeyDown;
87 CppVariant wmKeyUp;
88 CppVariant wmChar;
89 CppVariant wmDeadChar;
90 CppVariant wmSysKeyDown;
91 CppVariant wmSysKeyUp;
92 CppVariant wmSysChar;
93 CppVariant wmSysDeadChar;
94 #endif
95
96 private:
97 // Returns the test shell's webview.
98 WebKit::WebView* webview();
99
100 // Returns true if dragMode is true.
101 bool drag_mode() { return dragMode.isBool() && dragMode.ToBoolean(); }
102
103 // Sometimes we queue up mouse move and mouse up events for drag drop
104 // handling purposes. These methods dispatch the event.
105 void DoMouseMove(const WebKit::WebMouseEvent& e);
106 void DoMouseUp(const WebKit::WebMouseEvent& e);
107 static void DoLeapForward(int milliseconds);
108 void ReplaySavedEvents();
109
110 // Helper to return the button type given a button code
111 static WebKit::WebMouseEvent::Button GetButtonTypeFromButtonNumber(
112 int button_code);
113
114 // Helper to extract the button number from the optional argument in
115 // mouseDown and mouseUp
116 static int GetButtonNumberFromSingleArg(const CppArgumentList& args);
117
118 // Returns true if the key_code passed in needs a shift key modifier to
119 // be passed into the generated event.
120 bool NeedsShiftModifier(int key_code);
121
122 void UpdateClickCountForButton(WebKit::WebMouseEvent::Button button_type);
123
124 // Compose a touch event from the current touch points and send it.
125 void SendCurrentTouchEvent(const WebKit::WebInputEvent::Type type);
126
127 // Handle a request to send a wheel event.
128 void handleMouseWheel(const CppArgumentList&, CppVariant*, bool continuous);
129
130 ScopedRunnableMethodFactory<EventSendingController> method_factory_;
131
132 // Non-owning pointer. The LayoutTestController is owned by the host.
133 TestShell* shell_;
134
135 // Location of last mouseMoveTo event.
136 static gfx::Point last_mouse_pos_;
137
138 // Currently pressed mouse button (Left/Right/Middle or None)
139 static WebKit::WebMouseEvent::Button pressed_button_;
140
141 // The last button number passed to mouseDown and mouseUp.
142 // Used to determine whether the click count continues to
143 // increment or not.
144 static WebKit::WebMouseEvent::Button last_button_type_;
145 };
146
147 #endif // WEBKIT_TOOLS_TEST_SHELL_EVENT_SENDING_CONTROLLER_H_
OLDNEW
« no previous file with comments | « webkit/tools/test_shell/accessibility_controller.cc ('k') | webkit/tools/test_shell/event_sending_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698