summaryrefslogtreecommitdiffstats
path: root/chrome/test/ui/ui_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/test/ui/ui_test.cc')
-rw-r--r--chrome/test/ui/ui_test.cc60
1 files changed, 21 insertions, 39 deletions
diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc
index e6aff60..9fbb857 100644
--- a/chrome/test/ui/ui_test.cc
+++ b/chrome/test/ui/ui_test.cc
@@ -43,7 +43,6 @@
#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"
@@ -141,9 +140,7 @@ void UITestBase::SetUp() {
JavaScriptExecutionController::set_timeout(
TestTimeouts::action_max_timeout_ms());
test_start_time_ = Time::NowFromSystemTime();
-
- launcher_.reset(CreateProxyLauncher());
- launcher_->InitializeConnection(this);
+ LaunchBrowserAndServer();
}
void UITestBase::TearDown() {
@@ -178,39 +175,24 @@ void UITestBase::TearDown() {
// TODO(phajdan.jr): get rid of set_command_execution_timeout_ms.
void UITestBase::set_command_execution_timeout_ms(int timeout) {
- automation_proxy_->set_command_execution_timeout_ms(timeout);
+ server_->set_command_execution_timeout_ms(timeout);
VLOG(1) << "Automation command execution timeout set to " << timeout << " ms";
}
-ProxyLauncher* UITestBase::CreateProxyLauncher() {
- return new AnonymousProxyLauncher(false);
-}
-
-void UITestBase::LaunchBrowser() {
- LaunchBrowser(launch_arguments_, clear_profile_);
+AutomationProxy* UITestBase::CreateAutomationProxy(int execution_timeout) {
+ return new AutomationProxy(execution_timeout, false);
}
void UITestBase::LaunchBrowserAndServer() {
- // Set up IPC testing interface as a server.
- automation_proxy_.reset(launcher_->CreateAutomationProxy(
- TestTimeouts::command_execution_timeout_ms()));
+ // Set up IPC testing interface server.
+ server_.reset(CreateAutomationProxy(
+ TestTimeouts::command_execution_timeout_ms()));
LaunchBrowser(launch_arguments_, clear_profile_);
- 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())
+ ASSERT_EQ(AUTOMATION_SUCCESS, server_->WaitForAppLaunch())
<< "Error while awaiting automation ping from browser process";
if (wait_for_initial_loads_)
- ASSERT_TRUE(automation_proxy_->WaitForInitialLoads());
+ ASSERT_TRUE(server_->WaitForInitialLoads());
else
PlatformThread::Sleep(sleep_timeout_ms());
@@ -228,7 +210,7 @@ void UITestBase::CloseBrowserAndServer() {
AssertAppNotRunning(StringPrintf(
L"Unable to quit all browser processes. Original PID %d", process_id_));
- automation_proxy_.reset(); // Shut down IPC testing interface.
+ server_.reset(); // Shut down IPC testing interface.
}
void UITestBase::LaunchBrowser(const CommandLine& arguments,
@@ -585,7 +567,7 @@ FilePath UITestBase::GetDownloadDirectory() {
}
void UITestBase::CloseBrowserAsync(BrowserProxy* browser) const {
- ASSERT_TRUE(automation_proxy_->Send(
+ ASSERT_TRUE(server_->Send(
new AutomationMsg_CloseBrowserRequestAsync(0, browser->handle())));
}
@@ -597,7 +579,7 @@ bool UITestBase::CloseBrowser(BrowserProxy* browser,
bool result = true;
- bool succeeded = automation_proxy_->Send(new AutomationMsg_CloseBrowser(
+ bool succeeded = server_->Send(new AutomationMsg_CloseBrowser(
0, browser->handle(), &result, application_closed));
if (!succeeded)
@@ -712,9 +694,10 @@ 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,
- launcher_->PrefixedChannelID());
+ server_->channel_id());
+ }
if (!show_error_dialogs_ &&
!CommandLine::ForCurrentProcess()->HasSwitch(
@@ -803,11 +786,10 @@ bool UITestBase::LaunchBrowserHelper(const CommandLine& arguments,
<< browser_wrapper;
}
- 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);
+ bool started = base::LaunchApp(command_line.argv(),
+ server_->fds_to_map(),
+ wait,
+ process);
#endif
return started;
@@ -885,11 +867,11 @@ void UITest::TearDown() {
PlatformTest::TearDown();
}
-ProxyLauncher* UITest::CreateProxyLauncher() {
+AutomationProxy* UITest::CreateAutomationProxy(int execution_timeout) {
// 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 AnonymousProxyLauncher(true);
+ return new AutomationProxy(execution_timeout, true);
}
static CommandLine* CreatePythonCommandLine() {