Mock out Flash.isSupported early
If flash support isn't true when video.js is initialized, no tech will be loaded and tests will fail in phantomjs.
Showing
2 changed files
with
25 additions
and
23 deletions
... | @@ -20,20 +20,19 @@ | ... | @@ -20,20 +20,19 @@ |
20 | throws(block, [expected], [message]) | 20 | throws(block, [expected], [message]) |
21 | */ | 21 | */ |
22 | var | 22 | var |
23 | segmentController, | ||
24 | parser, | 23 | parser, |
25 | 24 | ||
26 | expectedHeader = [ | 25 | expectedHeader = [ |
27 | 0x46, 0x4c, 0x56, 0x01, 0x05, 0x00, 0x00, 0x00, | 26 | 0x46, 0x4c, 0x56, 0x01, 0x05, 0x00, 0x00, 0x00, |
28 | 0x09, 0x00, 0x00, 0x00, 0x00 | 27 | 0x09, 0x00, 0x00, 0x00, 0x00 |
29 | ], | 28 | ], |
30 | testAudioTag, | 29 | testAudioTag, |
31 | testVideoTag, | 30 | testVideoTag, |
32 | testScriptTag, | 31 | testScriptTag, |
33 | asciiFromBytes, | 32 | asciiFromBytes, |
34 | testScriptString, | 33 | testScriptString, |
35 | testScriptEcmaArray, | 34 | testScriptEcmaArray, |
36 | testNalUnit; | 35 | testNalUnit; |
37 | 36 | ||
38 | module('segment parser', { | 37 | module('segment parser', { |
39 | setup: function() { | 38 | setup: function() { | ... | ... |
... | @@ -20,10 +20,22 @@ | ... | @@ -20,10 +20,22 @@ |
20 | throws(block, [expected], [message]) | 20 | throws(block, [expected], [message]) |
21 | */ | 21 | */ |
22 | 22 | ||
23 | var player, oldFlashSupported, oldXhr, oldSourceBuffer, xhrParams; | 23 | var |
24 | player, | ||
25 | segmentController, | ||
26 | oldFlashSupported, | ||
27 | oldXhr, | ||
28 | oldSourceBuffer, | ||
29 | xhrParams; | ||
24 | 30 | ||
25 | module('HLS', { | 31 | module('HLS', { |
26 | setup: function() { | 32 | setup: function() { |
33 | // force Flash support in phantomjs | ||
34 | oldFlashSupported = videojs.Flash.isSupported; | ||
35 | videojs.Flash.isSupported = function() { | ||
36 | return true; | ||
37 | }; | ||
38 | |||
27 | var video = document.createElement('video'); | 39 | var video = document.createElement('video'); |
28 | document.querySelector('#qunit-fixture').appendChild(video); | 40 | document.querySelector('#qunit-fixture').appendChild(video); |
29 | player = videojs(video, { | 41 | player = videojs(video, { |
... | @@ -32,12 +44,6 @@ module('HLS', { | ... | @@ -32,12 +44,6 @@ module('HLS', { |
32 | }, | 44 | }, |
33 | techOrder: ['flash'] | 45 | techOrder: ['flash'] |
34 | }); | 46 | }); |
35 | |||
36 | // force Flash support in phantomjs | ||
37 | oldFlashSupported = videojs.Flash.isSupported; | ||
38 | videojs.Flash.isSupported = function() { | ||
39 | return true; | ||
40 | }; | ||
41 | player.buffered = function() { | 47 | player.buffered = function() { |
42 | return videojs.createTimeRange(0, 0); | 48 | return videojs.createTimeRange(0, 0); |
43 | }; | 49 | }; |
... | @@ -219,10 +225,7 @@ test('only makes one segment request at a time', function() { | ... | @@ -219,10 +225,7 @@ test('only makes one segment request at a time', function() { |
219 | module('segment controller', { | 225 | module('segment controller', { |
220 | setup: function() { | 226 | setup: function() { |
221 | segmentController = new window.videojs.hls.SegmentController(); | 227 | segmentController = new window.videojs.hls.SegmentController(); |
222 | this.vjsget = window.videojs.get; | 228 | |
223 | window.videojs.get = function(url, success) { | ||
224 | success(window.bcSegment); | ||
225 | }; | ||
226 | }, | 229 | }, |
227 | teardown: function() { | 230 | teardown: function() { |
228 | window.videojs.get = this.vjsget; | 231 | window.videojs.get = this.vjsget; | ... | ... |
-
Please register or sign in to post a comment