Commit b534fbdb authored by Kent Tamura's avatar Kent Tamura Committed by Commit Bot

html: Convert an autofocus web test to WPT

and remove three redundant web tests.

- Adopt autofocus-only-once.html to WPT
- Remove autofocus-opera-001.html and autofocus-opera-006.html. They are
  covered by html/interaction/focus/the-autofocus-attribute/first.html
  in WPT.
- Remove autofocus-opera-008.html. It's covered by |html/interaction/
  focus/the-autofocus-attribute/focusable-area-in-top-document.html| in
  WPT

Bug: 1058203, 1059322
Change-Id: I0fec1af7821ad596c522f6df56aba66504db295a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2094058
Commit-Queue: Mason Freed <masonfreed@chromium.org>
Auto-Submit: Kent Tamura <tkent@chromium.org>
Reviewed-by: default avatarMason Freed <masonfreed@chromium.org>
Cr-Commit-Position: refs/heads/master@{#748463}
parent 84f25e23
...@@ -6753,23 +6753,17 @@ crbug.com/1058403 external/wpt/webaudio/the-audio-api/the-audioworklet-interface ...@@ -6753,23 +6753,17 @@ crbug.com/1058403 external/wpt/webaudio/the-audio-api/the-audioworklet-interface
crbug.com/1057020 [ Fuchsia ] http/tests/streams/chromium/get-reader-byob.html [ Pass Timeout ] crbug.com/1057020 [ Fuchsia ] http/tests/streams/chromium/get-reader-byob.html [ Pass Timeout ]
# Sheriff 2020-03-05 # Sheriff 2020-03-05
crbug.com/1058203 [ Mac10.13 ] virtual/form-controls-refresh-disabled/fast/forms/autofocus-opera-008.html [ Pass Failure ]
crbug.com/1058203 [ Mac10.12 ] virtual/form-controls-refresh-disabled/fast/forms/autofocus-opera-008.html [ Pass Failure ]
crbug.com/1058203 [ Mac10.10 ] virtual/form-controls-refresh-disabled/fast/forms/autofocus-opera-008.html [ Pass Failure ]
crbug.com/1058073 [ Retina ] virtual/threaded/fast/scroll-snap/snap-to-target-on-layout-change.html [ Pass Failure ] crbug.com/1058073 [ Retina ] virtual/threaded/fast/scroll-snap/snap-to-target-on-layout-change.html [ Pass Failure ]
crbug.com/1058073 [ Mac10.14 ] accessibility/content-changed-notification-causes-crash.html [ Pass Failure ] crbug.com/1058073 [ Mac10.14 ] accessibility/content-changed-notification-causes-crash.html [ Pass Failure ]
crbug.com/1058073 [ Retina ] accessibility/content-changed-notification-causes-crash.html [ Pass Failure ] crbug.com/1058073 [ Retina ] accessibility/content-changed-notification-causes-crash.html [ Pass Failure ]
# Sheriff 2020-03-06 # Sheriff 2020-03-06
crbug.com/1058203 [ Mac10.11 ] virtual/form-controls-refresh-disabled/fast/forms/autofocus-opera-008.html [ Pass Failure ]
crbug.com/1059262 http/tests/worklet/webexposed/global-interface-listing-paint-worklet.html [ Pass Failure ] crbug.com/1059262 http/tests/worklet/webexposed/global-interface-listing-paint-worklet.html [ Pass Failure ]
crbug.com/1059262 virtual/threaded/http/tests/worklet/webexposed/global-interface-listing-paint-worklet.html [ Pass Failure ] crbug.com/1059262 virtual/threaded/http/tests/worklet/webexposed/global-interface-listing-paint-worklet.html [ Pass Failure ]
crbug.com/1059322 [ Mac ] fast/forms/file/file-input-webkitdirectory-key-enter.html [ Pass Failure ] crbug.com/1059322 [ Mac ] fast/forms/file/file-input-webkitdirectory-key-enter.html [ Pass Failure ]
crbug.com/1059322 [ Mac ] fast/forms/file/file-input-webkitdirectory-click.html [ Pass Failure ] crbug.com/1059322 [ Mac ] fast/forms/file/file-input-webkitdirectory-click.html [ Pass Failure ]
crbug.com/1059322 [ Mac ] fast/forms/file/file-input-webkitdirectory-key-space.html [ Pass Failure ] crbug.com/1059322 [ Mac ] fast/forms/file/file-input-webkitdirectory-key-space.html [ Pass Failure ]
crbug.com/1059322 [ Mac ] fast/forms/file/file-input-click.html [ Pass Failure ] crbug.com/1059322 [ Mac ] fast/forms/file/file-input-click.html [ Pass Failure ]
crbug.com/1059322 [ Mac ] fast/forms/autofocus-focus-only-once.html [ Pass Failure ]
crbug.com/1059322 [ Mac ] virtual/form-controls-refresh-disabled/fast/forms/autofocus-focus-only-once.html [ Pass Failure ]
crbug.com/1058244 [ Mac ] virtual/threaded-prefer-compositing/fast/scrolling/scrollbars/scrollbar-rtl-manipulation.html [ Pass Failure ] crbug.com/1058244 [ Mac ] virtual/threaded-prefer-compositing/fast/scrolling/scrollbars/scrollbar-rtl-manipulation.html [ Pass Failure ]
# Sheriff 2020-03-08 # Sheriff 2020-03-08
......
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/utils.js"></script>
<body>
<input id="input1" autofocus>
<select><option>o1</option></select>
<script>
"use strict";
// WebKit had a bug that reattaching RenderObject triggered autofocus again.
// https://bugs.webkit.org/show_bug.cgi?id=68513
promise_test(async () => {
const input1 = document.querySelector('input');
const select = document.querySelector('select');
await waitUntilStableAutofocusState();
assert_equals(document.activeElement, input1);
input1.onblur = () => { input1.type = 'password'; };
select.focus();
await waitUntilStableAutofocusState();
assert_equals(document.activeElement, select);
}, 'Changing input type should not refocus on the element.');
</script>
</body>
<html>
<head>
<title>basic "autofocus" test</title>
<style>
input { background:red }
input:focus { background:lime }
</style>
<script src="../../resources/js-test.js"></script>
<script language="JavaScript" type="text/javascript">
window.jsTestIsAsync = true;
function elementBlur() {
document.getElementById("input1").type = "password";
}
function elementFocus() {
document.getElementById("input1").type = "text";
}
function test() {
document.getElementById("input2").focus();
shouldBe('document.activeElement', 'document.getElementById("input2")');
finishJSTest();
}
</script>
</head>
<body onload="test()">
<input id="input1" type="text" autofocus onblur="elementBlur()" onfocus="elementFocus()"/>
<br/>
<p>This form control should have a green background and active state:<input id="input2">
<hr>
<pre id="console">
</pre>
</body>
</html>
<html>
<head>
<title>basic "autofocus" test</title>
<style>
input { background:red }
input:focus { background:lime }
</style>
<script src="resources/common.js"></script>
<script language="JavaScript" type="text/javascript">
function log(message) {
document.getElementById("console").innerHTML += "<li>"+message+"</li>";
}
function test() {
if (window.testRunner)
testRunner.dumpAsText();
if (document.activeElement == document.getElementsByTagName("input")[0])
log("SUCCESS");
else
log("FAILURE");
if (window.testRunner)
testRunner.notifyDone();
}
waitUntilLoadedAndAutofocused(test);
</script>
</head>
<body>
<p>This form control should have a green background and active state: <input autofocus>
<hr>
<ol id="console"></ol>
</body>
</html>
<html>
<head>
<title>test with multiple controls having "autofocus" set</title>
<style>
input, input#test:focus { background:lime }
input:focus, input#test { background:red }
</style>
<script src="resources/common.js"></script>
<script language="JavaScript" type="text/javascript">
function log(message) {
document.getElementById("console").innerHTML += "<li>"+message+"</li>";
}
function test() {
if (window.testRunner)
testRunner.dumpAsText();
if (document.activeElement == document.getElementById("test"))
log("SUCCESS");
else
log("FAILURE");
if (window.testRunner)
testRunner.notifyDone();
}
waitUntilLoadedAndAutofocused(test);
</script>
</head>
<body>
<p>All form controls below should have a green background:</p>
<p><input autofocus id="test">
<p><input autofocus>
<p><input autofocus>
<p><input>
<p><input autofocus>
<p><input>
<hr/>
<ol id="console"></ol>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>"autofocus" in XHTML and the focus() method</title>
<style>
input, input#test:focus { background:lime }
input#test, input:focus { background:red }
</style>
<script language="JavaScript" type="text/javascript">
function log(message) {
document.getElementById("console").innerHTML += "<li>"+message+"</li>";
}
function test() {
document.getElementsByTagName('input')[0].focus();
if (window.testRunner)
testRunner.dumpAsText();
if (document.activeElement == document.getElementsByTagName('input')[0])
log("SUCCESS");
else
log("FAILURE");
}
</script>
</head>
<body onload="test()">
<p>The form controls below should have a green background:</p>
<p><input id="test"/></p>
<p><input autofocus="autofocus"/></p>
<p><input autofocus="autofocus"/></p>
<hr/>
<ol id="console"></ol>
</body>
</html>
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