3a9f92ab by jrivera

Fixed tests now that rendition selection is working correctly

* Added a media2.m3u8 file since that was the only variant that was missing and it just so happens that fixing selection meant media2 became very commonly selected in tests
* Rendition selection test for non-exact player dimensions
1 parent 7671b5a0
#EXTM3U
#EXT-X-PLAYLIST-TYPE:VOD
#EXT-X-TARGETDURATION:10
#EXTINF:10,
media2-00001.ts
#EXTINF:10,
media2-00002.ts
#EXTINF:10,
media2-00003.ts
#EXTINF:10,
media2-00004.ts
#ZEN-TOTAL-DURATION:57.9911
#EXT-X-ENDLIST
......@@ -446,9 +446,6 @@ test('calls `remove` on sourceBuffer to when loading a vod segment', function()
standardXHRResponse(requests[2]);
strictEqual(requests[0].url, 'manifest/master.m3u8', 'master playlist requested');
strictEqual(requests[1].url,
absoluteUrl('manifest/media3.m3u8'),
'media playlist requested');
equal(removes.length, 1, 'remove called');
deepEqual(removes[0], [0, 120 - 60], 'remove called with the right range');
});
......@@ -723,10 +720,10 @@ test('downloads media playlists after loading the master', function() {
strictEqual(requests[0].url, 'manifest/master.m3u8', 'master playlist requested');
strictEqual(requests[1].url,
absoluteUrl('manifest/media3.m3u8'),
absoluteUrl('manifest/media2.m3u8'),
'media playlist requested');
strictEqual(requests[2].url,
absoluteUrl('manifest/media3-00001.ts'),
absoluteUrl('manifest/media2-00001.ts'),
'first segment requested');
});
......@@ -744,10 +741,10 @@ test('upshifts if the initial bandwidth hint is high', function() {
strictEqual(requests[0].url, 'manifest/master.m3u8', 'master playlist requested');
strictEqual(requests[1].url,
absoluteUrl('manifest/media3.m3u8'),
absoluteUrl('manifest/media2.m3u8'),
'media playlist requested');
strictEqual(requests[2].url,
absoluteUrl('manifest/media3-00001.ts'),
absoluteUrl('manifest/media2-00001.ts'),
'first segment requested');
});
......@@ -1083,7 +1080,10 @@ test('selects the correct rendition by player dimensions', function() {
playlist = player.tech_.hls.selectPlaylist();
deepEqual(playlist.attributes.RESOLUTION, {width:960,height:540},'should return the correct resolution by player dimensions');
deepEqual(playlist.attributes.RESOLUTION, {
width: 960,
height:540
},'should return the correct resolution by player dimensions');
equal(playlist.attributes.BANDWIDTH, 1928000, 'should have the expected bandwidth in case of multiple');
player.width(1920);
......@@ -1108,6 +1108,15 @@ test('selects the correct rendition by player dimensions', function() {
},'should return the correct resolution by player dimensions, if exact match');
equal(playlist.attributes.BANDWIDTH, 440000, 'should have the expected bandwidth in case of multiple, if exact match');
player.width(395);
player.height(222);
playlist = player.tech_.hls.selectPlaylist();
deepEqual(playlist.attributes.RESOLUTION, {
width:396,
height:224
},'should return the next larger resolution by player dimensions, if no exact match exists');
equal(playlist.attributes.BANDWIDTH, 440000, 'should have the expected bandwidth in case of multiple, if exact match');
});
test('selects the highest bitrate playlist when the player dimensions are ' +
......@@ -1448,7 +1457,7 @@ test('waits to download new segments until the media playlist is stable', functi
standardXHRResponse(requests.shift()); // media1
// force a playlist switch
player.tech_.hls.playlists.media('media3.m3u8');
player.tech_.hls.playlists.media('media2.m3u8');
standardXHRResponse(requests.shift()); // segment 0
player.tech_.hls.sourceBuffer.trigger('updateend');
......