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
1 #EXTM3U
2 #EXT-X-PLAYLIST-TYPE:VOD
3 #EXT-X-TARGETDURATION:10
4 #EXTINF:10,
5 media2-00001.ts
6 #EXTINF:10,
7 media2-00002.ts
8 #EXTINF:10,
9 media2-00003.ts
10 #EXTINF:10,
11 media2-00004.ts
12 #ZEN-TOTAL-DURATION:57.9911
13 #EXT-X-ENDLIST
...@@ -446,9 +446,6 @@ test('calls `remove` on sourceBuffer to when loading a vod segment', function() ...@@ -446,9 +446,6 @@ test('calls `remove` on sourceBuffer to when loading a vod segment', function()
446 standardXHRResponse(requests[2]); 446 standardXHRResponse(requests[2]);
447 447
448 strictEqual(requests[0].url, 'manifest/master.m3u8', 'master playlist requested'); 448 strictEqual(requests[0].url, 'manifest/master.m3u8', 'master playlist requested');
449 strictEqual(requests[1].url,
450 absoluteUrl('manifest/media3.m3u8'),
451 'media playlist requested');
452 equal(removes.length, 1, 'remove called'); 449 equal(removes.length, 1, 'remove called');
453 deepEqual(removes[0], [0, 120 - 60], 'remove called with the right range'); 450 deepEqual(removes[0], [0, 120 - 60], 'remove called with the right range');
454 }); 451 });
...@@ -723,10 +720,10 @@ test('downloads media playlists after loading the master', function() { ...@@ -723,10 +720,10 @@ test('downloads media playlists after loading the master', function() {
723 720
724 strictEqual(requests[0].url, 'manifest/master.m3u8', 'master playlist requested'); 721 strictEqual(requests[0].url, 'manifest/master.m3u8', 'master playlist requested');
725 strictEqual(requests[1].url, 722 strictEqual(requests[1].url,
726 absoluteUrl('manifest/media3.m3u8'), 723 absoluteUrl('manifest/media2.m3u8'),
727 'media playlist requested'); 724 'media playlist requested');
728 strictEqual(requests[2].url, 725 strictEqual(requests[2].url,
729 absoluteUrl('manifest/media3-00001.ts'), 726 absoluteUrl('manifest/media2-00001.ts'),
730 'first segment requested'); 727 'first segment requested');
731 }); 728 });
732 729
...@@ -744,10 +741,10 @@ test('upshifts if the initial bandwidth hint is high', function() { ...@@ -744,10 +741,10 @@ test('upshifts if the initial bandwidth hint is high', function() {
744 741
745 strictEqual(requests[0].url, 'manifest/master.m3u8', 'master playlist requested'); 742 strictEqual(requests[0].url, 'manifest/master.m3u8', 'master playlist requested');
746 strictEqual(requests[1].url, 743 strictEqual(requests[1].url,
747 absoluteUrl('manifest/media3.m3u8'), 744 absoluteUrl('manifest/media2.m3u8'),
748 'media playlist requested'); 745 'media playlist requested');
749 strictEqual(requests[2].url, 746 strictEqual(requests[2].url,
750 absoluteUrl('manifest/media3-00001.ts'), 747 absoluteUrl('manifest/media2-00001.ts'),
751 'first segment requested'); 748 'first segment requested');
752 }); 749 });
753 750
...@@ -1083,7 +1080,10 @@ test('selects the correct rendition by player dimensions', function() { ...@@ -1083,7 +1080,10 @@ test('selects the correct rendition by player dimensions', function() {
1083 1080
1084 playlist = player.tech_.hls.selectPlaylist(); 1081 playlist = player.tech_.hls.selectPlaylist();
1085 1082
1086 deepEqual(playlist.attributes.RESOLUTION, {width:960,height:540},'should return the correct resolution by player dimensions'); 1083 deepEqual(playlist.attributes.RESOLUTION, {
1084 width: 960,
1085 height:540
1086 },'should return the correct resolution by player dimensions');
1087 equal(playlist.attributes.BANDWIDTH, 1928000, 'should have the expected bandwidth in case of multiple'); 1087 equal(playlist.attributes.BANDWIDTH, 1928000, 'should have the expected bandwidth in case of multiple');
1088 1088
1089 player.width(1920); 1089 player.width(1920);
...@@ -1108,6 +1108,15 @@ test('selects the correct rendition by player dimensions', function() { ...@@ -1108,6 +1108,15 @@ test('selects the correct rendition by player dimensions', function() {
1108 },'should return the correct resolution by player dimensions, if exact match'); 1108 },'should return the correct resolution by player dimensions, if exact match');
1109 equal(playlist.attributes.BANDWIDTH, 440000, 'should have the expected bandwidth in case of multiple, if exact match'); 1109 equal(playlist.attributes.BANDWIDTH, 440000, 'should have the expected bandwidth in case of multiple, if exact match');
1110 1110
1111 player.width(395);
1112 player.height(222);
1113 playlist = player.tech_.hls.selectPlaylist();
1114
1115 deepEqual(playlist.attributes.RESOLUTION, {
1116 width:396,
1117 height:224
1118 },'should return the next larger resolution by player dimensions, if no exact match exists');
1119 equal(playlist.attributes.BANDWIDTH, 440000, 'should have the expected bandwidth in case of multiple, if exact match');
1111 }); 1120 });
1112 1121
1113 test('selects the highest bitrate playlist when the player dimensions are ' + 1122 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 ...@@ -1448,7 +1457,7 @@ test('waits to download new segments until the media playlist is stable', functi
1448 standardXHRResponse(requests.shift()); // media1 1457 standardXHRResponse(requests.shift()); // media1
1449 1458
1450 // force a playlist switch 1459 // force a playlist switch
1451 player.tech_.hls.playlists.media('media3.m3u8'); 1460 player.tech_.hls.playlists.media('media2.m3u8');
1452 1461
1453 standardXHRResponse(requests.shift()); // segment 0 1462 standardXHRResponse(requests.shift()); // segment 0
1454 player.tech_.hls.sourceBuffer.trigger('updateend'); 1463 player.tech_.hls.sourceBuffer.trigger('updateend');
......