summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authordtu@chromium.org <dtu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-31 19:28:00 +0000
committerdtu@chromium.org <dtu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-31 19:28:00 +0000
commitdce050dc0b29bdf9077ca491ea400f48253abd8b (patch)
tree7d51cb610cda10730273ef8b258ac215899adef2 /chrome
parent78c52ff1676a5aee32833d42a1828ac7dd443066 (diff)
downloadchromium_src-dce050dc0b29bdf9077ca491ea400f48253abd8b.zip
chromium_src-dce050dc0b29bdf9077ca491ea400f48253abd8b.tar.gz
chromium_src-dce050dc0b29bdf9077ca491ea400f48253abd8b.tar.bz2
Add channel_id parameter for NamedProxyLauncher constructor.
BUG=none TEST=none Review URL: http://codereview.chromium.org/6336018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73173 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/test/automation/proxy_launcher.cc15
-rw-r--r--chrome/test/automation/proxy_launcher.h6
-rw-r--r--chrome/test/test_switches.cc5
-rw-r--r--chrome/test/test_switches.h1
-rw-r--r--chrome/test/ui/named_interface_uitest.cc9
5 files changed, 27 insertions, 9 deletions
diff --git a/chrome/test/automation/proxy_launcher.cc b/chrome/test/automation/proxy_launcher.cc
index 028849d..0a02144 100644
--- a/chrome/test/automation/proxy_launcher.cc
+++ b/chrome/test/automation/proxy_launcher.cc
@@ -32,9 +32,6 @@ namespace {
// Passed as value of kTestType.
const char kUITestType[] = "ui";
-// Default path of named testing interface.
-const char kInterfacePath[] = "/var/tmp/ChromeTestingInterface";
-
// Rewrite the preferences file to point to the proper image directory.
void RewritePreferencesFile(const FilePath& user_data_dir) {
const FilePath pref_template_path(
@@ -98,6 +95,9 @@ void UpdateHistoryDates(const FilePath& user_data_dir) {
// ProxyLauncher functions
+const char ProxyLauncher::kDefaultInterfacePath[] =
+ "/var/tmp/ChromeTestingInterface";
+
bool ProxyLauncher::in_process_renderer_ = false;
bool ProxyLauncher::no_sandbox_ = false;
bool ProxyLauncher::full_memory_dump_ = false;
@@ -484,11 +484,12 @@ base::TimeDelta ProxyLauncher::browser_quit_time() const {
// NamedProxyLauncher functions
-NamedProxyLauncher::NamedProxyLauncher(bool launch_browser,
+NamedProxyLauncher::NamedProxyLauncher(const std::string& channel_id,
+ bool launch_browser,
bool disconnect_on_failure)
- : launch_browser_(launch_browser),
+ : channel_id_(channel_id),
+ launch_browser_(launch_browser),
disconnect_on_failure_(disconnect_on_failure) {
- channel_id_ = kInterfacePath;
}
AutomationProxy* NamedProxyLauncher::CreateAutomationProxy(
@@ -507,7 +508,7 @@ void NamedProxyLauncher::InitializeConnection(const LaunchState& state,
// Wait for browser to be ready for connections.
struct stat file_info;
- while (stat(kInterfacePath, &file_info))
+ while (stat(channel_id_.c_str(), &file_info))
base::PlatformThread::Sleep(automation::kSleepTime);
}
diff --git a/chrome/test/automation/proxy_launcher.h b/chrome/test/automation/proxy_launcher.h
index 97d2dd4..bdb8dc5 100644
--- a/chrome/test/automation/proxy_launcher.h
+++ b/chrome/test/automation/proxy_launcher.h
@@ -25,6 +25,9 @@ class AutomationProxy;
// implementation or to override browser launching behavior.
class ProxyLauncher {
public:
+ // Default path for named testing interface.
+ static const char kDefaultInterfacePath[];
+
// Profile theme type choices.
enum ProfileType {
DEFAULT_THEME = 0,
@@ -297,7 +300,8 @@ 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.
- NamedProxyLauncher(bool launch_browser, bool disconnect_on_failure);
+ NamedProxyLauncher(const std::string& channel_id,
+ bool launch_browser, bool disconnect_on_failure);
virtual AutomationProxy* CreateAutomationProxy(int execution_timeout);
virtual void InitializeConnection(const LaunchState& state,
diff --git a/chrome/test/test_switches.cc b/chrome/test/test_switches.cc
index aa93da4..be4e34d 100644
--- a/chrome/test/test_switches.cc
+++ b/chrome/test/test_switches.cc
@@ -12,3 +12,8 @@ const char switches::kEnableErrorDialogs[] = "enable-errdialogs";
// Number of iterations that page cycler tests will run.
const char switches::kPageCyclerIterations[] = "page-cycler-iterations";
+
+// Name of channel used to connect to Chrome
+// when using the named testing interface.
+const char switches::kTestingChannel[] = "testing-channel";
+
diff --git a/chrome/test/test_switches.h b/chrome/test/test_switches.h
index 68613d4..3494605 100644
--- a/chrome/test/test_switches.h
+++ b/chrome/test/test_switches.h
@@ -12,6 +12,7 @@ namespace switches {
extern const char kExtraChromeFlags[];
extern const char kEnableErrorDialogs[];
extern const char kPageCyclerIterations[];
+extern const char kTestingChannel[];
} // namespace switches
diff --git a/chrome/test/ui/named_interface_uitest.cc b/chrome/test/ui/named_interface_uitest.cc
index 14603b1..00a939b 100644
--- a/chrome/test/ui/named_interface_uitest.cc
+++ b/chrome/test/ui/named_interface_uitest.cc
@@ -6,6 +6,7 @@
#include "chrome/common/url_constants.h"
#include "chrome/test/automation/proxy_launcher.h"
+#include "chrome/test/test_switches.h"
// The named testing interface enables the use of a named socket for controlling
// the browser. This eliminates the dependency that the browser must be forked
@@ -19,7 +20,13 @@ class NamedInterfaceTest : public UITest {
}
virtual ProxyLauncher *CreateProxyLauncher() {
- return new NamedProxyLauncher(true, true);
+ CommandLine::StringType channel_path =
+ CommandLine::ForCurrentProcess()->GetSwitchValueNative(
+ switches::kTestingChannel);
+ if (channel_path.empty())
+ channel_path = ProxyLauncher::kDefaultInterfacePath;
+
+ return new NamedProxyLauncher(channel_path, true, true);
}
};