forked from mykmelez/gecko
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1607407 [wpt PR 21064] - [Import Maps] Migrate Jest-based parsing…
… tests into JSON-based, a=testonly Automatic update from web-platform-tests [Import Maps] Migrate Jest-based parsing tests into JSON-based This CL - Converts Jest-based parsing tests into JSONs (with minor refinement, and removing test cases depending on interoperability issues of underlying URL parsers), - Adjust the JSON schema for parsing tests, and - Removes imported resolution tests. The test failures (virtual/import-maps-without-builtin-modules/external/wpt/import-maps/common/parsing.tentative.html) are due to WICG/import-maps#184, i.e. whether `null` mappings are removed from parsed import map or not. Bug: 1026809, WICG/import-maps#170 Change-Id: If1e53cbeafd44c1de1a7fa38ef646fcd5721b495 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1982509 Reviewed-by: Domenic Denicola <[email protected]> Commit-Queue: Hiroshige Hayashizaki <[email protected]> Cr-Commit-Position: refs/heads/master@{#731910} -- wpt-commits: a5e2efd90b6766f33e94d92e1858a68f8c40c977 wpt-pr: 21064
- Loading branch information
1 parent
6158162
commit 93a0da2
Showing
23 changed files
with
921 additions
and
707 deletions.
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
26 changes: 26 additions & 0 deletions
26
testing/web-platform/tests/import-maps/common/parsing.tentative.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,26 @@ | ||
<!DOCTYPE html> | ||
<meta name="timeout" content="long"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<body> | ||
<script type="module"> | ||
import { runTestsFromJSON } from "./resources/common-test-helper.js"; | ||
|
||
for (const json of [ | ||
'resources/parsing-addresses-absolute.json', | ||
'resources/parsing-addresses-invalid.json', | ||
'resources/parsing-addresses.json', | ||
'resources/parsing-invalid-json.json', | ||
'resources/parsing-schema-normalization.json', | ||
'resources/parsing-schema-scope.json', | ||
'resources/parsing-schema-specifier-map.json', | ||
'resources/parsing-schema-toplevel.json', | ||
'resources/parsing-scope-keys.json', | ||
'resources/parsing-specifier-keys.json', | ||
'resources/parsing-trailing-slashes.json', | ||
]) { | ||
promise_test(() => | ||
runTestsFromJSON(json), | ||
"Test helper: fetching and sanity checking test JSON: " + json); | ||
} | ||
</script> |
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
63 changes: 63 additions & 0 deletions
63
testing/web-platform/tests/import-maps/common/resources/parsing-addresses-absolute.json
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,63 @@ | ||
{ | ||
"name": "Absolute URL addresses", | ||
"tests": { | ||
"should only accept absolute URL addresses with fetch schemes": { | ||
"importMap": { | ||
"imports": { | ||
"about": "about:good", | ||
"blob": "blob:good", | ||
"data": "data:good", | ||
"file": "file:///good", | ||
"filesystem": "filesystem:http://example.com/good/", | ||
"http": "http://good/", | ||
"https": "https://good/", | ||
"ftp": "ftp://good/", | ||
"import": "import:bad", | ||
"mailto": "mailto:bad", | ||
"javascript": "javascript:bad", | ||
"wss": "wss:bad" | ||
} | ||
}, | ||
"importMapBaseURL": "https://base.example/path1/path2/path3", | ||
"expectedParsedImportMap": { | ||
"imports": { | ||
"about": "about:good", | ||
"blob": "blob:good", | ||
"data": "data:good", | ||
"file": "file:///good", | ||
"filesystem": "filesystem:http://example.com/good/", | ||
"http": "http://good/", | ||
"https": "https://good/", | ||
"ftp": "ftp://good/", | ||
"import": "import:bad", | ||
"javascript": "javascript:bad", | ||
"mailto": "mailto:bad", | ||
"wss": "wss://bad/" | ||
}, | ||
"scopes": {} | ||
} | ||
}, | ||
"should parse absolute URLs, ignoring unparseable ones": { | ||
"importMap": { | ||
"imports": { | ||
"unparseable2": "https://example.com:demo", | ||
"unparseable3": "http://[www.example.com]/", | ||
"invalidButParseable1": "https:example.org", | ||
"invalidButParseable2": "https://///example.com///", | ||
"prettyNormal": "https://example.net", | ||
"percentDecoding": "https://ex%41mple.com/" | ||
} | ||
}, | ||
"importMapBaseURL": "https://base.example/path1/path2/path3", | ||
"expectedParsedImportMap": { | ||
"imports": { | ||
"invalidButParseable1": "https://example.org/", | ||
"invalidButParseable2": "https://example.com///", | ||
"prettyNormal": "https://example.net/", | ||
"percentDecoding": "https://example.com/" | ||
}, | ||
"scopes": {} | ||
} | ||
} | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
testing/web-platform/tests/import-maps/common/resources/parsing-addresses-invalid.json
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,21 @@ | ||
{ | ||
"name": "Other invalid addresses", | ||
"tests": { | ||
"should ignore unprefixed strings that are not absolute URLs": { | ||
"importMap": { | ||
"imports": { | ||
"foo1": "bar", | ||
"foo2": "\\bar", | ||
"foo3": "~bar", | ||
"foo4": "#bar", | ||
"foo5": "?bar" | ||
} | ||
}, | ||
"importMapBaseURL": "https://base.example/path1/path2/path3", | ||
"expectedParsedImportMap": { | ||
"imports": {}, | ||
"scopes": {} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.