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

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

Issue 10787010: Switch to TimeDelta interfaces in chrome automation test infrastructure. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase onto master. Created 8 years, 5 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
« no previous file with comments | « no previous file | chrome/test/automation/automation_proxy.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) 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 #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 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 // and the proxy provider might be still working on the previous 47 // and the proxy provider might be still working on the previous
48 // request. 48 // request.
49 virtual bool Send(IPC::Message* message) = 0; 49 virtual bool Send(IPC::Message* message) = 0;
50 virtual bool Send(IPC::Message* message, int timeout_ms) = 0; 50 virtual bool Send(IPC::Message* message, int timeout_ms) = 0;
51 }; 51 };
52 52
53 // This is the interface that external processes can use to interact with 53 // This is the interface that external processes can use to interact with
54 // a running instance of the app. 54 // a running instance of the app.
55 class AutomationProxy : public IPC::Listener, public AutomationMessageSender { 55 class AutomationProxy : public IPC::Listener, public AutomationMessageSender {
56 public: 56 public:
57 AutomationProxy(int action_timeout_ms, bool disconnect_on_failure); 57 AutomationProxy(base::TimeDelta action_timeout, bool disconnect_on_failure);
58 virtual ~AutomationProxy(); 58 virtual ~AutomationProxy();
59 59
60 // Creates a previously unused channel id. 60 // Creates a previously unused channel id.
61 static std::string GenerateChannelID(); 61 static std::string GenerateChannelID();
62 62
63 // Initializes a channel for a connection to an AutomationProvider. 63 // Initializes a channel for a connection to an AutomationProvider.
64 // If use_named_interface is false, it will act as a client 64 // If use_named_interface is false, it will act as a client
65 // and connect to the named IPC socket with channel_id as its path. 65 // and connect to the named IPC socket with channel_id as its path.
66 // If use_named_interface is true, it will act as a server and 66 // If use_named_interface is true, it will act as a server and
67 // use an anonymous socketpair instead. 67 // use an anonymous socketpair instead.
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 virtual void InvalidateHandle(const IPC::Message& message); 185 virtual void InvalidateHandle(const IPC::Message& message);
186 186
187 // Creates a tab that can hosted in an external process. The function 187 // Creates a tab that can hosted in an external process. The function
188 // returns a TabProxy representing the tab as well as a window handle 188 // returns a TabProxy representing the tab as well as a window handle
189 // that can be reparented in another process. 189 // that can be reparented in another process.
190 scoped_refptr<TabProxy> CreateExternalTab( 190 scoped_refptr<TabProxy> CreateExternalTab(
191 const ExternalTabSettings& settings, 191 const ExternalTabSettings& settings,
192 gfx::NativeWindow* external_tab_container, 192 gfx::NativeWindow* external_tab_container,
193 gfx::NativeWindow* tab); 193 gfx::NativeWindow* tab);
194 194
195 int action_timeout_ms() const { 195 base::TimeDelta action_timeout() const {
196 return static_cast<int>(action_timeout_.InMilliseconds()); 196 return action_timeout_;
197 } 197 }
198 198
199 // Sets the timeout for subsequent automation calls. 199 // Sets the timeout for subsequent automation calls.
200 void set_action_timeout_ms(int timeout_ms) { 200 void set_action_timeout(base::TimeDelta timeout) {
201 DCHECK(timeout_ms <= 10 * 60 * 1000 ) << "10+ min of automation timeout " 201 DCHECK(timeout <= base::TimeDelta::FromMinutes(10))
202 "can make the test hang and be killed by buildbot"; 202 << "10+ min of automation timeout "
203 action_timeout_ = base::TimeDelta::FromMilliseconds(timeout_ms); 203 "can make the test hang and be killed by buildbot";
204 action_timeout_ = timeout;
204 } 205 }
205 206
206 // Returns the server version of the server connected. You may only call this 207 // Returns the server version of the server connected. You may only call this
207 // method after WaitForAppLaunch() has returned SUCCESS or VERSION_MISMATCH. 208 // method after WaitForAppLaunch() has returned SUCCESS or VERSION_MISMATCH.
208 // If you call it before this, the return value is undefined. 209 // If you call it before this, the return value is undefined.
209 std::string server_version() const { 210 std::string server_version() const {
210 return server_version_; 211 return server_version_;
211 } 212 }
212 213
213 // Call this while passing true to tell the automation proxy to perform 214 // Call this while passing true to tell the automation proxy to perform
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 262
262 // Delay to let the browser execute the command. 263 // Delay to let the browser execute the command.
263 base::TimeDelta action_timeout_; 264 base::TimeDelta action_timeout_;
264 265
265 base::PlatformThreadId listener_thread_id_; 266 base::PlatformThreadId listener_thread_id_;
266 267
267 DISALLOW_COPY_AND_ASSIGN(AutomationProxy); 268 DISALLOW_COPY_AND_ASSIGN(AutomationProxy);
268 }; 269 };
269 270
270 #endif // CHROME_TEST_AUTOMATION_AUTOMATION_PROXY_H_ 271 #endif // CHROME_TEST_AUTOMATION_AUTOMATION_PROXY_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/test/automation/automation_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698