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

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: Remove empty check 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..b9895d30b917d37033e205ca035a84d071f355bd
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/preload/link_header_preload_on_commit.php
@@ -0,0 +1,40 @@
+<?php
+ header("Link: </resources/dummy.css>;rel=preload", false);
+ header("Link: </resources/square.png>;rel=preload;as=image;media=(min-width: 1px)", 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 nonMediaHeader = performance.getEntriesByName(
+ "http://127.0.0.1:8000/resources/dummy.css")[0];
+ var mediaHeader = performance.getEntriesByName(
+ "http://127.0.0.1:8000/resources/square.png")[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 non-media header can be processed at commit time.
+ // The media header needs to tokenize the first chunk of html, and the
+ // markup still needs to be tokenized.
+ // Note: the link preloads can be preloaded before the normal resource
+ // because they don't need to wait for the document element to be
+ // available (ApplicationCache initialization time).
+ assert_greater_than(markup.startTime, nonMediaHeader.startTime);
+ assert_greater_than(mediaHeader.startTime, nonMediaHeader.startTime);
+ assert_greater_than(normalResource.startTime, mediaHeader.startTime);
+ assert_greater_than(normalResource.startTime, markup.startTime);
+ t.done();
+ }));
+</script>
+</body>
+</html>
+
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698