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

Unified Diff: chrome/test/automation/proxy_launcher.h

Issue 7523060: Let pyauto create an attached webdriver instance to manipulate web pages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address nirnimesh' latest comments Created 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/automation/proxy_launcher.h
diff --git a/chrome/test/automation/proxy_launcher.h b/chrome/test/automation/proxy_launcher.h
index d306a334fd87ba5fbbb3fbd77de186dcb789df1f..e2a273a164494cd714ee2bb915102d427e1e3b39 100644
--- a/chrome/test/automation/proxy_launcher.h
+++ b/chrome/test/automation/proxy_launcher.h
@@ -65,8 +65,10 @@ class ProxyLauncher {
virtual ~ProxyLauncher();
// Launches the browser if needed and establishes a connection with it.
- virtual void InitializeConnection(const LaunchState& state,
- bool wait_for_initial_loads) = 0;
+ // Returns true on success.
+ virtual bool InitializeConnection(
+ const LaunchState& state,
+ bool wait_for_initial_loads) WARN_UNUSED_RESULT = 0;
// Shuts down the browser if needed and destroys any
// connections established by InitalizeConnection.
@@ -282,21 +284,35 @@ class ProxyLauncher {
// The channel id of the proxy is a constant specified by kInterfacePath.
class NamedProxyLauncher : public ProxyLauncher {
public:
- // If launch_browser is true, launches Chrome with named interface enabled.
- // Otherwise, there should be an existing instance the proxy can connect to.
+ struct InitParams {
+ // True if the browser should be launched. If false, this will connect
+ // to an already started Chrome.
+ bool launch_browser;
+
+ // True if we should disconnect on an IPC failure.
+ bool disconnect_on_failure;
+
+ // True if we should wait for Chrome's server channel to be initialized
+ // and listening. Only set to false if it is guaranteed the server channel
+ // is already listening.
+ bool wait_for_server_channel;
+ };
+
NamedProxyLauncher(const std::string& channel_id,
- bool launch_browser, bool disconnect_on_failure);
+ const InitParams& params);
virtual AutomationProxy* CreateAutomationProxy(int execution_timeout);
- virtual void InitializeConnection(const LaunchState& state,
- bool wait_for_initial_loads);
+ virtual bool InitializeConnection(
+ const LaunchState& state,
+ bool wait_for_initial_loads) OVERRIDE WARN_UNUSED_RESULT;
virtual void TerminateConnection();
virtual std::string PrefixedChannelID() const;
protected:
- std::string channel_id_; // Channel id of automation proxy.
- bool launch_browser_; // True if we should launch the browser too.
- bool disconnect_on_failure_; // True if we disconnect on IPC channel failure.
+ std::string channel_id_; // Channel id of automation proxy.
+ bool launch_browser_; // True if we should launch the browser too.
+ bool disconnect_on_failure_; // True if we disconnect on channel failure.
+ bool wait_for_server_channel_; // True if we should wait for server channel.
private:
DISALLOW_COPY_AND_ASSIGN(NamedProxyLauncher);
@@ -307,8 +323,9 @@ class AnonymousProxyLauncher : public ProxyLauncher {
public:
explicit AnonymousProxyLauncher(bool disconnect_on_failure);
virtual AutomationProxy* CreateAutomationProxy(int execution_timeout);
- virtual void InitializeConnection(const LaunchState& state,
- bool wait_for_initial_loads);
+ virtual bool InitializeConnection(
+ const LaunchState& state,
+ bool wait_for_initial_loads) OVERRIDE WARN_UNUSED_RESULT;
virtual void TerminateConnection();
virtual std::string PrefixedChannelID() const;

Powered by Google App Engine
This is Rietveld 408576698