Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / chrome / test / chromedriver / window_commands.h
blobfa36e2b1cd0cf68f083544b6ec09ad62c164b652
1 // Copyright (c) 2013 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.
5 #ifndef CHROME_TEST_CHROMEDRIVER_WINDOW_COMMANDS_H_
6 #define CHROME_TEST_CHROMEDRIVER_WINDOW_COMMANDS_H_
8 #include <string>
10 #include "base/callback_forward.h"
11 #include "base/memory/scoped_ptr.h"
13 namespace base {
14 class DictionaryValue;
15 class Value;
18 struct Session;
19 class Status;
20 class WebView;
22 typedef base::Callback<Status(
23 Session* session,
24 WebView* web_view,
25 const base::DictionaryValue&,
26 scoped_ptr<base::Value>*)> WindowCommand;
28 // Execute a Window Command on the target window.
29 Status ExecuteWindowCommand(
30 const WindowCommand& command,
31 Session* session,
32 const base::DictionaryValue& params,
33 scoped_ptr<base::Value>* value);
35 // Loads a URL.
36 Status ExecuteGet(
37 Session* session,
38 WebView* web_view,
39 const base::DictionaryValue& params,
40 scoped_ptr<base::Value>* value);
42 // Evaluates a given synchronous script with arguments.
43 Status ExecuteExecuteScript(
44 Session* session,
45 WebView* web_view,
46 const base::DictionaryValue& params,
47 scoped_ptr<base::Value>* value);
49 // Evaluates a given asynchronous script with arguments.
50 Status ExecuteExecuteAsyncScript(
51 Session* session,
52 WebView* web_view,
53 const base::DictionaryValue& params,
54 scoped_ptr<base::Value>* value);
56 // Changes the targeted frame for the given session.
57 Status ExecuteSwitchToFrame(
58 Session* session,
59 WebView* web_view,
60 const base::DictionaryValue& params,
61 scoped_ptr<base::Value>* value);
63 // Change focus to the parent frame.
64 Status ExecuteSwitchToParentFrame(
65 Session* session,
66 WebView* web_view,
67 const base::DictionaryValue& params,
68 scoped_ptr<base::Value>* value);
70 // Get the current page title.
71 Status ExecuteGetTitle(
72 Session* session,
73 WebView* web_view,
74 const base::DictionaryValue& params,
75 scoped_ptr<base::Value>* value);
77 // Get the current page source.
78 Status ExecuteGetPageSource(
79 Session* session,
80 WebView* web_view,
81 const base::DictionaryValue& params,
82 scoped_ptr<base::Value>* value);
84 // Search for an element on the page, starting from the document root.
85 Status ExecuteFindElement(
86 int interval_ms,
87 Session* session,
88 WebView* web_view,
89 const base::DictionaryValue& params,
90 scoped_ptr<base::Value>* value);
92 // Search for multiple elements on the page, starting from the document root.
93 Status ExecuteFindElements(
94 int interval_ms,
95 Session* session,
96 WebView* web_view,
97 const base::DictionaryValue& params,
98 scoped_ptr<base::Value>* value);
100 // Get the current page url.
101 Status ExecuteGetCurrentUrl(
102 Session* session,
103 WebView* web_view,
104 const base::DictionaryValue& params,
105 scoped_ptr<base::Value>* value);
107 // Navigate backward in the browser history.
108 Status ExecuteGoBack(
109 Session* session,
110 WebView* web_view,
111 const base::DictionaryValue& params,
112 scoped_ptr<base::Value>* value);
114 // Navigate forward in the browser history.
115 Status ExecuteGoForward(
116 Session* session,
117 WebView* web_view,
118 const base::DictionaryValue& params,
119 scoped_ptr<base::Value>* value);
121 // Refresh the current page.
122 Status ExecuteRefresh(
123 Session* session,
124 WebView* web_view,
125 const base::DictionaryValue& params,
126 scoped_ptr<base::Value>* value);
128 // Move the mouse by an offset of the element if specified .
129 Status ExecuteMouseMoveTo(
130 Session* session,
131 WebView* web_view,
132 const base::DictionaryValue& params,
133 scoped_ptr<base::Value>* value);
135 // Click a mouse button at the coordinates set by the last moveto.
136 Status ExecuteMouseClick(
137 Session* session,
138 WebView* web_view,
139 const base::DictionaryValue& params,
140 scoped_ptr<base::Value>* value);
142 // Click and hold a mouse button at the coordinates set by the last moveto.
143 Status ExecuteMouseButtonDown(
144 Session* session,
145 WebView* web_view,
146 const base::DictionaryValue& params,
147 scoped_ptr<base::Value>* value);
149 // Releases the mouse button previously held (where the mouse is currently at).
150 Status ExecuteMouseButtonUp(
151 Session* session,
152 WebView* web_view,
153 const base::DictionaryValue& params,
154 scoped_ptr<base::Value>* value);
156 // Double-clicks at the current mouse coordinates (set by last moveto).
157 Status ExecuteMouseDoubleClick(
158 Session* session,
159 WebView* web_view,
160 const base::DictionaryValue& params,
161 scoped_ptr<base::Value>* value);
163 // Touch press at a given coordinate.
164 Status ExecuteTouchDown(
165 Session* session,
166 WebView* web_view,
167 const base::DictionaryValue& params,
168 scoped_ptr<base::Value>* value);
170 // Touch release at a given coordinate.
171 Status ExecuteTouchUp(
172 Session* session,
173 WebView* web_view,
174 const base::DictionaryValue& params,
175 scoped_ptr<base::Value>* value);
177 // Touch move at a given coordinate.
178 Status ExecuteTouchMove(
179 Session* session,
180 WebView* web_view,
181 const base::DictionaryValue& params,
182 scoped_ptr<base::Value>* value);
184 // Do a swipe (scroll) gesture beginning at the element.
185 Status ExecuteTouchScroll(
186 Session *session,
187 WebView* web_view,
188 const base::DictionaryValue& params,
189 scoped_ptr<base::Value>* value);
191 Status ExecuteTouchPinch(
192 Session* session,
193 WebView* web_view,
194 const base::DictionaryValue& params,
195 scoped_ptr<base::Value>* value);
197 Status ExecuteGetActiveElement(
198 Session* session,
199 WebView* web_view,
200 const base::DictionaryValue& params,
201 scoped_ptr<base::Value>* value);
203 // Send a sequence of key strokes to the active element.
204 Status ExecuteSendKeysToActiveElement(
205 Session* session,
206 WebView* web_view,
207 const base::DictionaryValue& params,
208 scoped_ptr<base::Value>* value);
210 // Gets the status of the application cache (window.applicationCache.status).
211 Status ExecuteGetAppCacheStatus(
212 Session* session,
213 WebView* web_view,
214 const base::DictionaryValue& params,
215 scoped_ptr<base::Value>* value);
217 Status ExecuteIsBrowserOnline(
218 Session* session,
219 WebView* web_view,
220 const base::DictionaryValue& params,
221 scoped_ptr<base::Value>* value);
223 Status ExecuteGetStorageItem(
224 const char* storage,
225 Session* session,
226 WebView* web_view,
227 const base::DictionaryValue& params,
228 scoped_ptr<base::Value>* value);
230 Status ExecuteGetStorageKeys(
231 const char* storage,
232 Session* session,
233 WebView* web_view,
234 const base::DictionaryValue& params,
235 scoped_ptr<base::Value>* value);
237 Status ExecuteSetStorageItem(
238 const char* storage,
239 Session* session,
240 WebView* web_view,
241 const base::DictionaryValue& params,
242 scoped_ptr<base::Value>* value);
244 Status ExecuteRemoveStorageItem(
245 const char* storage,
246 Session* session,
247 WebView* web_view,
248 const base::DictionaryValue& params,
249 scoped_ptr<base::Value>* value);
251 Status ExecuteClearStorage(
252 const char* storage,
253 Session* session,
254 WebView* web_view,
255 const base::DictionaryValue& params,
256 scoped_ptr<base::Value>* value);
258 Status ExecuteGetStorageSize(
259 const char* storage,
260 Session* session,
261 WebView* web_view,
262 const base::DictionaryValue& params,
263 scoped_ptr<base::Value>* value);
265 Status ExecuteScreenshot(
266 Session* session,
267 WebView* web_view,
268 const base::DictionaryValue& params,
269 scoped_ptr<base::Value>* value);
271 // Retrieve all cookies visible to the current page.
272 Status ExecuteGetCookies(
273 Session* session,
274 WebView* web_view,
275 const base::DictionaryValue& params,
276 scoped_ptr<base::Value>* value);
278 // Set a cookie. If the cookie path is not specified, it should be set to "/".
279 // If the domain is omitted, it should default to the current page's domain.
280 Status ExecuteAddCookie(
281 Session* session,
282 WebView* web_view,
283 const base::DictionaryValue& params,
284 scoped_ptr<base::Value>* value);
286 // Delete the cookie with the given name if it exists in the current page.
287 Status ExecuteDeleteCookie(
288 Session* session,
289 WebView* web_view,
290 const base::DictionaryValue& params,
291 scoped_ptr<base::Value>* value);
293 // Delete all cookies visible to the current page.
294 Status ExecuteDeleteAllCookies(
295 Session* session,
296 WebView* web_view,
297 const base::DictionaryValue& params,
298 scoped_ptr<base::Value>* value);
300 Status ExecuteSetLocation(
301 Session* session,
302 WebView* web_view,
303 const base::DictionaryValue& params,
304 scoped_ptr<base::Value>* value);
306 Status ExecuteSetNetworkConditions(
307 Session* session,
308 WebView* web_view,
309 const base::DictionaryValue& params,
310 scoped_ptr<base::Value>* value);
312 Status ExecuteDeleteNetworkConditions(
313 Session* session,
314 WebView* web_view,
315 const base::DictionaryValue& params,
316 scoped_ptr<base::Value>* value);
318 Status ExecuteTakeHeapSnapshot(
319 Session* session,
320 WebView* web_view,
321 const base::DictionaryValue& params,
322 scoped_ptr<base::Value>* value);
324 #endif // CHROME_TEST_CHROMEDRIVER_WINDOW_COMMANDS_H_