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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/preload/link_header_preload_on_commit.php

Issue 2165653004: Don't wait for AppCache for link rel preloads (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Don't wait for appcache for link rel preloads Created 4 years, 5 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/preload/link_header_preload_on_commit.php
diff --git a/third_party/WebKit/LayoutTests/http/tests/preload/link_header_preload_on_commit.php b/third_party/WebKit/LayoutTests/http/tests/preload/link_header_preload_on_commit.php
new file mode 100644
index 0000000000000000000000000000000000000000..7d6a722d11b5d5b03edc46d6b2d7e8781c3f0be2
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/preload/link_header_preload_on_commit.php
@@ -0,0 +1,34 @@
+<?php
+ header("Link: </resources/dummy.css>;rel=preload;as=image", false);
+?>
+<!DOCTYPE html>
+<html>
+<body>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<link rel="preload" href="/resources/dummy.js" as="script">
+<script>
+ var t = async_test('Makes sure that Link headers preload resources');
+</script>
+<script src="/resources/slow-script.pl?delay=200"></script>
+<script>
+ window.addEventListener("load", t.step_func(function() {
+ var header = performance.getEntriesByName(
+ "http://127.0.0.1:8000/resources/dummy.css")[0];
+ var markup = performance.getEntriesByName(
+ "http://127.0.0.1:8000/resources/dummy.js")[0];
+ var normalResource = performance.getEntriesByName(
+ "http://127.0.0.1:8000/resources/testharness.js")[0];
+ // The header can be processed at commit time, but the markup still
+ // needs to be parsed. Also, the link rel preload should be preloaded
+ // before the normal resource, because it doesn't need to wait for
+ // the document element to be available (ApplicationCache
+ // initialization time).
+ assert_greater_than(markup.startTime, header.startTime);
+ assert_greater_than(normalResource.startTime, markup.startTime);
+ t.done();
+ }));
+</script>
+</body>
+</html>
+

Powered by Google App Engine
This is Rietveld 408576698