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 // This file declares the C++ side of PyAuto, the python interface to | 5 // This file declares the C++ side of PyAuto, the python interface to |
6 // Chromium automation. It access Chromium's internals using Automation Proxy. | 6 // Chromium automation. It access Chromium's internals using Automation Proxy. |
7 | 7 |
8 #ifndef CHROME_TEST_PYAUTOLIB_PYAUTOLIB_H_ | 8 #ifndef CHROME_TEST_PYAUTOLIB_PYAUTOLIB_H_ |
9 #define CHROME_TEST_PYAUTOLIB_PYAUTOLIB_H_ | 9 #define CHROME_TEST_PYAUTOLIB_PYAUTOLIB_H_ |
10 #pragma once | 10 #pragma once |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 bool RemoveBookmark(std::wstring& id); | 161 bool RemoveBookmark(std::wstring& id); |
162 | 162 |
163 // Get a handle to browser window at the given index, or NULL on failure. | 163 // Get a handle to browser window at the given index, or NULL on failure. |
164 scoped_refptr<BrowserProxy> GetBrowserWindow(int window_index); | 164 scoped_refptr<BrowserProxy> GetBrowserWindow(int window_index); |
165 | 165 |
166 // Meta-methods. Generic pattern of passing args and response as | 166 // Meta-methods. Generic pattern of passing args and response as |
167 // JSON dict to avoid future use of the SWIG interface and | 167 // JSON dict to avoid future use of the SWIG interface and |
168 // automation proxy additions. Returns response as JSON dict. | 168 // automation proxy additions. Returns response as JSON dict. |
169 // Use -ve window_index for automation calls not targetted at a browser | 169 // Use -ve window_index for automation calls not targetted at a browser |
170 // window. Example: Login call for chromeos. | 170 // window. Example: Login call for chromeos. |
171 std::string _SendJSONRequest(int window_index, const std::string& request); | 171 std::string _SendJSONRequest(int window_index, |
| 172 const std::string& request, |
| 173 int timeout); |
172 | 174 |
173 // Execute javascript in a given tab, and return the response. This is | 175 // Execute javascript in a given tab, and return the response. This is |
174 // a low-level method intended for use mostly by GetDOMValue(). Note that | 176 // a low-level method intended for use mostly by GetDOMValue(). Note that |
175 // any complicated manipulation of the page should be done by something | 177 // any complicated manipulation of the page should be done by something |
176 // like WebDriver, not PyAuto. Also note that in order for the script to | 178 // like WebDriver, not PyAuto. Also note that in order for the script to |
177 // return a value to the calling code, it invoke | 179 // return a value to the calling code, it invoke |
178 // window.domAutomationController.send(), passing in the intended return | 180 // window.domAutomationController.send(), passing in the intended return |
179 // value. | 181 // value. |
180 std::wstring ExecuteJavascript(const std::wstring& script, | 182 std::wstring ExecuteJavascript(const std::wstring& script, |
181 int window_index = 0, | 183 int window_index = 0, |
(...skipping 14 matching lines...) Expand all Loading... |
196 bool SetCookie(const GURL& cookie_url, const std::string& value, | 198 bool SetCookie(const GURL& cookie_url, const std::string& value, |
197 int window_index = 0, int tab_index = 0); | 199 int window_index = 0, int tab_index = 0); |
198 // Gets a cookie value for the given url. | 200 // Gets a cookie value for the given url. |
199 std::string GetCookie(const GURL& cookie_url, int window_index = 0, | 201 std::string GetCookie(const GURL& cookie_url, int window_index = 0, |
200 int tab_index = 0); | 202 int tab_index = 0); |
201 | 203 |
202 int action_max_timeout_ms() const { | 204 int action_max_timeout_ms() const { |
203 return TestTimeouts::action_max_timeout_ms(); | 205 return TestTimeouts::action_max_timeout_ms(); |
204 } | 206 } |
205 | 207 |
206 int command_execution_timeout_ms() const { | 208 int large_test_timeout_ms() const { |
207 return TestTimeouts::command_execution_timeout_ms(); | 209 return TestTimeouts::large_test_timeout_ms(); |
208 } | 210 } |
209 | 211 |
210 private: | 212 private: |
211 // Enables PostTask to main thread. | 213 // Enables PostTask to main thread. |
212 // Should be shared across multiple instances of PyUITestBase so that this | 214 // Should be shared across multiple instances of PyUITestBase so that this |
213 // class is re-entrant and multiple instances can be created. | 215 // class is re-entrant and multiple instances can be created. |
214 // This is necessary since python's unittest module creates instances of | 216 // This is necessary since python's unittest module creates instances of |
215 // TestCase at load time itself. | 217 // TestCase at load time itself. |
216 static MessageLoop* GetSharedMessageLoop(MessageLoop::Type msg_loop_type); | 218 static MessageLoop* GetSharedMessageLoop(MessageLoop::Type msg_loop_type); |
217 static MessageLoop* message_loop_; | 219 static MessageLoop* message_loop_; |
218 | 220 |
219 // Path to named channel id. | 221 // Path to named channel id. |
220 std::string named_channel_id_; | 222 std::string named_channel_id_; |
221 }; | 223 }; |
222 | 224 |
223 #endif // CHROME_TEST_PYAUTOLIB_PYAUTOLIB_H_ | 225 #endif // CHROME_TEST_PYAUTOLIB_PYAUTOLIB_H_ |
OLD | NEW |