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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
160 bool RemoveBookmark(std::wstring& id); | 160 bool RemoveBookmark(std::wstring& id); |
161 | 161 |
162 // Get a handle to browser window at the given index, or NULL on failure. | 162 // Get a handle to browser window at the given index, or NULL on failure. |
163 scoped_refptr<BrowserProxy> GetBrowserWindow(int window_index); | 163 scoped_refptr<BrowserProxy> GetBrowserWindow(int window_index); |
164 | 164 |
165 // Meta-methods. Generic pattern of passing args and response as | 165 // Meta-methods. Generic pattern of passing args and response as |
166 // JSON dict to avoid future use of the SWIG interface and | 166 // JSON dict to avoid future use of the SWIG interface and |
167 // automation proxy additions. Returns response as JSON dict. | 167 // automation proxy additions. Returns response as JSON dict. |
168 // Use -ve window_index for automation calls not targetted at a browser | 168 // Use -ve window_index for automation calls not targetted at a browser |
169 // window. Example: Login call for chromeos. | 169 // window. Example: Login call for chromeos. |
170 std::string _SendJSONRequest(int window_index, const std::string& request); | 170 std::string _SendJSONRequest(int window_index, const std::string& request); |
Nirnimesh
2011/03/29 20:27:28
Do we need this version anymore?
Huyen
2011/03/31 02:42:55
Removed and used one with timeout.
| |
171 std::string _SendJSONRequest(int window_index, | |
172 const std::string& request, | |
173 int timeout); | |
171 | 174 |
172 // 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 |
173 // 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 |
174 // any complicated manipulation of the page should be done by something | 177 // any complicated manipulation of the page should be done by something |
175 // 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 |
176 // return a value to the calling code, it invoke | 179 // return a value to the calling code, it invoke |
177 // window.domAutomationController.send(), passing in the intended return | 180 // window.domAutomationController.send(), passing in the intended return |
178 // value. | 181 // value. |
179 std::wstring ExecuteJavascript(const std::wstring& script, | 182 std::wstring ExecuteJavascript(const std::wstring& script, |
180 int window_index = 0, | 183 int window_index = 0, |
(...skipping 14 matching lines...) Expand all Loading... | |
195 bool SetCookie(const GURL& cookie_url, const std::string& value, | 198 bool SetCookie(const GURL& cookie_url, const std::string& value, |
196 int window_index = 0, int tab_index = 0); | 199 int window_index = 0, int tab_index = 0); |
197 // Gets a cookie value for the given url. | 200 // Gets a cookie value for the given url. |
198 std::string GetCookie(const GURL& cookie_url, int window_index = 0, | 201 std::string GetCookie(const GURL& cookie_url, int window_index = 0, |
199 int tab_index = 0); | 202 int tab_index = 0); |
200 | 203 |
201 int action_max_timeout_ms() const { | 204 int action_max_timeout_ms() const { |
202 return TestTimeouts::action_max_timeout_ms(); | 205 return TestTimeouts::action_max_timeout_ms(); |
203 } | 206 } |
204 | 207 |
205 int command_execution_timeout_ms() const { | 208 int large_test_timeout_ms() const { |
206 return TestTimeouts::command_execution_timeout_ms(); | 209 return TestTimeouts::large_test_timeout_ms(); |
207 } | 210 } |
208 | 211 |
209 private: | 212 private: |
210 // Enables PostTask to main thread. | 213 // Enables PostTask to main thread. |
211 // Should be shared across multiple instances of PyUITestBase so that this | 214 // Should be shared across multiple instances of PyUITestBase so that this |
212 // class is re-entrant and multiple instances can be created. | 215 // class is re-entrant and multiple instances can be created. |
213 // This is necessary since python's unittest module creates instances of | 216 // This is necessary since python's unittest module creates instances of |
214 // TestCase at load time itself. | 217 // TestCase at load time itself. |
215 static MessageLoop* GetSharedMessageLoop(MessageLoop::Type msg_loop_type); | 218 static MessageLoop* GetSharedMessageLoop(MessageLoop::Type msg_loop_type); |
216 static MessageLoop* message_loop_; | 219 static MessageLoop* message_loop_; |
217 | 220 |
218 // Path to named channel id. | 221 // Path to named channel id. |
219 std::string named_channel_id_; | 222 std::string named_channel_id_; |
220 }; | 223 }; |
221 | 224 |
222 #endif // CHROME_TEST_PYAUTOLIB_PYAUTOLIB_H_ | 225 #endif // CHROME_TEST_PYAUTOLIB_PYAUTOLIB_H_ |
OLD | NEW |