Commit 4c4ac549 authored by John Budorick's avatar John Budorick Committed by Commit Bot

android: switch to space key in js AwAutofillTests.

DPAD_CENTER appears to have been unreliable and caused test flake.

This CL also limits forms to a single autofocus element.

Bug: 1048365
Change-Id: I6d1c29f8fc50c4e70e57fe3c65d6f6b59a0fc694
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2036644Reviewed-by: default avatarTao Bai <michaelbai@chromium.org>
Commit-Queue: John Budorick <jbudorick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#738193}
parent 0d30ad6f
...@@ -1304,7 +1304,7 @@ public class AwAutofillTest { ...@@ -1304,7 +1304,7 @@ public class AwAutofillTest {
new Integer[] {AUTOFILL_CANCEL, AUTOFILL_VIEW_ENTERED, AUTOFILL_VALUE_CHANGED}); new Integer[] {AUTOFILL_CANCEL, AUTOFILL_VIEW_ENTERED, AUTOFILL_VALUE_CHANGED});
clearChangedValues(); clearChangedValues();
executeJavaScriptAndWaitForResult("document.getElementById('color').focus();"); executeJavaScriptAndWaitForResult("document.getElementById('color').focus();");
dispatchDownAndUpKeyEvents(KeyEvent.KEYCODE_DPAD_CENTER); dispatchDownAndUpKeyEvents(KeyEvent.KEYCODE_SPACE);
// Use key B to select 'blue'. // Use key B to select 'blue'.
dispatchDownAndUpKeyEvents(KeyEvent.KEYCODE_B); dispatchDownAndUpKeyEvents(KeyEvent.KEYCODE_B);
cnt += waitForCallbackAndVerifyTypes(cnt, cnt += waitForCallbackAndVerifyTypes(cnt,
...@@ -1342,7 +1342,7 @@ public class AwAutofillTest { ...@@ -1342,7 +1342,7 @@ public class AwAutofillTest {
final String url = webServer.setResponse(FILE, data, null); final String url = webServer.setResponse(FILE, data, null);
loadUrlSync(url); loadUrlSync(url);
// Change select control first shall start autofill session. // Change select control first shall start autofill session.
dispatchDownAndUpKeyEvents(KeyEvent.KEYCODE_DPAD_CENTER); dispatchDownAndUpKeyEvents(KeyEvent.KEYCODE_SPACE);
// Use key B to select 'blue'. // Use key B to select 'blue'.
dispatchDownAndUpKeyEvents(KeyEvent.KEYCODE_B); dispatchDownAndUpKeyEvents(KeyEvent.KEYCODE_B);
cnt += waitForCallbackAndVerifyTypes(cnt, cnt += waitForCallbackAndVerifyTypes(cnt,
...@@ -1371,7 +1371,7 @@ public class AwAutofillTest { ...@@ -1371,7 +1371,7 @@ public class AwAutofillTest {
+ "</script>" + "</script>"
+ "<form action='a.html' name='formname' id='formid'>" + "<form action='a.html' name='formname' id='formid'>"
+ "<button onclick='myFunction();' autofocus>button </button>" + "<button onclick='myFunction();' autofocus>button </button>"
+ "<select id='color' autofocus><option value='red'>red</option><option " + "<select id='color'><option value='red'>red</option><option "
+ "value='blue' id='blue'>blue</option></select>" + "value='blue' id='blue'>blue</option></select>"
+ "</form>" + "</form>"
+ "</body>" + "</body>"
...@@ -1380,7 +1380,7 @@ public class AwAutofillTest { ...@@ -1380,7 +1380,7 @@ public class AwAutofillTest {
final String url = webServer.setResponse(FILE, data, null); final String url = webServer.setResponse(FILE, data, null);
loadUrlSync(url); loadUrlSync(url);
// Change select control first shall start autofill session. // Change select control first shall start autofill session.
dispatchDownAndUpKeyEvents(KeyEvent.KEYCODE_DPAD_CENTER); dispatchDownAndUpKeyEvents(KeyEvent.KEYCODE_SPACE);
cnt += waitForCallbackAndVerifyTypes(cnt, cnt += waitForCallbackAndVerifyTypes(cnt,
new Integer[] {AUTOFILL_CANCEL, AUTOFILL_VIEW_ENTERED, AUTOFILL_VALUE_CHANGED}); new Integer[] {AUTOFILL_CANCEL, AUTOFILL_VIEW_ENTERED, AUTOFILL_VALUE_CHANGED});
ArrayList<Pair<Integer, AutofillValue>> values = getChangedValues(); ArrayList<Pair<Integer, AutofillValue>> values = getChangedValues();
...@@ -1408,7 +1408,7 @@ public class AwAutofillTest { ...@@ -1408,7 +1408,7 @@ public class AwAutofillTest {
+ "</script>" + "</script>"
+ "<form action='a.html' name='formname' id='formid'>" + "<form action='a.html' name='formname' id='formid'>"
+ "<button onclick='myFunction();' autofocus>button </button>" + "<button onclick='myFunction();' autofocus>button </button>"
+ "<select id='color' autofocus><option value='red'>red</option><option " + "<select id='color'><option value='red'>red</option><option "
+ "value='blue' id='blue'>blue</option></select>" + "value='blue' id='blue'>blue</option></select>"
+ "</form>" + "</form>"
+ "</body>" + "</body>"
...@@ -1421,7 +1421,7 @@ public class AwAutofillTest { ...@@ -1421,7 +1421,7 @@ public class AwAutofillTest {
// didn't trigger the autofill, since // didn't trigger the autofill, since
// testUserInitiatedJavascriptSelectControlChangeNotification verified user's triggering // testUserInitiatedJavascriptSelectControlChangeNotification verified user's triggering
// work. // work.
dispatchDownAndUpKeyEvents(KeyEvent.KEYCODE_DPAD_CENTER); dispatchDownAndUpKeyEvents(KeyEvent.KEYCODE_SPACE);
cnt += waitForCallbackAndVerifyTypes(cnt, cnt += waitForCallbackAndVerifyTypes(cnt,
new Integer[] {AUTOFILL_CANCEL, AUTOFILL_VIEW_ENTERED, AUTOFILL_VALUE_CHANGED}); new Integer[] {AUTOFILL_CANCEL, AUTOFILL_VIEW_ENTERED, AUTOFILL_VALUE_CHANGED});
ArrayList<Pair<Integer, AutofillValue>> values = getChangedValues(); ArrayList<Pair<Integer, AutofillValue>> values = getChangedValues();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment