Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3312)

Unified Diff: chrome/test/remoting/remote_desktop_browsertest.cc

Issue 1554313002: Adding changes to Remote_Desktop_BrowserTest ConnecToRemoteHost to verify if the remote host is onl… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Formatting the files Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/remoting/remote_desktop_browsertest.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..31cdbbdf6db65026557ec6fda525561e925d04d5 100644
--- a/chrome/test/remoting/remote_desktop_browsertest.cc
+++ b/chrome/test/remoting/remote_desktop_browsertest.cc
@@ -585,10 +585,11 @@ 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));
+ EXPECT_TRUE(hostOnlineWaiter.Wait());
ClickOnControl(element_id);
@@ -816,6 +817,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_?
« no previous file with comments | « chrome/test/remoting/remote_desktop_browsertest.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698