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

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, 8 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 209
209 // Gets a list of all enabled extensions' base directories. 210 // Gets a list of all enabled extensions' base directories.
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,
220 int timeout) WARN_UNUSED_RESULT;
219 221
220 #if defined(OS_CHROMEOS) 222 #if defined(OS_CHROMEOS)
221 // Logs in through the Chrome OS login wizard with given |username| 223 // Logs in through the Chrome OS login wizard with given |username|
222 // and |password|. Returns true on success. 224 // and |password|. Returns true on success.
223 bool LoginWithUserAndPass(const std::string& username, 225 bool LoginWithUserAndPass(const std::string& username,
224 const std::string& password) WARN_UNUSED_RESULT; 226 const std::string& password) WARN_UNUSED_RESULT;
225 #endif 227 #endif
226 228
227 #if defined(OS_POSIX) 229 #if defined(OS_POSIX)
228 base::file_handle_mapping_vector fds_to_map() const; 230 base::file_handle_mapping_vector fds_to_map() const;
229 #endif 231 #endif
230 232
231 // AutomationMessageSender implementation. 233 // AutomationMessageSender implementation.
232 virtual bool Send(IPC::Message* message) WARN_UNUSED_RESULT; 234 virtual bool Send(IPC::Message* message) WARN_UNUSED_RESULT;
235 virtual bool Send(IPC::Message* message, int timeout_ms) WARN_UNUSED_RESULT;
233 236
234 // Wrapper over AutomationHandleTracker::InvalidateHandle. Receives the 237 // Wrapper over AutomationHandleTracker::InvalidateHandle. Receives the
235 // message from AutomationProxy, unpacks the messages and routes that call to 238 // message from AutomationProxy, unpacks the messages and routes that call to
236 // the tracker. 239 // the tracker.
237 virtual void InvalidateHandle(const IPC::Message& message); 240 virtual void InvalidateHandle(const IPC::Message& message);
238 241
239 // Creates a tab that can hosted in an external process. The function 242 // 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 243 // returns a TabProxy representing the tab as well as a window handle
241 // that can be reparented in another process. 244 // that can be reparented in another process.
242 scoped_refptr<TabProxy> CreateExternalTab( 245 scoped_refptr<TabProxy> CreateExternalTab(
243 const ExternalTabSettings& settings, 246 const ExternalTabSettings& settings,
244 gfx::NativeWindow* external_tab_container, 247 gfx::NativeWindow* external_tab_container,
245 gfx::NativeWindow* tab); 248 gfx::NativeWindow* tab);
246 249
247 int command_execution_timeout_ms() const {
Nirnimesh 2011/03/29 20:27:28 Please add corresponding getter/setter for action_
Huyen 2011/03/31 02:42:55 Done.
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 250 // Returns the server version of the server connected. You may only call this
259 // method after WaitForAppLaunch() has returned SUCCESS or VERSION_MISMATCH. 251 // method after WaitForAppLaunch() has returned SUCCESS or VERSION_MISMATCH.
260 // If you call it before this, the return value is undefined. 252 // If you call it before this, the return value is undefined.
261 std::string server_version() const { 253 std::string server_version() const {
262 return server_version_; 254 return server_version_;
263 } 255 }
264 256
265 // Call this while passing true to tell the automation proxy to perform 257 // Call this while passing true to tell the automation proxy to perform
266 // a version check when WaitForAppLaunch() is called. Note that 258 // a version check when WaitForAppLaunch() is called. Note that
267 // platform_version_check_ defaults to false. 259 // platform_version_check_ defaults to false.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 300
309 // Delay to let the browser execute the command. 301 // Delay to let the browser execute the command.
310 base::TimeDelta command_execution_timeout_; 302 base::TimeDelta command_execution_timeout_;
311 303
312 base::PlatformThreadId listener_thread_id_; 304 base::PlatformThreadId listener_thread_id_;
313 305
314 DISALLOW_COPY_AND_ASSIGN(AutomationProxy); 306 DISALLOW_COPY_AND_ASSIGN(AutomationProxy);
315 }; 307 };
316 308
317 #endif // CHROME_TEST_AUTOMATION_AUTOMATION_PROXY_H_ 309 #endif // CHROME_TEST_AUTOMATION_AUTOMATION_PROXY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698