3 <script src=media-file.js></script>
4 <script src=video-test.js></script>
6 var mediaFile = findMediaFile("video", "content/test");
9 if (window.layoutTestController) {
10 layoutTestController.dumpAsText();
11 layoutTestController.waitUntilDone();
12 layoutTestController.overridePreference("WebKitUsesPageCachePreferenceKey", 1);
15 function pageshow(evt)
18 // this is the first time the page has been loaded, setup the video element
21 consoleWrite("*** Page returned from cache");
23 testExpected("loadCount", 1);
25 // schedule the test to end shortly, but wait long enough for the element to fire loading events
26 // if that is going to happen
27 setTimeout(function() { if (window.layoutTestController) layoutTestController.notifyDone(); }, 200);
31 function canplaythrough()
33 testExpected("loadCount", 0);
35 consoleWrite("*** Page going into cache");
36 setTimeout('window.location = "data:text/html,<script>history.back()<" + "/script>"', 0);
43 video = mediaElement = document.getElementsByTagName('video')[0];
45 waitForEvent('loadstart');
46 waitForEvent('canplaythrough', canplaythrough);
48 video.src = mediaFile;
51 window.onpageshow = pageshow;
56 <video controls > </video>
57 <p>Make sure we don't reload a <video> element when navigating back to an uncached page.</p>