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

Unified Diff: chrome/browser/autofill/autofill_interactive_uitest.cc

Issue 2478803003: Remove DOMAutomationController::automation_id_ (Closed)
Patch Set: Rebasing... Created 3 years, 6 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/browser/autofill/autofill_interactive_uitest.cc
diff --git a/chrome/browser/autofill/autofill_interactive_uitest.cc b/chrome/browser/autofill/autofill_interactive_uitest.cc
index d151972248d007b22205288c1c2148ccbc8a234e..51dd935ca92e5a3682aff6dd12af9d38ce619599 100644
--- a/chrome/browser/autofill/autofill_interactive_uitest.cc
+++ b/chrome/browser/autofill/autofill_interactive_uitest.cc
@@ -69,8 +69,7 @@ static const char kDataURIPrefix[] = "data:text/html;charset=utf-8,";
static const char kTestFormString[] =
"<form action=\"http://www.example.com/\" method=\"POST\">"
"<label for=\"firstname\">First name:</label>"
- " <input type=\"text\" id=\"firstname\""
- " onfocus=\"domAutomationController.send(true)\"><br>"
+ " <input type=\"text\" id=\"firstname\"><br>"
"<label for=\"lastname\">Last name:</label>"
" <input type=\"text\" id=\"lastname\"><br>"
"<label for=\"address1\">Address line 1:</label>"
@@ -120,8 +119,7 @@ static const char kTestEventFormString[] =
"</script>"
"<form action=\"http://www.example.com/\" method=\"POST\">"
"<label for=\"firstname\">First name:</label>"
- " <input type=\"text\" id=\"firstname\""
- " onfocus=\"domAutomationController.send(true)\"><br>"
+ " <input type=\"text\" id=\"firstname\"><br>"
"<label for=\"lastname\">Last name:</label>"
" <input type=\"text\" id=\"lastname\""
" onfocus=\"inputfocus = true\" onkeydown=\"inputkeydown = true\""
@@ -361,25 +359,24 @@ class AutofillInteractiveTest : public InProcessBrowserTest {
bool result = false;
ASSERT_TRUE(content::ExecuteScriptAndExtractBool(
GetRenderViewHost(),
- "if (document.readyState === 'complete')"
- " document.getElementById('" + name + "').focus();"
- "else"
- " domAutomationController.send(false);",
+ "function onFocusHandler(e) {"
+ " e.target.removeEventListener(e.type, arguments.callee);"
+ " domAutomationController.send(true);"
+ "}"
+ "if (document.readyState === 'complete') {"
+ " var target = document.getElementById('" +
+ name +
+ "');"
+ " target.addEventListener('focus', onFocusHandler);"
+ " target.focus();"
+ "} else {"
+ " domAutomationController.send(false);"
+ "}",
&result));
ASSERT_TRUE(result);
}
- void FocusFirstNameField() {
- bool result = false;
- ASSERT_TRUE(content::ExecuteScriptAndExtractBool(
- GetRenderViewHost(),
- "if (document.readyState === 'complete')"
- " document.getElementById('firstname').focus();"
- "else"
- " domAutomationController.send(false);",
- &result));
- ASSERT_TRUE(result);
- }
+ void FocusFirstNameField() { FocusFieldByName("firstname"); }
// Simulates a click on the middle of the DOM element with the given |id|.
void ClickElementWithId(const std::string& id) {
@@ -795,8 +792,7 @@ IN_PROC_BROWSER_TEST_F(AutofillInteractiveTest,
browser(),
GURL(std::string(kDataURIPrefix) +
"<form action=\"http://www.example.com/\" method=\"POST\">"
- " <input list=\"dl\" type=\"search\" id=\"firstname\""
- " onfocus=\"domAutomationController.send(true)\"><br>"
+ " <input list=\"dl\" type=\"search\" id=\"firstname\"><br>"
" <datalist id=\"dl\">"
" <option value=\"Adam\"></option>"
" <option value=\"Bob\"></option>"
« no previous file with comments | « no previous file | chrome/browser/captive_portal/captive_portal_browsertest.cc » ('j') | content/public/test/browser_test_utils.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698