Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Unified Diff: third_party/WebKit/LayoutTests/http/tests/prefetch/prefetch_deferred_after_onload.html

Issue 2751973005: Link prefetch fetches deferred until onload
Patch Set: Fixed post onload addition and crash Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/http/tests/prefetch/prefetch_deferred_after_onload.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/prefetch/prefetch_deferred_after_onload.html b/third_party/WebKit/LayoutTests/http/tests/prefetch/prefetch_deferred_after_onload.html
new file mode 100644
index 0000000000000000000000000000000000000000..7b326eec86cc26e73ef0bb327a907b11dedcbbf8
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/prefetch/prefetch_deferred_after_onload.html
@@ -0,0 +1,26 @@
+<!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 not downloaded before window.onload fired.');
+</script>
+<link rel=prefetch href="../resources/slow-script.pl?delay=100;prefetch">
+<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 loaded = loadedPrefetch();
+ assert_false(loaded);
+ t.step_timeout(function() {
+ assert_true(loadedPrefetch());
+ t.done();
+ }, 400);
+ }));
+</script>
+<script src="../resources/slow-script.pl?delay=200" defer></script>

Powered by Google App Engine
This is Rietveld 408576698