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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/preload/memcache_eviction.html

Issue 2903653005: [preload] Mandatory `as` value and related spec alignments (Closed)
Patch Set: IDL changes Created 3 years, 6 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 unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src="../resources/testharness.js"></script> 2 <script src="../resources/testharness.js"></script>
3 <script src="../resources/testharnessreport.js"></script> 3 <script src="../resources/testharnessreport.js"></script>
4 <body> 4 <body>
5 <script> 5 <script>
6 var t = async_test('Test that preloaded resources get evicted from MemoryCache') ; 6 var t = async_test('Test that preloaded resources get evicted from MemoryCache') ;
7 var action; 7 var action;
8 var loadTimestampWithXHR = t.step_func(function() { 8 var loadTimestampWithXHR = t.step_func(function() {
9 var xhr = new XMLHttpRequest; 9 var xhr = new XMLHttpRequest;
10 xhr.withCredentials = true; 10 xhr.withCredentials = true;
11 xhr.open("GET", "resources/timestamp.php"); 11 xhr.open("GET", "resources/timestamp.php");
12 xhr.send(); 12 xhr.send();
13 xhr.onload = function() { 13 xhr.onload = function() {
14 action(xhr.responseText); 14 action(xhr.responseText);
15 }; 15 };
16 }); 16 });
17 17
18 var loadTimestampWithLink = t.step_func(function() { 18 var loadTimestampWithLink = t.step_func(function() {
19 var l = document.createElement('link'); 19 var l = document.createElement('link');
20 l.setAttribute('rel', 'preload'); 20 l.setAttribute('rel', 'preload');
21 l.setAttribute('href', "resources/timestamp.php"); 21 l.setAttribute('href', "resources/timestamp.php");
22 l.setAttribute('as', 'fetch');
22 l.onload = loadTimestampWithXHR; 23 l.onload = loadTimestampWithXHR;
23 document.body.appendChild(l); 24 document.body.appendChild(l);
24 }); 25 });
25 26
26 var writeAndReload = t.step_func(function(text) { 27 var writeAndReload = t.step_func(function(text) {
27 sessionStorage.timestamp = text; 28 sessionStorage.timestamp = text;
28 document.location.reload(true); 29 document.location.reload(true);
29 }); 30 });
30 31
31 var compare = t.step_func(function(text) { 32 var compare = t.step_func(function(text) {
32 assert_true(sessionStorage.timestamp != text); 33 assert_true(sessionStorage.timestamp != text);
33 t.done(); 34 t.done();
34 }); 35 });
35 36
36 if (!sessionStorage.timestamp) { 37 if (!sessionStorage.timestamp) {
37 action = writeAndReload; 38 action = writeAndReload;
38 } else { 39 } else {
39 action = compare; 40 action = compare;
40 } 41 }
41 loadTimestampWithLink(); 42 loadTimestampWithLink();
42 </script> 43 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698