Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 279 | 279 |
| 280 DISALLOW_COPY_AND_ASSIGN(ProxyLauncher); | 280 DISALLOW_COPY_AND_ASSIGN(ProxyLauncher); |
| 281 }; | 281 }; |
| 282 | 282 |
| 283 // Uses an automation proxy that communicates over a named socket. | 283 // Uses an automation proxy that communicates over a named socket. |
| 284 // This is used if you want to connect an AutomationProxy | 284 // This is used if you want to connect an AutomationProxy |
| 285 // to a browser process that is already running. | 285 // to a browser process that is already running. |
| 286 // The channel id of the proxy is a constant specified by kInterfacePath. | 286 // The channel id of the proxy is a constant specified by kInterfacePath. |
| 287 class NamedProxyLauncher : public ProxyLauncher { | 287 class NamedProxyLauncher : public ProxyLauncher { |
| 288 public: | 288 public: |
| 289 // If launch_browser is true, launches Chrome with named interface enabled. | 289 struct InitParams { |
| 290 // Otherwise, there should be an existing instance the proxy can connect to. | 290 // True if the browser should be launched. If false, this will connect |
| 291 // to an already started Chrome. | |
| 292 bool launch_browser; | |
| 293 | |
| 294 // True if we should disconnect on an IPC failure. | |
| 295 bool disconnect_on_failure; | |
| 296 | |
| 297 // True if we should wait for Chrome's server channel to be initialized | |
| 298 // and listening. Only set to false if it is guaranteed the server channel | |
| 299 // is already listening. | |
| 300 bool wait_for_server_channel; | |
|
Nirnimesh
2011/08/01 19:21:24
Why is this necessary? In what case would you set
kkania
2011/08/02 15:10:44
This is necessary because the code for waiting for
| |
| 301 }; | |
| 302 | |
| 291 NamedProxyLauncher(const std::string& channel_id, | 303 NamedProxyLauncher(const std::string& channel_id, |
| 292 bool launch_browser, | 304 const InitParams& params); |
| 293 bool disconnect_on_failure); | |
| 294 | 305 |
| 295 virtual AutomationProxy* CreateAutomationProxy( | 306 virtual AutomationProxy* CreateAutomationProxy( |
| 296 int execution_timeout) OVERRIDE; | 307 int execution_timeout) OVERRIDE; |
| 297 virtual bool InitializeConnection( | 308 virtual bool InitializeConnection( |
| 298 const LaunchState& state, | 309 const LaunchState& state, |
| 299 bool wait_for_initial_loads) OVERRIDE WARN_UNUSED_RESULT; | 310 bool wait_for_initial_loads) OVERRIDE WARN_UNUSED_RESULT; |
| 300 virtual void TerminateConnection() OVERRIDE; | 311 virtual void TerminateConnection() OVERRIDE; |
| 301 virtual std::string PrefixedChannelID() const OVERRIDE; | 312 virtual std::string PrefixedChannelID() const OVERRIDE; |
| 302 | 313 |
| 303 protected: | 314 protected: |
| 304 std::string channel_id_; // Channel id of automation proxy. | 315 std::string channel_id_; // Channel id of automation proxy. |
| 305 bool launch_browser_; // True if we should launch the browser too. | 316 bool launch_browser_; // True if we should launch the browser too. |
| 306 bool disconnect_on_failure_; // True if we disconnect on IPC channel failure. | 317 bool disconnect_on_failure_; // True if we disconnect on channel failure. |
| 318 bool wait_for_server_channel_; // True if we should wait for server channel. | |
| 307 | 319 |
| 308 private: | 320 private: |
| 309 DISALLOW_COPY_AND_ASSIGN(NamedProxyLauncher); | 321 DISALLOW_COPY_AND_ASSIGN(NamedProxyLauncher); |
| 310 }; | 322 }; |
| 311 | 323 |
| 312 // Uses an automation proxy that communicates over an anonymous socket. | 324 // Uses an automation proxy that communicates over an anonymous socket. |
| 313 class AnonymousProxyLauncher : public ProxyLauncher { | 325 class AnonymousProxyLauncher : public ProxyLauncher { |
| 314 public: | 326 public: |
| 315 explicit AnonymousProxyLauncher(bool disconnect_on_failure); | 327 explicit AnonymousProxyLauncher(bool disconnect_on_failure); |
| 316 virtual AutomationProxy* CreateAutomationProxy( | 328 virtual AutomationProxy* CreateAutomationProxy( |
| 317 int execution_timeout) OVERRIDE; | 329 int execution_timeout) OVERRIDE; |
| 318 virtual bool InitializeConnection( | 330 virtual bool InitializeConnection( |
| 319 const LaunchState& state, | 331 const LaunchState& state, |
| 320 bool wait_for_initial_loads) OVERRIDE WARN_UNUSED_RESULT; | 332 bool wait_for_initial_loads) OVERRIDE WARN_UNUSED_RESULT; |
| 321 virtual void TerminateConnection() OVERRIDE; | 333 virtual void TerminateConnection() OVERRIDE; |
| 322 virtual std::string PrefixedChannelID() const OVERRIDE; | 334 virtual std::string PrefixedChannelID() const OVERRIDE; |
| 323 | 335 |
| 324 protected: | 336 protected: |
| 325 std::string channel_id_; // Channel id of automation proxy. | 337 std::string channel_id_; // Channel id of automation proxy. |
| 326 bool disconnect_on_failure_; // True if we disconnect on IPC channel failure. | 338 bool disconnect_on_failure_; // True if we disconnect on IPC channel failure. |
| 327 | 339 |
| 328 private: | 340 private: |
| 329 DISALLOW_COPY_AND_ASSIGN(AnonymousProxyLauncher); | 341 DISALLOW_COPY_AND_ASSIGN(AnonymousProxyLauncher); |
| 330 }; | 342 }; |
| 331 | 343 |
| 332 #endif // CHROME_TEST_AUTOMATION_PROXY_LAUNCHER_H_ | 344 #endif // CHROME_TEST_AUTOMATION_PROXY_LAUNCHER_H_ |
| OLD | NEW |