Skip to content

Commit

Permalink
Bug 1589241 [wpt PR 19743] - [Import Maps] WPT: Check parsed import m…
Browse files Browse the repository at this point in the history
…aps' scopes, a=testonly

Automatic update from web-platform-tests
[Import Maps] WPT: Check parsed import maps' scopes

Before this CL, only `imports` parts of import maps were tested.

Chromium side:
- This CL makes ImportMap::ToString() to output the whole import map,
  rather than only the `imports` value.
- This CL removes white spaces for pretty printing, to simplify
  the logic.

WPT side:
- This CL checks the whole import maps in `jest-test-helper.js`.
- Reflect the upstream changes in
  WICG/import-maps#190 to
  `builtin-support.tentative/imported/resources/parsing-scope-keys.js`.

Test expectation changes:
- This CL exposes new test failures in
  `parsing-scope-keys.tentative.html` on Chromium
  due to the spec-inconformant behavior of Chromium's URL parser.
- Other test expectation changes are just converting
  `x` to `{imports: x, scopes: {}}`.

Bug: 990561, 927181
Change-Id: Ic6a0171298636170d2fd96db2ac1a8d60e3ff345
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1863854
Reviewed-by: Kouhei Ueno <kouheichromium.org>
Commit-Queue: Hiroshige Hayashizaki <hiroshigechromium.org>
Cr-Commit-Position: refs/heads/master{#706790}

--

wpt-commits: dfaa0ba046478cb6db6284a4a036147b17d316d9
wpt-pr: 19743

UltraBlame original commit: 52907e7e763b51717f9c58d08c26aa5ae16454ce
  • Loading branch information
marco-c committed Oct 27, 2019
1 parent c3a73cd commit 02ac41f
Show file tree
Hide file tree
Showing 2 changed files with 120 additions and 85 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -563,13 +563,15 @@ it
(
'
should
only
accept
all
absolute
URL
scope
keys
with
or
without
fetch
schemes
'
Expand Down Expand Up @@ -607,7 +609,16 @@ good
'
filesystem
:
http
:
/
/
example
.
com
/
good
/
'
'
http
Expand Down Expand Up @@ -696,7 +707,16 @@ good
'
filesystem
:
http
:
/
/
example
.
com
/
good
/
'
'
http
Expand All @@ -722,84 +742,32 @@ ftp
good
/
'
]
[
'
Invalid
scope
"
import
:
bad
"
.
Scope
URLs
must
have
a
fetch
scheme
.
'
'
Invalid
scope
"
mailto
:
bad
"
.
Scope
URLs
must
have
a
fetch
scheme
.
'
'
Invalid
scope
"
javascript
:
bad
"
.
Scope
URLs
must
have
a
fetch
scheme
.
'
'
Invalid
scope
"
wss
:
/
/
ba
/
"
.
Scope
URLs
must
have
a
fetch
scheme
.
'
]
[
]
)
;
}
Expand Down
127 changes: 97 additions & 30 deletions testing/web-platform/tests/import-maps/resources/jest-test-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,101 @@ exports
)
;
}
/
/
Sort
keys
and
then
stringify
for
comparison
.
function
stringifyImportMap
(
importMap
)
{
function
getKeys
(
m
)
{
if
(
typeof
m
!
=
=
'
object
'
)
return
[
]
;
let
keys
=
[
]
;
for
(
const
key
in
m
)
{
keys
.
push
(
key
)
;
keys
=
keys
.
concat
(
getKeys
(
m
[
key
]
)
)
;
}
return
keys
;
}
return
JSON
.
stringify
(
importMap
getKeys
(
importMap
)
.
sort
(
)
)
;
}
function
expect
(
Expand Down Expand Up @@ -249,41 +344,13 @@ contentDocument
;
assert_equals
(
JSON
.
stringify
stringifyImportMap
(
actualParsedImportMap
Object
.
keys
(
actualParsedImportMap
)
.
sort
(
)
)
JSON
.
stringify
stringifyImportMap
(
expected
.
imports
Object
.
keys
(
expected
.
imports
)
.
sort
(
)
)
)
;
Expand Down

0 comments on commit 02ac41f

Please sign in to comment.