0ccdb7a9 by David LaPalomento

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.
1 parent 8ee9d787
......@@ -20,20 +20,19 @@
throws(block, [expected], [message])
*/
var
segmentController,
parser,
expectedHeader = [
0x46, 0x4c, 0x56, 0x01, 0x05, 0x00, 0x00, 0x00,
0x09, 0x00, 0x00, 0x00, 0x00
],
testAudioTag,
testVideoTag,
testScriptTag,
asciiFromBytes,
testScriptString,
testScriptEcmaArray,
testNalUnit;
expectedHeader = [
0x46, 0x4c, 0x56, 0x01, 0x05, 0x00, 0x00, 0x00,
0x09, 0x00, 0x00, 0x00, 0x00
],
testAudioTag,
testVideoTag,
testScriptTag,
asciiFromBytes,
testScriptString,
testScriptEcmaArray,
testNalUnit;
module('segment parser', {
setup: function() {
......
......@@ -20,10 +20,22 @@
throws(block, [expected], [message])
*/
var player, oldFlashSupported, oldXhr, oldSourceBuffer, xhrParams;
var
player,
segmentController,
oldFlashSupported,
oldXhr,
oldSourceBuffer,
xhrParams;
module('HLS', {
setup: function() {
// force Flash support in phantomjs
oldFlashSupported = videojs.Flash.isSupported;
videojs.Flash.isSupported = function() {
return true;
};
var video = document.createElement('video');
document.querySelector('#qunit-fixture').appendChild(video);
player = videojs(video, {
......@@ -32,12 +44,6 @@ module('HLS', {
},
techOrder: ['flash']
});
// force Flash support in phantomjs
oldFlashSupported = videojs.Flash.isSupported;
videojs.Flash.isSupported = function() {
return true;
};
player.buffered = function() {
return videojs.createTimeRange(0, 0);
};
......@@ -219,10 +225,7 @@ test('only makes one segment request at a time', function() {
module('segment controller', {
setup: function() {
segmentController = new window.videojs.hls.SegmentController();
this.vjsget = window.videojs.get;
window.videojs.get = function(url, success) {
success(window.bcSegment);
};
},
teardown: function() {
window.videojs.get = this.vjsget;
......