diff --git a/Gruntfile.js b/Gruntfile.js index bfecfdff..a9e16ae5 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -45,9 +45,6 @@ module.exports = function(grunt) { dest: 'dist/videojs.hls.min.js' } }, - qunit: { - files: ['test/**/*.html', '!test/perf.html', '!test/muxer/**'] - }, jshint: { gruntfile: { options: { @@ -93,11 +90,11 @@ module.exports = function(grunt) { }, src: { files: '<%= jshint.src.src %>', - tasks: ['jshint:src', 'qunit'] + tasks: ['jshint:src', 'test'] }, test: { files: '<%= jshint.test.src %>', - tasks: ['jshint:test', 'qunit'] + tasks: ['jshint:test', 'test'] } }, concurrent: { @@ -194,7 +191,6 @@ module.exports = function(grunt) { grunt.loadNpmTasks('grunt-contrib-clean'); grunt.loadNpmTasks('grunt-contrib-concat'); grunt.loadNpmTasks('grunt-contrib-uglify'); - grunt.loadNpmTasks('grunt-contrib-qunit'); grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-contrib-connect'); @@ -255,7 +251,7 @@ module.exports = function(grunt) { ['clean', 'jshint', 'manifests-to-js', - 'qunit', + 'test', 'concat', 'uglify']); diff --git a/package.json b/package.json index 390f276f..5a7e5493 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,6 @@ "grunt-contrib-concat": "~0.3.0", "grunt-contrib-connect": "~0.6.0", "grunt-contrib-jshint": "~0.6.0", - "grunt-contrib-qunit": "~0.2.0", "grunt-contrib-uglify": "~0.2.0", "grunt-contrib-watch": "~0.4.0", "grunt-karma": "~0.6.2", diff --git a/test/playlist-loader_test.js b/test/playlist-loader_test.js index 21a02fe4..5012bbaa 100644 --- a/test/playlist-loader_test.js +++ b/test/playlist-loader_test.js @@ -378,4 +378,31 @@ loader.media('unrecognized.m3u8'); }, 'throws an error'); }); + + test('dispose cancels the refresh timeout', function() { + var loader = new videojs.Hls.PlaylistLoader('live.m3u8'); + requests.pop().respond(200, null, + '#EXTM3U\n' + + '#EXT-X-MEDIA-SEQUENCE:0\n' + + '#EXTINF:10,\n' + + '0.ts\n'); + loader.dispose(); + // a lot of time passes... + clock.tick(15 * 1000); + + strictEqual(requests.length, 0, 'no refresh request was made'); + }); + + test('dispose aborts pending refresh requests', function() { + var loader = new videojs.Hls.PlaylistLoader('live.m3u8'); + requests.pop().respond(200, null, + '#EXTM3U\n' + + '#EXT-X-MEDIA-SEQUENCE:0\n' + + '#EXTINF:10,\n' + + '0.ts\n'); + clock.tick(10 * 1000); + + loader.dispose(); + ok(requests[0].aborted, 'refresh request aborted'); + }); })(window); diff --git a/test/videojs-hls_test.js b/test/videojs-hls_test.js index 3ce79947..d0e00c71 100644 --- a/test/videojs-hls_test.js +++ b/test/videojs-hls_test.js @@ -1140,4 +1140,22 @@ test('does not break if the playlist has no segments', function() { strictEqual(requests.length, 1, 'no requests for non-existent segments were queued'); }); +test('disposes the playlist loader', function() { + var disposes = 0, player; + player = createPlayer(); + player.src({ + src: 'manifest/master.m3u8', + type: 'application/vnd.apple.mpegurl' + }); + player.hls.mediaSource.trigger({ + type: 'sourceopen' + }); + player.hls.playlists.dispose = function() { + disposes++; + }; + + player.dispose(); + strictEqual(disposes, 1, 'disposed playlist loader'); +}); + })(window, window.videojs);