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 5ca641e2fbd68d1ef5ab386bc393f09a7ed135f7..28228103ea67f13140c5fd4ee408c50e91845ada 100644 |
--- a/chrome/test/remoting/remote_desktop_browsertest.cc |
+++ b/chrome/test/remoting/remote_desktop_browsertest.cc |
@@ -350,6 +350,7 @@ void RemoteDesktopBrowserTest::DisconnectMe2Me() { |
ASSERT_TRUE(RemoteDesktopBrowserTest::IsSessionConnected()); |
+ // Assuming the toolbar-stub is always enabled, click on it. |
Jamie
2014/09/19 20:29:45
This comment is no longer needed.
anandc
2014/09/19 22:34:26
Done.
|
ClickOnControl("toolbar-stub"); |
EXPECT_TRUE(HtmlElementVisible("session-toolbar")); |
@@ -707,12 +708,18 @@ 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)); |
- ASSERT_TRUE(waiter.Wait()); |
+ std::string check_for_disabled = |
Jamie
2014/09/19 20:29:45
Maybe call this has_disabled_attribute?
anandc
2014/09/19 22:34:26
Ah, but that takes the line beyond 80 chars. :-)
D
|
+ "document.getElementById(\"" + name + "\").hasAttribute('disabled')"; |
Jamie
2014/09/19 20:29:45
Nit: Use single quotes for JS code (it also means
anandc
2014/09/19 22:34:26
Done.
|
+ |
+ if (ExecuteScriptAndExtractBool(active_web_contents(), check_for_disabled)) { |
+ // This element has a disabled attribute. Wait for it become enabled. |
+ ConditionalTimeoutWaiter waiter( |
+ base::TimeDelta::FromSeconds(5), |
+ base::TimeDelta::FromMilliseconds(500), |
+ base::Bind(&RemoteDesktopBrowserTest::IsEnabled, |
+ active_web_contents(), name)); |
+ ASSERT_TRUE(waiter.Wait()); |
+ } |
ExecuteScript("document.getElementById(\"" + name + "\").click();"); |
} |