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 |