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

Side by Side Diff: LayoutTests/http/tests/media/media-source/mediasource-endofstream-invaliderror.html

Issue 267333006: Adding a few new MSE tests based on the spec. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Addressing CR comments Created 6 years, 7 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
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 <link rel='stylesheet' href='/w3c/resources/testharness.css'> 7 <link rel='stylesheet' href='/w3c/resources/testharness.css'>
8 </head> 8 </head>
9 <body> 9 <body>
10 <div id="log"></div> 10 <div id="log"></div>
(...skipping 22 matching lines...) Expand all
33 33
34 assert_equals(mediaSource.readyState, 'open'); 34 assert_equals(mediaSource.readyState, 'open');
35 test.done(); 35 test.done();
36 }, 'Test MediaSource.endOfStream() with invalid empty error string.'); 36 }, 'Test MediaSource.endOfStream() with invalid empty error string.');
37 37
38 mediasource_test(function(test, mediaElement, mediaSource) 38 mediasource_test(function(test, mediaElement, mediaSource)
39 { 39 {
40 test.failOnEvent(mediaElement, 'error'); 40 test.failOnEvent(mediaElement, 'error');
41 assert_equals(mediaSource.readyState, 'open'); 41 assert_equals(mediaSource.readyState, 'open');
42 42
43 test.expectEvent(mediaSource, 'sourceend');
44 mediaSource.endOfStream();
45
46 assert_equals(mediaSource.readyState, 'ended');
47 assert_throws("InvalidStateError",
48 function() { mediaSource.endOfStream(); },
49 "endofStream() threw an exception when in ended state");
50
51 test.done();
52 }, 'Test MediaSource.endOfStream() with when readyState is ended.');
53
54 mediasource_test(function(test, mediaElement, mediaSource)
55 {
56 test.failOnEvent(mediaElement, 'error');
57 assert_equals(mediaSource.readyState, 'open');
58
59 test.expectEvent(mediaSource, 'sourceend');
60 mediaSource.endOfStream();
61
62 assert_equals(mediaSource.readyState, 'ended');
63 assert_throws("InvalidStateError",
64 function() { mediaSource.endOfStream("decode"); },
65 "endofStream() threw an exception when in ended state");
66
67 test.done();
68 }, 'Test MediaSource.endOfStream(decode) with when readyState is ended .');
69
70 mediasource_test(function(test, mediaElement, mediaSource)
71 {
72 test.failOnEvent(mediaElement, 'error');
73 assert_equals(mediaSource.readyState, 'open');
74
75 test.expectEvent(mediaSource, 'sourceend');
76 mediaSource.endOfStream();
77
78 assert_equals(mediaSource.readyState, 'ended');
79 assert_throws("InvalidStateError",
80 function() { mediaSource.endOfStream("network"); },
81 "endofStream() threw an exception when in ended state");
82
83 test.done();
84 }, 'Test MediaSource.endOfStream(network) with when readyState is ende d.');
85
86 mediasource_test(function(test, mediaElement, mediaSource)
87 {
88 test.failOnEvent(mediaElement, 'error');
89 assert_equals(mediaSource.readyState, 'open');
90
43 assert_throws(new TypeError(), 91 assert_throws(new TypeError(),
44 function() { mediaSource.endOfStream(null); }, 92 function() { mediaSource.endOfStream(null); },
45 'endOfStream(null) throws TypeError'); 93 'endOfStream(null) throws TypeError');
46 94
47 assert_equals(mediaSource.readyState, 'open'); 95 assert_equals(mediaSource.readyState, 'open');
48 test.done(); 96 test.done();
49 }, 'Test MediaSource.endOfStream() with invalid null error parameter.' ); 97 }, 'Test MediaSource.endOfStream() with invalid null error parameter.' );
50 </script> 98 </script>
51 </body> 99 </body>
52 </html> 100 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698