8b13aaa9 by jrivera

Added a test for calling remove on the sourceBuffer when loadSegment is called

1 parent b653e0ce
...@@ -373,6 +373,39 @@ test('duration is set when the source opens after the playlist is loaded', funct ...@@ -373,6 +373,39 @@ test('duration is set when the source opens after the playlist is loaded', funct
373 equal(player.tech_.hls.mediaSource.duration , 40, 'set the duration'); 373 equal(player.tech_.hls.mediaSource.duration , 40, 'set the duration');
374 }); 374 });
375 375
376 test('calls `remove` on sourceBuffer to when loading a segment', function() {
377 var removes = [];
378 player.src({
379 src: 'manifest/master.m3u8',
380 type: 'application/vnd.apple.mpegurl'
381 });
382 openMediaSource(player);
383 player.tech_.hls.mediaSource.addSourceBuffer = function() {
384 return new (videojs.extend(videojs.EventTarget, {
385 constructor: function() {},
386 abort: function() {},
387 buffered: videojs.createTimeRange(),
388 appendBuffer: function() {},
389 remove: function(start, end) {
390 removes.push([start, end]);
391 }
392 }))();
393 };
394 player.tech_.hls.bandwidth = 20e10;
395 standardXHRResponse(requests[0]);
396 player.currentTime(120);
397 standardXHRResponse(requests[1]);
398 standardXHRResponse(requests[2]);
399
400 strictEqual(requests[0].url, 'manifest/master.m3u8', 'master playlist requested');
401 strictEqual(requests[1].url,
402 absoluteUrl('manifest/media3.m3u8'),
403 'media playlist requested');
404 equal(removes.length, 1, 'remove called');
405 deepEqual(removes[0], [0, 120 - 60], 'remove called with the right range');
406 });
407
408
376 test('codecs are passed to the source buffer', function() { 409 test('codecs are passed to the source buffer', function() {
377 var codecs = []; 410 var codecs = [];
378 player.src({ 411 player.src({
......