-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Import wpt@61d372914a4a23c86022f4abafc4d819247d1788
Using wpt-import in Chromium d1311be. With Chromium commits locally applied on WPT: 50840fb "Ignore the second and subsequent Early Hints responses" Note to sheriffs: This CL imports external tests and adds expectations for those tests; if this CL is large and causes a few new failures, please fix the failures by adding new lines to TestExpectations rather than reverting. See: https://chromium.googlesource.com/chromium/src/+/main/docs/testing/web_platform_tests.md Directory owners for changes in this CL: igrigorik@chromium.org, yoavweiss@chromium.org: external/wpt/preload NOAUTOREVERT=true No-Export: true Cq-Include-Trybots: luci.chromium.try:linux-wpt-identity-fyi-rel,linux-wpt-input-fyi-rel,linux-blink-rel Change-Id: If91f77966929e3bfcb7f71bb8930618365494ce1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3540480 Auto-Submit: WPT Autoroller <wpt-autoroller@chops-service-accounts.iam.gserviceaccount.com> Reviewed-by: Weizhong Xia <weizhong@google.com> Commit-Queue: Weizhong Xia <weizhong@google.com> Cr-Commit-Position: refs/heads/main@{#983404}
- Loading branch information
Chromium WPT Sync
authored and
Chromium LUCI CQ
committed
Mar 21, 2022
1 parent
01d1d52
commit 9cf7c10
Showing
6 changed files
with
149 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
Version: b6fd9afc6cdfdbcc306503d7b689006fd461923b | ||
Version: 61d372914a4a23c86022f4abafc4d819247d1788 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
third_party/blink/web_tests/external/wpt/preload/link-header-preload-non-html-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
This is a testharness.js-based test. | ||
PASS XHTML documents should respect preload Link headers | ||
PASS plain text documents should respect preload Link headers | ||
PASS image documents should respect preload Link headers | ||
FAIL media documents should respect preload Link headers assert_equals: verify that request was issued exactly once expected 1 but got 2 | ||
PASS invalid image documents should respect preload Link headers | ||
Harness: the test ran to completion. | ||
|
59 changes: 59 additions & 0 deletions
59
third_party/blink/web_tests/external/wpt/preload/link-header-preload-non-html.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<!DOCTYPE html> | ||
<meta charset=utf-8> | ||
<title>Makes sure that Link headers preload resources in non-HTML documents</title> | ||
<meta name="timeout" content="long"> | ||
<script src="resources/dummy.js?link-header-preload2"></script> | ||
<script src="/common/utils.js"></script> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/preload/resources/preload_helper.js"></script> | ||
<body> | ||
<script> | ||
|
||
function test_document_type(options, desc) { | ||
promise_test(async t => { | ||
const id = token(); | ||
const preloadLink = `/html/semantics/document-metadata/the-link-element/stylesheet.py?id=${id}`; | ||
const params = new URLSearchParams(); | ||
for (const opt in options) | ||
params.set(opt, options[opt]); | ||
params.set('link', `<${preloadLink}>;rel=preload;as=style`); | ||
|
||
const docURL = getAbsoluteURL(`./resources/echo-preload-header.py?${params.toString()}`); | ||
const iframe = document.createElement('iframe'); | ||
t.add_cleanup(() => iframe.remove()); | ||
iframe.src = docURL; | ||
document.body.appendChild(iframe); | ||
await new Promise(resolve => iframe.addEventListener('load', resolve)); | ||
const timeout = 5000; | ||
const interval = 25; | ||
let count = 0; | ||
const before = performance.now(); | ||
|
||
while (performance.now() < before + timeout) { | ||
// count=true returns the number of times the resource was accessed | ||
const res = await fetch(preloadLink + '&count=true'); | ||
|
||
// If count is positive, the resource was accessed. | ||
count = Number(await res.text()); | ||
if (count > 0) | ||
break; | ||
|
||
await new Promise(resolve => t.step_timeout(resolve, interval)); | ||
} | ||
|
||
assert_equals(count, 1, "verify that request was issued exactly once"); | ||
}, `${desc} documents should respect preload Link headers`); | ||
} | ||
|
||
test_document_type({ | ||
type: 'application/xml', | ||
content: `<?xml version="1.0" encoding="utf-8"?> | ||
<html xmlns="http://www.w3.org/1999/xhtml"> | ||
</html>`}, "XHTML"); | ||
test_document_type({content: 'Hello', type: 'text/plain'}, 'plain text'); | ||
test_document_type({file: 'square.png', type: 'image/png'}, 'image'); | ||
test_document_type({file: 'white.mp4', type: 'video/mp4'}, 'media'); | ||
test_document_type({content: 'dummy', type: 'image/png'}, 'invalid image'); | ||
</script> | ||
</body> |
16 changes: 16 additions & 0 deletions
16
third_party/blink/web_tests/external/wpt/preload/resources/echo-preload-header.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import os | ||
from wptserve.utils import isomorphic_encode | ||
|
||
def main(request, response): | ||
response.headers.set(b"Content-Type", request.GET.first(b"type")) | ||
link = request.GET.first(b"link") | ||
response.headers.set(b"Access-Control-Allow-Origin", b"*") | ||
response.headers.set(b"Access-Control-Allow-Credentials", b"true") | ||
if link is not None: | ||
response.headers.set(b"Link", link) | ||
|
||
if b"file" in request.GET: | ||
path = os.path.join(os.path.dirname(isomorphic_encode(__file__)), request.GET.first(b"file")); | ||
response.content = open(path, mode=u'rb').read(); | ||
else: | ||
return request.GET.first(b"content") |
8 changes: 8 additions & 0 deletions
8
...ests/flag-specific/highdpi/external/wpt/preload/link-header-preload-non-html-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
This is a testharness.js-based test. | ||
PASS XHTML documents should respect preload Link headers | ||
PASS plain text documents should respect preload Link headers | ||
PASS image documents should respect preload Link headers | ||
FAIL media documents should respect preload Link headers assert_equals: verify that request was issued exactly once expected 1 but got 2 | ||
PASS invalid image documents should respect preload Link headers | ||
Harness: the test ran to completion. | ||
|