mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-17 15:25:52 +00:00
Bug 1227051
- [Testcase] No audio track video shouldn't register the AudioChannelAgent. r=baku.
--HG-- extra : transplant_source : %C9%27%AB%5D9%91%BD%9Bb%9F%98%FF%CC%C2%C6O%C6%09%E4%60
This commit is contained in:
parent
b9925dcea5
commit
e83a4f13a1
88
dom/browser-element/mochitest/browserElement_NoAudioTrack.js
Normal file
88
dom/browser-element/mochitest/browserElement_NoAudioTrack.js
Normal file
@ -0,0 +1,88 @@
|
||||
"use strict";
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
browserElementTestHelpers.setEnabledPref(true);
|
||||
browserElementTestHelpers.addPermission();
|
||||
|
||||
var fileURL = 'http://example.org/tests/dom/browser-element/mochitest/file_browserElement_NoAudioTrack.html';
|
||||
var generator = runTests();
|
||||
var testFrame;
|
||||
|
||||
function error(aMessage) {
|
||||
ok(false, "Error : " + aMessage);
|
||||
finish();
|
||||
}
|
||||
|
||||
function continueTest() {
|
||||
try {
|
||||
generator.next();
|
||||
} catch (e if e instanceof StopIteration) {
|
||||
error("Stop test because of exception!");
|
||||
}
|
||||
}
|
||||
|
||||
function finish() {
|
||||
document.body.removeChild(testFrame);
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
function setCommand(aArg) {
|
||||
info("# Command = " + aArg);
|
||||
testFrame.src = fileURL + '#' + aArg;
|
||||
|
||||
// Yield to the event loop a few times to make sure that onactivestatechanged
|
||||
// is not dispatched.
|
||||
SimpleTest.executeSoon(function() {
|
||||
SimpleTest.executeSoon(function() {
|
||||
SimpleTest.executeSoon(function() {
|
||||
continueTest();
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function runTests() {
|
||||
setCommand('play');
|
||||
yield undefined;
|
||||
|
||||
setCommand('pause');
|
||||
yield undefined;
|
||||
|
||||
finish();
|
||||
yield undefined;
|
||||
}
|
||||
|
||||
function setupTestFrame() {
|
||||
testFrame = document.createElement('iframe');
|
||||
testFrame.setAttribute('mozbrowser', 'true');
|
||||
testFrame.setAttribute('mozapp', 'http://example.org/manifest.webapp');
|
||||
testFrame.src = fileURL;
|
||||
|
||||
function loadend() {
|
||||
testFrame.removeEventListener('mozbrowserloadend', loadend);
|
||||
ok("allowedAudioChannels" in testFrame, "allowedAudioChannels exist");
|
||||
var channels = testFrame.allowedAudioChannels;
|
||||
is(channels.length, 1, "1 audio channel by default");
|
||||
|
||||
var ac = channels[0];
|
||||
ok(ac instanceof BrowserElementAudioChannel, "Correct class");
|
||||
ok("onactivestatechanged" in ac, "onactivestatechanged exists");
|
||||
|
||||
ac.onactivestatechanged = () => {
|
||||
ac.onactivestatechanged = null;
|
||||
error("Should not receive onactivestatechanged!");
|
||||
};
|
||||
|
||||
continueTest();
|
||||
}
|
||||
|
||||
testFrame.addEventListener('mozbrowserloadend', loadend);
|
||||
document.body.appendChild(testFrame);
|
||||
}
|
||||
|
||||
addEventListener('testready', function() {
|
||||
SpecialPowers.pushPrefEnv({'set': [["b2g.system_manifest_url", "http://mochi.test:8888/manifest.webapp"]]},
|
||||
function() {
|
||||
SimpleTest.executeSoon(setupTestFrame);
|
||||
});
|
||||
});
|
@ -0,0 +1,11 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<body>
|
||||
<script type="application/javascript;version=1.7">
|
||||
var audio = new Audio();
|
||||
audio.src = "noaudio.webm";
|
||||
audio.loop = true;
|
||||
audio.play();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -57,6 +57,7 @@ skip-if = (toolkit == 'gonk' && !debug)
|
||||
[test_browserElement_oop_LoadEvents.html]
|
||||
[test_browserElement_oop_Manifestchange.html]
|
||||
[test_browserElement_oop_Metachange.html]
|
||||
[test_browserElement_oop_NoAudioTrack.html]
|
||||
[test_browserElement_oop_AudioPlayback.html]
|
||||
[test_browserElement_oop_OpenMixedProcess.html]
|
||||
skip-if = (toolkit == 'gonk' && !debug)
|
||||
|
@ -45,6 +45,7 @@ support-files =
|
||||
browserElement_Manifestchange.js
|
||||
browserElement_Metachange.js
|
||||
browserElement_NextPaint.js
|
||||
browserElement_NoAudioTrack.js
|
||||
browserElement_OpenNamed.js
|
||||
browserElement_OpenTab.js
|
||||
browserElement_OpenWindow.js
|
||||
@ -102,6 +103,7 @@ support-files =
|
||||
file_browserElement_LoadEvents.html
|
||||
file_browserElement_Metachange.sjs
|
||||
file_browserElement_NextPaint.html
|
||||
file_browserElement_NoAudioTrack.html
|
||||
file_browserElement_Open1.html
|
||||
file_browserElement_Open2.html
|
||||
file_browserElement_OpenNamed.html
|
||||
@ -142,6 +144,7 @@ support-files =
|
||||
file_web_manifest.json
|
||||
file_illegal_web_manifest.html
|
||||
file_processingAudioSample.html
|
||||
noaudio.webm
|
||||
|
||||
# Note: browserElementTestHelpers.js looks at the test's filename to determine
|
||||
# whether the test should be OOP. "_oop_" signals OOP, "_inproc_" signals in
|
||||
@ -198,6 +201,7 @@ skip-if = (toolkit == 'android' && processor == 'x86') #x86 only
|
||||
[test_browserElement_inproc_Manifestchange.html]
|
||||
[test_browserElement_inproc_Metachange.html]
|
||||
[test_browserElement_inproc_NextPaint.html]
|
||||
[test_browserElement_inproc_NoAudioTrack.html]
|
||||
[test_browserElement_inproc_OpenNamed.html]
|
||||
skip-if = (toolkit == 'gonk' && !debug)
|
||||
[test_browserElement_inproc_OpenTab.html]
|
||||
|
BIN
dom/browser-element/mochitest/noaudio.webm
Normal file
BIN
dom/browser-element/mochitest/noaudio.webm
Normal file
Binary file not shown.
@ -0,0 +1,13 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Bug 1227051 - No audio track video shouldn't register the AudioChannelAgent</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="browserElementTestHelpers.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<script type="application/javascript;version=1.7" src="browserElement_NoAudioTrack.js">
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,13 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Bug 1227051 - No audio track video shouldn't register the AudioChannelAgent</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="browserElementTestHelpers.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<script type="application/javascript;version=1.7" src="browserElement_NoAudioTrack.js">
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user