Skip to content

Commit

Permalink
Add more tests for img element
Browse files Browse the repository at this point in the history
  • Loading branch information
zcorpan committed Sep 2, 2020
1 parent ed10e7e commit 3849cc1
Show file tree
Hide file tree
Showing 51 changed files with 393 additions and 57 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<meta charset=utf-8>
<!-- DO NOT EDIT. This file has been generated. Source:
/html/syntax/preload-scanner.tentative/tools/generate.py
-->
<title>Preload scanner, document.write(): img-data-src</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=/common/utils.js></script>
<script src=/html/syntax/preload-scanner.tentative/resources/preload-scanner-util.js></script>
<script>
setup({single_test: true});
const uuid = token();
expect_fetched_onload(uuid, false)
.then(compare_with_nonspeculative(uuid, 'img-data-src', true))
.then(done);
document.write(`
<script src=/common/slow.py><\/script>
<script>
document.write('<plaintext>');
<\/script>
speculative case in document.write
<img data-src=/html/syntax/preload-scanner.tentative/resources/stash.py?action=put&uuid=${uuid}>
`);
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<meta charset=utf-8>
<!-- DO NOT EDIT. This file has been generated. Source:
/html/syntax/preload-scanner.tentative/tools/generate.py
-->
<title>Preload scanner, document.write(): img-src-crossorigin</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=/common/utils.js></script>
<script src=/html/syntax/preload-scanner.tentative/resources/preload-scanner-util.js></script>
<script>
setup({single_test: true});
const uuid = token();
expect_fetched_onload(uuid, true)
.then(compare_with_nonspeculative(uuid, 'img-src-crossorigin', true))
.then(done);
document.write(`
<script src=/common/slow.py><\/script>
<script>
document.write('<plaintext>');
<\/script>
speculative case in document.write
<img src=/html/syntax/preload-scanner.tentative/resources/stash.py?action=put&uuid=${uuid} crossorigin>
`);
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<meta charset=utf-8>
<!-- DO NOT EDIT. This file has been generated. Source:
/html/syntax/preload-scanner.tentative/tools/generate.py
-->
<title>Preload scanner, document.write(): img-src-loading-lazy</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=/common/utils.js></script>
<script src=/html/syntax/preload-scanner.tentative/resources/preload-scanner-util.js></script>
<script>
setup({single_test: true});
const uuid = token();
expect_fetched_onload(uuid, false)
.then(compare_with_nonspeculative(uuid, 'img-src-loading-lazy', false))
.then(done);
document.write(`
<script src=/common/slow.py><\/script>
<script>
document.write('<plaintext>');
<\/script>
speculative case in document.write
<img src=/html/syntax/preload-scanner.tentative/resources/stash.py?action=put&uuid=${uuid} loading=lazy>
`);
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<meta charset=utf-8>
<!-- DO NOT EDIT. This file has been generated. Source:
/html/syntax/preload-scanner.tentative/tools/generate.py
-->
<title>Preload scanner, document.write(): img-src-referrerpolicy-no-referrer</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=/common/utils.js></script>
<script src=/html/syntax/preload-scanner.tentative/resources/preload-scanner-util.js></script>
<script>
setup({single_test: true});
const uuid = token();
expect_fetched_onload(uuid, true)
.then(compare_with_nonspeculative(uuid, 'img-src-referrerpolicy-no-referrer', true))
.then(done);
document.write(`
<script src=/common/slow.py><\/script>
<script>
document.write('<plaintext>');
<\/script>
speculative case in document.write
<img src=/html/syntax/preload-scanner.tentative/resources/stash.py?action=put&uuid=${uuid} referrerpolicy=no-referrer>
`);
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
setup({single_test: true});
const uuid = token();
expect_fetched_onload(uuid, true)
.then(compare_with_nonspeculative(uuid, 'img-src'))
.then(compare_with_nonspeculative(uuid, 'img-src', true))
.then(done);
document.write(`
<script src=/common/slow.py><\/script>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<meta charset=utf-8>
<!-- DO NOT EDIT. This file has been generated. Source:
/html/syntax/preload-scanner.tentative/tools/generate.py
-->
<title>Preload scanner, document.write(): img-srcset</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=/common/utils.js></script>
<script src=/html/syntax/preload-scanner.tentative/resources/preload-scanner-util.js></script>
<script>
setup({single_test: true});
const uuid = token();
expect_fetched_onload(uuid, true)
.then(compare_with_nonspeculative(uuid, 'img-srcset', true))
.then(done);
document.write(`
<script src=/common/slow.py><\/script>
<script>
document.write('<plaintext>');
<\/script>
speculative case in document.write
<img srcset=/html/syntax/preload-scanner.tentative/resources/stash.py?action=put&uuid=${uuid}>
`);
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
setup({single_test: true});
const uuid = token();
expect_fetched_onload(uuid, true)
.then(compare_with_nonspeculative(uuid, 'picture-source-br-img'))
.then(compare_with_nonspeculative(uuid, 'picture-source-br-img', true))
.then(done);
document.write(`
<script src=/common/slow.py><\/script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
setup({single_test: true});
const uuid = token();
expect_fetched_onload(uuid, false)
.then(compare_with_nonspeculative(uuid, 'picture-source-no-img'))
.then(compare_with_nonspeculative(uuid, 'picture-source-no-img', true))
.then(done);
document.write(`
<script src=/common/slow.py><\/script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
setup({single_test: true});
const uuid = token();
expect_fetched_onload(uuid, false)
.then(compare_with_nonspeculative(uuid, 'picture-source-nomatch-media'))
.then(compare_with_nonspeculative(uuid, 'picture-source-nomatch-media', true))
.then(done);
document.write(`
<script src=/common/slow.py><\/script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
setup({single_test: true});
const uuid = token();
expect_fetched_onload(uuid, false)
.then(compare_with_nonspeculative(uuid, 'picture-source-unsupported-type'))
.then(compare_with_nonspeculative(uuid, 'picture-source-unsupported-type', true))
.then(done);
document.write(`
<script src=/common/slow.py><\/script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
setup({single_test: true});
const uuid = token();
expect_fetched_onload(uuid, true)
.then(compare_with_nonspeculative(uuid, 'script-src-async'))
.then(compare_with_nonspeculative(uuid, 'script-src-async', true))
.then(done);
document.write(`
<script src=/common/slow.py><\/script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
setup({single_test: true});
const uuid = token();
expect_fetched_onload(uuid, true)
.then(compare_with_nonspeculative(uuid, 'script-src-crossorigin'))
.then(compare_with_nonspeculative(uuid, 'script-src-crossorigin', true))
.then(done);
document.write(`
<script src=/common/slow.py><\/script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
setup({single_test: true});
const uuid = token();
expect_fetched_onload(uuid, true)
.then(compare_with_nonspeculative(uuid, 'script-src-defer'))
.then(compare_with_nonspeculative(uuid, 'script-src-defer', true))
.then(done);
document.write(`
<script src=/common/slow.py><\/script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
setup({single_test: true});
const uuid = token();
expect_fetched_onload(uuid, true)
.then(compare_with_nonspeculative(uuid, 'script-src-integrity'))
.then(compare_with_nonspeculative(uuid, 'script-src-integrity', true))
.then(done);
document.write(`
<script src=/common/slow.py><\/script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
setup({single_test: true});
const uuid = token();
expect_fetched_onload(uuid, true)
.then(compare_with_nonspeculative(uuid, 'script-src-module'))
.then(compare_with_nonspeculative(uuid, 'script-src-module', true))
.then(done);
document.write(`
<script src=/common/slow.py><\/script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
setup({single_test: true});
const uuid = token();
expect_fetched_onload(uuid, false)
.then(compare_with_nonspeculative(uuid, 'script-src-nomodule'))
.then(compare_with_nonspeculative(uuid, 'script-src-nomodule', true))
.then(done);
document.write(`
<script src=/common/slow.py><\/script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
setup({single_test: true});
const uuid = token();
expect_fetched_onload(uuid, true)
.then(compare_with_nonspeculative(uuid, 'script-src-referrerpolicy-no-referrer'))
.then(compare_with_nonspeculative(uuid, 'script-src-referrerpolicy-no-referrer', true))
.then(done);
document.write(`
<script src=/common/slow.py><\/script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
setup({single_test: true});
const uuid = token();
expect_fetched_onload(uuid, true)
.then(compare_with_nonspeculative(uuid, 'script-src-type-application-ecmascript'))
.then(compare_with_nonspeculative(uuid, 'script-src-type-application-ecmascript', true))
.then(done);
document.write(`
<script src=/common/slow.py><\/script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
setup({single_test: true});
const uuid = token();
expect_fetched_onload(uuid, false)
.then(compare_with_nonspeculative(uuid, 'script-src-unsupported-type'))
.then(compare_with_nonspeculative(uuid, 'script-src-unsupported-type', true))
.then(done);
document.write(`
<script src=/common/slow.py><\/script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
setup({single_test: true});
const uuid = token();
expect_fetched_onload(uuid, true)
.then(compare_with_nonspeculative(uuid, 'script-src'))
.then(compare_with_nonspeculative(uuid, 'script-src', true))
.then(done);
document.write(`
<script src=/common/slow.py><\/script>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!DOCTYPE html>
<meta charset=utf-8>
<!-- DO NOT EDIT. This file has been generated. Source:
/html/syntax/preload-scanner.tentative/tools/generate.py
-->
<title>Preload scanner, page load: img-data-src</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=/common/utils.js></script>
<script src=/html/syntax/preload-scanner.tentative/resources/preload-scanner-util.js></script>
<body>
<script>
setup({single_test: true});
const uuid = token();
const iframe = document.createElement('iframe');
iframe.src = `resources/img-data-src-framed.sub.html?uuid=${uuid}`;
document.body.appendChild(iframe);
expect_fetched_onload(uuid, false)
.then(compare_with_nonspeculative(uuid, 'img-data-src', true))
.then(done);
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!DOCTYPE html>
<meta charset=utf-8>
<!-- DO NOT EDIT. This file has been generated. Source:
/html/syntax/preload-scanner.tentative/tools/generate.py
-->
<title>Preload scanner, page load: img-src-crossorigin</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=/common/utils.js></script>
<script src=/html/syntax/preload-scanner.tentative/resources/preload-scanner-util.js></script>
<body>
<script>
setup({single_test: true});
const uuid = token();
const iframe = document.createElement('iframe');
iframe.src = `resources/img-src-crossorigin-framed.sub.html?uuid=${uuid}`;
document.body.appendChild(iframe);
expect_fetched_onload(uuid, true)
.then(compare_with_nonspeculative(uuid, 'img-src-crossorigin', true))
.then(done);
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!DOCTYPE html>
<meta charset=utf-8>
<!-- DO NOT EDIT. This file has been generated. Source:
/html/syntax/preload-scanner.tentative/tools/generate.py
-->
<title>Preload scanner, page load: img-src-loading-lazy</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=/common/utils.js></script>
<script src=/html/syntax/preload-scanner.tentative/resources/preload-scanner-util.js></script>
<body>
<script>
setup({single_test: true});
const uuid = token();
const iframe = document.createElement('iframe');
iframe.src = `resources/img-src-loading-lazy-framed.sub.html?uuid=${uuid}`;
document.body.appendChild(iframe);
expect_fetched_onload(uuid, false)
.then(compare_with_nonspeculative(uuid, 'img-src-loading-lazy', false))
.then(done);
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!DOCTYPE html>
<meta charset=utf-8>
<!-- DO NOT EDIT. This file has been generated. Source:
/html/syntax/preload-scanner.tentative/tools/generate.py
-->
<title>Preload scanner, page load: img-src-referrerpolicy-no-referrer</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=/common/utils.js></script>
<script src=/html/syntax/preload-scanner.tentative/resources/preload-scanner-util.js></script>
<body>
<script>
setup({single_test: true});
const uuid = token();
const iframe = document.createElement('iframe');
iframe.src = `resources/img-src-referrerpolicy-no-referrer-framed.sub.html?uuid=${uuid}`;
document.body.appendChild(iframe);
expect_fetched_onload(uuid, true)
.then(compare_with_nonspeculative(uuid, 'img-src-referrerpolicy-no-referrer', true))
.then(done);
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
iframe.src = `resources/img-src-framed.sub.html?uuid=${uuid}`;
document.body.appendChild(iframe);
expect_fetched_onload(uuid, true)
.then(compare_with_nonspeculative(uuid, 'img-src'))
.then(compare_with_nonspeculative(uuid, 'img-src', true))
.then(done);
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!DOCTYPE html>
<meta charset=utf-8>
<!-- DO NOT EDIT. This file has been generated. Source:
/html/syntax/preload-scanner.tentative/tools/generate.py
-->
<title>Preload scanner, page load: img-srcset</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=/common/utils.js></script>
<script src=/html/syntax/preload-scanner.tentative/resources/preload-scanner-util.js></script>
<body>
<script>
setup({single_test: true});
const uuid = token();
const iframe = document.createElement('iframe');
iframe.src = `resources/img-srcset-framed.sub.html?uuid=${uuid}`;
document.body.appendChild(iframe);
expect_fetched_onload(uuid, true)
.then(compare_with_nonspeculative(uuid, 'img-srcset', true))
.then(done);
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
iframe.src = `resources/picture-source-br-img-framed.sub.html?uuid=${uuid}`;
document.body.appendChild(iframe);
expect_fetched_onload(uuid, true)
.then(compare_with_nonspeculative(uuid, 'picture-source-br-img'))
.then(compare_with_nonspeculative(uuid, 'picture-source-br-img', true))
.then(done);
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
iframe.src = `resources/picture-source-no-img-framed.sub.html?uuid=${uuid}`;
document.body.appendChild(iframe);
expect_fetched_onload(uuid, false)
.then(compare_with_nonspeculative(uuid, 'picture-source-no-img'))
.then(compare_with_nonspeculative(uuid, 'picture-source-no-img', true))
.then(done);
</script>
Loading

0 comments on commit 3849cc1

Please sign in to comment.