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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-util.js

Issue 2467233002: Remove "legacy" experimental stream support (Closed)
Patch Set: fix Created 4 years, 1 month 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 (function(window) { 1 (function(window) {
2 // Set the testharness.js timeout to 120 seconds so that it is higher than 2 // Set the testharness.js timeout to 120 seconds so that it is higher than
3 // the LayoutTest timeout. This prevents testharness.js from prematurely 3 // the LayoutTest timeout. This prevents testharness.js from prematurely
4 // terminating tests and allows the LayoutTest runner to control when to 4 // terminating tests and allows the LayoutTest runner to control when to
5 // timeout the test. 5 // timeout the test.
6 setup({ explicit_timeout: 120000 }); 6 setup({ explicit_timeout: 120000 });
7 7
8 var SEGMENT_INFO_LIST = [ 8 var SEGMENT_INFO_LIST = [
9 { 9 {
10 url: '/media/resources/media-source/webm/test.webm', 10 url: '/media/resources/media-source/webm/test.webm',
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 MediaSourceUtil.loadTextData = function(test, url, callback) 174 MediaSourceUtil.loadTextData = function(test, url, callback)
175 { 175 {
176 loadData_(test, url, callback); 176 loadData_(test, url, callback);
177 }; 177 };
178 178
179 MediaSourceUtil.loadBinaryData = function(test, url, callback) 179 MediaSourceUtil.loadBinaryData = function(test, url, callback)
180 { 180 {
181 loadData_(test, url, callback, 'arraybuffer'); 181 loadData_(test, url, callback, 'arraybuffer');
182 }; 182 };
183 183
184 MediaSourceUtil.loadDataStream = function(test, url, callback)
185 {
186 loadData_(test, url, callback, 'legacystream');
187 };
188
189 MediaSourceUtil.fetchManifestAndData = function(test, manifestFilename, call back) 184 MediaSourceUtil.fetchManifestAndData = function(test, manifestFilename, call back)
190 { 185 {
191 var baseURL = '/media/resources/media-source/'; 186 var baseURL = '/media/resources/media-source/';
192 var manifestURL = baseURL + manifestFilename; 187 var manifestURL = baseURL + manifestFilename;
193 MediaSourceUtil.loadTextData(test, manifestURL, function(manifestText) 188 MediaSourceUtil.loadTextData(test, manifestURL, function(manifestText)
194 { 189 {
195 var manifest = JSON.parse(manifestText); 190 var manifest = JSON.parse(manifestText);
196 191
197 assert_true(MediaSource.isTypeSupported(manifest.type), manifest.typ e + " is supported."); 192 assert_true(MediaSource.isTypeSupported(manifest.type), manifest.typ e + " is supported.");
198 193
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 function () { // doAppendDataFunc 250 function () { // doAppendDataFunc
256 appendedDataSize += mediaData.length; 251 appendedDataSize += mediaData.length;
257 sourceBuffer.appendBuffer(mediaData); 252 sourceBuffer.appendBuffer(mediaData);
258 }, 253 },
259 function () { // onCaughtQuotaExceeded 254 function () { // onCaughtQuotaExceeded
260 onBufferFull(appendedDataSize); 255 onBufferFull(appendedDataSize);
261 }); 256 });
262 }); 257 });
263 }; 258 };
264 259
265 MediaSourceUtil.fillUpSourceBufferViaAppendStream = function (test, mediaSou rce, sourceBuffer, mediaURL, onBufferFull, appendSize)
266 {
267 var appendedDataSize = 0;
268 function appendStreamData() {
269 MediaSourceUtil.loadDataStream(test, mediaURL, function(response)
270 {
271 // We are appending data repeatedly in sequence mode, there shou ld be no gaps.
272 assert_false(sourceBuffer.buffered.length > 1, "unexpected gap i n buffered ranges.");
273 try {
274 if (appendSize !== undefined) {
275 appendedDataSize += appendSize;
276 sourceBuffer.appendStream(response, appendSize);
277 } else {
278 sourceBuffer.appendStream(response);
279 }
280 } catch(ex) {
281 assert_equals(ex.name, 'QuotaExceededError');
282 onBufferFull(appendedDataSize);
283 }
284 test.expectEvent(sourceBuffer, "updateend", "Append ended.");
285 test.waitForExpectedEvents(appendStreamData);
286 });
287 }
288 // Start appending data
289 appendStreamData();
290 };
291
292
293 function getFirstSupportedType(typeList) 260 function getFirstSupportedType(typeList)
294 { 261 {
295 for (var i = 0; i < typeList.length; ++i) { 262 for (var i = 0; i < typeList.length; ++i) {
296 if (MediaSource.isTypeSupported(typeList[i])) 263 if (MediaSource.isTypeSupported(typeList[i]))
297 return typeList[i]; 264 return typeList[i];
298 } 265 }
299 return ""; 266 return "";
300 } 267 }
301 268
302 function getSegmentInfo() 269 function getSegmentInfo()
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 assert_equals(actual, expected, description); 435 assert_equals(actual, expected, description);
469 }; 436 };
470 437
471 window['assertSeekableEquals'] = function(obj, expected, description) 438 window['assertSeekableEquals'] = function(obj, expected, description)
472 { 439 {
473 var actual = timeRangesToString(obj.seekable); 440 var actual = timeRangesToString(obj.seekable);
474 assert_equals(actual, expected, description); 441 assert_equals(actual, expected, description);
475 }; 442 };
476 443
477 })(window); 444 })(window);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698