Bug 1302320 - add noaudio icon test for video control. r=jaws

MozReview-Commit-ID: KfrsEJ3mgB6

--HG--
extra : rebase_source : d32c3351292432be0b074703cc7d40f6dc2c19ce
This commit is contained in:
Ray Lin 2016-09-22 15:30:48 +08:00
Родитель e6fe42b1fa
Коммит 4c77bd44dd
2 изменённых файлов: 68 добавлений и 0 удалений

Просмотреть файл

@ -3,6 +3,7 @@ support-files =
audio.wav
audio.ogg
seek_with_sound.ogg
video.ogg
head.js
tree_shared.js
videocontrols_direction-1-ref.html
@ -37,5 +38,6 @@ skip-if = toolkit == 'android' # bug 1272646
skip-if = toolkit == 'android' # bug 1075573
[test_videocontrols_video_direction.html]
skip-if = os == 'win'
[test_videocontrols_video_noaudio.html]
[test_bug898940.html]
[test_videocontrols_error.html]

Просмотреть файл

@ -0,0 +1,66 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Video controls test</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<p id="display"></p>
<div id="content">
<video id="video" controls preload="auto"></video>
</div>
<pre id="test">
<script clas="testbody" type="application/javascript">
SimpleTest.waitForExplicitFinish();
const domUtils = SpecialPowers.Cc["@mozilla.org/inspector/dom-utils;1"].
getService(SpecialPowers.Ci.inIDOMUtils);
const video = document.getElementById("video");
const muteButton = getElementByAttribute("class", "muteButton");
const volumeStack = getElementByAttribute("class", "volumeStack");
const testCases = [];
testCases.push(() => new Promise(resolve => {
is(muteButton.getAttribute("noAudio"), "true");
is(muteButton.getAttribute("disabled"), "true");
if (volumeStack) {
ok(volumeStack.hidden);
}
resolve();
}));
function executeTestCases(tasks) {
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);
}
function startMediaLoad() {
video.src = "video.ogg";
video.addEventListener("loadedmetadata", loadedmetadata, false);
}
function loadevent() {
SpecialPowers.pushPrefEnv({"set": [["media.cache_size", 40000]]}, startMediaLoad);
}
window.addEventListener("load", loadevent, false);
</script>
</pre>
</body>
</html>