2009-08-20 Eric Carlson <eric.carlson@apple.com>
[WebKit-https.git] / LayoutTests / media / media-load-event.html
1 <html>
2     <head>
3         <script src=video-test.js></script>
4
5         <script>
6
7             function playing()
8             {
9                 consoleWrite("EVENT(playing)<br>");
10                 endTest();
11             }
12
13             function loadend()
14             {
15                 consoleWrite("EVENT(loadend)");
16                 consoleWrite("");
17                 run("document.getElementById('parent').appendChild(mediaElement)");
18                 run("mediaElement.play()");
19                 consoleWrite("");
20             }
21
22             function start()
23             {
24                 run("mediaElement = document.createElement('audio')");
25
26                 mediaElement.setAttribute('onloadend', "loadend()");
27                 mediaElement.setAttribute('onplaying', "playing()");
28
29                 waitForEvent("loadstart");
30                 waitForEvent("load");
31                 waitForEvent("waiting");
32                 waitForEvent("ratechange");
33                 waitForEvent("durationchange");
34                 waitForEvent("pause");
35                 waitForEvent("play");
36                 waitForEvent('loadeddata');
37
38                 run("mediaElement.src = 'content/test.wav'");
39                 run("mediaElement.load()");
40
41                 consoleWrite("");
42             }
43
44         </script>
45     </head>
46
47     <body onload="start()">
48
49     <p>Test that media file is not reloaded when an element is inserted into the DOM.</p>
50
51     <div id="parent"></div>
52     
53     </body>
54 </html>