Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
brainfood
/
videojs-contrib-hls
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
050e0699
authored
2014-09-17 15:13:00 -0700
by
Alex Rubin
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Added tests for xhr timeouts
1 parent
e7ae98e1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
0 deletions
test/videojs-hls_test.js
test/videojs-hls_test.js
View file @
050e069
...
...
@@ -145,6 +145,9 @@ module('HLS', {
xhr
=
sinon
.
useFakeXMLHttpRequest
();
requests
=
[];
xhr
.
onCreate
=
function
(
xhr
)
{
// we set this here since sinon doesn't
// it is needed to force ontimeout usage
xhr
.
timeout
=
0
;
requests
.
push
(
xhr
);
};
...
...
@@ -1108,6 +1111,23 @@ test('resets the switching algorithm if a request times out', function() {
'reset to the lowest bitrate playlist'
);
});
asyncTest
(
'handles xhr timeouts correctly'
,
function
(
assert
)
{
var
testTimeout
=
setTimeout
(
function
()
{
// since we are faking xhr, the test will hang if we don't
// manually end it (ontimeout will never be called)
ok
(
false
,
'request was not completed'
);
start
();
},
10
*
1000
);
videojs
.
Hls
.
xhr
({
url
:
'http://google.com:81'
,
timeout
:
1
},
function
(
error
,
url
)
{
assert
.
strictEqual
(
error
,
'timeout'
,
'called with timeout error'
);
clearTimeout
(
testTimeout
);
start
();
});
});
test
(
'disposes the playlist loader'
,
function
()
{
var
disposes
=
0
,
player
,
loaderDispose
;
player
=
createPlayer
();
...
...
Please
register
or
sign in
to post a comment