Index: chrome/test/automation/proxy_launcher.cc |
diff --git a/chrome/test/automation/proxy_launcher.cc b/chrome/test/automation/proxy_launcher.cc |
index 052e510def9f7cf54a6e3272dc4551639902fbda..0c3fa0eecc2cb5aaa4d2d2d9ec09709fb9c372e2 100644 |
--- a/chrome/test/automation/proxy_launcher.cc |
+++ b/chrome/test/automation/proxy_launcher.cc |
@@ -26,6 +26,11 @@ |
#include "chrome/test/ui/ui_test.h" |
#include "content/common/child_process_info.h" |
#include "content/common/debug_flags.h" |
+#include "ipc/ipc_channel_win.h" |
+ |
+#if defined(OS_WIN) |
+#include <windows.h> |
+#endif |
namespace { |
@@ -62,8 +67,12 @@ void UpdateHistoryDates(const FilePath& user_data_dir) { |
// ProxyLauncher functions |
-const char ProxyLauncher::kDefaultInterfacePath[] = |
+#if defined(OS_WIN) |
+const char ProxyLauncher::kDefaultInterfaceId[] = "ChromeTestingInterface"; |
+#elif defined(OS_POSIX) |
+const char ProxyLauncher::kDefaultInterfaceId[] = |
"/var/tmp/ChromeTestingInterface"; |
+#endif |
bool ProxyLauncher::in_process_renderer_ = false; |
bool ProxyLauncher::no_sandbox_ = false; |
@@ -512,31 +521,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_) { |
+#if defined(OS_POSIX) |
// 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)); |
+ EXPECT_TRUE(file_util::Delete(FilePath(channel_id_), false)); |
+#endif |
// Set up IPC testing interface as a client. |
ASSERT_TRUE(LaunchBrowser(state)); |
} |
// Wait for browser to be ready for connections. |
+ const int kPollIntervalMs = 50; |
bool testing_channel_exists = false; |
for (int wait_time = 0; |
wait_time < TestTimeouts::action_max_timeout_ms(); |
- wait_time += automation::kSleepTime) { |
- testing_channel_exists = file_util::PathExists(testing_channel_path); |
+ wait_time += kPollIntervalMs) { |
+#if defined(OS_WIN) |
+ testing_channel_exists = WaitNamedPipe( |
+ IPC::PipeNameFromChannelId(channel_id_).c_str(), |
+ 1); |
dmac
2011/08/02 00:32:14
on Windows does it not make more sense just to cal
kkania
2011/08/02 15:00:58
WaitNamedPipe on windows returns immediately if th
|
+#elif defined(OS_POSIX) |
+ testing_channel_exists = file_util::PathExists(FilePath(channel_id_)); |
+#endif |
if (testing_channel_exists) |
break; |
- base::PlatformThread::Sleep(automation::kSleepTime); |
+ base::PlatformThread::Sleep(kPollIntervalMs); |
} |
EXPECT_TRUE(testing_channel_exists); |