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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/prefetch/link_header_prefetch.php

Issue 2602233002: Prefetch Link header support. (Closed)
Patch Set: Test based of perfObserver Created 3 years, 12 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/loader/LinkLoader.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/http/tests/prefetch/link_header_prefetch.php
diff --git a/third_party/WebKit/LayoutTests/http/tests/prefetch/link_header_prefetch.php b/third_party/WebKit/LayoutTests/http/tests/prefetch/link_header_prefetch.php
new file mode 100644
index 0000000000000000000000000000000000000000..2758292596d6d51ca23f05fd8a58e3dbd05923bc
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/prefetch/link_header_prefetch.php
@@ -0,0 +1,36 @@
+<?php
+header("Link: <http://127.0.0.1:8000/resources/square.png>;rel=prefetch",
+ false);
+?>
+<!DOCTYPE html>
+<html>
+<head></head>
+<body>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+ var observer = new PerformanceObserver(function(list) {
+ list.getEntries().forEach(function(entry) {
+ if (entry.name.indexOf("square.png") != -1) {
+ // If we found a resource timing entry of the prefetched image,
+ // the test passes.
+ t.done();
+ }
+ });
+ });
+ observer.observe({entryTypes: ["resource"]});
+ var t = async_test('Makes sure that Link headers prefetch resources');
+</script>
+<script>
+ window.addEventListener("load", t.step_func(function() {
+ var entries =
+ performance.getEntriesByName(
+ "http://127.0.0.1:8000/resources/square.png");
+ if (entries.length) {
+ assert_equals(entries.length, 1);
+ t.done();
+ }
+ }));
+</script>
+</body>
+</html>
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/loader/LinkLoader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698