Skip to content
This repository has been archived by the owner on Jan 12, 2019. It is now read-only.

Commit

Permalink
Test for correct segment references on pending segments
Browse files Browse the repository at this point in the history
  • Loading branch information
gesinger committed Jan 24, 2017
1 parent 016913a commit 279f6e4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/segment-loader.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -996,6 +996,7 @@ function(assert) {
loader.load();

assert.equal(loader.pendingSegment_.uri, '0.ts', 'retrieving first segment');
assert.equal(loader.pendingSegment_.segment.uri, '0.ts', 'correct segment reference');
assert.equal(loader.state, 'WAITING', 'waiting for response');

this.requests[0].response = new Uint8Array(10).buffer;
Expand All @@ -1011,6 +1012,7 @@ function(assert) {
mediaSource.sourceBuffers[0].trigger('updateend');

assert.equal(loader.pendingSegment_.uri, '1.ts', 'retrieving second segment');
assert.equal(loader.pendingSegment_.segment.uri, '1.ts', 'correct segment reference');
assert.equal(loader.state, 'WAITING', 'waiting for response');
});

Expand All @@ -1026,6 +1028,7 @@ function(assert) {

assert.equal(loader.state, 'WAITING', 'in waiting state');
assert.equal(loader.pendingSegment_.uri, '0.ts', 'first segment pending');
assert.equal(loader.pendingSegment_.segment.uri, '0.ts', 'correct segment reference');

// wrap up the first request to set mediaIndex and start normal live streaming
this.requests[0].response = new Uint8Array(10).buffer;
Expand All @@ -1035,6 +1038,7 @@ function(assert) {

assert.equal(loader.state, 'WAITING', 'in waiting state');
assert.equal(loader.pendingSegment_.uri, '1.ts', 'second segment pending');
assert.equal(loader.pendingSegment_.segment.uri, '1.ts', 'correct segment reference');

// playlist updated during waiting
let playlistUpdated = playlistWithDuration(40);
Expand All @@ -1045,6 +1049,7 @@ function(assert) {
loader.playlist(playlistUpdated);

assert.equal(loader.pendingSegment_.uri, '1.ts', 'second segment still pending');
assert.equal(loader.pendingSegment_.segment.uri, '1.ts', 'correct segment reference');

this.requests[0].response = new Uint8Array(10).buffer;
this.requests.shift().respond(200, null, '');
Expand All @@ -1054,6 +1059,7 @@ function(assert) {
// response
assert.equal(loader.state, 'APPENDING', 'moved to appending state');
assert.equal(loader.pendingSegment_.uri, '1.ts', 'still using second segment');
assert.equal(loader.pendingSegment_.segment.uri, '1.ts', 'correct segment reference');
});

QUnit.test('saves segment info to new segment after playlist refresh',
Expand All @@ -1068,6 +1074,7 @@ function(assert) {

assert.equal(loader.state, 'WAITING', 'in waiting state');
assert.equal(loader.pendingSegment_.uri, '0.ts', 'first segment pending');
assert.equal(loader.pendingSegment_.segment.uri, '0.ts', 'correct segment reference');

// wrap up the first request to set mediaIndex and start normal live streaming
this.requests[0].response = new Uint8Array(10).buffer;
Expand All @@ -1077,6 +1084,7 @@ function(assert) {

assert.equal(loader.state, 'WAITING', 'in waiting state');
assert.equal(loader.pendingSegment_.uri, '1.ts', 'second segment pending');
assert.equal(loader.pendingSegment_.segment.uri, '1.ts', 'correct segment reference');

// playlist updated during waiting
let playlistUpdated = playlistWithDuration(40);
Expand All @@ -1086,6 +1094,7 @@ function(assert) {
loader.playlist(playlistUpdated);

assert.equal(loader.pendingSegment_.uri, '1.ts', 'second segment still pending');
assert.equal(loader.pendingSegment_.segment.uri, '1.ts', 'correct segment reference');

// mock probeSegmentInfo as the response bytes aren't parsable (and won't provide
// time info)
Expand Down Expand Up @@ -1119,6 +1128,7 @@ function(assert) {

assert.equal(loader.state, 'WAITING', 'in waiting state');
assert.equal(loader.pendingSegment_.uri, '0.ts', 'first segment pending');
assert.equal(loader.pendingSegment_.segment.uri, '0.ts', 'correct segment reference');

// wrap up the first request to set mediaIndex and start normal live streaming
this.requests[0].response = new Uint8Array(10).buffer;
Expand All @@ -1128,6 +1138,7 @@ function(assert) {

assert.equal(loader.state, 'WAITING', 'in waiting state');
assert.equal(loader.pendingSegment_.uri, '1.ts', 'second segment pending');
assert.equal(loader.pendingSegment_.segment.uri, '1.ts', 'correct segment reference');

// playlist updated during waiting
let playlistUpdated = playlistWithDuration(40);
Expand All @@ -1138,6 +1149,7 @@ function(assert) {
loader.playlist(playlistUpdated);

assert.equal(loader.pendingSegment_.uri, '1.ts', 'second segment still pending');
assert.equal(loader.pendingSegment_.segment.uri, '1.ts', 'correct segment reference');

// mock probeSegmentInfo as the response bytes aren't parsable (and won't provide
// time info)
Expand Down

0 comments on commit 279f6e4

Please sign in to comment.