6e7f77c8 by Gary Katsevman

fixup test

1 parent f09be04b
...@@ -1172,22 +1172,20 @@ test('if withCredentials option is used, withCredentials is set on the XHR objec ...@@ -1172,22 +1172,20 @@ test('if withCredentials option is used, withCredentials is set on the XHR objec
1172 }); 1172 });
1173 1173
1174 test('does not break if the playlist has no segments', function() { 1174 test('does not break if the playlist has no segments', function() {
1175 window.XMLHttpRequest = function () { 1175 var customResponse = function(request) {
1176 this.open = function () {}; 1176 request.response = new Uint8Array([1]).buffer;
1177 this.send = function () { 1177 request.respond(200,
1178 this.readyState = 4; 1178 {'Content-Type': 'application/vnd.apple.mpegurl'},
1179 this.status = 200; 1179 '#EXTM3U\n' +
1180 this.responseText = '#EXTM3U\n' + 1180 '#EXT-X-PLAYLIST-TYPE:VOD\n' +
1181 '#EXT-X-PLAYLIST-TYPE:VOD\n' + 1181 '#EXT-X-TARGETDURATION:10\n');
1182 '#EXT-X-TARGETDURATION:10\n';
1183 this.onreadystatechange();
1184 };
1185 }; 1182 };
1186 player.hls('manifest/master.m3u8'); 1183 player.hls('manifest/master.m3u8');
1187 try { 1184 try {
1188 videojs.mediaSources[player.currentSrc()].trigger({ 1185 videojs.mediaSources[player.currentSrc()].trigger({
1189 type: 'sourceopen' 1186 type: 'sourceopen'
1190 }); 1187 });
1188 customResponse(requests[0]);
1191 } catch(e) { 1189 } catch(e) {
1192 ok(false, 'an error was thrown'); 1190 ok(false, 'an error was thrown');
1193 throw e; 1191 throw e;
......