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