Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(138)

Unified Diff: chrome/test/automation/proxy_launcher.cc

Issue 10736064: Switch to TimeDelta interfaces in chrome automation test infrastructure. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/automation/proxy_launcher.h ('k') | chrome/test/base/ui_test_utils.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/automation/proxy_launcher.cc
diff --git a/chrome/test/automation/proxy_launcher.cc b/chrome/test/automation/proxy_launcher.cc
index c86c8b138d7328f4199b471ba088ae6a1ab7b83e..d387aefc32118fa6630bb475cf06a37b75633399 100644
--- a/chrome/test/automation/proxy_launcher.cc
+++ b/chrome/test/automation/proxy_launcher.cc
@@ -130,7 +130,7 @@ bool ProxyLauncher::LaunchBrowserAndServer(const LaunchState& state,
bool wait_for_initial_loads) {
// Set up IPC testing interface as a server.
automation_proxy_.reset(CreateAutomationProxy(
- TestTimeouts::action_max_timeout_ms()));
+ TestTimeouts::action_max_timeout()));
if (!LaunchBrowser(state))
return false;
@@ -144,7 +144,7 @@ bool ProxyLauncher::LaunchBrowserAndServer(const LaunchState& state,
bool ProxyLauncher::ConnectToRunningBrowser(bool wait_for_initial_loads) {
// Set up IPC testing interface as a client.
automation_proxy_.reset(CreateAutomationProxy(
- TestTimeouts::action_max_timeout_ms()));
+ TestTimeouts::action_max_timeout()));
return WaitForBrowserLaunch(wait_for_initial_loads);
}
@@ -271,7 +271,7 @@ void ProxyLauncher::QuitBrowser() {
// been closed.
int exit_code = -1;
EXPECT_TRUE(WaitForBrowserProcessToQuit(
- TestTimeouts::action_max_timeout_ms(), &exit_code));
+ TestTimeouts::action_max_timeout(), &exit_code));
EXPECT_EQ(0, exit_code); // Expect a clean shutdown.
browser_quit_time_ = base::TimeTicks::Now() - quit_start;
@@ -302,7 +302,7 @@ void ProxyLauncher::TerminateBrowser() {
int exit_code = -1;
EXPECT_TRUE(WaitForBrowserProcessToQuit(
- TestTimeouts::action_max_timeout_ms(), &exit_code));
+ TestTimeouts::action_max_timeout(), &exit_code));
EXPECT_EQ(0, exit_code); // Expect a clean shutdown.
browser_quit_time_ = base::TimeTicks::Now() - quit_start;
@@ -323,9 +323,11 @@ void ProxyLauncher::AssertAppNotRunning(const std::string& error_message) {
ASSERT_TRUE(processes.empty()) << final_error_message;
}
-bool ProxyLauncher::WaitForBrowserProcessToQuit(int timeout, int* exit_code) {
+bool ProxyLauncher::WaitForBrowserProcessToQuit(
+ base::TimeDelta timeout,
+ int* exit_code) {
#ifdef WAIT_FOR_DEBUGGER_ON_OPEN
- timeout = 500000;
+ timeout = base::TimeDelta::FromSeconds(500);
#endif
bool success = false;
@@ -511,7 +513,7 @@ NamedProxyLauncher::NamedProxyLauncher(const std::string& channel_id,
}
AutomationProxy* NamedProxyLauncher::CreateAutomationProxy(
- int execution_timeout) {
+ base::TimeDelta execution_timeout) {
AutomationProxy* proxy = new AutomationProxy(execution_timeout,
disconnect_on_failure_);
proxy->InitializeChannel(channel_id_, true);
@@ -538,14 +540,15 @@ bool NamedProxyLauncher::InitializeConnection(const LaunchState& state,
// Wait for browser to be ready for connections.
bool channel_initialized = false;
- for (int wait_time = 0;
- wait_time < TestTimeouts::action_max_timeout_ms();
- wait_time += automation::kSleepTime) {
+ base::TimeDelta sleep_time = base::TimeDelta::FromMilliseconds(
+ automation::kSleepTime);
+ for (base::TimeDelta wait_time = base::TimeDelta();
+ wait_time < TestTimeouts::action_max_timeout();
+ wait_time += sleep_time) {
channel_initialized = IPC::Channel::IsNamedServerInitialized(channel_id_);
if (channel_initialized)
break;
- base::PlatformThread::Sleep(
- base::TimeDelta::FromMilliseconds(automation::kSleepTime));
+ base::PlatformThread::Sleep(sleep_time);
}
if (!channel_initialized) {
LOG(ERROR) << "Failed to wait for testing channel presence.";
@@ -580,7 +583,7 @@ AnonymousProxyLauncher::AnonymousProxyLauncher(bool disconnect_on_failure)
}
AutomationProxy* AnonymousProxyLauncher::CreateAutomationProxy(
- int execution_timeout) {
+ base::TimeDelta execution_timeout) {
AutomationProxy* proxy = new AutomationProxy(execution_timeout,
disconnect_on_failure_);
proxy->InitializeChannel(channel_id_, false);
« no previous file with comments | « chrome/test/automation/proxy_launcher.h ('k') | chrome/test/base/ui_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698