зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1311700 - Part 2. move shared function to head.js. r=jaws
MozReview-Commit-ID: 5Ym2ZAARitL --HG-- extra : rebase_source : 3da5617d48d15c011f5e6c98423761b7beeda669
This commit is contained in:
Родитель
65882b7943
Коммит
7e3288c81a
|
@ -21,3 +21,10 @@ function waitForCondition(condition, nextTest, errorMsg) {
|
|||
}, 100);
|
||||
var moveOn = function() { clearInterval(interval); nextTest(); };
|
||||
}
|
||||
|
||||
function getAnonElementWithinVideoByAttribute(video, aName, aValue) {
|
||||
const videoControl = domUtils.getChildrenForNode(video, true)[1];
|
||||
|
||||
return SpecialPowers.wrap(videoControl.ownerDocument)
|
||||
.getAnonymousElementByAttribute(videoControl, aName, aValue);
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
<title>Video controls test - Error</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
<script type="text/javascript" src="head.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
|
@ -21,8 +22,8 @@
|
|||
getService(SpecialPowers.Ci.inIDOMUtils);
|
||||
|
||||
const video = document.getElementById("video");
|
||||
const statusOverlay = getElementByAttribute("anonid", "statusOverlay");
|
||||
const statusIcon = getElementByAttribute("anonid", "statusIcon");
|
||||
const statusOverlay = getAnonElementWithinVideoByAttribute(video, "anonid", "statusOverlay");
|
||||
const statusIcon = getAnonElementWithinVideoByAttribute(video, "anonid", "statusIcon");
|
||||
|
||||
const testCases = [];
|
||||
|
||||
|
@ -53,13 +54,6 @@
|
|||
return tasks.reduce((promise, task) => promise.then(task), Promise.resolve());
|
||||
}
|
||||
|
||||
function getElementByAttribute(aName, aValue) {
|
||||
const videoControl = domUtils.getChildrenForNode(video, true)[1];
|
||||
|
||||
return SpecialPowers.wrap(document)
|
||||
.getAnonymousElementByAttribute(videoControl, aName, aValue);
|
||||
}
|
||||
|
||||
function startTest() {
|
||||
executeTestCases(testCases).then(SimpleTest.finish);
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
<title>Video controls test - Size</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
<script type="text/javascript" src="head.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
|
@ -74,15 +75,15 @@
|
|||
const videoWidth = video.clientWidth;
|
||||
|
||||
const videoSizeMsg = `size:${videoRect.width}x${videoRect.height} -`;
|
||||
const controlBar = getElementWithinVideoByAttribute(video, "anonid", "controlBar");
|
||||
const playBtn = getElementWithinVideoByAttribute(video, "anonid", "playButton");
|
||||
const scrubber = getElementWithinVideoByAttribute(video, "anonid", "scrubberStack");
|
||||
const positionDurationBox = getElementWithinVideoByAttribute(video, "anonid", "positionDurationBox");
|
||||
const controlBar = getAnonElementWithinVideoByAttribute(video, "anonid", "controlBar");
|
||||
const playBtn = getAnonElementWithinVideoByAttribute(video, "anonid", "playButton");
|
||||
const scrubber = getAnonElementWithinVideoByAttribute(video, "anonid", "scrubberStack");
|
||||
const positionDurationBox = getAnonElementWithinVideoByAttribute(video, "anonid", "positionDurationBox");
|
||||
const durationLabel = positionDurationBox.getElementsByTagName("span")[0];
|
||||
const muteBtn = getElementWithinVideoByAttribute(video, "anonid", "muteButton");
|
||||
const volumeStack = getElementWithinVideoByAttribute(video, "anonid", "volumeStack");
|
||||
const fullscreenBtn = getElementWithinVideoByAttribute(video, "anonid", "fullscreenButton");
|
||||
const clickToPlay = getElementWithinVideoByAttribute(video, "anonid", "clickToPlay");
|
||||
const muteBtn = getAnonElementWithinVideoByAttribute(video, "anonid", "muteButton");
|
||||
const volumeStack = getAnonElementWithinVideoByAttribute(video, "anonid", "volumeStack");
|
||||
const fullscreenBtn = getAnonElementWithinVideoByAttribute(video, "anonid", "fullscreenButton");
|
||||
const clickToPlay = getAnonElementWithinVideoByAttribute(video, "anonid", "clickToPlay");
|
||||
|
||||
|
||||
// Controls should show/hide according to the priority
|
||||
|
@ -163,13 +164,6 @@
|
|||
return tasks.reduce((promise, task) => promise.then(task), Promise.resolve());
|
||||
}
|
||||
|
||||
function getElementWithinVideoByAttribute(video, aName, aValue) {
|
||||
const videoControl = domUtils.getChildrenForNode(video, true)[1];
|
||||
|
||||
return SpecialPowers.wrap(videoControl.ownerDocument)
|
||||
.getAnonymousElementByAttribute(videoControl, aName, aValue);
|
||||
}
|
||||
|
||||
function start() {
|
||||
executeTasks(testCases).then(SimpleTest.finish);
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
<title>Video controls test - VTT</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
<script type="text/javascript" src="head.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
|
@ -20,7 +21,7 @@
|
|||
const domUtils = SpecialPowers.Cc["@mozilla.org/inspector/dom-utils;1"].
|
||||
getService(SpecialPowers.Ci.inIDOMUtils);
|
||||
const video = document.getElementById("video");
|
||||
const ccBtn = getElementByAttribute("anonid", "closedCaptionButton");
|
||||
const ccBtn = getAnonElementWithinVideoByAttribute(video, "anonid", "closedCaptionButton");
|
||||
const testCases = [];
|
||||
|
||||
testCases.push(() => new Promise(resolve => {
|
||||
|
@ -82,13 +83,6 @@
|
|||
return tasks.reduce((promise, task) => promise.then(task), Promise.resolve());
|
||||
}
|
||||
|
||||
function getElementByAttribute(aName, aValue) {
|
||||
const videoControl = domUtils.getChildrenForNode(video, true)[1];
|
||||
|
||||
return SpecialPowers.wrap(document)
|
||||
.getAnonymousElementByAttribute(videoControl, aName, aValue);
|
||||
}
|
||||
|
||||
function loadedmetadata() {
|
||||
executeTestCases(testCases).then(SimpleTest.finish);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче