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

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

Issue 582833003: Make optional the checking for an element being enabled before clicking it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Wait for an element to be enabled only if it has a 'disabled' attribute. 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
« no previous file with comments | « no previous file | 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 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();");
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698