Index: chrome/test/remoting/remote_desktop_browsertest.cc |
diff --git a/chrome/test/remoting/remote_desktop_browsertest.cc b/chrome/test/remoting/remote_desktop_browsertest.cc |
index 8cd1e505703fc93b1cf37b3d2863c8fda0d1c337..1c5288c188ebd9f1feaf1fd7528466501d59d893 100644 |
--- a/chrome/test/remoting/remote_desktop_browsertest.cc |
+++ b/chrome/test/remoting/remote_desktop_browsertest.cc |
@@ -343,27 +343,12 @@ void RemoteDesktopBrowserTest::ExpandMe2Me() { |
EXPECT_TRUE(HtmlElementVisible("me2me-content")); |
EXPECT_FALSE(HtmlElementVisible("me2me-first-run")); |
- |
- // Wait until localHost is initialized. This can take a while. |
- ConditionalTimeoutWaiter waiter( |
- base::TimeDelta::FromSeconds(3), |
- base::TimeDelta::FromSeconds(1), |
- base::Bind(&RemoteDesktopBrowserTest::IsLocalHostReady, this)); |
- EXPECT_TRUE(waiter.Wait()); |
- |
- EXPECT_TRUE(ExecuteScriptAndExtractBool( |
- "remoting.hostList.localHost_.hostName && " |
- "remoting.hostList.localHost_.hostId && " |
- "remoting.hostList.localHost_.status && " |
- "remoting.hostList.localHost_.status == 'ONLINE'")); |
} |
void RemoteDesktopBrowserTest::DisconnectMe2Me() { |
// The chromoting extension should be installed. |
ASSERT_TRUE(extension_); |
- // The active tab should have the chromoting app loaded. |
- ASSERT_EQ(Chromoting_Main_URL(), GetCurrentURL()); |
ASSERT_TRUE(RemoteDesktopBrowserTest::IsSessionConnected()); |
ClickOnControl("toolbar-stub"); |
@@ -483,9 +468,10 @@ void RemoteDesktopBrowserTest::SetUpTestForMe2Me() { |
VerifyInternetAccess(); |
Install(); |
LaunchChromotingApp(); |
+ LoadScript(app_web_content(), FILE_PATH_LITERAL("browser_test.js")); |
Auth(); |
ExpandMe2Me(); |
- LoadScript(app_web_content(), FILE_PATH_LITERAL("browser_test.js")); |
+ EnsureRemoteConnectionEnabled(); |
} |
void RemoteDesktopBrowserTest::Auth() { |
@@ -494,6 +480,20 @@ void RemoteDesktopBrowserTest::Auth() { |
Approve(); |
} |
+void RemoteDesktopBrowserTest::EnsureRemoteConnectionEnabled() { |
+ // browser_test.ensureRemoteConnectionEnabled is defined in |
+ // browser_test.js, which must be loaded before calling this function. |
+ // TODO(kelvinp): This function currently only works on linux when the user is |
+ // already part of the chrome-remote-desktop group. Extend this functionality |
+ // to Mac (https://crbug.com/397576) and Windows (https://crbug.com/397575). |
+ bool result; |
+ EXPECT_TRUE(content::ExecuteScriptAndExtractBool( |
+ app_web_content(), |
+ "browserTest.ensureRemoteConnectionEnabled(" + me2me_pin() + ")", |
+ &result)); |
+ EXPECT_TRUE(result) << "Cannot start the host with Pin:" << me2me_pin(); |
+} |
+ |
void RemoteDesktopBrowserTest::ConnectToLocalHost(bool remember_pin) { |
// Verify that the local host is online. |
ASSERT_TRUE(ExecuteScriptAndExtractBool( |