e64ce8ac by Alex Rubin

Moved XHR test to separate file

1 parent 044200b7
......@@ -58,6 +58,7 @@
<script src="m3u8_test.js"></script>
<script src="playlist-loader_test.js"></script>
<script src="decrypter_test.js"></script>
<script src="xhr_test.js"></script>
</head>
<body>
<div id="qunit"></div>
......
......@@ -1108,20 +1108,6 @@ test('resets the switching algorithm if a request times out', function() {
'reset to the lowest bitrate playlist');
});
test('handles xhr timeouts correctly', function () {
var error;
var clock = sinon.useFakeTimers();
videojs.Hls.xhr({
url: 'http://example.com',
timeout: 1
}, function(innerError) {
error = innerError;
});
clock.tick(1);
strictEqual(error, 'timeout', 'called with timeout error');
clock.restore();
});
test('disposes the playlist loader', function() {
var disposes = 0, player, loaderDispose;
player = createPlayer();
......
(function(window, videojs, undefined) {
'use strict';
/*
XHR test suite
*/
var xhr;
module('XHR', {
setup: function() {
xhr = sinon.useFakeXMLHttpRequest();
},
teardown: function() {
xhr.restore();
}
});
test('handles xhr timeouts correctly', function () {
var error;
var clock = sinon.useFakeTimers();
videojs.Hls.xhr({
url: 'http://example.com',
timeout: 1
}, function(innerError) {
error = innerError;
});
clock.tick(1);
strictEqual(error, 'timeout', 'called with timeout error');
clock.restore();
});
})(window, window.videojs);