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

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

Issue 552943002: MSE: Start letting SourceBuffer begin to do initialization segment received algorithm (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updated to be part 1 of a 3-sided blink->chromium->blink set of changes Created 6 years, 3 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 (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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 oldTestDone(); 353 oldTestDone();
354 }; 354 };
355 355
356 openMediaSource_(test, mediaTag, function(mediaSource) 356 openMediaSource_(test, mediaTag, function(mediaSource)
357 { 357 {
358 testFunction(test, mediaTag, mediaSource); 358 testFunction(test, mediaTag, mediaSource);
359 }); 359 });
360 }, description, options); 360 }, description, options);
361 }; 361 };
362 362
363 window['mediasource_testafterdataloaded'] = function(testFunction, descripti on, options) 363 window['mediasource_testafterdataloaded_internal'] = function(testFunction, description, failOnMediaElementError, options)
acolwell GONE FROM CHROMIUM 2014/09/10 17:16:26 Don't make this available on the window object sin
wolenetz 2014/09/10 21:18:22 Done (see next comment).
364 { 364 {
365 mediasource_test(function(test, mediaElement, mediaSource) 365 mediasource_test(function(test, mediaElement, mediaSource)
366 { 366 {
367 var segmentInfo = MediaSourceUtil.SEGMENT_INFO; 367 var segmentInfo = MediaSourceUtil.SEGMENT_INFO;
368 368
369 if (!segmentInfo) { 369 if (!segmentInfo) {
370 assert_unreached("No segment info compatible with this MediaSour ce implementation."); 370 assert_unreached("No segment info compatible with this MediaSour ce implementation.");
371 return; 371 return;
372 } 372 }
373 373
374 test.failOnEvent(mediaElement, 'error'); 374 if (failOnMediaElementError)
375 test.failOnEvent(mediaElement, 'error');
375 376
376 var sourceBuffer = mediaSource.addSourceBuffer(segmentInfo.type); 377 var sourceBuffer = mediaSource.addSourceBuffer(segmentInfo.type);
377 MediaSourceUtil.loadBinaryData(test, segmentInfo.url, function(media Data) 378 MediaSourceUtil.loadBinaryData(test, segmentInfo.url, function(media Data)
378 { 379 {
379 testFunction(test, mediaElement, mediaSource, segmentInfo, sourc eBuffer, mediaData); 380 testFunction(test, mediaElement, mediaSource, segmentInfo, sourc eBuffer, mediaData);
380 }); 381 });
381 }, description, options); 382 }, description, options);
382 } 383 };
384
385 window['mediasource_testafterdataloaded'] = function(testFunction, descripti on, options)
386 {
387 mediasource_testafterdataloaded_internal(testFunction, description, true , options);
388 };
389
390 window['mediasource_testafterdataloaded_nofailonerror'] = function(testFunct ion, description, options)
acolwell GONE FROM CHROMIUM 2014/09/10 17:16:26 any reason not to use |options| for this instead o
wolenetz 2014/09/10 21:18:22 Done (renamed options->properties to match async_t
391 {
392 mediasource_testafterdataloaded_internal(testFunction, description, fals e, options);
393 };
383 394
384 function timeRangesToString(ranges) 395 function timeRangesToString(ranges)
385 { 396 {
386 var s = "{"; 397 var s = "{";
387 for (var i = 0; i < ranges.length; ++i) { 398 for (var i = 0; i < ranges.length; ++i) {
388 s += " [" + ranges.start(i).toFixed(3) + ", " + ranges.end(i).toFixe d(3) + ")"; 399 s += " [" + ranges.start(i).toFixed(3) + ", " + ranges.end(i).toFixe d(3) + ")";
389 } 400 }
390 return s + " }"; 401 return s + " }";
391 } 402 }
392 403
393 window['assertBufferedEquals'] = function(obj, expected, description) 404 window['assertBufferedEquals'] = function(obj, expected, description)
394 { 405 {
395 var actual = timeRangesToString(obj.buffered); 406 var actual = timeRangesToString(obj.buffered);
396 assert_equals(actual, expected, description); 407 assert_equals(actual, expected, description);
397 }; 408 };
398 409
399 })(window); 410 })(window);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698