Chromium Code Reviews| 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 c8b006acd011651de27ca2b598ee365815d29d58..31a93d1f9900dd1fe7320b6c06af2c39602fb5a7 100644 |
| --- a/chrome/test/remoting/remote_desktop_browsertest.cc |
| +++ b/chrome/test/remoting/remote_desktop_browsertest.cc |
| @@ -585,10 +585,10 @@ void RemoteDesktopBrowserTest::ConnectToRemoteHost( |
| EXPECT_FALSE(host_id.empty()); |
| std::string element_id = "host_" + host_id; |
| - // Verify the host is online. |
| - std::string host_div_class = ExecuteScriptAndExtractString( |
| - "document.getElementById('" + element_id + "').parentNode.className"); |
| - EXPECT_NE(std::string::npos, host_div_class.find("host-online")); |
| + ConditionalTimeoutWaiter hostReadyWaiter( |
|
anandc1
2016/01/06 01:29:51
hostOnlineWaiter?
|
| + base::TimeDelta::FromSeconds(30), base::TimeDelta::FromMilliseconds(5000), |
| + base::Bind(&RemoteDesktopBrowserTest::IsHostOnline, this, element_id)); |
| + EXPECT_TRUE(hostReadyWaiter.Wait()); |
| ClickOnControl(element_id); |
| @@ -816,6 +816,21 @@ void RemoteDesktopBrowserTest::WaitForConnection() { |
| TimeoutWaiter(base::TimeDelta::FromSeconds(2)).Wait(); |
| } |
| +bool RemoteDesktopBrowserTest::IsHostOnline(std::string element_id) { |
|
anandc1
2016/01/06 01:29:51
It would be clearer to pass in the hostID to this
|
| + bool refresh_host_list = |
| + ExecuteScriptAndExtractBool("remoting.hostList.refreshAndDisplay()"); |
| + |
| + if (!refresh_host_list) { |
| + return false; |
| + } |
| + |
| + // Verify the host is online. |
| + std::string host_div_class = ExecuteScriptAndExtractString( |
| + "document.getElementById('" + element_id + "').parentNode.className"); |
| + |
| + return (std::string::npos != host_div_class.find("host-online")); |
| +} |
| + |
| bool RemoteDesktopBrowserTest::IsLocalHostReady() { |
| // TODO(weitaosu): Instead of polling, can we register a callback to |
| // remoting.hostList.setLocalHost_? |