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> |
+ |