Skip to content

Commit

Permalink
[Import Maps] Split out WPT tests related to built-in modules
Browse files Browse the repository at this point in the history
This CL splits some WPT tests into
- wpt/import-maps/core/ that tests the core features after
  WICG/import-maps#176, and
- wpt/import-maps/builtin-support.tentative/ that
  requires pre-#176 built-in module and fallback support,

in order to test builtin- and non-builtin- versions easier.

Bug: 1010751
Change-Id: I9f4793f64fa0ad267fa1d4e43d5597d94a5cc541
  • Loading branch information
hiroshige-g authored and chromium-wpt-export-bot committed Oct 16, 2019
1 parent 88c0d67 commit 1d26c26
Show file tree
Hide file tree
Showing 28 changed files with 213 additions and 119 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<meta name="timeout" content="long">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/test-helper.js"></script>
<script src="../resources/test-helper.js"></script>

<script>
// "bare/..." (i.e. without leading "./") are bare specifiers
Expand All @@ -15,16 +15,10 @@
const importMap = `
{
"imports": {
"bare/bare": "./resources/log.js?pipe=sub&name=bare",
"bare/cross-origin-bare": "https://{{domains[www1]}}:{{ports[https][0]}}/import-maps/resources/log.js?pipe=sub&name=cross-origin-bare",
"bare/to-data": "data:text/javascript,log.push('dataURL')",
"bare/std-blank": "std:blank",
"bare/blank": "@std/blank",
"bare/std-none": "std:none",
"bare/none": "@std/none",
"bare/to-bare": "bare/bare"
"bare/none": "@std/none"
}
}
`;
Expand All @@ -41,16 +35,6 @@
// a parse error, not fetch error. Therefore, we use Result.PARSE_ERROR
// below. https://crbug.com/928435

// Bare to HTTP(S).
"bare/bare":
[Result.URL, Result.URL, "log:bare", "log:bare"],
"bare/cross-origin-bare":
[Result.URL, Result.URL, "log:cross-origin-bare", "log:cross-origin-bare"],

// Bare to data:
"bare/to-data":
[Result.URL, Result.URL, "dataURL", "dataURL"],

// Bare to built-in.
"bare/std-blank":
[Result.URL, Result.URL, Result.BUILTIN, Result.BUILTIN],
Expand All @@ -60,10 +44,6 @@
[Result.URL, Result.URL, Result.PARSE_ERROR, Result.PARSE_ERROR],
"bare/none":
[Result.URL, Result.URL, Result.PARSE_ERROR, Result.PARSE_ERROR],

// Bare to bare mapping is disabled.
"bare/to-bare":
[Result.URL, Result.URL, Result.PARSE_ERROR, Result.PARSE_ERROR],
};

doTests(importMap, null, tests);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/test-helper.js"></script>
<script src="../resources/test-helper.js"></script>

