Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / appcache / video.html
blobece05b53e916eb80a98d6fc03a2ee86d34164838
1 <!DOCTYPE html>
2 <html manifest="resources/video.manifest">
3 <head>
4 <title>test media in the app cache</title>
5 <style>
6 video { background-color: yellow; width: 320px; height: 240px; }
7 </style>
8 <script src=/media-resources/media-file.js></script>
9 <script src=/media-resources/video-test.js></script>
10 <script>
11 var test;
13 function unexpectedEvent(event)
15 failTest(false, '<br>Unexpected "' + event.type + '" event!!');
18 function errorEvent()
20 consoleWrite("");
21 switch(test)
23 case 1:
24 failTest(false, "Failed loading file included in manifest!");
25 break;
26 case 2:
27 test3()
28 break;
29 case 3:
30 endTest();
31 break;
35 function durationchangeEvent()
37 switch(test)
39 case 1:
40 test2();
41 break;
42 case 2:
43 failTest("<br>Loaded file NOT included in manifest!");
44 break;
45 case 3:
46 failTest("<br>Loaded JavaScript file as media!");
47 break;
51 function test3()
53 consoleWrite("*** Setting 'src' to non-media file that is in manifest. This file should fail to load.<br>");
55 test = 3;
56 video = document.getElementsByTagName('video')[0];
57 video.src = "/media-resources/media-file.js";
60 function test2()
62 consoleWrite("<br>*** Setting 'src' to valid media file not in manifest. This file should fail to load.<br>");
64 test = 2;
65 video = document.getElementsByTagName('video')[0];
66 video.src = "/media-resources/content/" + findMediaFile("audio", "silence");
69 function test1()
71 consoleWrite("*** Setting 'src' to file specified in manifest. This file should load.<br>");
72 test = 1;
74 waitForEvent('durationchange', durationchangeEvent);
75 waitForEvent('error', errorEvent);
77 video = document.getElementsByTagName('video')[0];
78 video.src = "/media-resources/content/" + findMediaFile("video", "test");
81 function updateready(event)
83 applicationCache.swapCache();
84 test1();
87 applicationCache.addEventListener("updateready", updateready, false);
88 applicationCache.addEventListener("noupdate", test1, false);
89 applicationCache.addEventListener("cached", test1, false);
91 applicationCache.addEventListener("obsolete", unexpectedEvent, false);
92 applicationCache.addEventListener("error", unexpectedEvent, false);
93 </script>
95 </head>
96 <body>
98 <video controls ></video>
100 <p>Test that &lt;video&gt; can be loaded from the application cache.</p>
101 </body>
102 </html>