Commit 1d1222b3 authored by Hiroshige Hayashizaki's avatar Hiroshige Hayashizaki Committed by Chromium LUCI CQ

[Import Maps] Sync tests in WPT and WICG repository (WPT side)

WPT side: https://github.com/web-platform-tests/wpt/pull/26733
WICG side: https://github.com/WICG/import-maps/pull/237

After these PRs, the data-driven JSON files are identical
in the WPT and WICG repositories.

This CL (WPT side) mostly imports changes from WICG repository.

-expected.txt are added because the spec-side updates
corresponding to the newly imported tests are not yet implemented
in Chromium, and will be removed in upcoming Chromium CLs:
https://chromium-review.googlesource.com/c/chromium/src/+/2491594/
https://chromium-review.googlesource.com/c/chromium/src/+/2570012/

Bug: 848607
Change-Id: Iad3e04a785474ad5844bfcd47dcc7c65691a9a35
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2570445
Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org>
Reviewed-by: default avatarDomenic Denicola <domenic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#833316}
parent 9af2d2d0
This is a testharness.js-based test.
PASS global setup
PASS Test helper: fetching and sanity checking test JSON: resources/empty-import-map-internal.json
PASS Test helper: fetching and sanity checking test JSON: resources/url-specifiers-schemes-internal.json
PASS global cleanup
PASS non-HTTPS fetch scheme absolute URLs: about:fetch-scheme
PASS non-fetch scheme absolute URLs: about:fetch-scheme
PASS non-fetch scheme absolute URLs: mailto:non-fetch-scheme
PASS non-fetch scheme absolute URLs: import:non-fetch-scheme
PASS non-fetch scheme absolute URLs: javascript:non-fetch-scheme
PASS non-fetch scheme absolute URLs: wss:non-fetch-scheme
FAIL URL-like specifiers: Non-special vs. special schemes: data:text/javascript,console.log('foo') assert_equals: expected "data:text/javascript,console.log('foo')" but got "https://example.com/lib/test-data/javascript,console.log('foo')"
PASS URL-like specifiers: Non-special vs. special schemes: data:text/
FAIL URL-like specifiers: Non-special vs. special schemes: about:text/foo assert_equals: expected "about:text/foo" but got "https://example.com/lib/test-about/foo"
PASS URL-like specifiers: Non-special vs. special schemes: about:text/
FAIL URL-like specifiers: Non-special vs. special schemes: blob:text/foo assert_equals: expected "blob:text/foo" but got "https://example.com/lib/test-blob/foo"
PASS URL-like specifiers: Non-special vs. special schemes: blob:text/
FAIL URL-like specifiers: Non-special vs. special schemes: blah:text/foo assert_equals: expected "blah:text/foo" but got "https://example.com/lib/test-blah/foo"
PASS URL-like specifiers: Non-special vs. special schemes: blah:text/
PASS URL-like specifiers: Non-special vs. special schemes: http:text/foo
PASS URL-like specifiers: Non-special vs. special schemes: http:text/
PASS URL-like specifiers: Non-special vs. special schemes: https:text/foo
PASS URL-like specifiers: Non-special vs. special schemes: https:text/
PASS URL-like specifiers: Non-special vs. special schemes: ftp:text/foo
PASS URL-like specifiers: Non-special vs. special schemes: ftp:text/
PASS URL-like specifiers: Non-special vs. special schemes: file:text/foo
PASS URL-like specifiers: Non-special vs. special schemes: file:text/
PASS URL-like specifiers: Non-special vs. special schemes: ws:text/foo
PASS URL-like specifiers: Non-special vs. special schemes: ws:text/
PASS URL-like specifiers: Non-special vs. special schemes: wss:text/foo
PASS URL-like specifiers: Non-special vs. special schemes: wss:text/
Harness: the test ran to completion.
...@@ -18,6 +18,7 @@ const promises = []; ...@@ -18,6 +18,7 @@ const promises = [];
for (const json of [ for (const json of [
'resources/empty-import-map-internal.json', 'resources/empty-import-map-internal.json',
'resources/url-specifiers-schemes-internal.json'
]) { ]) {
promise_test(() => { promise_test(() => {
const promise = runTestsFromJSON(json); const promise = runTestsFromJSON(json);
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
}, },
"non-fetch scheme absolute URLs": { "non-fetch scheme absolute URLs": {
"expectedResults": { "expectedResults": {
"about:fetch-scheme": "about:fetch-scheme",
"mailto:non-fetch-scheme": "mailto:non-fetch-scheme", "mailto:non-fetch-scheme": "mailto:non-fetch-scheme",
"import:non-fetch-scheme": "import:non-fetch-scheme", "import:non-fetch-scheme": "import:non-fetch-scheme",
"javascript:non-fetch-scheme": "javascript:non-fetch-scheme", "javascript:non-fetch-scheme": "javascript:non-fetch-scheme",
......
...@@ -6,7 +6,9 @@ ...@@ -6,7 +6,9 @@
"lodash-dot": "./node_modules/lodash-es/lodash.js", "lodash-dot": "./node_modules/lodash-es/lodash.js",
"lodash-dot/": "./node_modules/lodash-es/", "lodash-dot/": "./node_modules/lodash-es/",
"lodash-dotdot": "../node_modules/lodash-es/lodash.js", "lodash-dotdot": "../node_modules/lodash-es/lodash.js",
"lodash-dotdot/": "../node_modules/lodash-es/" "lodash-dotdot/": "../node_modules/lodash-es/",
"mapped/": "https://example.com/",
"mapped/path/": "https://github.com/WICG/import-maps/issues/207/"
} }
}, },
"importMapBaseURL": "https://example.com/app/index.html", "importMapBaseURL": "https://example.com/app/index.html",
...@@ -38,6 +40,18 @@ ...@@ -38,6 +40,18 @@
"underscore/": null, "underscore/": null,
"underscore/foo": null "underscore/foo": null
} }
},
"backtracking via ..": {
"expectedResults": {
"mapped/path": "https://example.com/path",
"mapped/path/": "https://github.com/WICG/import-maps/issues/207/",
"mapped/path/..": null,
"mapped/path/../backtrack": null,
"mapped/path/../../backtrack": null,
"mapped/path/../../../backtrack": null,
"moment/../backtrack": null,
"moment/..": null
}
} }
} }
} }
{
"importMap": {
"imports": {
"data:text/": "/lib/test-data/",
"about:text/": "/lib/test-about/",
"blob:text/": "/lib/test-blob/",
"blah:text/": "/lib/test-blah/",
"http:text/": "/lib/test-http/",
"https:text/": "/lib/test-https/",
"file:text/": "/lib/test-file/",
"ftp:text/": "/lib/test-ftp/",
"ws:text/": "/lib/test-ws/",
"wss:text/": "/lib/test-wss/"
}
},
"importMapBaseURL": "https://example.com/app/index.html",
"baseURL": "https://example.com/js/app.mjs",
"name": "URL-like specifiers",
"tests": {
"Non-special vs. special schemes": {
"expectedResults": {
"data:text/javascript,console.log('foo')": "data:text/javascript,console.log('foo')",
"data:text/": "https://example.com/lib/test-data/",
"about:text/foo": "about:text/foo",
"about:text/": "https://example.com/lib/test-about/",
"blob:text/foo": "blob:text/foo",
"blob:text/": "https://example.com/lib/test-blob/",
"blah:text/foo": "blah:text/foo",
"blah:text/": "https://example.com/lib/test-blah/",
"http:text/foo": "https://example.com/lib/test-http/foo",
"http:text/": "https://example.com/lib/test-http/",
"https:text/foo": "https://example.com/lib/test-https/foo",
"https:text/": "https://example.com/lib/test-https/",
"ftp:text/foo": "https://example.com/lib/test-ftp/foo",
"ftp:text/": "https://example.com/lib/test-ftp/",
"file:text/foo": "https://example.com/lib/test-file/foo",
"file:text/": "https://example.com/lib/test-file/",
"ws:text/foo": "https://example.com/lib/test-ws/foo",
"ws:text/": "https://example.com/lib/test-ws/",
"wss:text/foo": "https://example.com/lib/test-wss/foo",
"wss:text/": "https://example.com/lib/test-wss/"
}
}
}
}
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
"baseURL": "https://example.com/js/app.mjs", "baseURL": "https://example.com/js/app.mjs",
"name": "URL-like specifiers", "name": "URL-like specifiers",
"tests": { "tests": {
"Ordinal URL-like specifiers": { "Ordinary URL-like specifiers": {
"expectedResults": { "expectedResults": {
"https://example.com/lib/foo.mjs": "https://example.com/app/more/bar.mjs", "https://example.com/lib/foo.mjs": "https://example.com/app/more/bar.mjs",
"https://///example.com/lib/foo.mjs": "https://example.com/app/more/bar.mjs", "https://///example.com/lib/foo.mjs": "https://example.com/app/more/bar.mjs",
...@@ -47,6 +47,22 @@ ...@@ -47,6 +47,22 @@
"expectedResults": { "expectedResults": {
"/test": "https://example.com/lib/test2.mjs" "/test": "https://example.com/lib/test2.mjs"
} }
},
"backtracking (relative URLs)": {
"expectedResults": {
"/test/..": "https://example.com/lib/slash-only/",
"/test/../backtrack": "https://example.com/lib/slash-only/backtrack",
"/test/../../backtrack": "https://example.com/lib/slash-only/backtrack",
"/test/../../../backtrack": "https://example.com/lib/slash-only/backtrack"
}
},
"backtracking (absolute URLs)": {
"expectedResults": {
"https://example.com/test/..": "https://example.com/lib/slash-only/",
"https://example.com/test/../backtrack": "https://example.com/lib/slash-only/backtrack",
"https://example.com/test/../../backtrack": "https://example.com/lib/slash-only/backtrack",
"https://example.com/test/../../../backtrack": "https://example.com/lib/slash-only/backtrack"
}
} }
} }
} }
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