Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / cache / loaded-from-cache-after-reload-within-iframe.html
blobe5bbcfc3193f45f3cea8f96539344624cd0af166
1 <body>
2 <h1></h1>
3 <script>
4 // Test that a subresource fetched after onload, following a reload, is still
5 // loaded from the cache.
7 if (!sessionStorage.lastRandom) {
8 if (window.testRunner) {
9 testRunner.dumpAsText();
10 testRunner.waitUntilDone();
14 function done(result)
16 delete sessionStorage.lastRandom;
18 document.body.innerText = result;
20 if (window.testRunner)
21 testRunner.notifyDone();
24 function iframeLoaded()
26 setTimeout(function() {
27 if (!window.randomNumber)
28 done('FAIL: window.randomNumber not defined!');
29 else if (sessionStorage.lastRandom) {
30 if ((sessionStorage.lastRandom - 0) == (randomNumber - 0))
31 done('PASS');
32 else
33 done('FAIL');
34 } else {
35 sessionStorage.lastRandom = randomNumber;
36 location.reload();
38 }, 0);
41 onload = function()
43 // After onload, add a script tag that should always load from the cache.
44 setTimeout(function()
46 var f = document.createElement('iframe');
47 f.src = 'resources/loaded-from-cache-after-reload-within-iframe-subframe.html';
48 f.onload = iframeLoaded;
49 document.body.appendChild(f);
50 }, 1000);
52 </script>
53 </body>