Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / media / audio-delete-while-slider-thumb-clicked.html
blob322075fc4d413ae0205be3b694b98d6ef73625d5
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src=media-file.js></script>
5 <script src=video-test.js></script>
6 <script src=media-controls.js></script>
7 <script>
8 if (window.testRunner) {
9 testRunner.dumpAsText();
10 testRunner.waitUntilDone();
13 function log(msg)
15 var console = document.getElementById('console');
16 console.innerHTML = console.innerHTML + msg + "<br>";
19 function forceGC()
21 if (window.GCController)
22 return GCController.collect();
24 // Force garbage collection
25 for (var ndx = 0; ndx < 99000; ndx++)
26 var str = new String("1234");
29 function buttonClick()
31 forceGC();
33 if (document.getElementById('audio'))
34 log("<br>FAIL: audio element not deleted!!");
36 log("<br>clicking button");
38 // click the button
39 var button = document.getElementById('button');
40 eventSender.mouseMoveTo(button.offsetLeft + 20, button.offsetTop + 7);
41 eventSender.mouseDown();
42 eventSender.mouseUp();
44 testRunner.notifyDone();
47 function deleteAudio()
49 var audio = document.getElementById('audio');
50 if (!audio)
51 return;
53 log("<br>deleting audio element");
54 audio.parentNode.removeChild(audio);
56 setTimeout(buttonClick, 10);
59 function drag()
61 if (!window.testRunner)
62 return;
64 testRunner.dumpAsText();
65 testRunner.waitUntilDone();
67 var audio = document.getElementById('audio');
68 var seekCoords;
69 try {
70 seekCoords = mediaControlsButtonCoordinates(audio, "timeline");
71 } catch (exception) {
72 failTest(exception.description);
73 return;
75 var x = seekCoords[0];
76 var y = seekCoords[1];
78 // Click in the slider to get the thumb under the mouse.
79 log("clicking in controller");
80 eventSender.mouseMoveTo(x, y);
81 eventSender.mouseDown();
82 eventSender.mouseUp();
84 // Click slider to scrub, leave the mouse down.
85 log("clicking on thumb");
86 eventSender.mouseDown();
87 eventSender.mouseMoveTo(x, y + 20);
89 // Remove the element after seeking started
90 audio.addEventListener("seeking", deleteAudio);
94 function start()
96 setSrcByTagName("audio", findMediaFile("audio", "content/test"));
99 </script>
100 </head>
101 <body onload="start()">
102 This tests that events don't continue to target a slider thumb if the media element is deleted while scrubbing.
103 <br>
104 <input type="button" id="button" value="Click Me!" onmouseup="log('button click!')">
105 <br>
106 <audio id="audio" autoplay onplaying="drag()" controls></audio><br><br>
107 <div id="console"></div>
108 </body>
109 </html>