diff options
author | nirnimesh@chromium.org <nirnimesh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-19 23:34:18 +0000 |
---|---|---|
committer | nirnimesh@chromium.org <nirnimesh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-19 23:34:18 +0000 |
commit | b1308bd418eefc8b1f3410724229c1016a47f01d (patch) | |
tree | 76ee7652d0cf3db6b9bf7c1dc7e06c8ad14cf852 /chrome/test | |
parent | 3e24622628f9b80010c3784b7ee615c25236fc7f (diff) | |
download | chromium_src-b1308bd418eefc8b1f3410724229c1016a47f01d.zip chromium_src-b1308bd418eefc8b1f3410724229c1016a47f01d.tar.gz chromium_src-b1308bd418eefc8b1f3410724229c1016a47f01d.tar.bz2 |
Add named testing interface. This allows you to connect to a pre-existing Chrome process and run tests on it. This is an addition to the low level interface underlying testing frameworks like PyAuto and WebDriver.
Normally, test frameworks communicate with Chrome over an unnamed socket pair on POSIX. The test creates the socket pair and then launches the browser as a child process, passing an open file descriptor for one end of the socket to the browser. This change adds a command line switch that, when passed to the browser, causes it to listen on a named socket instead, eliminating this parent/child process requirement. Therefore, you can potentially connect any number of tests to a preexisting browser process.
For ChromeOS, this allows you to run tests on the instance of Chrome that is launched on startup, which controls things like the login and lock screens, the battery meter, the wireless UI, etc. Currently there is no way to run tests on a pre-existing Chrome instance. Eventually this will also allow you to connect both PyAuto and WebDriver to the same Chrome instance and run both in the same test.
If you pass the browser the following command line switch:
./chrome --testing-channel=NamedTestingInterface:/path/to/file
This causes the browser to listen for incoming connections. An AutomationProxy can connect to the browser by connecting a Unix domain socket to the specified path and control the browser over the socket.
This is currently only for POSIX. Windows support will come in a future change. Also, this initial change only allows one connection; multiple connection support will come in a future change.
BUG=chromium-os:8512
TEST=Run Chrome with --testing-interface=/var/tmp/NamedTestingInterface, then run NamedInterfaceTest.BasicNamedInterface under ui_tests.
Review URL: http://codereview.chromium.org/4202004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66840 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
-rw-r--r-- | chrome/test/automation/automation_proxy.cc | 14 | ||||
-rw-r--r-- | chrome/test/automation/automation_proxy.h | 18 | ||||
-rw-r--r-- | chrome/test/automation/automation_proxy_uitest.cc | 20 | ||||
-rw-r--r-- | chrome/test/automation/automation_proxy_uitest.h | 14 | ||||
-rw-r--r-- | chrome/test/automation/proxy_launcher.cc | 75 | ||||
-rw-r--r-- | chrome/test/automation/proxy_launcher.h | 78 | ||||
-rw-r--r-- | chrome/test/ui/named_interface_uitest.cc | 42 | ||||
-rw-r--r-- | chrome/test/ui/ui_test.cc | 60 | ||||
-rw-r--r-- | chrome/test/ui/ui_test.h | 27 |
9 files changed, 300 insertions, 48 deletions
diff --git a/chrome/test/automation/automation_proxy.cc b/chrome/test/automation/automation_proxy.cc index fbdde25..a33f095 100644 --- a/chrome/test/automation/automation_proxy.cc +++ b/chrome/test/automation/automation_proxy.cc @@ -107,10 +107,8 @@ AutomationProxy::AutomationProxy(int command_execution_timeout_ms, // least it is legal... ;-) DCHECK_GE(command_execution_timeout_ms, 0); listener_thread_id_ = PlatformThread::CurrentId(); - InitializeChannelID(); InitializeHandleTracker(); InitializeThread(); - InitializeChannel(); } AutomationProxy::~AutomationProxy() { @@ -122,7 +120,7 @@ AutomationProxy::~AutomationProxy() { tracker_.reset(); } -void AutomationProxy::InitializeChannelID() { +std::string AutomationProxy::GenerateChannelID() { // The channel counter keeps us out of trouble if we create and destroy // several AutomationProxies sequentially over the course of a test run. // (Creating the channel sometimes failed before when running a lot of @@ -133,7 +131,7 @@ void AutomationProxy::InitializeChannelID() { std::ostringstream buf; buf << "ChromeTestingInterface:" << base::GetCurrentProcId() << "." << ++channel_counter; - channel_id_ = buf.str(); + return buf.str(); } void AutomationProxy::InitializeThread() { @@ -146,7 +144,8 @@ void AutomationProxy::InitializeThread() { thread_.swap(thread); } -void AutomationProxy::InitializeChannel() { +void AutomationProxy::InitializeChannel(const std::string& channel_id, + bool use_named_interface) { DCHECK(shutdown_event_.get() != NULL); // TODO(iyengar) @@ -154,8 +153,9 @@ void AutomationProxy::InitializeChannel() { // provider, where we use the shutdown event provided by the chrome browser // process. channel_.reset(new IPC::SyncChannel( - channel_id_, - IPC::Channel::MODE_SERVER, + channel_id, + use_named_interface ? IPC::Channel::MODE_NAMED_CLIENT + : IPC::Channel::MODE_SERVER, this, // we are the listener new AutomationMessageFilter(this), thread_->message_loop(), diff --git a/chrome/test/automation/automation_proxy.h b/chrome/test/automation/automation_proxy.h index 853a6d3..7902ef0 100644 --- a/chrome/test/automation/automation_proxy.h +++ b/chrome/test/automation/automation_proxy.h @@ -61,6 +61,17 @@ class AutomationProxy : public IPC::Channel::Listener, AutomationProxy(int command_execution_timeout_ms, bool disconnect_on_failure); virtual ~AutomationProxy(); + // Creates a previously unused channel id. + static std::string GenerateChannelID(); + + // Initializes a channel for a connection to an AutomationProvider. + // If use_named_interface is false, it will act as a client + // and connect to the named IPC socket with channel_id as its path. + // If use_named_interface is true, it will act as a server and + // use an anonymous socketpair instead. + void InitializeChannel(const std::string& channel_id, + bool use_named_interface); + // IPC callback virtual void OnMessageReceived(const IPC::Message& msg); virtual void OnChannelError(); @@ -208,10 +219,6 @@ class AutomationProxy : public IPC::Channel::Listener, const std::string& password) WARN_UNUSED_RESULT; #endif - // Returns the ID of the automation IPC channel, so that it can be - // passed to the app as a launch parameter. - const std::string& channel_id() const { return channel_id_; } - #if defined(OS_POSIX) base::file_handle_mapping_vector fds_to_map() const; #endif @@ -263,12 +270,9 @@ class AutomationProxy : public IPC::Channel::Listener, protected: template <class T> scoped_refptr<T> ProxyObjectFromHandle(int handle); - void InitializeChannelID(); void InitializeThread(); - void InitializeChannel(); void InitializeHandleTracker(); - std::string channel_id_; scoped_ptr<base::Thread> thread_; scoped_ptr<IPC::SyncChannel> channel_; scoped_ptr<AutomationHandleTracker> tracker_; diff --git a/chrome/test/automation/automation_proxy_uitest.cc b/chrome/test/automation/automation_proxy_uitest.cc index db6a18e4..f94e442 100644 --- a/chrome/test/automation/automation_proxy_uitest.cc +++ b/chrome/test/automation/automation_proxy_uitest.cc @@ -841,11 +841,27 @@ template <typename T> T** ReceivePointer(scoped_refptr<T>& p) { // NOLINT return reinterpret_cast<T**>(&p); } -AutomationProxy* ExternalTabUITest::CreateAutomationProxy(int exec_timeout) { - mock_ = new ExternalTabUITestMockClient(exec_timeout); +// Replace the default automation proxy with our mock client. +ProxyLauncher* ExternalTabUITest::CreateProxyLauncher() { + channel_id_ = AutomationProxy::GenerateChannelID(); + return this; +} + +AutomationProxy* ExternalTabUITest::CreateAutomationProxy( + int execution_timeout) { + mock_ = new ExternalTabUITestMockClient(execution_timeout); + mock_->InitializeChannel(channel_id_, false); return mock_; } +void ExternalTabUITest::InitializeConnection(UITestBase* ui_test_base) const { + ui_test_base->LaunchBrowserAndServer(); +} + +std::string ExternalTabUITest::PrefixedChannelID() const { + return channel_id_; +} + // Create with specifying a url // Flaky, http://crbug.com/32293 TEST_F(ExternalTabUITest, FLAKY_CreateExternalTab1) { diff --git a/chrome/test/automation/automation_proxy_uitest.h b/chrome/test/automation/automation_proxy_uitest.h index 55da8cc..073cd5b 100644 --- a/chrome/test/automation/automation_proxy_uitest.h +++ b/chrome/test/automation/automation_proxy_uitest.h @@ -12,6 +12,7 @@ #include "base/platform_thread.h" #include "base/time.h" #include "chrome/test/automation/automation_proxy.h" +#include "chrome/test/automation/proxy_launcher.h" #include "chrome/test/ui/ui_test.h" #include "gfx/native_widget_types.h" #include "googleurl/src/gurl.h" @@ -109,19 +110,26 @@ class ExternalTabUITestMockClient : public AutomationProxy { }; // Base your external tab UI tests on this. -class ExternalTabUITest : public UITest { +class ExternalTabUITest : public UITest, public ProxyLauncher { public: ExternalTabUITest() : UITest(MessageLoop::TYPE_UI) {} - // Override UITest's CreateAutomationProxy to provide the unit test + + // Override UITest's CreateProxyLauncher to provide the unit test // with our special implementation of AutomationProxy. - // This function is called from within UITest::LaunchBrowserAndServer. + // This function is called from within UITest::SetUp(). + virtual ProxyLauncher* CreateProxyLauncher(); + + // ProxyLauncher functions virtual AutomationProxy* CreateAutomationProxy(int execution_timeout); + virtual void InitializeConnection(UITestBase* ui_test_base) const; + virtual std::string PrefixedChannelID() const; protected: // Filtered Inet will override automation callbacks for network resources. virtual bool ShouldFilterInet() { return false; } ExternalTabUITestMockClient* mock_; + std::string channel_id_; // Channel id of automation proxy. }; #endif // CHROME_TEST_AUTOMATION_AUTOMATION_PROXY_UITEST_H_ diff --git a/chrome/test/automation/proxy_launcher.cc b/chrome/test/automation/proxy_launcher.cc new file mode 100644 index 0000000..2325958 --- /dev/null +++ b/chrome/test/automation/proxy_launcher.cc @@ -0,0 +1,75 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/test/automation/proxy_launcher.h" + +#include "chrome/common/automation_constants.h" +#include "chrome/common/logging_chrome.h" +#include "chrome/test/automation/automation_proxy.h" +#include "chrome/test/ui/ui_test.h" + +// Default path of named testing interface. +static const char kInterfacePath[] = "/var/tmp/ChromeTestingInterface"; + +// NamedProxyLauncher functions + +NamedProxyLauncher::NamedProxyLauncher(bool launch_browser, + bool disconnect_on_failure) + : launch_browser_(launch_browser), + disconnect_on_failure_(disconnect_on_failure) { + channel_id_ = kInterfacePath; +} + +AutomationProxy* NamedProxyLauncher::CreateAutomationProxy( + int execution_timeout) { + AutomationProxy* proxy = new AutomationProxy(execution_timeout, + disconnect_on_failure_); + proxy->InitializeChannel(channel_id_, true); + return proxy; +} + +void NamedProxyLauncher::InitializeConnection(UITestBase* ui_test_base) const { + if (launch_browser_) { + // Set up IPC testing interface as a client. + ui_test_base->LaunchBrowser(); + + // Wait for browser to be ready for connections. + struct stat file_info; + while (stat(kInterfacePath, &file_info)) + PlatformThread::Sleep(automation::kSleepTime); + } + + ui_test_base->ConnectToRunningBrowser(); +} + +std::string NamedProxyLauncher::PrefixedChannelID() const { + std::string channel_id; + channel_id.append(automation::kNamedInterfacePrefix).append(channel_id_); + return channel_id; +} + +// AnonymousProxyLauncher functions + +AnonymousProxyLauncher::AnonymousProxyLauncher(bool disconnect_on_failure) + : disconnect_on_failure_(disconnect_on_failure) { + channel_id_ = AutomationProxy::GenerateChannelID(); +} + +AutomationProxy* AnonymousProxyLauncher::CreateAutomationProxy( + int execution_timeout) { + AutomationProxy* proxy = new AutomationProxy(execution_timeout, + disconnect_on_failure_); + proxy->InitializeChannel(channel_id_, false); + return proxy; +} + +void AnonymousProxyLauncher::InitializeConnection( + UITestBase* ui_test_base) const { + ui_test_base->LaunchBrowserAndServer(); +} + +std::string AnonymousProxyLauncher::PrefixedChannelID() const { + return channel_id_; +} + diff --git a/chrome/test/automation/proxy_launcher.h b/chrome/test/automation/proxy_launcher.h new file mode 100644 index 0000000..0f4d04d --- /dev/null +++ b/chrome/test/automation/proxy_launcher.h @@ -0,0 +1,78 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_TEST_AUTOMATION_PROXY_LAUNCHER_H_ +#define CHROME_TEST_AUTOMATION_PROXY_LAUNCHER_H_ + +#include <string> + +#include "base/basictypes.h" + +class AutomationProxy; +class UITestBase; + +// Subclass from this class to use a different implementation of AutomationProxy +// or to use different channel IDs inside a class that derives from UITest. +class ProxyLauncher { + public: + ProxyLauncher() {} + virtual ~ProxyLauncher() {} + + // Creates an automation proxy. + virtual AutomationProxy* CreateAutomationProxy( + int execution_timeout) = 0; + + // Launches the browser if needed and establishes a connection + // connection with it using the specified UITestBase. + virtual void InitializeConnection(UITestBase* ui_test_base) const = 0; + + // Returns the automation proxy's channel with any prefixes prepended, + // for passing as a command line parameter over to the browser. + virtual std::string PrefixedChannelID() const = 0; + + private: + DISALLOW_COPY_AND_ASSIGN(ProxyLauncher); +}; + +// Uses an automation proxy that communicates over a named socket. +// This is used if you want to connect an AutomationProxy +// to a browser process that is already running. +// 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. + NamedProxyLauncher(bool launch_browser, bool disconnect_on_failure); + + virtual AutomationProxy* CreateAutomationProxy(int execution_timeout); + virtual void InitializeConnection(UITestBase* ui_test_base) const; + 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. + + private: + DISALLOW_COPY_AND_ASSIGN(NamedProxyLauncher); +}; + +// Uses an automation proxy that communicates over an anonymous socket. +class AnonymousProxyLauncher : public ProxyLauncher { + public: + explicit AnonymousProxyLauncher(bool disconnect_on_failure); + virtual AutomationProxy* CreateAutomationProxy(int execution_timeout); + virtual void InitializeConnection(UITestBase* ui_test_base) const; + virtual std::string PrefixedChannelID() const; + + protected: + std::string channel_id_; // Channel id of automation proxy. + bool disconnect_on_failure_; // True if we disconnect on IPC channel failure. + + private: + DISALLOW_COPY_AND_ASSIGN(AnonymousProxyLauncher); +}; + +#endif // CHROME_TEST_AUTOMATION_PROXY_LAUNCHER_H_ + diff --git a/chrome/test/ui/named_interface_uitest.cc b/chrome/test/ui/named_interface_uitest.cc new file mode 100644 index 0000000..ee44820 --- /dev/null +++ b/chrome/test/ui/named_interface_uitest.cc @@ -0,0 +1,42 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/test/ui/ui_test.h" + +#include "chrome/common/url_constants.h" +#include "chrome/test/automation/proxy_launcher.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 +// from the controlling process. +namespace { + +class NamedInterfaceTest : public UITest { + public: + NamedInterfaceTest() { + show_window_ = true; + } + + virtual ProxyLauncher *CreateProxyLauncher() { + return new NamedProxyLauncher(true, true); + } +}; + +// Basic sanity test for named testing interface which +// launches a browser instance that uses a named socket, then +// sends it some commands to open some tabs over that socket. +TEST_F(NamedInterfaceTest, BasicNamedInterface) { + scoped_refptr<BrowserProxy> browser_proxy( + automation()->GetBrowserWindow(0)); + ASSERT_TRUE(browser_proxy.get()); + + for (int i = 0; i < 10; ++i) + ASSERT_TRUE(browser_proxy->AppendTab(GURL(chrome::kAboutBlankURL))); +} + +// TODO(dtu): crosbug.com/8514: Write a test that makes sure you can disconnect, +// then reconnect with a new connection and continue automation. + +} // namespace + diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc index 9fbb857..e6aff60 100644 --- a/chrome/test/ui/ui_test.cc +++ b/chrome/test/ui/ui_test.cc @@ -43,6 +43,7 @@ #include "chrome/test/automation/automation_proxy.h" #include "chrome/test/automation/browser_proxy.h" #include "chrome/test/automation/javascript_execution_controller.h" +#include "chrome/test/automation/proxy_launcher.h" #include "chrome/test/automation/tab_proxy.h" #include "chrome/test/automation/window_proxy.h" #include "chrome/test/chrome_process_util.h" @@ -140,7 +141,9 @@ void UITestBase::SetUp() { JavaScriptExecutionController::set_timeout( TestTimeouts::action_max_timeout_ms()); test_start_time_ = Time::NowFromSystemTime(); - LaunchBrowserAndServer(); + + launcher_.reset(CreateProxyLauncher()); + launcher_->InitializeConnection(this); } void UITestBase::TearDown() { @@ -175,24 +178,39 @@ void UITestBase::TearDown() { // TODO(phajdan.jr): get rid of set_command_execution_timeout_ms. void UITestBase::set_command_execution_timeout_ms(int timeout) { - server_->set_command_execution_timeout_ms(timeout); + automation_proxy_->set_command_execution_timeout_ms(timeout); VLOG(1) << "Automation command execution timeout set to " << timeout << " ms"; } -AutomationProxy* UITestBase::CreateAutomationProxy(int execution_timeout) { - return new AutomationProxy(execution_timeout, false); +ProxyLauncher* UITestBase::CreateProxyLauncher() { + return new AnonymousProxyLauncher(false); +} + +void UITestBase::LaunchBrowser() { + LaunchBrowser(launch_arguments_, clear_profile_); } void UITestBase::LaunchBrowserAndServer() { - // Set up IPC testing interface server. - server_.reset(CreateAutomationProxy( - TestTimeouts::command_execution_timeout_ms())); + // Set up IPC testing interface as a server. + automation_proxy_.reset(launcher_->CreateAutomationProxy( + TestTimeouts::command_execution_timeout_ms())); LaunchBrowser(launch_arguments_, clear_profile_); - ASSERT_EQ(AUTOMATION_SUCCESS, server_->WaitForAppLaunch()) + WaitForBrowserLaunch(); +} + +void UITestBase::ConnectToRunningBrowser() { + // Set up IPC testing interface as a client. + automation_proxy_.reset(launcher_->CreateAutomationProxy( + TestTimeouts::command_execution_timeout_ms())); + WaitForBrowserLaunch(); +} + +void UITestBase::WaitForBrowserLaunch() { + ASSERT_EQ(AUTOMATION_SUCCESS, automation_proxy_->WaitForAppLaunch()) << "Error while awaiting automation ping from browser process"; if (wait_for_initial_loads_) - ASSERT_TRUE(server_->WaitForInitialLoads()); + ASSERT_TRUE(automation_proxy_->WaitForInitialLoads()); else PlatformThread::Sleep(sleep_timeout_ms()); @@ -210,7 +228,7 @@ void UITestBase::CloseBrowserAndServer() { AssertAppNotRunning(StringPrintf( L"Unable to quit all browser processes. Original PID %d", process_id_)); - server_.reset(); // Shut down IPC testing interface. + automation_proxy_.reset(); // Shut down IPC testing interface. } void UITestBase::LaunchBrowser(const CommandLine& arguments, @@ -567,7 +585,7 @@ FilePath UITestBase::GetDownloadDirectory() { } void UITestBase::CloseBrowserAsync(BrowserProxy* browser) const { - ASSERT_TRUE(server_->Send( + ASSERT_TRUE(automation_proxy_->Send( new AutomationMsg_CloseBrowserRequestAsync(0, browser->handle()))); } @@ -579,7 +597,7 @@ bool UITestBase::CloseBrowser(BrowserProxy* browser, bool result = true; - bool succeeded = server_->Send(new AutomationMsg_CloseBrowser( + bool succeeded = automation_proxy_->Send(new AutomationMsg_CloseBrowser( 0, browser->handle(), &result, application_closed)); if (!succeeded) @@ -694,10 +712,9 @@ void UITestBase::PrepareTestCommandline(CommandLine* command_line) { if (dom_automation_enabled_) command_line->AppendSwitch(switches::kDomAutomationController); - if (include_testing_id_) { + if (include_testing_id_) command_line->AppendSwitchASCII(switches::kTestingChannelID, - server_->channel_id()); - } + launcher_->PrefixedChannelID()); if (!show_error_dialogs_ && !CommandLine::ForCurrentProcess()->HasSwitch( @@ -786,10 +803,11 @@ bool UITestBase::LaunchBrowserHelper(const CommandLine& arguments, << browser_wrapper; } - bool started = base::LaunchApp(command_line.argv(), - server_->fds_to_map(), - wait, - process); + base::file_handle_mapping_vector fds; + if (automation_proxy_.get()) + fds = automation_proxy_->fds_to_map(); + + bool started = base::LaunchApp(command_line.argv(), fds, wait, process); #endif return started; @@ -867,11 +885,11 @@ void UITest::TearDown() { PlatformTest::TearDown(); } -AutomationProxy* UITest::CreateAutomationProxy(int execution_timeout) { +ProxyLauncher* UITest::CreateProxyLauncher() { // Make the AutomationProxy disconnect the channel on the first error, // so that we avoid spending a lot of time in timeouts. The browser is likely // hosed if we hit those errors. - return new AutomationProxy(execution_timeout, true); + return new AnonymousProxyLauncher(true); } static CommandLine* CreatePythonCommandLine() { diff --git a/chrome/test/ui/ui_test.h b/chrome/test/ui/ui_test.h index ced9f34..3305cc5 100644 --- a/chrome/test/ui/ui_test.h +++ b/chrome/test/ui/ui_test.h @@ -38,6 +38,7 @@ class BrowserProxy; class DictionaryValue; class FilePath; class GURL; +class ProxyLauncher; class ScopedTempDir; class TabProxy; @@ -68,14 +69,21 @@ class UITestBase { public: // ********* Utility functions ********* - // Launches the browser and IPC testing server. + // Launches the browser only. + void LaunchBrowser(); + + // Launches the browser and IPC testing connection in server mode. void LaunchBrowserAndServer(); + // Launches the IPC testing connection in client mode, + // which then attempts to connect to a browser. + void ConnectToRunningBrowser(); + // Only for pyauto. void set_command_execution_timeout_ms(int timeout); - // Overridable so that derived classes can provide their own AutomationProxy. - virtual AutomationProxy* CreateAutomationProxy(int execution_timeout); + // Overridable so that derived classes can provide their own ProxyLauncher. + virtual ProxyLauncher* CreateProxyLauncher(); // Closes the browser and IPC testing server. void CloseBrowserAndServer(); @@ -102,7 +110,7 @@ class UITestBase { // Terminates the browser, simulates end of session. void TerminateBrowser(); - // Tells the browser to navigato to the givne URL in the active tab + // Tells the browser to navigate to the given URL in the active tab // of the first app window. // Does not wait for the navigation to complete to return. void NavigateToURLAsync(const GURL& url); @@ -361,8 +369,8 @@ class UITestBase { protected: AutomationProxy* automation() { - EXPECT_TRUE(server_.get()); - return server_.get(); + EXPECT_TRUE(automation_proxy_.get()); + return automation_proxy_.get(); } virtual bool ShouldFilterInet() { @@ -412,6 +420,7 @@ class UITestBase { // id on the command line? Default is // true. bool enable_file_cookies_; // Enable file cookies, default is true. + scoped_ptr<ProxyLauncher> launcher_; // Launches browser and AutomationProxy. ProfileType profile_type_; // Are we using a profile with a // complex theme? FilePath websocket_pid_file_; // PID file for websocket server. @@ -419,6 +428,8 @@ class UITestBase { // the browser. Used in ShutdownTest. private: + void WaitForBrowserLaunch(); + bool LaunchBrowserHelper(const CommandLine& arguments, bool wait, base::ProcessHandle* process); @@ -450,7 +461,7 @@ class UITestBase { static std::string js_flags_; // Flags passed to the JS engine. static std::string log_level_; // Logging level. - scoped_ptr<AutomationProxy> server_; + scoped_ptr<AutomationProxy> automation_proxy_; std::string ui_test_name_; @@ -468,7 +479,7 @@ class UITest : public UITestBase, public PlatformTest { virtual void SetUp(); virtual void TearDown(); - virtual AutomationProxy* CreateAutomationProxy(int execution_timeout); + virtual ProxyLauncher* CreateProxyLauncher(); // Synchronously launches local http server normally used to run LayoutTests. void StartHttpServer(const FilePath& root_directory); |