Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(435)

Side by Side Diff: LayoutTests/http/tests/media/media-source/mediasource-garbage-collection-before-sourceopen.html

Issue 245893002: Improve unprefixed MediaSource test coverage. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="/media-resources/video-test.js"></script> 4 <script src="/media-resources/video-test.js"></script>
5 </head> 5 </head>
6 <body> 6 <body>
7 <video autoplay controls="controls" id='vid'></video> 7 <video autoplay controls="controls" id='vid'></video>
8 <p>Tests that webkitsourceopen event fires even if garbage collection ha ppens between setting video.src &amp; the webkitsourceopen event.</p> 8 <p>Tests that sourceopen event fires even if garbage collection happens between setting video.src &amp; the sourceopen event.</p>
9 <script type="text/javascript"> 9 <script type="text/javascript">
10 function createMediaSourceURL() 10 function createMediaSourceURL()
11 { 11 {
12 var mediaSource = new WebKitMediaSource(); 12 var mediaSource = new MediaSource();
13 var onSourceOpen = function (e) 13 var onSourceOpen = function (e)
14 { 14 {
15 sourceOpened = true; 15 sourceOpened = true;
16 consoleWrite("onSourceOpen called."); 16 consoleWrite("onSourceOpen called.");
17 endTest(); 17 endTest();
18 }; 18 };
19 consoleWrite("Setting webkitsourceopen event listener."); 19 consoleWrite("Setting sourceopen event listener.");
20 mediaSource.addEventListener('webkitsourceopen', onSourceOpen); 20 mediaSource.addEventListener('sourceopen', onSourceOpen);
21 return window.URL.createObjectURL(mediaSource); 21 return window.URL.createObjectURL(mediaSource);
22 } 22 }
23 23
24 function start() 24 function start()
25 { 25 {
26 var video = document.getElementById('vid'); 26 var video = document.getElementById('vid');
27 var sourceOpened = false; 27 var sourceOpened = false;
28 var onStalled = function (e) 28 var onStalled = function (e)
29 { 29 {
30 if (sourceOpened) 30 if (sourceOpened)
31 return; 31 return;
32 32
33 failTest('stalled event fired before webkitsourceopen'); 33 failTest('stalled event fired before sourceopen');
34 }; 34 };
35 video.addEventListener('stalled', onStalled); 35 video.addEventListener('stalled', onStalled);
36 36
37 var url = createMediaSourceURL(); 37 var url = createMediaSourceURL();
38 consoleWrite("Running garbage collector."); 38 consoleWrite("Running garbage collector.");
39 gc(); 39 gc();
40 40
41 consoleWrite("Setting video.src to object URL."); 41 consoleWrite("Setting video.src to object URL.");
42 video.src = url; 42 video.src = url;
43 } 43 }
44 start(); 44 start();
45 </script> 45 </script>
46 </body> 46 </body>
47 </html> 47 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698