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..11f6492558813c698313882fc3d44ec4dceebc99 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 hostOnlineWaiter( |
| + base::TimeDelta::FromSeconds(30), base::TimeDelta::FromSeconds(5), |
| + base::Bind(&RemoteDesktopBrowserTest::IsHostOnline, base::Unretained(this), host_id)); |
|
joedow
2016/01/06 21:51:48
I think this line overflows now, you should fix th
|
| + EXPECT_TRUE(hostOnlineWaiter.Wait()); |
| ClickOnControl(element_id); |
| @@ -816,6 +816,22 @@ void RemoteDesktopBrowserTest::WaitForConnection() { |
| TimeoutWaiter(base::TimeDelta::FromSeconds(2)).Wait(); |
| } |
| +bool RemoteDesktopBrowserTest::IsHostOnline(const std::string& host_id) { |
| + bool refresh_host_list = |
| + ExecuteScriptAndExtractBool("remoting.hostList.refreshAndDisplay()"); |
| + |
| + if (!refresh_host_list) { |
| + return false; |
| + } |
| + |
| + // Verify the host is online. |
| + std::string element_id = "host_" + host_id; |
| + 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_? |