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

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

Issue 7634031: Let pyauto create an attached webdriver instance to manipulate web pages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: forgot to re-add the previously added files Created 9 years, 4 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) 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_PROXY_LAUNCHER_H_ 5 #ifndef CHROME_TEST_AUTOMATION_PROXY_LAUNCHER_H_
6 #define CHROME_TEST_AUTOMATION_PROXY_LAUNCHER_H_ 6 #define CHROME_TEST_AUTOMATION_PROXY_LAUNCHER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 58
59 // If true, the window is shown. Otherwise it is hidden. 59 // If true, the window is shown. Otherwise it is hidden.
60 bool show_window; 60 bool show_window;
61 }; 61 };
62 62
63 ProxyLauncher(); 63 ProxyLauncher();
64 64
65 virtual ~ProxyLauncher(); 65 virtual ~ProxyLauncher();
66 66
67 // Launches the browser if needed and establishes a connection with it. 67 // Launches the browser if needed and establishes a connection with it.
68 virtual void InitializeConnection(const LaunchState& state, 68 // Returns true on success.
69 bool wait_for_initial_loads) = 0; 69 virtual bool InitializeConnection(
70 const LaunchState& state,
71 bool wait_for_initial_loads) WARN_UNUSED_RESULT = 0;
70 72
71 // Shuts down the browser if needed and destroys any 73 // Shuts down the browser if needed and destroys any
72 // connections established by InitalizeConnection. 74 // connections established by InitalizeConnection.
73 virtual void TerminateConnection() = 0; 75 virtual void TerminateConnection() = 0;
74 76
75 // Launches the browser and IPC testing connection in server mode. 77 // Launches the browser and IPC testing connection in server mode.
76 // Returns true on success. 78 // Returns true on success.
77 bool LaunchBrowserAndServer(const LaunchState& state, 79 bool LaunchBrowserAndServer(const LaunchState& state,
78 bool wait_for_initial_loads) WARN_UNUSED_RESULT; 80 bool wait_for_initial_loads) WARN_UNUSED_RESULT;
79 81
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 // to a browser process that is already running. 283 // to a browser process that is already running.
282 // The channel id of the proxy is a constant specified by kInterfacePath. 284 // The channel id of the proxy is a constant specified by kInterfacePath.
283 class NamedProxyLauncher : public ProxyLauncher { 285 class NamedProxyLauncher : public ProxyLauncher {
284 public: 286 public:
285 // If launch_browser is true, launches Chrome with named interface enabled. 287 // If launch_browser is true, launches Chrome with named interface enabled.
286 // Otherwise, there should be an existing instance the proxy can connect to. 288 // Otherwise, there should be an existing instance the proxy can connect to.
287 NamedProxyLauncher(const std::string& channel_id, 289 NamedProxyLauncher(const std::string& channel_id,
288 bool launch_browser, bool disconnect_on_failure); 290 bool launch_browser, bool disconnect_on_failure);
289 291
290 virtual AutomationProxy* CreateAutomationProxy(int execution_timeout); 292 virtual AutomationProxy* CreateAutomationProxy(int execution_timeout);
291 virtual void InitializeConnection(const LaunchState& state, 293 virtual bool InitializeConnection(
292 bool wait_for_initial_loads); 294 const LaunchState& state,
295 bool wait_for_initial_loads) OVERRIDE WARN_UNUSED_RESULT;
293 virtual void TerminateConnection(); 296 virtual void TerminateConnection();
294 virtual std::string PrefixedChannelID() const; 297 virtual std::string PrefixedChannelID() const;
295 298
296 protected: 299 protected:
297 std::string channel_id_; // Channel id of automation proxy. 300 std::string channel_id_; // Channel id of automation proxy.
298 bool launch_browser_; // True if we should launch the browser too. 301 bool launch_browser_; // True if we should launch the browser too.
299 bool disconnect_on_failure_; // True if we disconnect on IPC channel failure. 302 bool disconnect_on_failure_; // True if we disconnect on IPC channel failure.
300 303
301 private: 304 private:
302 DISALLOW_COPY_AND_ASSIGN(NamedProxyLauncher); 305 DISALLOW_COPY_AND_ASSIGN(NamedProxyLauncher);
303 }; 306 };
304 307
305 // Uses an automation proxy that communicates over an anonymous socket. 308 // Uses an automation proxy that communicates over an anonymous socket.
306 class AnonymousProxyLauncher : public ProxyLauncher { 309 class AnonymousProxyLauncher : public ProxyLauncher {
307 public: 310 public:
308 explicit AnonymousProxyLauncher(bool disconnect_on_failure); 311 explicit AnonymousProxyLauncher(bool disconnect_on_failure);
309 virtual AutomationProxy* CreateAutomationProxy(int execution_timeout); 312 virtual AutomationProxy* CreateAutomationProxy(int execution_timeout);
310 virtual void InitializeConnection(const LaunchState& state, 313 virtual bool InitializeConnection(
311 bool wait_for_initial_loads); 314 const LaunchState& state,
315 bool wait_for_initial_loads) OVERRIDE WARN_UNUSED_RESULT;
312 virtual void TerminateConnection(); 316 virtual void TerminateConnection();
313 virtual std::string PrefixedChannelID() const; 317 virtual std::string PrefixedChannelID() const;
314 318
315 protected: 319 protected:
316 std::string channel_id_; // Channel id of automation proxy. 320 std::string channel_id_; // Channel id of automation proxy.
317 bool disconnect_on_failure_; // True if we disconnect on IPC channel failure. 321 bool disconnect_on_failure_; // True if we disconnect on IPC channel failure.
318 322
319 private: 323 private:
320 DISALLOW_COPY_AND_ASSIGN(AnonymousProxyLauncher); 324 DISALLOW_COPY_AND_ASSIGN(AnonymousProxyLauncher);
321 }; 325 };
322 326
323 #endif // CHROME_TEST_AUTOMATION_PROXY_LAUNCHER_H_ 327 #endif // CHROME_TEST_AUTOMATION_PROXY_LAUNCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698