VulpesOS/gaia/apps/video/test/unit/mock_video_player.js
OverSu b38dea0597 Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
2026-09-30 23:13:03 +02:00

70 lines
1.4 KiB
JavaScript
Executable file

'use strict';
function MockVideoPlayer() {
MockVideoPlayer.instances.push(this);
this.src = null;
this.readyState = 0;
this.seeking = false;
this.duration = 0;
this.currentTime = 0;
this.classList = [];
}
MockVideoPlayer.instances = [];
MockVideoPlayer.mSetup = function() {
MockVideoPlayer.instances = [];
};
MockVideoPlayer.mTeardown = function() {
MockVideoPlayer.instances = [];
};
MockVideoPlayer.prototype.play = function() {
};
MockVideoPlayer.prototype.pause = function() {
};
MockVideoPlayer.prototype.load = function() {
};
MockVideoPlayer.prototype.setSeeking = function(seeking) {
this.seeking = seeking;
};
MockVideoPlayer.prototype.setDuration = function(duration) {
this.duration = duration;
};
MockVideoPlayer.prototype.hasAttribute = function(attr) {
if (attr === 'src') {
return (this.src !== undefined && this.src !== null);
}
return (this.classList.indexOf(attr) !== -1);
};
MockVideoPlayer.prototype.removeAttribute = function(attr) {
if (attr === 'src') {
this.src = null;
}
else {
var index = this.classList.indexOf(attr);
if (index >= 0) {
this.classList.splice(index, 1);
}
}
};
MockVideoPlayer.prototype.fastSeek = function(seekTime) {
this.currentTime = seekTime;
};
MockVideoPlayer.prototype.cloneNode = function() {
return this;
};
MockVideoPlayer.prototype.querySelectorAll = function(selector) {
return [];
};