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

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

Issue 14876007: Add Blink side support for SourceBuffer.appendWindowStart & SourceBuffer.appendWindowEnd. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: throw DOMException for set appendwindow error Created 7 years, 4 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
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="/w3c/resources/testharness.js"></script>
5 <script src="/w3c/resources/testharnessreport.js"></script>
6 <script src="mediasource-util.js"></script>
7 <link rel='stylesheet' href='/w3c/resources/testharness.css'>
8 </head>
9 <body>
10 <div id="log"></div>
11 <script>
12 mediasource_loaddata_test = function(callback, description)
13 {
14 mediasource_test(function(test, mediaElement, mediaSource)
15 {
16 var mediaType = 'video/webm;codecs="vp8,vorbis"';
acolwell GONE FROM CHROMIUM 2013/08/06 18:10:33 nit: Move this to a higher scope and reused the va
17 var mediaURL = '/media/resources/media-source/webm/test.webm';
18 var sourceBuffer = mediaSource.addSourceBuffer(mediaType);
19 MediaSourceUtil.loadBinaryData(test, mediaURL, function(mediaD ata)
20 {
21 callback(test, mediaElement, mediaSource, sourceBuffer, me diaData);
22
23 });
24 }, description);
25 };
26
27 mediasource_test(function(test, mediaElement, mediaSource)
acolwell GONE FROM CHROMIUM 2013/08/06 18:10:33 nit: add a space to fix indent.
28 {
29 var mimetype = 'video/webm;codecs="vp8,vorbis"';
30 var sourceBuffer = mediaSource.addSourceBuffer(mimetype);
31 assert_true(sourceBuffer != null, "New SourceBuffer returned");
32
33 sourceBuffer.appendWindowStart = 100.0;
34 sourceBuffer.appendWindowEnd = 500.0;
35 assert_equals(sourceBuffer.appendWindowStart, 100.0, "appendWindow Start is correctly set'");
36 assert_equals(sourceBuffer.appendWindowEnd, 500.0, "appendWindowEn d is correctly set'");
37
38 sourceBuffer.appendWindowStart = 200.0;
39 sourceBuffer.appendWindowEnd = 400.0;
40 assert_equals(sourceBuffer.appendWindowStart, 200.0, "appendWindow Start is correctly reset'");
41 assert_equals(sourceBuffer.appendWindowEnd, 400.0, "appendWindowEn d is correctly reset'");
42 test.done();
43 }, "Test correctly reset appendWindowStart and appendWindowEnd values" );
44
45 mediasource_test(function(test, mediaElement, mediaSource)
46 {
47 var mimetype = 'video/webm;codecs="vp8,vorbis"';
48 var sourceBuffer = mediaSource.addSourceBuffer(mimetype);
49 assert_true(sourceBuffer != null, "New SourceBuffer returned");
50 sourceBuffer.appendWindowEnd = 500.0;
51
52 assert_throws("InvalidAccessError",
53 function() { sourceBuffer.appendWindowStart = 600.0; },
54 "set appendWindowStart throws an exception when greater than a ppendWindowEnd.");
55
56 assert_throws("InvalidAccessError",
57 function() { sourceBuffer.appendWindowStart = -100.0; },
58 "set appendWindowStart throws an exception when less than 0.") ;
acolwell GONE FROM CHROMIUM 2013/08/06 18:10:33 nit: Test appendWindowStart with Number.NEGATIVE_I
59
60 assert_throws("InvalidAccessError",
61 function() { sourceBuffer.appendWindowEnd = "string"; },
acolwell GONE FROM CHROMIUM 2013/08/06 18:10:33 nit:s/"string"/Number.NaN/ since the description e
62 "set appendWindowEnd throws an exception if NaN.");
63 test.done();
64 }, "Test set wrong values to appendWindowStart and appendWindowEnd.");
65
66 mediasource_loaddata_test(function(test, mediaElement, mediaSource, so urceBuffer, mediaData)
67 {
68 sourceBuffer.appendBuffer(mediaData);
69
70 mediaSource.removeSourceBuffer(sourceBuffer);
71 assert_throws("InvalidStateError",
72 function() { sourceBuffer.appendWindowStart = 100.0; },
73 "set appendWindowStart throws an exception when mediasource ob ject is not associated with an buffer.");
acolwell GONE FROM CHROMIUM 2013/08/06 18:10:33 nit: s/an buffer/a buffer/
74
75 assert_throws("InvalidStateError",
76 function() { sourceBuffer.appendWindowEnd = 500.0; },
77 "set appendWindowEnd throws an exception when mediasource obje ct is not associated with an buffer.");
acolwell GONE FROM CHROMIUM 2013/08/06 18:10:33 nit: s/an buffer/a buffer/
78 test.done();
79
80 }, "Test appendwindow throw error when mediasource object is not assoc iated with an sourebuffer.");
acolwell GONE FROM CHROMIUM 2013/08/06 18:10:33 nit:s/an sourebuffer/a sourcebuffer/
81
82 mediasource_loaddata_test(function(test, mediaElement, mediaSource, so urceBuffer, mediaData)
83 {
84 sourceBuffer.appendBuffer(mediaData);
85 assert_true(sourceBuffer.updating, "updating attribute is true");
86
87 assert_throws("InvalidStateError",
88 function() { sourceBuffer.appendWindowStart = 100.0; },
89 "set appendWindowStart throws an exception when there is a pen ding append.");
90
91 assert_throws("InvalidStateError",
92 function() { sourceBuffer.appendWindowEnd = 500.0; },
93 "set appendWindowEnd throws an exception when there is a pendi ng append.");
94
95 test.waitForExpectedEvents(function()
96 {
97 assert_false(sourceBuffer.updating, "updating attribute is fals e");
98 test.done();
99 });
100 }, "Test set appendWindowStart and appendWindowEnd when source buffer updating.");
101
102 mediasource_loaddata_test(function(test, mediaElement, mediaSource, so urceBuffer, mediaData)
103 {
104 sourceBuffer.appendBuffer(mediaData);
105 assert_true(sourceBuffer.updating, "updating attribute is true");
106
107 sourceBuffer.abort();
108 assert_equals(sourceBuffer.appendWindowStart, 0, "appendWindowStar t is 0 when abort'");
acolwell GONE FROM CHROMIUM 2013/08/06 18:10:33 nit:s/when/after an/
109 assert_equals(sourceBuffer.appendWindowEnd, Number.POSITIVE_INFINI TY,
110 "appendWindowStart is POSITIVE_INFINITY when abort") ;
acolwell GONE FROM CHROMIUM 2013/08/06 18:10:33 nit:s/when/after an/
111 test.waitForExpectedEvents(function()
112 {
113 assert_false(sourceBuffer.updating, "updating attribute is fals e");
114 test.done();
115 });
116 }, "Test appendWindowStart and appendWindowEnd value if sourceBuffer.a bort().");
acolwell GONE FROM CHROMIUM 2013/08/06 18:10:33 nit:s/if/after a/
117
118 </script>
119 </body>
120 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698