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

Side by Side Diff: chrome/test/automation/automation_proxy.h

Issue 6685099: Removing command_execution_timeout_ms in favor of action_max_timeout_ms. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 9 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
OLDNEW
1 // Copyright (c) 2010 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_PROXY_H_ 5 #ifndef CHROME_TEST_AUTOMATION_AUTOMATION_PROXY_H_
6 #define CHROME_TEST_AUTOMATION_AUTOMATION_PROXY_H_ 6 #define CHROME_TEST_AUTOMATION_AUTOMATION_PROXY_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
(...skipping 30 matching lines...) Expand all
42 // received or a timeout has expired. 42 // received or a timeout has expired.
43 // 43 //
44 // The function returns true if a response is received, and returns false if 44 // The function returns true if a response is received, and returns false if
45 // there is a failure or timeout (in milliseconds). 45 // there is a failure or timeout (in milliseconds).
46 // 46 //
47 // NOTE: When timeout occurs, the connection between proxy provider may be 47 // NOTE: When timeout occurs, the connection between proxy provider may be
48 // in transit state. Specifically, there might be pending IPC messages, 48 // in transit state. Specifically, there might be pending IPC messages,
49 // and the proxy provider might be still working on the previous 49 // and the proxy provider might be still working on the previous
50 // request. 50 // request.
51 virtual bool Send(IPC::Message* message) = 0; 51 virtual bool Send(IPC::Message* message) = 0;
52 virtual bool Send(IPC::Message* message, int timeout) = 0;
52 }; 53 };
53 54
54 // This is the interface that external processes can use to interact with 55 // This is the interface that external processes can use to interact with
55 // a running instance of the app. 56 // a running instance of the app.
56 class AutomationProxy : public IPC::Channel::Listener, 57 class AutomationProxy : public IPC::Channel::Listener,
57 public AutomationMessageSender { 58 public AutomationMessageSender {
58 public: 59 public:
59 AutomationProxy(int command_execution_timeout_ms, bool disconnect_on_failure); 60 AutomationProxy(int command_execution_timeout_ms, bool disconnect_on_failure);
60 virtual ~AutomationProxy(); 61 virtual ~AutomationProxy();
61 62
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 // Returns true on success. 211 // Returns true on success.
211 bool GetEnabledExtensions(std::vector<FilePath>* extension_directories); 212 bool GetEnabledExtensions(std::vector<FilePath>* extension_directories);
212 213
213 // Resets to the default theme. Returns true on success. 214 // Resets to the default theme. Returns true on success.
214 bool ResetToDefaultTheme(); 215 bool ResetToDefaultTheme();
215 216
216 // Generic pattern for sending automation requests. 217 // Generic pattern for sending automation requests.
217 bool SendJSONRequest(const std::string& request, 218 bool SendJSONRequest(const std::string& request,
218 std::string* response) WARN_UNUSED_RESULT; 219 std::string* response) WARN_UNUSED_RESULT;
219 220
221 bool SendJSONRequest(const std::string& request,
222 std::string* response,
223 int timeout) WARN_UNUSED_RESULT;
Paweł Hajdan Jr. 2011/03/26 10:55:12 nit: Similarly here, please remove the version tha
Huyen 2011/03/29 00:11:39 Done.
224
220 #if defined(OS_CHROMEOS) 225 #if defined(OS_CHROMEOS)
221 // Logs in through the Chrome OS login wizard with given |username| 226 // Logs in through the Chrome OS login wizard with given |username|
222 // and |password|. Returns true on success. 227 // and |password|. Returns true on success.
223 bool LoginWithUserAndPass(const std::string& username, 228 bool LoginWithUserAndPass(const std::string& username,
224 const std::string& password) WARN_UNUSED_RESULT; 229 const std::string& password) WARN_UNUSED_RESULT;
225 #endif 230 #endif
226 231
227 #if defined(OS_POSIX) 232 #if defined(OS_POSIX)
228 base::file_handle_mapping_vector fds_to_map() const; 233 base::file_handle_mapping_vector fds_to_map() const;
229 #endif 234 #endif
230 235
231 // AutomationMessageSender implementation. 236 // AutomationMessageSender implementation.
232 virtual bool Send(IPC::Message* message) WARN_UNUSED_RESULT; 237 virtual bool Send(IPC::Message* message) WARN_UNUSED_RESULT;
238 virtual bool Send(IPC::Message* message, int timeout_ms) WARN_UNUSED_RESULT;
Paweł Hajdan Jr. 2011/03/26 10:55:12 Just in case you ask, IMHO it's fine and even pref
233 239
234 // Wrapper over AutomationHandleTracker::InvalidateHandle. Receives the 240 // Wrapper over AutomationHandleTracker::InvalidateHandle. Receives the
235 // message from AutomationProxy, unpacks the messages and routes that call to 241 // message from AutomationProxy, unpacks the messages and routes that call to
236 // the tracker. 242 // the tracker.
237 virtual void InvalidateHandle(const IPC::Message& message); 243 virtual void InvalidateHandle(const IPC::Message& message);
238 244
239 // Creates a tab that can hosted in an external process. The function 245 // Creates a tab that can hosted in an external process. The function
240 // returns a TabProxy representing the tab as well as a window handle 246 // returns a TabProxy representing the tab as well as a window handle
241 // that can be reparented in another process. 247 // that can be reparented in another process.
242 scoped_refptr<TabProxy> CreateExternalTab( 248 scoped_refptr<TabProxy> CreateExternalTab(
243 const ExternalTabSettings& settings, 249 const ExternalTabSettings& settings,
244 gfx::NativeWindow* external_tab_container, 250 gfx::NativeWindow* external_tab_container,
245 gfx::NativeWindow* tab); 251 gfx::NativeWindow* tab);
246 252
247 int command_execution_timeout_ms() const {
248 return static_cast<int>(command_execution_timeout_.InMilliseconds());
249 }
250
251 // Sets the timeout for subsequent automation calls.
252 void set_command_execution_timeout_ms(int timeout_ms) {
253 DCHECK(timeout_ms <= 10 * 60 * 1000 ) << "10+ min of automation timeout "
254 "can make the test hang and be killed by buildbot";
255 command_execution_timeout_ = base::TimeDelta::FromMilliseconds(timeout_ms);
256 }
257
258 // Returns the server version of the server connected. You may only call this 253 // Returns the server version of the server connected. You may only call this
259 // method after WaitForAppLaunch() has returned SUCCESS or VERSION_MISMATCH. 254 // method after WaitForAppLaunch() has returned SUCCESS or VERSION_MISMATCH.
260 // If you call it before this, the return value is undefined. 255 // If you call it before this, the return value is undefined.
261 std::string server_version() const { 256 std::string server_version() const {
262 return server_version_; 257 return server_version_;
263 } 258 }
264 259
265 // Call this while passing true to tell the automation proxy to perform 260 // Call this while passing true to tell the automation proxy to perform
266 // a version check when WaitForAppLaunch() is called. Note that 261 // a version check when WaitForAppLaunch() is called. Note that
267 // platform_version_check_ defaults to false. 262 // platform_version_check_ defaults to false.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 303
309 // Delay to let the browser execute the command. 304 // Delay to let the browser execute the command.
310 base::TimeDelta command_execution_timeout_; 305 base::TimeDelta command_execution_timeout_;
311 306
312 base::PlatformThreadId listener_thread_id_; 307 base::PlatformThreadId listener_thread_id_;
313 308
314 DISALLOW_COPY_AND_ASSIGN(AutomationProxy); 309 DISALLOW_COPY_AND_ASSIGN(AutomationProxy);
315 }; 310 };
316 311
317 #endif // CHROME_TEST_AUTOMATION_AUTOMATION_PROXY_H_ 312 #endif // CHROME_TEST_AUTOMATION_AUTOMATION_PROXY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698