OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CHROME_TEST_AUTOMATION_AUTOMATION_JSON_REQUESTS_H_ | 5 #ifndef CHROME_TEST_AUTOMATION_AUTOMATION_JSON_REQUESTS_H_ |
6 #define CHROME_TEST_AUTOMATION_AUTOMATION_JSON_REQUESTS_H_ | 6 #define CHROME_TEST_AUTOMATION_AUTOMATION_JSON_REQUESTS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/file_path.h" | 13 #include "base/file_path.h" |
| 14 #include "base/string_number_conversions.h" |
14 #include "chrome/common/automation_constants.h" | 15 #include "chrome/common/automation_constants.h" |
| 16 #include "chrome/common/automation_id.h" |
15 #include "ui/base/keycodes/keyboard_codes.h" | 17 #include "ui/base/keycodes/keyboard_codes.h" |
16 | 18 |
17 class AutomationMessageSender; | 19 class AutomationMessageSender; |
18 class FilePath; | 20 class FilePath; |
19 | 21 |
20 namespace base { | 22 namespace base { |
21 class DictionaryValue; | 23 class DictionaryValue; |
22 class ListValue; | 24 class ListValue; |
23 class Value; | 25 class Value; |
24 } | 26 } |
25 | 27 |
26 struct WebKeyEvent { | 28 struct WebKeyEvent { |
27 WebKeyEvent(automation::KeyEventTypes type, | 29 WebKeyEvent(automation::KeyEventTypes type, |
28 ui::KeyboardCode key_code, | 30 ui::KeyboardCode key_code, |
29 const std::string& unmodified_text, | 31 const std::string& unmodified_text, |
30 const std::string& modified_text, | 32 const std::string& modified_text, |
31 int modifiers); | 33 int modifiers); |
32 | 34 |
33 automation::KeyEventTypes type; | 35 automation::KeyEventTypes type; |
34 ui::KeyboardCode key_code; | 36 ui::KeyboardCode key_code; |
35 std::string unmodified_text; | 37 std::string unmodified_text; |
36 std::string modified_text; | 38 std::string modified_text; |
37 int modifiers; | 39 int modifiers; |
38 }; | 40 }; |
39 | 41 |
| 42 // Uniquely identifies a particular WebView. |
| 43 // This is needed because Chrome used to accept just tab IDs, while |
| 44 // now it accepts IDs for other types of WebViews. |
| 45 // TOOD(kkania): Remove this abstraction once Chrome 16 is unsupported. |
| 46 class WebViewId { |
| 47 public: |
| 48 // Creates an ID for the given view ID. |
| 49 static WebViewId ForView(const AutomationId& view_id); |
| 50 |
| 51 // Creates an ID for the given tab ID. |
| 52 static WebViewId ForOldStyleTab(int tab_id); |
| 53 |
| 54 // Creates an invalid ID. |
| 55 WebViewId(); |
| 56 |
| 57 // Updates the given dictionary to include this ID. If the ID refers to a |
| 58 // view ID, |view_id_key| will be the key modified in the dictionary. |
| 59 void UpdateDictionary(base::DictionaryValue* dictionary, |
| 60 const std::string& view_id_key) const; |
| 61 |
| 62 // Returns whether this ID is valid. Even if it is valid, the object it |
| 63 // refers to may not exist. |
| 64 bool IsValid() const; |
| 65 |
| 66 // Returns an |AutomationId| made from this ID. |
| 67 AutomationId GetId() const; |
| 68 |
| 69 // Returns whether this ID refers to a tab. |
| 70 bool IsTab() const; |
| 71 |
| 72 int tab_id() const; |
| 73 |
| 74 // The old style is to use a single integer ID for a tab. The new style is |
| 75 // to use an automation ID which may refer to a number of different object |
| 76 // types. |
| 77 bool old_style() const; |
| 78 |
| 79 private: |
| 80 // Whether this ID is an old-style integer tab ID. |
| 81 bool old_style_; |
| 82 |
| 83 AutomationId id_; |
| 84 int tab_id_; |
| 85 }; |
| 86 |
| 87 // Used to locate a WebView. The same locator may locate different WebViews |
| 88 // at different times. This is needed because Chrome used to only accept |
| 89 // browser/tab indices, while the new Chrome accepts a unique ID. |
| 90 // TOOD(kkania): Simplify this once Chrome 16 is unsupported. |
| 91 class WebViewLocator { |
| 92 public: |
| 93 // Creates a locator for locating the given tab. |
| 94 static WebViewLocator ForIndexPair(int browser_index, int tab_index); |
| 95 |
| 96 // Creates a locator for locating the given view. |
| 97 static WebViewLocator ForViewId(const AutomationId& view_id); |
| 98 |
| 99 // Creates an invalid locator. |
| 100 WebViewLocator(); |
| 101 ~WebViewLocator(); |
| 102 |
| 103 // Updates the given dictionary to include the given locator information. |
| 104 // If this locator is a view ID, |view_id_key| will be the name of the key |
| 105 // to update. |
| 106 void UpdateDictionary(base::DictionaryValue* dict, |
| 107 const std::string& view_id_key) const; |
| 108 |
| 109 int browser_index() const; |
| 110 int tab_index() const; |
| 111 |
| 112 private: |
| 113 enum Type { |
| 114 kTypeIndexPair, |
| 115 kTypeViewId, |
| 116 }; |
| 117 |
| 118 struct IndexPair { |
| 119 int browser_index; |
| 120 int tab_index; |
| 121 }; |
| 122 |
| 123 struct Locator { |
| 124 Locator(); |
| 125 ~Locator(); |
| 126 |
| 127 IndexPair index_pair; |
| 128 AutomationId view_id; |
| 129 }; |
| 130 |
| 131 Type type_; |
| 132 Locator locator_; |
| 133 }; |
| 134 |
| 135 // Collection of info about a given WebView. |
| 136 struct WebViewInfo { |
| 137 WebViewInfo(const WebViewId& view_id, |
| 138 const std::string& extension_id); |
| 139 ~WebViewInfo(); |
| 140 |
| 141 // The view's unique ID. |
| 142 WebViewId view_id; |
| 143 |
| 144 // If this view belongs to an extension, this ID will be set to it. |
| 145 std::string extension_id; |
| 146 }; |
| 147 |
40 // Sends a JSON request to the chrome automation provider. Returns true | 148 // Sends a JSON request to the chrome automation provider. Returns true |
41 // if the JSON request was successfully sent and the reply was received. | 149 // if the JSON request was successfully sent and the reply was received. |
42 // If true, |success| will be set to whether the JSON request was | 150 // If true, |success| will be set to whether the JSON request was |
43 // completed successfully by the automation provider. | 151 // completed successfully by the automation provider. |
44 bool SendAutomationJSONRequest(AutomationMessageSender* sender, | 152 bool SendAutomationJSONRequest(AutomationMessageSender* sender, |
45 const std::string& request, | 153 const std::string& request, |
46 int timeout_ms, | 154 int timeout_ms, |
47 std::string* reply, | 155 std::string* reply, |
48 bool* success) WARN_UNUSED_RESULT; | 156 bool* success) WARN_UNUSED_RESULT; |
49 | 157 |
(...skipping 20 matching lines...) Expand all Loading... |
70 AutomationMessageSender* sender, | 178 AutomationMessageSender* sender, |
71 int tab_proxy_handle, | 179 int tab_proxy_handle, |
72 int* browser_index, | 180 int* browser_index, |
73 int* tab_index, | 181 int* tab_index, |
74 std::string* error_msg) WARN_UNUSED_RESULT; | 182 std::string* error_msg) WARN_UNUSED_RESULT; |
75 | 183 |
76 // Requests to navigate to the given url and wait for the given number of | 184 // Requests to navigate to the given url and wait for the given number of |
77 // navigations to complete. Returns true on success. | 185 // navigations to complete. Returns true on success. |
78 bool SendNavigateToURLJSONRequest( | 186 bool SendNavigateToURLJSONRequest( |
79 AutomationMessageSender* sender, | 187 AutomationMessageSender* sender, |
80 int browser_index, | 188 const WebViewLocator& locator, |
81 int tab_index, | |
82 const std::string& url, | 189 const std::string& url, |
83 int navigation_count, | 190 int navigation_count, |
84 AutomationMsg_NavigationResponseValues* nav_response, | 191 AutomationMsg_NavigationResponseValues* nav_response, |
85 std::string* error_msg) WARN_UNUSED_RESULT; | 192 std::string* error_msg) WARN_UNUSED_RESULT; |
86 | 193 |
87 // Requests the given javascript to be executed in the frame specified by the | 194 // Requests the given javascript to be executed in the frame specified by the |
88 // given xpath. Returns true on success. If true, |result| will be set to the | 195 // given xpath. Returns true on success. If true, |result| will be set to the |
89 // result of the execution and ownership will be given to the caller. | 196 // result of the execution and ownership will be given to the caller. |
90 bool SendExecuteJavascriptJSONRequest( | 197 bool SendExecuteJavascriptJSONRequest( |
91 AutomationMessageSender* sender, | 198 AutomationMessageSender* sender, |
92 int browser_index, | 199 const WebViewLocator& locator, |
93 int tab_index, | |
94 const std::string& frame_xpath, | 200 const std::string& frame_xpath, |
95 const std::string& javascript, | 201 const std::string& javascript, |
96 base::Value** result, | 202 base::Value** result, |
97 std::string* error_msg) WARN_UNUSED_RESULT; | 203 std::string* error_msg) WARN_UNUSED_RESULT; |
98 | 204 |
99 // Requests the specified tab to go forward. Waits for the load to complete. | 205 // Requests the specified view to go forward. Waits for the load to complete. |
100 // Returns true on success. | 206 // Returns true on success. |
101 bool SendGoForwardJSONRequest( | 207 bool SendGoForwardJSONRequest( |
102 AutomationMessageSender* sender, | 208 AutomationMessageSender* sender, |
103 int browser_index, | 209 const WebViewLocator& locator, |
104 int tab_index, | |
105 std::string* error_msg) WARN_UNUSED_RESULT; | 210 std::string* error_msg) WARN_UNUSED_RESULT; |
106 | 211 |
107 // Requests the specified tab to go back. Waits for the load to complete. | 212 // Requests the specified view to go back. Waits for the load to complete. |
108 // Returns true on success. | 213 // Returns true on success. |
109 bool SendGoBackJSONRequest( | 214 bool SendGoBackJSONRequest( |
110 AutomationMessageSender* sender, | 215 AutomationMessageSender* sender, |
111 int browser_index, | 216 const WebViewLocator& locator, |
112 int tab_index, | |
113 std::string* error_msg) WARN_UNUSED_RESULT; | 217 std::string* error_msg) WARN_UNUSED_RESULT; |
114 | 218 |
115 // Requests the specified tab to reload. Waits for the load to complete. | 219 // Requests the specified view to reload. Waits for the load to complete. |
116 // Returns true on success. | 220 // Returns true on success. |
117 bool SendReloadJSONRequest( | 221 bool SendReloadJSONRequest( |
118 AutomationMessageSender* sender, | 222 AutomationMessageSender* sender, |
119 int browser_index, | 223 const WebViewLocator& locator, |
120 int tab_index, | |
121 std::string* error_msg) WARN_UNUSED_RESULT; | 224 std::string* error_msg) WARN_UNUSED_RESULT; |
122 | 225 |
123 // Requests a snapshot of the entire page to be saved to the given path | 226 // Requests a snapshot of the entire page to be saved to the given path |
124 // in PNG format. | 227 // in PNG format. |
125 // Returns true on success. | 228 // Returns true on success. |
126 bool SendCaptureEntirePageJSONRequest( | 229 bool SendCaptureEntirePageJSONRequest( |
127 AutomationMessageSender* sender, | 230 AutomationMessageSender* sender, |
128 int browser_index, | 231 const WebViewLocator& locator, |
129 int tab_index, | |
130 const FilePath& path, | 232 const FilePath& path, |
131 std::string* error_msg) WARN_UNUSED_RESULT; | 233 std::string* error_msg) WARN_UNUSED_RESULT; |
132 | 234 |
133 // Requests the url of the specified tab. Returns true on success. | |
134 bool SendGetTabURLJSONRequest( | |
135 AutomationMessageSender* sender, | |
136 int browser_index, | |
137 int tab_index, | |
138 std::string* url, | |
139 std::string* error_msg) WARN_UNUSED_RESULT; | |
140 | |
141 // Requests the title of the specified tab. Returns true on success. | |
142 bool SendGetTabTitleJSONRequest( | |
143 AutomationMessageSender* sender, | |
144 int browser_index, | |
145 int tab_index, | |
146 std::string* tab_title, | |
147 std::string* error_msg) WARN_UNUSED_RESULT; | |
148 | |
149 // Requests all the cookies for the given URL. On success returns true and | 235 // Requests all the cookies for the given URL. On success returns true and |
150 // caller takes ownership of |cookies|, which is a list of all the cookies in | 236 // caller takes ownership of |cookies|, which is a list of all the cookies in |
151 // dictionary format. | 237 // dictionary format. |
152 bool SendGetCookiesJSONRequest( | 238 bool SendGetCookiesJSONRequest( |
153 AutomationMessageSender* sender, | 239 AutomationMessageSender* sender, |
154 const std::string& url, | 240 const std::string& url, |
155 base::ListValue** cookies, | 241 base::ListValue** cookies, |
156 std::string* error_msg) WARN_UNUSED_RESULT; | 242 std::string* error_msg) WARN_UNUSED_RESULT; |
157 | 243 |
158 // Requests deletion of the cookie with the given name and URL. Returns true | 244 // Requests deletion of the cookie with the given name and URL. Returns true |
159 // on success. | 245 // on success. |
160 bool SendDeleteCookieJSONRequest( | 246 bool SendDeleteCookieJSONRequest( |
161 AutomationMessageSender* sender, | 247 AutomationMessageSender* sender, |
162 const std::string& url, | 248 const std::string& url, |
163 const std::string& cookie_name, | 249 const std::string& cookie_name, |
164 std::string* error_msg) WARN_UNUSED_RESULT; | 250 std::string* error_msg) WARN_UNUSED_RESULT; |
165 | 251 |
166 // Requests setting the given cookie for the given URL. Returns true on | 252 // Requests setting the given cookie for the given URL. Returns true on |
167 // success. The caller retains ownership of |cookie_dict|. | 253 // success. The caller retains ownership of |cookie_dict|. |
168 bool SendSetCookieJSONRequest( | 254 bool SendSetCookieJSONRequest( |
169 AutomationMessageSender* sender, | 255 AutomationMessageSender* sender, |
170 const std::string& url, | 256 const std::string& url, |
171 base::DictionaryValue* cookie_dict, | 257 base::DictionaryValue* cookie_dict, |
172 std::string* error_msg) WARN_UNUSED_RESULT; | 258 std::string* error_msg) WARN_UNUSED_RESULT; |
173 | 259 |
174 // Requests the IDs for all open tabs. Returns true on success. | 260 // Requests the IDs for all open tabs. Returns true on success. |
175 bool SendGetTabIdsJSONRequest( | 261 bool SendGetTabIdsJSONRequest( |
176 AutomationMessageSender* sender, | 262 AutomationMessageSender* sender, |
177 std::vector<int>* tab_ids, | 263 std::vector<WebViewInfo>* views, |
| 264 std::string* error_msg) WARN_UNUSED_RESULT; |
| 265 |
| 266 // Requests info for all open views. Returns true on success. |
| 267 bool SendGetWebViewsJSONRequest( |
| 268 AutomationMessageSender* sender, |
| 269 std::vector<WebViewInfo>* views, |
178 std::string* error_msg) WARN_UNUSED_RESULT; | 270 std::string* error_msg) WARN_UNUSED_RESULT; |
179 | 271 |
180 // Requests whether the given tab ID is valid. Returns true on success. | 272 // Requests whether the given tab ID is valid. Returns true on success. |
181 bool SendIsTabIdValidJSONRequest( | 273 bool SendIsTabIdValidJSONRequest( |
182 AutomationMessageSender* sender, | 274 AutomationMessageSender* sender, |
183 int tab_id, | 275 const WebViewId& view_id, |
184 bool* is_valid, | 276 bool* is_valid, |
185 std::string* error_msg) WARN_UNUSED_RESULT; | 277 std::string* error_msg) WARN_UNUSED_RESULT; |
186 | 278 |
187 // Requests to close the given tab. Returns true on success. | 279 // Requests whether the given automation ID refers to an actual automation |
188 bool SendCloseTabJSONRequest( | 280 // object. Returns true on success. |
| 281 bool SendDoesAutomationObjectExistJSONRequest( |
189 AutomationMessageSender* sender, | 282 AutomationMessageSender* sender, |
190 int browser_index, | 283 const WebViewId& view_id, |
191 int tab_index, | 284 bool* does_exist, |
| 285 std::string* error_msg) WARN_UNUSED_RESULT; |
| 286 |
| 287 // Requests to close the given view. Returns true on success. |
| 288 bool SendCloseViewJSONRequest( |
| 289 AutomationMessageSender* sender, |
| 290 const WebViewLocator& locator, |
192 std::string* error_msg) WARN_UNUSED_RESULT; | 291 std::string* error_msg) WARN_UNUSED_RESULT; |
193 | 292 |
194 // Requests to send the WebKit event for a mouse move to the given | 293 // Requests to send the WebKit event for a mouse move to the given |
195 // coordinate in the specified tab. Returns true on success. | 294 // coordinate in the specified view. Returns true on success. |
196 bool SendMouseMoveJSONRequest( | 295 bool SendMouseMoveJSONRequest( |
197 AutomationMessageSender* sender, | 296 AutomationMessageSender* sender, |
198 int browser_index, | 297 const WebViewLocator& locator, |
199 int tab_index, | |
200 int x, | 298 int x, |
201 int y, | 299 int y, |
202 std::string* error_msg) WARN_UNUSED_RESULT; | 300 std::string* error_msg) WARN_UNUSED_RESULT; |
203 | 301 |
204 // Requests to send the WebKit events for a mouse click at the given | 302 // Requests to send the WebKit events for a mouse click at the given |
205 // coordinate in the specified tab. Returns true on success. | 303 // coordinate in the specified view. Returns true on success. |
206 bool SendMouseClickJSONRequest( | 304 bool SendMouseClickJSONRequest( |
207 AutomationMessageSender* sender, | 305 AutomationMessageSender* sender, |
208 int browser_index, | 306 const WebViewLocator& locator, |
209 int tab_index, | |
210 automation::MouseButton button, | 307 automation::MouseButton button, |
211 int x, | 308 int x, |
212 int y, | 309 int y, |
213 std::string* error_msg) WARN_UNUSED_RESULT; | 310 std::string* error_msg) WARN_UNUSED_RESULT; |
214 | 311 |
215 // Requests to send the WebKit events for a mouse drag from the start to end | 312 // Requests to send the WebKit events for a mouse drag from the start to end |
216 // coordinates given in the specified tab. Returns true on success. | 313 // coordinates given in the specified view. Returns true on success. |
217 bool SendMouseDragJSONRequest( | 314 bool SendMouseDragJSONRequest( |
218 AutomationMessageSender* sender, | 315 AutomationMessageSender* sender, |
219 int browser_index, | 316 const WebViewLocator& locator, |
220 int tab_index, | |
221 int start_x, | 317 int start_x, |
222 int start_y, | 318 int start_y, |
223 int end_x, | 319 int end_x, |
224 int end_y, | 320 int end_y, |
225 std::string* error_msg) WARN_UNUSED_RESULT; | 321 std::string* error_msg) WARN_UNUSED_RESULT; |
226 | 322 |
227 // Requests to send the WebKit event for a mouse button down at the given | 323 // Requests to send the WebKit event for a mouse button down at the given |
228 // coordinate in the specified tab. Returns true on success. | 324 // coordinate in the specified view. Returns true on success. |
229 bool SendMouseButtonDownJSONRequest( | 325 bool SendMouseButtonDownJSONRequest( |
230 AutomationMessageSender* sender, | 326 AutomationMessageSender* sender, |
231 int browser_index, | 327 const WebViewLocator& locator, |
232 int tab_index, | |
233 int x, | 328 int x, |
234 int y, | 329 int y, |
235 std::string* error_msg) WARN_UNUSED_RESULT; | 330 std::string* error_msg) WARN_UNUSED_RESULT; |
236 | 331 |
237 // Requests to send the WebKit event for a mouse button up at the given | 332 // Requests to send the WebKit event for a mouse button up at the given |
238 // coordinate in the specified tab. Returns true on success. | 333 // coordinate in the specified view. Returns true on success. |
239 bool SendMouseButtonUpJSONRequest( | 334 bool SendMouseButtonUpJSONRequest( |
240 AutomationMessageSender* sender, | 335 AutomationMessageSender* sender, |
241 int browser_index, | 336 const WebViewLocator& locator, |
242 int tab_index, | |
243 int x, | 337 int x, |
244 int y, | 338 int y, |
245 std::string* error_msg) WARN_UNUSED_RESULT; | 339 std::string* error_msg) WARN_UNUSED_RESULT; |
246 | 340 |
247 // Requests to send the WebKit event for a mouse double click at the given | 341 // Requests to send the WebKit event for a mouse double click at the given |
248 // coordinate in the specified tab. Returns true on success. | 342 // coordinate in the specified view. Returns true on success. |
249 bool SendMouseDoubleClickJSONRequest( | 343 bool SendMouseDoubleClickJSONRequest( |
250 AutomationMessageSender* sender, | 344 AutomationMessageSender* sender, |
251 int browser_index, | 345 const WebViewLocator& locator, |
252 int tab_index, | |
253 int x, | 346 int x, |
254 int y, | 347 int y, |
255 std::string* error_msg) WARN_UNUSED_RESULT; | 348 std::string* error_msg) WARN_UNUSED_RESULT; |
256 | 349 |
257 // Requests to send the WebKit event for the given |WebKeyEvent| in a | 350 // Requests to send the WebKit event for the given |WebKeyEvent| in a |
258 // specified tab. Returns true on success. | 351 // specified view. Returns true on success. |
259 bool SendWebKeyEventJSONRequest( | 352 bool SendWebKeyEventJSONRequest( |
260 AutomationMessageSender* sender, | 353 AutomationMessageSender* sender, |
261 int browser_index, | 354 const WebViewLocator& locator, |
262 int tab_index, | |
263 const WebKeyEvent& key_event, | 355 const WebKeyEvent& key_event, |
264 std::string* error_msg) WARN_UNUSED_RESULT; | 356 std::string* error_msg) WARN_UNUSED_RESULT; |
265 | 357 |
266 // Requests to send the key event for the given keycode+modifiers to a | 358 // Requests to send the key event for the given keycode+modifiers to a |
267 // browser window containing the specified tab. Returns true on success. | 359 // browser window containing the specified view. Returns true on success. |
268 bool SendNativeKeyEventJSONRequest( | 360 bool SendNativeKeyEventJSONRequest( |
269 AutomationMessageSender* sender, | 361 AutomationMessageSender* sender, |
270 int browser_index, | 362 const WebViewLocator& locator, |
271 int tab_index, | |
272 ui::KeyboardCode key_code, | 363 ui::KeyboardCode key_code, |
273 int modifiers, | 364 int modifiers, |
274 std::string* error_msg) WARN_UNUSED_RESULT; | 365 std::string* error_msg) WARN_UNUSED_RESULT; |
275 | 366 |
276 // Requests to drag and drop the file paths at the given coordinate in the | 367 // Requests to drag and drop the file paths at the given coordinate in the |
277 // specified tab. Returns true on success. | 368 // specified view. Returns true on success. |
278 bool SendDragAndDropFilePathsJSONRequest( | 369 bool SendDragAndDropFilePathsJSONRequest( |
279 AutomationMessageSender* sender, | 370 AutomationMessageSender* sender, |
280 int browser_index, | 371 const WebViewLocator& locator, |
281 int tab_index, | |
282 int x, | 372 int x, |
283 int y, | 373 int y, |
284 const std::vector<FilePath::StringType>& paths, | 374 const std::vector<FilePath::StringType>& paths, |
285 std::string* error_msg) WARN_UNUSED_RESULT; | 375 std::string* error_msg) WARN_UNUSED_RESULT; |
286 | 376 |
287 // Requests to get the active JavaScript modal dialog's message. Returns true | 377 // Requests to get the active JavaScript modal dialog's message. Returns true |
288 // on success. | 378 // on success. |
289 bool SendGetAppModalDialogMessageJSONRequest( | 379 bool SendGetAppModalDialogMessageJSONRequest( |
290 AutomationMessageSender* sender, | 380 AutomationMessageSender* sender, |
291 std::string* message, | 381 std::string* message, |
292 std::string* error_msg) WARN_UNUSED_RESULT; | 382 std::string* error_msg) WARN_UNUSED_RESULT; |
293 | 383 |
294 // Requests to accept or dismiss the active JavaScript modal dialog. | 384 // Requests to accept or dismiss the active JavaScript modal dialog. |
295 // Returns true on success. | 385 // Returns true on success. |
296 bool SendAcceptOrDismissAppModalDialogJSONRequest( | 386 bool SendAcceptOrDismissAppModalDialogJSONRequest( |
297 AutomationMessageSender* sender, | 387 AutomationMessageSender* sender, |
298 bool accept, | 388 bool accept, |
299 std::string* error_msg) WARN_UNUSED_RESULT; | 389 std::string* error_msg) WARN_UNUSED_RESULT; |
300 | 390 |
301 // Requests to accept the active JavaScript modal dialog with the given prompt | 391 // Requests to accept the active JavaScript modal dialog with the given prompt |
302 // text. Returns true on success. | 392 // text. Returns true on success. |
303 bool SendAcceptPromptAppModalDialogJSONRequest( | 393 bool SendAcceptPromptAppModalDialogJSONRequest( |
304 AutomationMessageSender* sender, | 394 AutomationMessageSender* sender, |
305 const std::string& prompt_text, | 395 const std::string& prompt_text, |
306 std::string* error_msg) WARN_UNUSED_RESULT; | 396 std::string* error_msg) WARN_UNUSED_RESULT; |
307 | 397 |
308 // Requests to wait for all tabs to stop loading. Returns true on success. | 398 // Requests to wait for all views to stop loading. Returns true on success. |
309 bool SendWaitForAllTabsToStopLoadingJSONRequest( | 399 bool SendWaitForAllViewsToStopLoadingJSONRequest( |
310 AutomationMessageSender* sender, | 400 AutomationMessageSender* sender, |
311 std::string* error_msg) WARN_UNUSED_RESULT; | 401 std::string* error_msg) WARN_UNUSED_RESULT; |
312 | 402 |
313 // Requests the version of ChromeDriver automation supported by the automation | 403 // Requests the version of ChromeDriver automation supported by the automation |
314 // server. Returns true on success. | 404 // server. Returns true on success. |
315 bool SendGetChromeDriverAutomationVersion( | 405 bool SendGetChromeDriverAutomationVersion( |
316 AutomationMessageSender* sender, | 406 AutomationMessageSender* sender, |
317 int* version, | 407 int* version, |
318 std::string* error_msg) WARN_UNUSED_RESULT; | 408 std::string* error_msg) WARN_UNUSED_RESULT; |
319 | 409 |
320 // Requests info about all installed extensions. Returns true on success. | |
321 bool SendGetExtensionsInfoJSONRequest( | |
322 AutomationMessageSender* sender, | |
323 base::ListValue* extensions_list, | |
324 std::string* error_msg) WARN_UNUSED_RESULT; | |
325 | |
326 // Requests that the given extension be installed. If |with_ui| is false, | 410 // Requests that the given extension be installed. If |with_ui| is false, |
327 // the extension will be installed silently. Returns true on success. | 411 // the extension will be installed silently. Returns true on success. |
328 bool SendInstallExtensionJSONRequest( | 412 bool SendInstallExtensionJSONRequest( |
329 AutomationMessageSender* sender, | 413 AutomationMessageSender* sender, |
330 const FilePath& path, | 414 const FilePath& path, |
331 bool with_ui, | 415 bool with_ui, |
332 std::string* extension_id, | 416 std::string* extension_id, |
333 std::string* error_msg) WARN_UNUSED_RESULT; | 417 std::string* error_msg) WARN_UNUSED_RESULT; |
334 | 418 |
| 419 // Requests info about all installed extensions. Returns true on success. |
| 420 bool SendGetExtensionsInfoJSONRequest( |
| 421 AutomationMessageSender* sender, |
| 422 base::ListValue* extensions_list, |
| 423 std::string* error_msg) WARN_UNUSED_RESULT; |
| 424 |
| 425 // Requests whether the given extension's page action is visible in the |
| 426 // given tab. |
| 427 bool SendIsPageActionVisibleJSONRequest( |
| 428 AutomationMessageSender* sender, |
| 429 const WebViewId& tab_id, |
| 430 const std::string& extension_id, |
| 431 bool* is_visible, |
| 432 std::string* error_msg) WARN_UNUSED_RESULT; |
| 433 |
| 434 // Requests a modification of the given extension state. Returns true on |
| 435 // success. |
| 436 bool SendSetExtensionStateJSONRequest( |
| 437 AutomationMessageSender* sender, |
| 438 const std::string& extension_id, |
| 439 bool enable, |
| 440 bool allow_in_incognito, |
| 441 std::string* error_msg) WARN_UNUSED_RESULT; |
| 442 |
| 443 // Requests the given extension's action button be pressed. Returns true on |
| 444 // success. |
| 445 bool SendClickExtensionButtonJSONRequest( |
| 446 AutomationMessageSender* sender, |
| 447 const std::string& extension_id, |
| 448 bool browser_action, |
| 449 std::string* error_msg) WARN_UNUSED_RESULT; |
| 450 |
| 451 // Requests the given extension be uninstalled. Returns true on success. |
| 452 bool SendUninstallExtensionJSONRequest( |
| 453 AutomationMessageSender* sender, |
| 454 const std::string& extension_id, |
| 455 std::string* error_msg) WARN_UNUSED_RESULT; |
| 456 |
335 #endif // CHROME_TEST_AUTOMATION_AUTOMATION_JSON_REQUESTS_H_ | 457 #endif // CHROME_TEST_AUTOMATION_AUTOMATION_JSON_REQUESTS_H_ |
OLD | NEW |