Skip to content

Commit

Permalink
Test that clear buffer is false
Browse files Browse the repository at this point in the history
When changing restrictions, we don't need to clear the buffers. This tests
checks that when we change the config to change the ABR restrictions,
we do not clear the buffers.

Change-Id: I04e360c7fdfa008d7ae9a8050974bcd28f1d3388
Closes: #1009
  • Loading branch information
vaage authored and joeyparrish committed Nov 1, 2017
1 parent 454d366 commit 3fd0887
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions test/player_unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,43 @@ describe('Player', function() {
.catch(fail)
.then(done);
});

it('does not clear buffers when restrictions change', function(done) {
var smallBandwidth = 200000;
var largeBandwidth = 1000000;

var smallDelay = 0.5;
var doNotClear = false;

var smallBandwidthSettings = {
abr: {restrictions: {maxBandwidth: smallBandwidth}}
};

var largeBandwidthSettings = {
abr: {restrictions: {maxBandwidth: largeBandwidth}}
};

var parser = new shaka.test.FakeManifestParser(manifest);
var factory = function() { return parser; };

var switchVariantSpy = spyOn(player, 'switchVariant_');

player.configure(smallBandwidthSettings);

player.load('', 0, factory)
.then(function() {
player.configure(largeBandwidthSettings);
// Delay to ensure that the switch would have been called.
return shaka.test.Util.delay(smallDelay);
})
.then(function() {
expect(switchVariantSpy).toHaveBeenCalledWith(
/* variant */ jasmine.anything(),
doNotClear);
})
.catch(fail)
.then(done);
});
});

describe('AbrManager', function() {
Expand Down

0 comments on commit 3fd0887

Please sign in to comment.