| Index: third_party/WebKit/LayoutTests/http/tests/prefetch/prefetch_added_after_onload.html
|
| diff --git a/third_party/WebKit/LayoutTests/http/tests/prefetch/prefetch_added_after_onload.html b/third_party/WebKit/LayoutTests/http/tests/prefetch/prefetch_added_after_onload.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..4c5472316c84647b6c7ecc9eb19db780c86fa2e4
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/http/tests/prefetch/prefetch_added_after_onload.html
|
| @@ -0,0 +1,30 @@
|
| +<!DOCTYPE html>
|
| +<script src="../resources/testharness.js"></script>
|
| +<script src="../resources/testharnessreport.js"></script>
|
| +<script>
|
| + var t = async_test('Makes sure that prefetched resources are downloaded when added after window.onload fired.');
|
| +</script>
|
| +<body>
|
| +<script>
|
| + function loadedPrefetch() {
|
| + var entries = performance.getEntriesByType("resource");
|
| + for (var i = 0; i < entries.length; ++i) {
|
| + if (entries[i].name.indexOf("prefetch") != -1)
|
| + return true;
|
| + }
|
| + return false;
|
| + }
|
| + window.addEventListener("load", t.step_func(function() {
|
| + var link = document.createElement("link");
|
| + link.rel = "prefetch";
|
| + link.href = "../resources/slow-script.pl?delay=100;prefetch";
|
| + document.body.appendChild(link);
|
| + var loaded = loadedPrefetch();
|
| + assert_false(loaded);
|
| + t.step_timeout(function() {
|
| + assert_true(loadedPrefetch());
|
| + t.done();
|
| + }, 400);
|
| + }));
|
| +</script>
|
| +</body>
|
|
|