<script>
const importMap = `
{
"imports": {
"./resources/log.js?pipe=sub&name=empty": [ "@std/" ],
"./resources/log.js?pipe=sub&name=empty-fallback": [
"../resources/log.js?pipe=sub&name=empty": [ "@std/" ],
"../resources/log.js?pipe=sub&name=empty-fallback": [
"@std/",
"./resources/log.js?pipe=sub&name=empty-fallback"
"../resources/log.js?pipe=sub&name=empty-fallback"
]
}
}
Expand All @@ -32,9 +32,9 @@
"@std/":
[Result.FETCH_ERROR, Result.PARSE_ERROR, Result.FETCH_ERROR, Result.FETCH_ERROR],

"./resources/log.js?pipe=sub&name=empty":
"../resources/log.js?pipe=sub&name=empty":
[Result.URL, Result.URL, Result.PARSE_ERROR, Result.PARSE_ERROR],
"./resources/log.js?pipe=sub&name=empty-fallback":
"../resources/log.js?pipe=sub&name=empty-fallback":
[Result.URL, Result.URL, Result.URL, Result.URL],
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/test-helper.js"></script>
<script src="../resources/test-helper.js"></script>

<script>
const tests = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/test-helper.js"></script>
<script src="../resources/test-helper.js"></script>

<script>
const tests = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<meta name="timeout" content="long">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/test-helper.js"></script>
<script src="../resources/test-helper.js"></script>

<script>
// "bare/..." (i.e. without leading "./") are bare specifiers
Expand All @@ -15,18 +15,10 @@
const importMap = `
{
"imports": {
"bare": "./resources/log.js?pipe=sub&name=bare",
"data:text/javascript,log.push('data:foo')": "./resources/log.js?pipe=sub&name=foo",
"data:text/javascript,log.push('data:cross-origin-foo')": "https://{{domains[www1]}}:{{ports[https][0]}}/import-maps/resources/log.js?pipe=sub&name=cross-origin-foo",
"data:text/javascript,log.push('data:to-data')": "data:text/javascript,log.push('dataURL')",
"data:text/javascript,log.push('data:std-blank')": "std:blank",
"data:text/javascript,log.push('data:blank')": "@std/blank",
"data:text/javascript,log.push('data:std-none')": "std:none",
"data:text/javascript,log.push('data:none')": "@std/none",
"data:text/javascript,log.push('data:to-bare')": "bare"
"data:text/javascript,log.push('data:none')": "@std/none"
}
}
`;
Expand All @@ -43,16 +35,6 @@
// a parse error, not fetch error. Therefore, we use Result.PARSE_ERROR
// below. https://crbug.com/928435

// data: to HTTP(S).
"data:text/javascript,log.push('data:foo')":
[Result.URL, Result.URL, "log:foo", "log:foo"],
"data:text/javascript,log.push('data:cross-origin-foo')":
[Result.URL, Result.URL, "log:cross-origin-foo", "log:cross-origin-foo"],

// data: to data:
"data:text/javascript,log.push('data:to-data')":
[Result.URL, Result.URL, "dataURL", "dataURL"],

// data: to built-in.
"data:text/javascript,log.push('data:std-blank')":
[Result.URL, Result.URL, Result.BUILTIN, Result.BUILTIN],
Expand All @@ -62,10 +44,6 @@
[Result.URL, Result.URL, Result.PARSE_ERROR, Result.PARSE_ERROR],
"data:text/javascript,log.push('data:none')":
[Result.URL, Result.URL, Result.PARSE_ERROR, Result.PARSE_ERROR],

// data: to bare mapping is disabled.
"data:text/javascript,log.push('data:to-bare')":
[Result.URL, Result.URL, Result.PARSE_ERROR, Result.PARSE_ERROR],
};

doTests(importMap, null, tests);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<meta name="timeout" content="long">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/test-helper.js"></script>
<script src="../resources/test-helper.js"></script>

<script>
// Fallbacks from external URLs (such as HTTPS URLs) are
Expand All @@ -18,51 +18,51 @@
const importMap = `
{
"imports": {
"bare": "./resources/log.js?pipe=sub&name=bare",
"bare": "../resources/log.js?pipe=sub&name=bare",
"./resources/log.js?pipe=sub&name=http-to-builtin": [
"./resources/log.js?pipe=sub&name=http-to-builtin",
"../resources/log.js?pipe=sub&name=http-to-builtin": [
"../resources/log.js?pipe=sub&name=http-to-builtin",
"@std/blank"
],
"./resources/log.js?pipe=sub&name=fallback-to-different-url-1": [
"../resources/log.js?pipe=sub&name=fallback-to-different-url-1": [
"@std/blank",
"./resources/log.js?pipe=sub&name=something-different"
"../resources/log.js?pipe=sub&name=something-different"
],
"./resources/log.js?pipe=sub&name=fallback-to-different-url-2": [
"../resources/log.js?pipe=sub&name=fallback-to-different-url-2": [
"@std/none",
"./resources/log.js?pipe=sub&name=something-different2"
"../resources/log.js?pipe=sub&name=something-different2"
],
"./resources/log.js?pipe=sub&name=fallback-to-different-origin-1": [
"../resources/log.js?pipe=sub&name=fallback-to-different-origin-1": [
"@std/blank",
"https://{{domains[www1]}}:{{ports[https][0]}}/import-maps/resources/log.js?pipe=sub&name=fallback-to-different-origin-1"
],
"./resources/log.js?pipe=sub&name=fallback-to-different-origin-2": [
"../resources/log.js?pipe=sub&name=fallback-to-different-origin-2": [
"@std/none",
"https://{{domains[www1]}}:{{ports[https][0]}}/import-maps/resources/log.js?pipe=sub&name=fallback-to-different-origin-2"
],
"./resources/log.js?pipe=sub&name=more-than-two-values-1": [
"../resources/log.js?pipe=sub&name=more-than-two-values-1": [
"@std/none",
"@std/blank",
"./resources/log.js?pipe=sub&name=more-than-two-values-1"
"../resources/log.js?pipe=sub&name=more-than-two-values-1"
],
"./resources/log.js?pipe=sub&name=more-than-two-values-2": [
"../resources/log.js?pipe=sub&name=more-than-two-values-2": [
"@std/none",
"./resources/log.js?pipe=sub&name=more-than-two-values-2",
"../resources/log.js?pipe=sub&name=more-than-two-values-2",
"@std/blank"
],
"./resources/log.js?pipe=sub&name=fallback-from-http": [
"./resources/log.js?pipe=sub&name=non-built-in",
"./resources/log.js?pipe=sub&name=fallback-from-http"
"../resources/log.js?pipe=sub&name=fallback-from-http": [
"../resources/log.js?pipe=sub&name=non-built-in",
"../resources/log.js?pipe=sub&name=fallback-from-http"
],
"./resources/log.js?pipe=sub&name=fallback-from-data-1": [
"../resources/log.js?pipe=sub&name=fallback-from-data-1": [
"data:text/plain,",
"./resources/log.js?pipe=sub&name=fallback-from-http"
"../resources/log.js?pipe=sub&name=fallback-from-http"
],
"./resources/log.js?pipe=sub&name=fallback-from-data-2": [
"../resources/log.js?pipe=sub&name=fallback-from-data-2": [
"data:text/javascript,log.push('dataURL')",
"./resources/log.js?pipe=sub&name=fallback-from-http"
"../resources/log.js?pipe=sub&name=fallback-from-http"
]
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<meta name="timeout" content="long">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/test-helper.js"></script>
<script src="../resources/test-helper.js"></script>

<script>
// This tests is for fallbacks with the pattern of
Expand All @@ -16,13 +16,13 @@
const importMap = `
{
"imports": {
"./resources/log.js?pipe=sub&name=blank": [
"../resources/log.js?pipe=sub&name=blank": [
"@std/blank",
"./resources/log.js?pipe=sub&name=blank"
"../resources/log.js?pipe=sub&name=blank"
],
"./resources/log.js?pipe=sub&name=none": [
"../resources/log.js?pipe=sub&name=none": [
"@std/none",
"./resources/log.js?pipe=sub&name=none"
"../resources/log.js?pipe=sub&name=none"
],
"https://{{domains[www1]}}:{{ports[https][0]}}/import-maps/resources/log.js?pipe=sub&name=cross-origin-blank": [
"@std/blank",
Expand All @@ -33,13 +33,13 @@
"https://{{domains[www1]}}:{{ports[https][0]}}/import-maps/resources/log.js?pipe=sub&name=cross-origin-none"
],
"./resources/log.js?pipe=sub&name=std-blank": [
"../resources/log.js?pipe=sub&name=std-blank": [
"std:blank",
"./resources/log.js?pipe=sub&name=std-blank"
"../resources/log.js?pipe=sub&name=std-blank"
],
"./resources/log.js?pipe=sub&name=std-none": [
"../resources/log.js?pipe=sub&name=std-none": [
"std:none",
"./resources/log.js?pipe=sub&name=std-none"
"../resources/log.js?pipe=sub&name=std-none"
],
"https://{{domains[www1]}}:{{ports[https][0]}}/import-maps/resources/log.js?pipe=sub&name=std-cross-origin-blank": [
"std:blank",
Expand All @@ -61,18 +61,18 @@
// - dynamic import.
// Result.URL indicates that the specifier was not re-mapped by import maps,
// i.e. either considered as a relative path, or fallback occured.
"./resources/log.js?pipe=sub&name=blank":
"../resources/log.js?pipe=sub&name=blank":
[Result.URL, Result.URL, Result.BUILTIN, Result.BUILTIN],
"./resources/log.js?pipe=sub&name=none":
"../resources/log.js?pipe=sub&name=none":
[Result.URL, Result.URL, Result.URL, Result.URL],
"https://{{domains[www1]}}:{{ports[https][0]}}/import-maps/resources/log.js?pipe=sub&name=cross-origin-blank":
[Result.URL, Result.URL, Result.BUILTIN, Result.BUILTIN],
"https://{{domains[www1]}}:{{ports[https][0]}}/import-maps/resources/log.js?pipe=sub&name=cross-origin-none":
[Result.URL, Result.URL, Result.URL, Result.URL],

"./resources/log.js?pipe=sub&name=std-blank":
"../resources/log.js?pipe=sub&name=std-blank":
[Result.URL, Result.URL, Result.BUILTIN, Result.BUILTIN],
"./resources/log.js?pipe=sub&name=std-none":
"../resources/log.js?pipe=sub&name=std-none":
[Result.URL, Result.URL, Result.URL, Result.URL],
"https://{{domains[www1]}}:{{ports[https][0]}}/import-maps/resources/log.js?pipe=sub&name=std-cross-origin-blank":
[Result.URL, Result.URL, Result.BUILTIN, Result.BUILTIN],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/test-helper.js"></script>
<script src="../resources/test-helper.js"></script>

<script>
// "bare/..." (i.e. without leading "./") are bare specifiers
Expand All @@ -14,18 +14,10 @@
const importMap = `
{
"imports": {
"bare": "./resources/log.js?pipe=sub&name=bare",
"./resources/log.js?pipe=sub&name=foo": "./resources/log.js?pipe=sub&name=bar",
"./resources/log.js?pipe=sub&name=cross-origin-foo": "https://{{domains[www1]}}:{{ports[https][0]}}/import-maps/resources/log.js?pipe=sub&name=cross-origin-bar",
"./resources/log.js?pipe=sub&name=to-data": "data:text/javascript,log.push('dataURL')",
"./resources/log.js?pipe=sub&name=std-blank": "std:blank",
"./resources/log.js?pipe=sub&name=blank": "@std/blank",
"./resources/log.js?pipe=sub&name=std-none": "std:none",
"./resources/log.js?pipe=sub&name=none": "@std/none",
"./resources/log.js?pipe=sub&name=to-bare": "bare"
"../resources/log.js?pipe=sub&name=std-blank": "std:blank",
"../resources/log.js?pipe=sub&name=blank": "@std/blank",
"../resources/log.js?pipe=sub&name=std-none": "std:none",
"../resources/log.js?pipe=sub&name=none": "@std/none"
}
}
`;
Expand All @@ -42,16 +34,6 @@
// a parse error, not fetch error. Therefore, we use Result.PARSE_ERROR
// below. https://crbug.com/928435

// HTTP(S) to HTTP(S).
"{{location[server]}}/import-maps/resources/log.js?pipe=sub&name=foo":
[Result.URL, Result.URL, "log:bar", "log:bar"],
"{{location[server]}}/import-maps/resources/log.js?pipe=sub&name=cross-origin-foo":
[Result.URL, Result.URL, "log:cross-origin-bar", "log:cross-origin-bar"],

// HTTP(S) to data:
"{{location[server]}}/import-maps/resources/log.js?pipe=sub&name=to-data":
[Result.URL, Result.URL, "dataURL", "dataURL"],

// HTTP(S) to built-in.
"{{location[server]}}/import-maps/resources/log.js?pipe=sub&name=std-blank":
[Result.URL, Result.URL, Result.BUILTIN, Result.BUILTIN],
Expand All @@ -61,10 +43,6 @@
[Result.URL, Result.URL, Result.PARSE_ERROR, Result.PARSE_ERROR],
"{{location[server]}}/import-maps/resources/log.js?pipe=sub&name=none":
[Result.URL, Result.URL, Result.PARSE_ERROR, Result.PARSE_ERROR],

// HTTP(S) to bare mapping is disabled.
"{{location[server]}}/import-maps/resources/log.js?pipe=sub&name=to-bare":
[Result.URL, Result.URL, Result.PARSE_ERROR, Result.PARSE_ERROR],
};

doTests(importMap, null, tests);
Expand Down
File renamed without changes.
Loading

0 comments on commit 1d26c26

Please sign in to comment.