Backed out changeset 3bb04c310d05 (bug 1223297) for M(4) failures on Android. r=backout

This commit is contained in:
Sebastian Hengst 2015-12-28 00:54:49 +01:00
parent b847ef85e6
commit 950ae01dca
9 changed files with 2 additions and 180 deletions

View File

@ -1,136 +0,0 @@
"use strict";
SimpleTest.waitForExplicitFinish();
var tests = [false /* INPROC */, true /* OOP */];
var rootURI = "http://test/chrome/dom/browser-element/mochitest/";
var manifestURI = rootURI + "multipleAudioChannels_manifest.webapp";
var srcURI = rootURI + "file_browserElement_MultipleAudioChannels.html";
var generator = startTest();
var app = null;
var channelsNum = 2;
addLoadEvent(() => {
SpecialPowers.pushPermissions(
[{ "type": "webapps-manage", "allow": 1, "context": document },
{ "type": "browser", "allow": 1, "context": document },
{ "type": "embed-apps", "allow": 1, "context": document }],
function() {
SpecialPowers.pushPrefEnv(
{'set': [["dom.mozBrowserFramesEnabled", true],
["dom.webapps.useCurrentProfile", true],
["media.useAudioChannelAPI", true],
["b2g.system_manifest_url", "http://mochi.test:8888/manifest.webapp"]]},
() => { generator.next(); })
});
});
function error(message) {
ok(false, message);
SimpleTest.finish();
}
function continueTest() {
try {
generator.next();
} catch (e if e instanceof StopIteration) {
error("Stop test because of exception!");
}
}
function showTestInfo(aOOPCEnabled) {
if (aOOPCEnabled) {
info("=== Start OOP testing ===");
} else {
info("=== Start INPROC testing ===");
}
}
function uninstallApp(aApp) {
if (aApp) {
var request = navigator.mozApps.mgmt.uninstall(app);
app = null;
request.onerror = () => {
error("Uninstall app failed!");
};
request.onsuccess = () => {
is(request.result, manifestURI, "App uninstalled.");
runNextTest();
}
}
}
function runTest(aOOPCEnabled) {
var request = navigator.mozApps.install(manifestURI, {});
request.onerror = () => {
error("Install app failed!");
};
request.onsuccess = () => {
app = request.result;
ok(app, "App is installed.");
is(app.manifestURL, manifestURI, "App manifest url is correct.");
var iframe = document.createElement('iframe');
iframe.setAttribute('mozbrowser', true);
iframe.setAttribute('remote', aOOPCEnabled);
iframe.setAttribute('mozapp', manifestURI);
iframe.src = srcURI;
iframe.addEventListener('mozbrowserloadend', () => {
var channels = iframe.allowedAudioChannels;
is(channels.length, channelsNum, "Have two channels.");
var activeCounter = 0;
for (var idx = 0; idx < channelsNum; idx++) {
let ac = channels[idx];
ok(ac instanceof BrowserElementAudioChannel, "Correct class.");
ok("getMuted" in ac, "ac.getMuted exists");
ok("onactivestatechanged" in ac, "ac.onactivestatechanged exists");
if (ac.name == "normal" || ac.name == "content") {
ok(true, "Get correct channel type.");
} else {
error("Get unexpected channel type!");
}
ac.getMuted().onsuccess = (e) => {
is(e.target.result, false, "Channel is unmuted.")
}
ac.onactivestatechanged = () => {
ok(true, "Receive activestatechanged event from " + ac.name);
ac.onactivestatechanged = null;
if (++activeCounter == channelsNum) {
document.body.removeChild(iframe);
uninstallApp(app);
}
};
}
});
document.body.appendChild(iframe);
};
}
function runNextTest() {
if (tests.length) {
var isEnabledOOP = tests.shift();
showTestInfo(isEnabledOOP);
runTest(isEnabledOOP);
} else {
SimpleTest.finish();
}
}
function startTest() {
SpecialPowers.setAllAppsLaunchable(true);
SpecialPowers.autoConfirmAppInstall(continueTest);
yield undefined;
SpecialPowers.autoConfirmAppUninstall(continueTest);
yield undefined;
runNextTest();
yield undefined;
}

View File

@ -63,6 +63,7 @@ function runTest(aEnable) {
iframe.setAttribute('remote', aEnable);
iframe.setAttribute('mozapp', manifestURI);
iframe.src = srcURI;
document.body.appendChild(iframe);
iframe.addEventListener('mozbrowserloadend', () => {
var channels = iframe.allowedAudioChannels;
@ -92,8 +93,6 @@ function runTest(aEnable) {
}
});
});
document.body.appendChild(iframe);
};
}

View File

@ -2,15 +2,9 @@
skip-if = buildapp == 'mulet' || (buildapp == 'b2g' && (toolkit != 'gonk' || debug))
support-files =
audio.ogg
browserElement_MultipleAudioChannels.js
browserElement_NotifyChannel.js
file_browserElement_MultipleAudioChannels.html
file_browserElement_NotifyChannel.html
manifest.webapp
manifest.webapp^headers^
multipleAudioChannels_manifest.webapp
multipleAudioChannels_manifest.webapp^headers^
[test_browserElement_MultipleAudioChannels.html]
[test_browserElement_NotifyChannel.html]

View File

@ -1,12 +0,0 @@
<html>
<body>
<script>
var audio1 = new Audio("audio.ogg");
var audio2 = new Audio("audio.ogg");
audio2.mozAudioChannelType = "content";
audio1.play();
audio2.play();
</script>
</body>
</html>

View File

@ -1,7 +1,7 @@
[DEFAULT]
skip-if = buildapp == 'mulet' || (buildapp == 'b2g' && (toolkit != 'gonk' || debug)) || e10s
support-files =
audio.ogg
../../../browser/base/content/test/general/audio.ogg
../../../dom/media/test/short-video.ogv
async.js
browserElementTestHelpers.js

View File

@ -1,7 +0,0 @@
{
"name": "Multiple audio channels test",
"launch_path": "/index.html",
"permissions": {
"audio-channel-content": {}
}
}

View File

@ -1 +0,0 @@
Content-Type: application/manifest+json

View File

@ -1,15 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test for multiple audio channels.</title>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/chrome-harness.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
</head>
<body>
<script type="application/javascript;version=1.7" src="browserElement_MultipleAudioChannels.js">
</script>
</body>
</html>