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

Side by Side Diff: LayoutTests/http/tests/media/media-source/mediasource-addsourcebuffer.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
« no previous file with comments | « no previous file | LayoutTests/http/tests/media/media-source/mediasource-addsourcebuffer-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="/w3c/resources/testharness.js"></script> 4 <script src="/w3c/resources/testharness.js"></script>
5 <script src="/w3c/resources/testharnessreport.js"></script> 5 <script src="/w3c/resources/testharnessreport.js"></script>
6 <script src="mediasource-util.js"></script> 6 <script src="mediasource-util.js"></script>
7 7
8 <link rel='stylesheet' href='/w3c/resources/testharness.css'> 8 <link rel='stylesheet' href='/w3c/resources/testharness.css'>
9 </head> 9 </head>
10 <body> 10 <body>
11 <div id="log"></div> 11 <div id="log"></div>
12 <script> 12 <script>
13 mediasource_test(function(test, mediaElement, mediaSource) 13 mediasource_test(function(test, mediaElement, mediaSource)
14 { 14 {
15 mediaSource.endOfStream();
16 assert_throws("InvalidStateError",
17 function() { mediaSource.addSourceBuffer(MediaSourceUt il.AUDIO_VIDEO_TYPE); },
18 "addSourceBuffer() threw an exception when in 'ended' state.");
19 test.done();
20 }, "Test addSourceBuffer() in 'ended' state.");
21
22 mediasource_test(function(test, mediaElement, mediaSource)
23 {
15 assert_throws("InvalidAccessError", 24 assert_throws("InvalidAccessError",
16 function() { mediaSource.addSourceBuffer(""); }, 25 function() { mediaSource.addSourceBuffer(""); },
17 "addSourceBuffer() threw an exception when passed an e mpty string."); 26 "addSourceBuffer() threw an exception when passed an e mpty string.");
18 test.done(); 27 test.done();
19 }, "Test addSourceBuffer() with empty type"); 28 }, "Test addSourceBuffer() with empty type");
20 29
21 mediasource_test(function(test, mediaElement, mediaSource) 30 mediasource_test(function(test, mediaElement, mediaSource)
22 { 31 {
23 assert_throws("NotSupportedError", 32 assert_throws("NotSupportedError",
24 function() { mediaSource.addSourceBuffer("invalidType" ); }, 33 function() { mediaSource.addSourceBuffer("invalidType" ); },
25 "addSourceBuffer() threw an exception for an unsupport ed type."); 34 "addSourceBuffer() threw an exception for an unsupport ed type.");
26 test.done(); 35 test.done();
27 }, "Test addSourceBuffer() with unsupported type"); 36 }, "Test addSourceBuffer() with unsupported type");
28 37
29
30 mediasource_test(function(test, mediaElement, mediaSource) 38 mediasource_test(function(test, mediaElement, mediaSource)
31 { 39 {
32 var mimetype = 'video/webm;codecs="vp8,vorbis"'; 40 var mimetype = 'video/webm;codecs="vp8,vorbis"';
33 41
34 assert_true(MediaSource.isTypeSupported(mimetype), mimetype + " is supported"); 42 assert_true(MediaSource.isTypeSupported(mimetype), mimetype + " is supported");
35 43
36 var sourceBuffer = mediaSource.addSourceBuffer(mimetype); 44 var sourceBuffer = mediaSource.addSourceBuffer(mimetype);
37 assert_true(sourceBuffer != null, "New SourceBuffer returned"); 45 assert_true(sourceBuffer != null, "New SourceBuffer returned");
38 assert_equals(mediaSource.sourceBuffers[0], sourceBuffer, "SourceB uffer is in mediaSource.sourceBuffers"); 46 assert_equals(mediaSource.sourceBuffers[0], sourceBuffer, "SourceB uffer is in mediaSource.sourceBuffers");
39 assert_equals(mediaSource.activeSourceBuffers[0], sourceBuffer, "S ourceBuffer is in mediaSource.activeSourceBuffers"); 47 assert_equals(mediaSource.activeSourceBuffers[0], sourceBuffer, "S ourceBuffer is in mediaSource.activeSourceBuffers");
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 assert_true(MediaSource.isTypeSupported(audioMimetype), audioMimet ype + " is supported"); 87 assert_true(MediaSource.isTypeSupported(audioMimetype), audioMimet ype + " is supported");
80 88
81 var sourceBufferA = mediaSource.addSourceBuffer(videoMimetype); 89 var sourceBufferA = mediaSource.addSourceBuffer(videoMimetype);
82 var sourceBufferB = mediaSource.addSourceBuffer(audioMimetype); 90 var sourceBufferB = mediaSource.addSourceBuffer(audioMimetype);
83 assert_equals(mediaSource.sourceBuffers[0], sourceBufferA, "source BufferA is in mediaSource.sourceBuffers"); 91 assert_equals(mediaSource.sourceBuffers[0], sourceBufferA, "source BufferA is in mediaSource.sourceBuffers");
84 assert_equals(mediaSource.activeSourceBuffers[0], sourceBufferA, " sourceBufferA is in mediaSource.activeSourceBuffers"); 92 assert_equals(mediaSource.activeSourceBuffers[0], sourceBufferA, " sourceBufferA is in mediaSource.activeSourceBuffers");
85 assert_equals(mediaSource.sourceBuffers[1], sourceBufferB, "source BufferB is in mediaSource.sourceBuffers"); 93 assert_equals(mediaSource.sourceBuffers[1], sourceBufferB, "source BufferB is in mediaSource.sourceBuffers");
86 assert_equals(mediaSource.activeSourceBuffers[1], sourceBufferB, " sourceBufferB is in mediaSource.activeSourceBuffers"); 94 assert_equals(mediaSource.activeSourceBuffers[1], sourceBufferB, " sourceBufferB is in mediaSource.activeSourceBuffers");
87 test.done(); 95 test.done();
88 }, "Test addSourceBuffer() with AAC and H.264 in separate SourceBuffer s"); 96 }, "Test addSourceBuffer() with AAC and H.264 in separate SourceBuffer s");
97
98 mediasource_test(function(test, mediaElement, mediaSource)
99 {
100 var reachedLimit = false;
101
102 // The 20 here is an arbitrary upper limit to make sure the test te rminates. This test
103 // assumes that implementations won't support more than 20 SourceBu ffers simultaneously.
104 for (var i = 0; i < 20; ++i) {
105 try {
106 mediaSource.addSourceBuffer(MediaSourceUtil.AUDIO_VIDEO_TYP E);
107 } catch(e) {
108 assert_equals(e.name, "QuotaExceededError");
109 reachedLimit = true;
110 break;
111 }
112 }
113 assert_true(reachedLimit, "Reached SourceBuffer limit.");
114 test.done();
115 }, "Test addSourceBuffer() QuotaExceededError.");
89 </script> 116 </script>
90 </body> 117 </body>
91 </html> 118 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/http/tests/media/media-source/mediasource-addsourcebuffer-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698