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
Showing
2 changed files
with
31 additions
and
9 deletions
test/manifest/media2.m3u8
0 → 100644
... | @@ -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'); | ... | ... |
-
Please register or sign in to post a comment