summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authordtu@chromium.org <dtu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-25 19:13:53 +0000
committerdtu@chromium.org <dtu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-25 19:13:53 +0000
commit3f69b720540ce42439ac0bbdb97f90999167ded3 (patch)
treed02deb50246548c059973d7df11f1c6c8d9c05e6 /chrome
parentc7ca058d4f48946e3743016084471fe4e6beaaab (diff)
downloadchromium_src-3f69b720540ce42439ac0bbdb97f90999167ded3.zip
chromium_src-3f69b720540ce42439ac0bbdb97f90999167ded3.tar.gz
chromium_src-3f69b720540ce42439ac0bbdb97f90999167ded3.tar.bz2
Make NamedProxyLauncher connections more robust to errors. It now clears the channel file before launching Chrome and has a timeout when waiting for the file to be created.
BUG=66414 TEST=Should see no change in ui_tests. FLAKY_BasicNamedInterface may become non-flaky. Review URL: http://codereview.chromium.org/6546030 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76080 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/test/automation/proxy_launcher.cc22
1 files changed, 20 insertions, 2 deletions
diff --git a/chrome/test/automation/proxy_launcher.cc b/chrome/test/automation/proxy_launcher.cc
index 2b3328a..0539c7e 100644
--- a/chrome/test/automation/proxy_launcher.cc
+++ b/chrome/test/automation/proxy_launcher.cc
@@ -508,15 +508,33 @@ AutomationProxy* NamedProxyLauncher::CreateAutomationProxy(
void NamedProxyLauncher::InitializeConnection(const LaunchState& state,
bool wait_for_initial_loads) {
+ FilePath testing_channel_path;
+#if defined(OS_WIN)
+ testing_channel_path = FilePath(ASCIIToWide(channel_id_));
+#else
+ testing_channel_path = FilePath(channel_id_);
+#endif
+
if (launch_browser_) {
+ // Because we are waiting on the existence of the testing file below,
+ // make sure there isn't one already there before browser launch.
+ EXPECT_TRUE(file_util::Delete(testing_channel_path, false));
+
// Set up IPC testing interface as a client.
LaunchBrowser(state);
}
// Wait for browser to be ready for connections.
- struct stat file_info;
- while (stat(channel_id_.c_str(), &file_info))
+ bool testing_channel_exists = false;
+ for (int wait_time = 0;
+ wait_time < TestTimeouts::command_execution_timeout_ms();
+ wait_time += automation::kSleepTime) {
+ testing_channel_exists = file_util::PathExists(testing_channel_path);
+ if (testing_channel_exists)
+ break;
base::PlatformThread::Sleep(automation::kSleepTime);
+ }
+ EXPECT_TRUE(testing_channel_exists);
ConnectToRunningBrowser(wait_for_initial_loads);
}