| OLD | NEW |
| (Empty) |
| 1 <html> | |
| 2 <head> | |
| 3 <script src=media-file.js></script> | |
| 4 <script src=video-test.js></script> | |
| 5 <script> | |
| 6 var mediaFile = findMediaFile("video", "content/test"); | |
| 7 var loadCount = 0; | |
| 8 | |
| 9 if (window.testRunner) { | |
| 10 testRunner.dumpAsText(); | |
| 11 testRunner.waitUntilDone(); | |
| 12 testRunner.overridePreference("WebKitUsesPageCachePreferenceKey"
, 1); | |
| 13 } | |
| 14 | |
| 15 function pageshow(evt) | |
| 16 { | |
| 17 if (!evt.persisted) { | |
| 18 // this is the first time the page has been loaded, setup th
e video element | |
| 19 setup(); | |
| 20 } else { | |
| 21 consoleWrite("*** Page returned from cache"); | |
| 22 | |
| 23 testExpected("loadCount", 1); | |
| 24 | |
| 25 // schedule the test to end shortly, but wait long enough fo
r the element to fire loading events | |
| 26 // if that is going to happen | |
| 27 setTimeout(function() { if (window.testRunner) testRunner.no
tifyDone(); }, 200); | |
| 28 } | |
| 29 } | |
| 30 | |
| 31 function canplaythrough() | |
| 32 { | |
| 33 testExpected("loadCount", 0); | |
| 34 if (!loadCount) { | |
| 35 consoleWrite("*** Page going into cache"); | |
| 36 setTimeout('window.location = "data:text/html,<script>histor
y.back()<" + "/script>"', 0); | |
| 37 } | |
| 38 ++loadCount; | |
| 39 } | |
| 40 | |
| 41 function setup() | |
| 42 { | |
| 43 video = mediaElement = document.getElementsByTagName('video')[0]
; | |
| 44 | |
| 45 waitForEvent('loadstart'); | |
| 46 waitForEvent('canplaythrough', canplaythrough); | |
| 47 | |
| 48 video.src = mediaFile; | |
| 49 } | |
| 50 | |
| 51 window.onpageshow = pageshow; | |
| 52 </script> | |
| 53 </head> | |
| 54 <body> | |
| 55 | |
| 56 <video controls > </video> | |
| 57 <p>Make sure we don't reload a <video> element when navigating bac
k to an uncached page.</p> | |
| 58 </body> | |
| 59 </html> | |
| 60 | |
| OLD | NEW |