OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_TEST_AUTOMATION_PROXY_LAUNCHER_H_ |
| 6 #define CHROME_TEST_AUTOMATION_PROXY_LAUNCHER_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 class AutomationProxy; |
| 11 class UITestBase; |
| 12 |
| 13 // Subclass from this class to use a different implementation of AutomationProxy |
| 14 // or to use different channel IDs inside a class that derives from UITest. |
| 15 class ProxyLauncher { |
| 16 public: |
| 17 virtual ~ProxyLauncher() {} |
| 18 |
| 19 // Creates an automation proxy. |
| 20 virtual AutomationProxy* CreateAutomationProxy( |
| 21 int execution_timeout) const = 0; |
| 22 |
| 23 // Launches the browser if needed and establishes a connection |
| 24 // connection with it using the specified UITestBase. |
| 25 virtual void InitializeConnection(UITestBase* ui_test_base) const = 0; |
| 26 |
| 27 // Returns the automation proxy's channel with any prefixes prepended, |
| 28 // for passing as a command line parameter over to the browser. |
| 29 virtual std::string PrefixedChannelID() const = 0; |
| 30 |
| 31 protected: |
| 32 std::string channel_id_; // Channel id of automation proxy. |
| 33 }; |
| 34 |
| 35 // Uses an automation proxy that communicates over a named socket. |
| 36 // The channel id is a constant specified by kInterfacePath. |
| 37 class NamedProxyLauncher : public ProxyLauncher { |
| 38 public: |
| 39 explicit NamedProxyLauncher(bool disconnect_on_failure); |
| 40 virtual AutomationProxy* CreateAutomationProxy(int execution_timeout) const; |
| 41 virtual void InitializeConnection(UITestBase* ui_test_base) const; |
| 42 virtual std::string PrefixedChannelID() const; |
| 43 |
| 44 protected: |
| 45 bool disconnect_on_failure_; // True if we disconnect on IPC channel failure. |
| 46 }; |
| 47 |
| 48 // Uses an automation proxy that communicates over an anonymous socket. |
| 49 class AnonymousProxyLauncher : public ProxyLauncher { |
| 50 public: |
| 51 explicit AnonymousProxyLauncher(bool disconnect_on_failure); |
| 52 virtual AutomationProxy* CreateAutomationProxy(int execution_timeout) const; |
| 53 virtual void InitializeConnection(UITestBase* ui_test_base) const; |
| 54 virtual std::string PrefixedChannelID() const; |
| 55 |
| 56 protected: |
| 57 bool disconnect_on_failure_; // True if we disconnect on IPC channel failure. |
| 58 }; |
| 59 |
| 60 #endif // CHROME_TEST_AUTOMATION_PROXY_LAUNCHER_H_ |
| 61 |
OLD | NEW |