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

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

Issue 544403002: Fix Auth browser-test failure: make sure element is ready to receive click. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use conditional timeout waiter for an element to become enabled. Created 6 years, 3 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
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 7966b5c183ab9d0e037fd1324fde844d4fd45e48..fdafbe0218964ac2142279be4f7df775becc8d8a 100644
--- a/chrome/test/remoting/remote_desktop_browsertest.cc
+++ b/chrome/test/remoting/remote_desktop_browsertest.cc
@@ -309,9 +309,8 @@ void RemoteDesktopBrowserTest::Approve() {
&RemoteDesktopBrowserTest::IsAuthenticatedInWindow,
browser()->tab_strip_model()->GetActiveWebContents()));
- ExecuteScript(
- "lso.approveButtonAction();"
- "document.forms[\"connect-approve\"].submit();");
+ // Click to Approve the web-app.
+ ClickOnControl("submit_approve_access");
observer.Wait();
@@ -708,6 +707,14 @@ void RemoteDesktopBrowserTest::RunJavaScriptTest(
void RemoteDesktopBrowserTest::ClickOnControl(const std::string& name) {
ASSERT_TRUE(HtmlElementVisible(name));
+ ConditionalTimeoutWaiter waiter(
+ base::TimeDelta::FromSeconds(5),
+ base::TimeDelta::FromMilliseconds(500),
+ base::Bind(&RemoteDesktopBrowserTest::IsEnabled,
+ active_web_contents(),
+ name));
weitao 2014/09/09 23:36:37 style nit: the last two arguments can fit in the s
anandc1 2014/09/10 00:52:26 Done.
+ EXPECT_TRUE(waiter.Wait());
weitao 2014/09/09 23:36:37 This should be a ASSERT_TRUE because the there is
anandc1 2014/09/10 00:52:26 Done.
+
ExecuteScript("document.getElementById(\"" + name + "\").click();");
}
@@ -801,4 +808,13 @@ bool RemoteDesktopBrowserTest::IsHostActionComplete(
host_action_var);
}
+// static
+bool RemoteDesktopBrowserTest::IsEnabled(
+ content::WebContents* client_web_content,
+ std::string element_name) {
+ return !ExecuteScriptAndExtractBool(
+ client_web_content,
+ "document.getElementById(\"" + element_name + "\").disabled");
+}
+
} // namespace remoting

Powered by Google App Engine
This is Rietveld 408576698