Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/http/tests/preload/no_cache_reuse.html |
| diff --git a/third_party/WebKit/LayoutTests/http/tests/preload/no_cache_reuse.html b/third_party/WebKit/LayoutTests/http/tests/preload/no_cache_reuse.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a075d8f2aeaa65f633a252dd9fe8b6a2af421dbe |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/http/tests/preload/no_cache_reuse.html |
| @@ -0,0 +1,39 @@ |
| +<!DOCTYPE html> |
| +<script src="../resources/testharness.js"></script> |
| +<script src="../resources/testharnessreport.js"></script> |
| +<body> |
| +<script> |
| +var t = async_test('Test that preloaded non-cacheable resources get reused even after onload'); |
|
Charlie Harrison
2016/08/04 18:10:25
Seems like the file name should be "cache_reuse" r
Yoav Weiss
2016/08/04 20:26:14
renamed to memcache_reuse_of_non_cacheable_preload
|
| +var action; |
| + |
| +var test = t.step_func(function() { |
| + var entries = performance.getEntriesByType("resource"); |
| + var resources = 0; |
| + for (var i = 0; i < entries.length; ++i) { |
| + if (entries[i].name.indexOf("timestamp") != -1) |
| + ++resources; |
| + } |
| + assert_equals(resources, 1); |
| + t.done(); |
| +}); |
| + |
| +var loadTimestampWithXHR = t.step_func(function() { |
| + var xhr = new XMLHttpRequest; |
| + xhr.withCredentials = true; |
| + xhr.open("GET", "resources/timestamp.php"); |
| + xhr.send(); |
| + xhr.onload = t.step_func(function() { |
| + setTimeout(test, 0); |
| + }); |
| +}); |
| + |
| +var loadTimestampWithLink = (function() { |
| + var l = document.createElement('link'); |
| + l.setAttribute('rel', 'preload'); |
| + l.setAttribute('href', "resources/timestamp.php"); |
| + l.onload = loadTimestampWithXHR; |
| + document.body.appendChild(l); |
| +}); |
| + |
| +loadTimestampWithLink(); |
| +</script> |