| 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>"
|
|
|