Moved XHR test to separate file
Showing
3 changed files
with
35 additions
and
14 deletions
... | @@ -58,6 +58,7 @@ | ... | @@ -58,6 +58,7 @@ |
58 | <script src="m3u8_test.js"></script> | 58 | <script src="m3u8_test.js"></script> |
59 | <script src="playlist-loader_test.js"></script> | 59 | <script src="playlist-loader_test.js"></script> |
60 | <script src="decrypter_test.js"></script> | 60 | <script src="decrypter_test.js"></script> |
61 | <script src="xhr_test.js"></script> | ||
61 | </head> | 62 | </head> |
62 | <body> | 63 | <body> |
63 | <div id="qunit"></div> | 64 | <div id="qunit"></div> | ... | ... |
... | @@ -1108,20 +1108,6 @@ test('resets the switching algorithm if a request times out', function() { | ... | @@ -1108,20 +1108,6 @@ test('resets the switching algorithm if a request times out', function() { |
1108 | 'reset to the lowest bitrate playlist'); | 1108 | 'reset to the lowest bitrate playlist'); |
1109 | }); | 1109 | }); |
1110 | 1110 | ||
1111 | test('handles xhr timeouts correctly', function () { | ||
1112 | var error; | ||
1113 | var clock = sinon.useFakeTimers(); | ||
1114 | videojs.Hls.xhr({ | ||
1115 | url: 'http://example.com', | ||
1116 | timeout: 1 | ||
1117 | }, function(innerError) { | ||
1118 | error = innerError; | ||
1119 | }); | ||
1120 | clock.tick(1); | ||
1121 | strictEqual(error, 'timeout', 'called with timeout error'); | ||
1122 | clock.restore(); | ||
1123 | }); | ||
1124 | |||
1125 | test('disposes the playlist loader', function() { | 1111 | test('disposes the playlist loader', function() { |
1126 | var disposes = 0, player, loaderDispose; | 1112 | var disposes = 0, player, loaderDispose; |
1127 | player = createPlayer(); | 1113 | player = createPlayer(); | ... | ... |
test/xhr_test.js
0 → 100644
1 | (function(window, videojs, undefined) { | ||
2 | 'use strict'; | ||
3 | |||
4 | /* | ||
5 | XHR test suite | ||
6 | */ | ||
7 | |||
8 | var xhr; | ||
9 | |||
10 | module('XHR', { | ||
11 | setup: function() { | ||
12 | xhr = sinon.useFakeXMLHttpRequest(); | ||
13 | }, | ||
14 | |||
15 | teardown: function() { | ||
16 | xhr.restore(); | ||
17 | } | ||
18 | }); | ||
19 | |||
20 | test('handles xhr timeouts correctly', function () { | ||
21 | var error; | ||
22 | var clock = sinon.useFakeTimers(); | ||
23 | videojs.Hls.xhr({ | ||
24 | url: 'http://example.com', | ||
25 | timeout: 1 | ||
26 | }, function(innerError) { | ||
27 | error = innerError; | ||
28 | }); | ||
29 | clock.tick(1); | ||
30 | strictEqual(error, 'timeout', 'called with timeout error'); | ||
31 | clock.restore(); | ||
32 | }); | ||
33 | |||
34 | })(window, window.videojs); |
-
Please register or sign in to post a comment