Browse Source

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.
pull/80/head
David LaPalomento 12 years ago
parent
commit
0ccdb7a9ad
  1. 23
      test/segment-parser.js
  2. 25
      test/videojs-hls_test.js

23
test/segment-parser.js

@ -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() {

25
test/videojs-hls_test.js

@ -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;

Loading…
Cancel
Save