| Index: third_party/WebKit/LayoutTests/http/tests/preload/memcache_eviction.html
|
| diff --git a/third_party/WebKit/LayoutTests/http/tests/preload/memcache_eviction.html b/third_party/WebKit/LayoutTests/http/tests/preload/memcache_eviction.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..ace8c78f1015062d861c6a7e942219d88688a5b4
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/http/tests/preload/memcache_eviction.html
|
| @@ -0,0 +1,42 @@
|
| +<!DOCTYPE html>
|
| +<script src="../resources/testharness.js"></script>
|
| +<script src="../resources/testharnessreport.js"></script>
|
| +<body>
|
| +<script>
|
| +var t = async_test('Test that preloaded resources get evicted from MemoryCache');
|
| +var action;
|
| +var loadTimestampWithXHR = t.step_func(function() {
|
| + var xhr = new XMLHttpRequest;
|
| + xhr.withCredentials = true;
|
| + xhr.open("GET", "resources/timestamp.php");
|
| + xhr.send();
|
| + xhr.onload = function() {
|
| + action(xhr.responseText);
|
| + };
|
| +});
|
| +
|
| +var loadTimestampWithLink = t.step_func(function() {
|
| + var l = document.createElement('link');
|
| + l.setAttribute('rel', 'preload');
|
| + l.setAttribute('href', "resources/timestamp.php");
|
| + l.onload = loadTimestampWithXHR;
|
| + document.body.appendChild(l);
|
| +});
|
| +
|
| +var writeAndReload = t.step_func(function(text) {
|
| + sessionStorage.timestamp = text;
|
| + document.location.reload(true);
|
| +});
|
| +
|
| +var compare = t.step_func(function(text) {
|
| + assert_true(sessionStorage.timestamp != text);
|
| + t.done();
|
| +});
|
| +
|
| +if (!sessionStorage.timestamp) {
|
| + action = writeAndReload;
|
| +} else {
|
| + action = compare;
|
| +}
|
| +loadTimestampWithLink();
|
| +</script>
|
|
|