OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_BROWSER_AUTOMATION_TESTING_AUTOMATION_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_AUTOMATION_TESTING_AUTOMATION_PROVIDER_H_ |
6 #define CHROME_BROWSER_AUTOMATION_TESTING_AUTOMATION_PROVIDER_H_ | 6 #define CHROME_BROWSER_AUTOMATION_TESTING_AUTOMATION_PROVIDER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 // importer::ImporterListObserver: | 81 // importer::ImporterListObserver: |
82 virtual void OnSourceProfilesLoaded() OVERRIDE; | 82 virtual void OnSourceProfilesLoaded() OVERRIDE; |
83 | 83 |
84 // content::NotificationObserver: | 84 // content::NotificationObserver: |
85 virtual void Observe(int type, | 85 virtual void Observe(int type, |
86 const content::NotificationSource& source, | 86 const content::NotificationSource& source, |
87 const content::NotificationDetails& details) OVERRIDE; | 87 const content::NotificationDetails& details) OVERRIDE; |
88 | 88 |
89 // IPC Message callbacks. | 89 // IPC Message callbacks. |
90 void CloseBrowser(int handle, IPC::Message* reply_message); | 90 void CloseBrowser(int handle, IPC::Message* reply_message); |
91 void CloseBrowserAsync(int browser_handle); | |
92 void ActivateTab(int handle, int at_index, int* status); | 91 void ActivateTab(int handle, int at_index, int* status); |
93 void AppendTab(int handle, const GURL& url, IPC::Message* reply_message); | 92 void AppendTab(int handle, const GURL& url, IPC::Message* reply_message); |
94 void AppendBackgroundTab(int handle, const GURL& url, | |
95 IPC::Message* reply_message); | |
96 void GetMachPortCount(int* port_count); | 93 void GetMachPortCount(int* port_count); |
97 void GetActiveTabIndex(int handle, int* active_tab_index); | 94 void GetActiveTabIndex(int handle, int* active_tab_index); |
98 void CloseTab(int tab_handle, bool wait_until_closed, | 95 void CloseTab(int tab_handle, bool wait_until_closed, |
99 IPC::Message* reply_message); | 96 IPC::Message* reply_message); |
100 void GetCookies(const GURL& url, int handle, int* value_size, | 97 void GetCookies(const GURL& url, int handle, int* value_size, |
101 std::string* value); | 98 std::string* value); |
102 void SetCookie(const GURL& url, | 99 void SetCookie(const GURL& url, |
103 const std::string& value, | 100 const std::string& value, |
104 int handle, | 101 int handle, |
105 int* response_value); | 102 int* response_value); |
106 void DeleteCookie(const GURL& url, const std::string& cookie_name, | |
107 int handle, bool* success); | |
108 void NavigateToURLBlockUntilNavigationsComplete(int handle, const GURL& url, | 103 void NavigateToURLBlockUntilNavigationsComplete(int handle, const GURL& url, |
109 int number_of_navigations, | 104 int number_of_navigations, |
110 IPC::Message* reply_message); | 105 IPC::Message* reply_message); |
111 void NavigationAsync(int handle, const GURL& url, bool* status); | 106 void NavigationAsync(int handle, const GURL& url, bool* status); |
112 void NavigationAsyncWithDisposition(int handle, | |
113 const GURL& url, | |
114 WindowOpenDisposition disposition, | |
115 bool* status); | |
116 void Reload(int handle, IPC::Message* reply_message); | 107 void Reload(int handle, IPC::Message* reply_message); |
117 void GetRedirectsFrom(int tab_handle, | 108 void GetRedirectsFrom(int tab_handle, |
118 const GURL& source_url, | 109 const GURL& source_url, |
119 IPC::Message* reply_message); | 110 IPC::Message* reply_message); |
120 void GetBrowserWindowCount(int* window_count); | 111 void GetBrowserWindowCount(int* window_count); |
121 void GetNormalBrowserWindowCount(int* window_count); | 112 void GetNormalBrowserWindowCount(int* window_count); |
122 // Be aware that the browser window returned might be of non TYPE_TABBED | 113 // Be aware that the browser window returned might be of non TYPE_TABBED |
123 // or in incognito mode. | 114 // or in incognito mode. |
124 void GetBrowserWindow(int index, int* handle); | 115 void GetBrowserWindow(int index, int* handle); |
125 void FindTabbedBrowserWindow(int* handle); | 116 void FindTabbedBrowserWindow(int* handle); |
126 void GetLastActiveBrowserWindow(int* handle); | |
127 void GetActiveWindow(int* handle); | 117 void GetActiveWindow(int* handle); |
128 void ExecuteBrowserCommandAsync(int handle, int command, bool* success); | 118 void ExecuteBrowserCommandAsync(int handle, int command, bool* success); |
129 void ExecuteBrowserCommand(int handle, int command, | 119 void ExecuteBrowserCommand(int handle, int command, |
130 IPC::Message* reply_message); | 120 IPC::Message* reply_message); |
131 void GetBrowserLocale(string16* locale); | |
132 void IsWindowActive(int handle, bool* success, bool* is_active); | |
133 void ActivateWindow(int handle); | |
134 void IsWindowMaximized(int handle, bool* is_maximized, bool* success); | |
135 void TerminateSession(int handle, bool* success); | 121 void TerminateSession(int handle, bool* success); |
136 void WindowGetViewBounds(int handle, int view_id, bool screen_coordinates, | 122 void WindowGetViewBounds(int handle, int view_id, bool screen_coordinates, |
137 bool* success, gfx::Rect* bounds); | 123 bool* success, gfx::Rect* bounds); |
138 void GetWindowBounds(int handle, gfx::Rect* bounds, bool* result); | |
139 void SetWindowBounds(int handle, const gfx::Rect& bounds, bool* result); | 124 void SetWindowBounds(int handle, const gfx::Rect& bounds, bool* result); |
140 void SetWindowVisible(int handle, bool visible, bool* result); | 125 void SetWindowVisible(int handle, bool visible, bool* result); |
141 void WindowSimulateClick(const IPC::Message& message, | |
142 int handle, | |
143 const gfx::Point& click, | |
144 int flags); | |
145 void WindowSimulateMouseMove(const IPC::Message& message, | 126 void WindowSimulateMouseMove(const IPC::Message& message, |
146 int handle, | 127 int handle, |
147 const gfx::Point& location); | 128 const gfx::Point& location); |
148 void WindowSimulateKeyPress(const IPC::Message& message, | 129 void WindowSimulateKeyPress(const IPC::Message& message, |
149 int handle, | 130 int handle, |
150 int key, | 131 int key, |
151 int flags); | 132 int flags); |
152 void GetTabCount(int handle, int* tab_count); | 133 void GetTabCount(int handle, int* tab_count); |
153 void GetType(int handle, int* type_as_int); | 134 void GetType(int handle, int* type_as_int); |
154 void IsBrowserInApplicationMode(int handle, | |
155 bool* is_application, | |
156 bool* success); | |
157 void GetTab(int win_handle, int tab_index, int* tab_handle); | 135 void GetTab(int win_handle, int tab_index, int* tab_handle); |
158 void GetTabProcessID(int handle, int* process_id); | |
159 void GetTabTitle(int handle, int* title_string_size, std::wstring* title); | 136 void GetTabTitle(int handle, int* title_string_size, std::wstring* title); |
160 void GetTabIndex(int handle, int* tabstrip_index); | 137 void GetTabIndex(int handle, int* tabstrip_index); |
161 void GetTabURL(int handle, bool* success, GURL* url); | 138 void GetTabURL(int handle, bool* success, GURL* url); |
162 void GetShelfVisibility(int handle, bool* visible); | 139 void GetShelfVisibility(int handle, bool* visible); |
163 void IsFullscreen(int handle, bool* is_fullscreen); | |
164 void GetFullscreenBubbleVisibility(int handle, bool* is_visible); | |
165 | |
166 void ExecuteJavascript(int handle, | 140 void ExecuteJavascript(int handle, |
167 const std::wstring& frame_xpath, | 141 const std::wstring& frame_xpath, |
168 const std::wstring& script, | 142 const std::wstring& script, |
169 IPC::Message* reply_message); | 143 IPC::Message* reply_message); |
170 | 144 |
171 void HandleInspectElementRequest(int handle, | |
172 int x, | |
173 int y, | |
174 IPC::Message* reply_message); | |
175 | |
176 void GetDownloadDirectory(int handle, FilePath* download_directory); | 145 void GetDownloadDirectory(int handle, FilePath* download_directory); |
177 | 146 |
178 // If |show| is true, call Show() on the new window after creating it. | 147 // If |show| is true, call Show() on the new window after creating it. |
179 void OpenNewBrowserWindowOfType(int type, | 148 void OpenNewBrowserWindowOfType(int type, |
180 bool show, | 149 bool show, |
181 IPC::Message* reply_message); | 150 IPC::Message* reply_message); |
182 | 151 |
183 // Retrieves a Browser from a Window and vice-versa. | 152 // Retrieves a Browser from a Window and vice-versa. |
184 void GetWindowForBrowser(int window_handle, bool* success, int* handle); | 153 void GetWindowForBrowser(int window_handle, bool* success, int* handle); |
185 void GetBrowserForWindow(int window_handle, bool* success, | |
186 int* browser_handle); | |
187 | |
188 void ShowInterstitialPage(int tab_handle, | |
189 const std::string& html_text, | |
190 IPC::Message* reply_message); | |
191 void HideInterstitialPage(int tab_handle, bool* success); | |
192 | 154 |
193 void WaitForTabToBeRestored(int tab_handle, IPC::Message* reply_message); | 155 void WaitForTabToBeRestored(int tab_handle, IPC::Message* reply_message); |
194 | 156 |
195 // Gets the security state for the tab associated to the specified |handle|. | 157 // Gets the security state for the tab associated to the specified |handle|. |
196 void GetSecurityState(int handle, | 158 void GetSecurityState(int handle, |
197 bool* success, | 159 bool* success, |
198 content::SecurityStyle* security_style, | 160 content::SecurityStyle* security_style, |
199 net::CertStatus* ssl_cert_status, | 161 net::CertStatus* ssl_cert_status, |
200 int* insecure_content_status); | 162 int* insecure_content_status); |
201 | 163 |
(...skipping 13 matching lines...) Expand all Loading... |
215 IPC::Message* reply_message); | 177 IPC::Message* reply_message); |
216 | 178 |
217 // Brings the browser window to the front and activates it. | 179 // Brings the browser window to the front and activates it. |
218 void BringBrowserToFront(int browser_handle, bool* success); | 180 void BringBrowserToFront(int browser_handle, bool* success); |
219 | 181 |
220 // Checks to see if a command on the browser's CommandController is enabled. | 182 // Checks to see if a command on the browser's CommandController is enabled. |
221 void IsMenuCommandEnabled(int browser_handle, | 183 void IsMenuCommandEnabled(int browser_handle, |
222 int message_num, | 184 int message_num, |
223 bool* menu_item_enabled); | 185 bool* menu_item_enabled); |
224 | 186 |
225 // Save the current web page. | |
226 void SavePage(int tab_handle, | |
227 const FilePath& file_name, | |
228 const FilePath& dir_path, | |
229 int type, | |
230 bool* success); | |
231 | |
232 // Responds to requests to open the FindInPage window. | 187 // Responds to requests to open the FindInPage window. |
233 void HandleOpenFindInPageRequest(const IPC::Message& message, | 188 void HandleOpenFindInPageRequest(const IPC::Message& message, |
234 int handle); | 189 int handle); |
235 | 190 |
236 // Get the visibility state of the Find window. | 191 // Get the visibility state of the Find window. |
237 void GetFindWindowVisibility(int handle, bool* visible); | 192 void GetFindWindowVisibility(int handle, bool* visible); |
238 | 193 |
239 // Responds to requests to find the location of the Find window. | |
240 void HandleFindWindowLocationRequest(int handle, int* x, int* y); | |
241 | |
242 // Get the visibility state of the Bookmark bar. | 194 // Get the visibility state of the Bookmark bar. |
243 void GetBookmarkBarVisibility( | 195 void GetBookmarkBarVisibility( |
244 int handle, bool* visible, bool* animating, bool* detached); | 196 int handle, bool* visible, bool* animating, bool* detached); |
245 | 197 |
246 // Get the bookmarks as a JSON string. | 198 // Get the bookmarks as a JSON string. |
247 void GetBookmarksAsJSON(int handle, std::string* bookmarks_as_json, | 199 void GetBookmarksAsJSON(int handle, std::string* bookmarks_as_json, |
248 bool* success); | 200 bool* success); |
249 | 201 |
250 // Wait for the bookmark model to load. | 202 // Wait for the bookmark model to load. |
251 void WaitForBookmarkModelToLoad(int handle, IPC::Message* reply_message); | 203 void WaitForBookmarkModelToLoad(int handle, IPC::Message* reply_message); |
(...skipping 16 matching lines...) Expand all Loading... |
268 void SetBookmarkTitle(int handle, | 220 void SetBookmarkTitle(int handle, |
269 int64 id, std::wstring title, | 221 int64 id, std::wstring title, |
270 bool* success); | 222 bool* success); |
271 void SetBookmarkURL(int handle, | 223 void SetBookmarkURL(int handle, |
272 int64 id, const GURL& url, | 224 int64 id, const GURL& url, |
273 bool* success); | 225 bool* success); |
274 void RemoveBookmark(int handle, | 226 void RemoveBookmark(int handle, |
275 int64 id, | 227 int64 id, |
276 bool* success); | 228 bool* success); |
277 | 229 |
278 // Retrieves the number of info-bars currently showing in |count|. | |
279 void GetInfoBarCount(int handle, size_t* count); | |
280 | |
281 // Causes a click on the "accept" button of the info-bar at |info_bar_index|. | |
282 // If |wait_for_navigation| is true, it sends the reply after a navigation has | |
283 // occurred. | |
284 void ClickInfoBarAccept(int handle, | |
285 size_t info_bar_index, | |
286 bool wait_for_navigation, | |
287 IPC::Message* reply_message); | |
288 | |
289 // Retrieves the last time a navigation occurred for the tab. | |
290 void GetLastNavigationTime(int handle, int64* last_navigation_time); | |
291 | |
292 // Waits for a new navigation in the tab if none has happened since | |
293 // |last_navigation_time|. | |
294 void WaitForNavigation(int handle, | |
295 int64 last_navigation_time, | |
296 IPC::Message* reply_message); | |
297 | |
298 // Sets the int value for preference with name |name|. | |
299 void SetIntPreference(int handle, | |
300 const std::string& name, | |
301 int value, | |
302 bool* success); | |
303 | |
304 // Sets the string value for preference with name |name|. | |
305 void SetStringPreference(int handle, | |
306 const std::string& name, | |
307 const std::string& value, | |
308 bool* success); | |
309 | |
310 // Gets the bool value for preference with name |name|. | |
311 void GetBooleanPreference(int handle, | |
312 const std::string& name, | |
313 bool* success, | |
314 bool* value); | |
315 | |
316 // Sets the bool value for preference with name |name|. | |
317 void SetBooleanPreference(int handle, | |
318 const std::string& name, | |
319 bool value, | |
320 bool* success); | |
321 | |
322 void GetShowingAppModalDialog(bool* showing_dialog, int* dialog_button); | |
323 void ClickAppModalDialogButton(int button, bool* success); | |
324 | |
325 void WaitForBrowserWindowCountToBecome(int target_count, | 230 void WaitForBrowserWindowCountToBecome(int target_count, |
326 IPC::Message* reply_message); | 231 IPC::Message* reply_message); |
327 | 232 |
328 void WaitForAppModalDialogToBeShown(IPC::Message* reply_message); | |
329 | |
330 void GoBackBlockUntilNavigationsComplete(int handle, | 233 void GoBackBlockUntilNavigationsComplete(int handle, |
331 int number_of_navigations, | 234 int number_of_navigations, |
332 IPC::Message* reply_message); | 235 IPC::Message* reply_message); |
333 | 236 |
334 void GoForwardBlockUntilNavigationsComplete(int handle, | 237 void GoForwardBlockUntilNavigationsComplete(int handle, |
335 int number_of_navigations, | 238 int number_of_navigations, |
336 IPC::Message* reply_message); | 239 IPC::Message* reply_message); |
337 | 240 |
338 void GetWindowTitle(int handle, string16* text); | |
339 | |
340 void SetShelfVisibility(int handle, bool visible); | 241 void SetShelfVisibility(int handle, bool visible); |
341 | 242 |
342 // Returns the number of blocked popups in the tab |handle|. | |
343 void GetBlockedPopupCount(int handle, int* count); | |
344 | |
345 // Generic pattern for pyautolib | 243 // Generic pattern for pyautolib |
346 // Uses the JSON interface for input/output. | 244 // Uses the JSON interface for input/output. |
347 void SendJSONRequest(int handle, | 245 void SendJSONRequest(int handle, |
348 const std::string& json_request, | 246 const std::string& json_request, |
349 IPC::Message* reply_message); | 247 IPC::Message* reply_message); |
350 | 248 |
351 // Method ptr for json handlers. | 249 // Method ptr for json handlers. |
352 // Uses the JSON interface for input/output. | 250 // Uses the JSON interface for input/output. |
353 typedef void (TestingAutomationProvider::*JsonHandler)(base::DictionaryValue*, | 251 typedef void (TestingAutomationProvider::*JsonHandler)(base::DictionaryValue*, |
354 IPC::Message*); | 252 IPC::Message*); |
(...skipping 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1548 #endif // defined(OS_CHROMEOS) | 1446 #endif // defined(OS_CHROMEOS) |
1549 | 1447 |
1550 void WaitForTabCountToBecome(int browser_handle, | 1448 void WaitForTabCountToBecome(int browser_handle, |
1551 int target_tab_count, | 1449 int target_tab_count, |
1552 IPC::Message* reply_message); | 1450 IPC::Message* reply_message); |
1553 | 1451 |
1554 void WaitForInfoBarCount(int tab_handle, | 1452 void WaitForInfoBarCount(int tab_handle, |
1555 size_t target_count, | 1453 size_t target_count, |
1556 IPC::Message* reply_message); | 1454 IPC::Message* reply_message); |
1557 | 1455 |
1558 // Gets the current used encoding name of the page in the specified tab. | |
1559 void GetPageCurrentEncoding(int tab_handle, std::string* current_encoding); | |
1560 | |
1561 void ShutdownSessionService(int handle, bool* result); | |
1562 | |
1563 void SetContentSetting(int handle, | |
1564 const std::string& host, | |
1565 ContentSettingsType content_type, | |
1566 ContentSetting setting, | |
1567 bool* success); | |
1568 | |
1569 // Resets to the default theme. | 1456 // Resets to the default theme. |
1570 void ResetToDefaultTheme(); | 1457 void ResetToDefaultTheme(); |
1571 | 1458 |
1572 void WaitForProcessLauncherThreadToGoIdle(IPC::Message* reply_message); | 1459 void WaitForProcessLauncherThreadToGoIdle(IPC::Message* reply_message); |
1573 | 1460 |
1574 // Gets the browser that contains the given tab. | |
1575 void GetParentBrowserOfTab( | |
1576 int tab_handle, int* browser_handle, bool* success); | |
1577 | |
1578 void OnRemoveProvider(); // Called via PostTask | 1461 void OnRemoveProvider(); // Called via PostTask |
1579 | 1462 |
1580 // Execute Javascript in the context of a specific render view. | 1463 // Execute Javascript in the context of a specific render view. |
1581 void ExecuteJavascriptInRenderViewFrame( | 1464 void ExecuteJavascriptInRenderViewFrame( |
1582 const string16& frame_xpath, const string16& script, | 1465 const string16& frame_xpath, const string16& script, |
1583 IPC::Message* reply_message, content::RenderViewHost* render_view_host); | 1466 IPC::Message* reply_message, content::RenderViewHost* render_view_host); |
1584 | 1467 |
1585 #if defined(OS_CHROMEOS) | 1468 #if defined(OS_CHROMEOS) |
1586 // Avoid scoped ptr here to avoid having to define it completely in the | 1469 // Avoid scoped ptr here to avoid having to define it completely in the |
1587 // non-ChromeOS code. | 1470 // non-ChromeOS code. |
(...skipping 12 matching lines...) Expand all Loading... |
1600 ImportSettingsData import_settings_data_; | 1483 ImportSettingsData import_settings_data_; |
1601 | 1484 |
1602 // The automation event observer queue. It is lazily created when an observer | 1485 // The automation event observer queue. It is lazily created when an observer |
1603 // is added to avoid overhead when not needed. | 1486 // is added to avoid overhead when not needed. |
1604 scoped_ptr<AutomationEventQueue> automation_event_queue_; | 1487 scoped_ptr<AutomationEventQueue> automation_event_queue_; |
1605 | 1488 |
1606 DISALLOW_COPY_AND_ASSIGN(TestingAutomationProvider); | 1489 DISALLOW_COPY_AND_ASSIGN(TestingAutomationProvider); |
1607 }; | 1490 }; |
1608 | 1491 |
1609 #endif // CHROME_BROWSER_AUTOMATION_TESTING_AUTOMATION_PROVIDER_H_ | 1492 #endif // CHROME_BROWSER_AUTOMATION_TESTING_AUTOMATION_PROVIDER_H_ |
OLD | NEW |