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

Side by Side Diff: chrome/browser/automation/testing_automation_provider.h

Issue 10804038: Convert cookie and download automation commands to the JSON interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 4 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
« no previous file with comments | « no previous file | chrome/browser/automation/testing_automation_provider.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 // IPC Message callbacks. 93 // IPC Message callbacks.
94 void CloseBrowser(int handle, IPC::Message* reply_message); 94 void CloseBrowser(int handle, IPC::Message* reply_message);
95 void ActivateTab(int handle, int at_index, int* status); 95 void ActivateTab(int handle, int at_index, int* status);
96 void AppendTab(int handle, const GURL& url, IPC::Message* reply_message); 96 void AppendTab(int handle, const GURL& url, IPC::Message* reply_message);
97 void GetMachPortCount(int* port_count); 97 void GetMachPortCount(int* port_count);
98 void GetActiveTabIndex(int handle, int* active_tab_index); 98 void GetActiveTabIndex(int handle, int* active_tab_index);
99 void CloseTab(int tab_handle, bool wait_until_closed, 99 void CloseTab(int tab_handle, bool wait_until_closed,
100 IPC::Message* reply_message); 100 IPC::Message* reply_message);
101 void GetCookies(const GURL& url, int handle, int* value_size, 101 void GetCookies(const GURL& url, int handle, int* value_size,
102 std::string* value); 102 std::string* value);
103 void SetCookie(const GURL& url,
104 const std::string& value,
105 int handle,
106 int* response_value);
107 void NavigateToURLBlockUntilNavigationsComplete(int handle, const GURL& url, 103 void NavigateToURLBlockUntilNavigationsComplete(int handle, const GURL& url,
108 int number_of_navigations, 104 int number_of_navigations,
109 IPC::Message* reply_message); 105 IPC::Message* reply_message);
110 void NavigationAsync(int handle, const GURL& url, bool* status); 106 void NavigationAsync(int handle, const GURL& url, bool* status);
111 void Reload(int handle, IPC::Message* reply_message); 107 void Reload(int handle, IPC::Message* reply_message);
112 void GetRedirectsFrom(int tab_handle, 108 void GetRedirectsFrom(int tab_handle,
113 const GURL& source_url, 109 const GURL& source_url,
114 IPC::Message* reply_message); 110 IPC::Message* reply_message);
115 void GetBrowserWindowCount(int* window_count); 111 void GetBrowserWindowCount(int* window_count);
116 void GetNormalBrowserWindowCount(int* window_count); 112 void GetNormalBrowserWindowCount(int* window_count);
(...skipping 14 matching lines...) Expand all
131 void WindowSimulateKeyPress(const IPC::Message& message, 127 void WindowSimulateKeyPress(const IPC::Message& message,
132 int handle, 128 int handle,
133 int key, 129 int key,
134 int flags); 130 int flags);
135 void GetTabCount(int handle, int* tab_count); 131 void GetTabCount(int handle, int* tab_count);
136 void GetType(int handle, int* type_as_int); 132 void GetType(int handle, int* type_as_int);
137 void GetTab(int win_handle, int tab_index, int* tab_handle); 133 void GetTab(int win_handle, int tab_index, int* tab_handle);
138 void GetTabTitle(int handle, int* title_string_size, std::wstring* title); 134 void GetTabTitle(int handle, int* title_string_size, std::wstring* title);
139 void GetTabIndex(int handle, int* tabstrip_index); 135 void GetTabIndex(int handle, int* tabstrip_index);
140 void GetTabURL(int handle, bool* success, GURL* url); 136 void GetTabURL(int handle, bool* success, GURL* url);
141 void GetShelfVisibility(int handle, bool* visible);
142 void ExecuteJavascript(int handle, 137 void ExecuteJavascript(int handle,
143 const std::wstring& frame_xpath, 138 const std::wstring& frame_xpath,
144 const std::wstring& script, 139 const std::wstring& script,
145 IPC::Message* reply_message); 140 IPC::Message* reply_message);
146 141
147 void GetDownloadDirectory(int handle, FilePath* download_directory);
148
149 // If |show| is true, call Show() on the new window after creating it. 142 // If |show| is true, call Show() on the new window after creating it.
150 void OpenNewBrowserWindowOfType(int type, 143 void OpenNewBrowserWindowOfType(int type,
151 bool show, 144 bool show,
152 IPC::Message* reply_message); 145 IPC::Message* reply_message);
153 146
154 // Retrieves a Browser from a Window and vice-versa. 147 // Retrieves a Browser from a Window and vice-versa.
155 void GetWindowForBrowser(int window_handle, bool* success, int* handle); 148 void GetWindowForBrowser(int window_handle, bool* success, int* handle);
156 149
157 void WaitForTabToBeRestored(int tab_handle, IPC::Message* reply_message); 150 void WaitForTabToBeRestored(int tab_handle, IPC::Message* reply_message);
158 151
(...skipping 15 matching lines...) Expand all
174 // |handle|. If |proceed| is true, it is equivalent to the user pressing the 167 // |handle|. If |proceed| is true, it is equivalent to the user pressing the
175 // 'Proceed' button, if false the 'Get me out of there button'. 168 // 'Proceed' button, if false the 'Get me out of there button'.
176 // Not that this fails if the tab is not displaying a SSL blocking page. 169 // Not that this fails if the tab is not displaying a SSL blocking page.
177 void ActionOnSSLBlockingPage(int handle, 170 void ActionOnSSLBlockingPage(int handle,
178 bool proceed, 171 bool proceed,
179 IPC::Message* reply_message); 172 IPC::Message* reply_message);
180 173
181 // Brings the browser window to the front and activates it. 174 // Brings the browser window to the front and activates it.
182 void BringBrowserToFront(int browser_handle, bool* success); 175 void BringBrowserToFront(int browser_handle, bool* success);
183 176
184 // Checks to see if a command on the browser's CommandController is enabled.
185 void IsMenuCommandEnabled(int browser_handle,
186 int message_num,
187 bool* menu_item_enabled);
188
189 // Responds to requests to open the FindInPage window. 177 // Responds to requests to open the FindInPage window.
190 void HandleOpenFindInPageRequest(const IPC::Message& message, 178 void HandleOpenFindInPageRequest(const IPC::Message& message,
191 int handle); 179 int handle);
192 180
193 // Get the visibility state of the Find window. 181 // Get the visibility state of the Find window.
194 void GetFindWindowVisibility(int handle, bool* visible); 182 void GetFindWindowVisibility(int handle, bool* visible);
195 183
196 // Get the visibility state of the Bookmark bar. 184 // Get the visibility state of the Bookmark bar.
197 void GetBookmarkBarVisibility( 185 void GetBookmarkBarVisibility(
198 int handle, bool* visible, bool* animating, bool* detached); 186 int handle, bool* visible, bool* animating, bool* detached);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 IPC::Message* reply_message); 221 IPC::Message* reply_message);
234 222
235 void GoBackBlockUntilNavigationsComplete(int handle, 223 void GoBackBlockUntilNavigationsComplete(int handle,
236 int number_of_navigations, 224 int number_of_navigations,
237 IPC::Message* reply_message); 225 IPC::Message* reply_message);
238 226
239 void GoForwardBlockUntilNavigationsComplete(int handle, 227 void GoForwardBlockUntilNavigationsComplete(int handle,
240 int number_of_navigations, 228 int number_of_navigations,
241 IPC::Message* reply_message); 229 IPC::Message* reply_message);
242 230
243 void SetShelfVisibility(int handle, bool visible);
244
245 // Generic pattern for pyautolib 231 // Generic pattern for pyautolib
246 // Uses the JSON interface for input/output. 232 // Uses the JSON interface for input/output.
247 void SendJSONRequestWithBrowserHandle(int handle, 233 void SendJSONRequestWithBrowserHandle(int handle,
248 const std::string& json_request, 234 const std::string& json_request,
249 IPC::Message* reply_message); 235 IPC::Message* reply_message);
250 void SendJSONRequestWithBrowserIndex(int index, 236 void SendJSONRequestWithBrowserIndex(int index,
251 const std::string& json_request, 237 const std::string& json_request,
252 IPC::Message* reply_message); 238 IPC::Message* reply_message);
253 void SendJSONRequest(Browser* browser, 239 void SendJSONRequest(Browser* browser,
254 const std::string& json_request, 240 const std::string& json_request,
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 void AddHistoryItem(Browser* browser, 347 void AddHistoryItem(Browser* browser,
362 base::DictionaryValue* args, 348 base::DictionaryValue* args,
363 IPC::Message* reply_message); 349 IPC::Message* reply_message);
364 350
365 // Invoke loading of template url model. 351 // Invoke loading of template url model.
366 // Uses the JSON interface for input/output. 352 // Uses the JSON interface for input/output.
367 void LoadSearchEngineInfo(Browser* browser, 353 void LoadSearchEngineInfo(Browser* browser,
368 base::DictionaryValue* args, 354 base::DictionaryValue* args,
369 IPC::Message* reply_message); 355 IPC::Message* reply_message);
370 356
357 // Sets the visibility of the download shelf. Uses the JSON interface.
358 // Example:
359 // input: { "is_visible": true,
360 // "windex": 1,
361 // }
362 // output: none
363 void SetDownloadShelfVisibleJSON(base::DictionaryValue* args,
364 IPC::Message* reply_message);
365
366 // Gets the visibility of the download shelf. Uses the JSON interface.
367 // Example:
368 // input: { "windex": 1 }
369 // output: { "is_visible": true }
370 void IsDownloadShelfVisibleJSON(base::DictionaryValue* args,
371 IPC::Message* reply_message);
372
373 // Gets the download path of the given tab. Uses the JSON interface.
374 // Example:
375 // input: { "tab_index": 1,
376 // "windex": 1,
377 // }
378 // output: { "path": "/home/foobar/Downloads" }
379 void GetDownloadDirectoryJSON(base::DictionaryValue* args,
380 IPC::Message* reply_message);
381
371 // Get search engines list. 382 // Get search engines list.
372 // Assumes that the profile's template url model is loaded. 383 // Assumes that the profile's template url model is loaded.
373 // Uses the JSON interface for input/output. 384 // Uses the JSON interface for input/output.
374 void GetSearchEngineInfo(Browser* browser, 385 void GetSearchEngineInfo(Browser* browser,
375 base::DictionaryValue* args, 386 base::DictionaryValue* args,
376 IPC::Message* reply_message); 387 IPC::Message* reply_message);
377 388
378 // Add or edit search engine. 389 // Add or edit search engine.
379 // Assumes that the profile's template url model is loaded. 390 // Assumes that the profile's template url model is loaded.
380 // Uses the JSON interface for input/output. 391 // Uses the JSON interface for input/output.
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after
1107 // "value": "123101", 1118 // "value": "123101",
1108 // "path": "/", // optional 1119 // "path": "/", // optional
1109 // "domain": ".www.google.com", // optional 1120 // "domain": ".www.google.com", // optional
1110 // "secure": false, // optional 1121 // "secure": false, // optional
1111 // "expiry": 1401982012 // optional 1122 // "expiry": 1401982012 // optional
1112 // } 1123 // }
1113 // } 1124 // }
1114 // output: none 1125 // output: none
1115 void SetCookieJSON(base::DictionaryValue* args, IPC::Message* reply_message); 1126 void SetCookieJSON(base::DictionaryValue* args, IPC::Message* reply_message);
1116 1127
1128 // Gets the cookies for the given URL in the context of a given browser
1129 // window. Uses the JSON interface.
1130 // Example:
1131 // input: { "url": "http://www.google.com",
1132 // "tab_index": 1,
1133 // "windex": 1,
1134 // }
1135 // output: { "cookies": "foo=bar" }
1136 void GetCookiesInBrowserContext(base::DictionaryValue* args,
1137 IPC::Message* reply_message);
1138
1139 // Deletes the cookie with the given name for the URL in the context of a
1140 // given browser window. Uses the JSON interface.
1141 // Example:
1142 // input: { "url": "http://www.google.com",
1143 // "cookie_name": "my_cookie"
1144 // "tab_index": 1,
1145 // "windex": 1,
1146 // }
1147 // output: none
1148 void DeleteCookieInBrowserContext(base::DictionaryValue* args,
1149 IPC::Message* reply_message);
1150
1151 // Sets a cookie for the given URL in the context of a given browser window.
1152 // Uses the JSON interface.
1153 //
1154 // Example:
1155 // input: { "url": "http://www.google.com",
1156 // "value": "name=value; Expires=Wed, 09 Jun 2021 10:18:14 GMT",
1157 // "tab_index": 1,
1158 // "windex": 1,
1159 // }
1160 // output: none
1161 void SetCookieInBrowserContext(base::DictionaryValue* args,
1162 IPC::Message* reply_message);
1163
1117 // Gets the ID for every open tab. This ID is unique per session. 1164 // Gets the ID for every open tab. This ID is unique per session.
1118 // Example: 1165 // Example:
1119 // input: none 1166 // input: none
1120 // output: { "ids": [213, 1] } 1167 // output: { "ids": [213, 1] }
1121 void GetTabIds(base::DictionaryValue* args, IPC::Message* reply_message); 1168 void GetTabIds(base::DictionaryValue* args, IPC::Message* reply_message);
1122 1169
1123 // Gets info about all open views. Each view ID is unique per session. 1170 // Gets info about all open views. Each view ID is unique per session.
1124 // Example: 1171 // Example:
1125 // input: none 1172 // input: none
1126 // output: { "views": [ 1173 // output: { "views": [
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
1653 scoped_ptr<AutomationEventQueue> automation_event_queue_; 1700 scoped_ptr<AutomationEventQueue> automation_event_queue_;
1654 1701
1655 // List of commands which just finish synchronously and don't require 1702 // List of commands which just finish synchronously and don't require
1656 // setting up an observer. 1703 // setting up an observer.
1657 static const int kSynchronousCommands[]; 1704 static const int kSynchronousCommands[];
1658 1705
1659 DISALLOW_COPY_AND_ASSIGN(TestingAutomationProvider); 1706 DISALLOW_COPY_AND_ASSIGN(TestingAutomationProvider);
1660 }; 1707 };
1661 1708
1662 #endif // CHROME_BROWSER_AUTOMATION_TESTING_AUTOMATION_PROVIDER_H_ 1709 #endif // CHROME_BROWSER_AUTOMATION_TESTING_AUTOMATION_PROVIDER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/automation/testing_automation_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698