1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
<html>
<head>
<script type="text/javascript">
function ok(a, msg) {
alert((!!a ? "OK" : "KO") + " " + msg);
}
function is(a, b, msg) {
ok(a === b, msg);
}
function finish(a, b, msg) {
alert("DONE");
}
addEventListener('load', function(e) {
var iframe = document.createElement('iframe');
iframe.setAttribute('mozbrowser', 'true');
// set 'remote' to true here will make the the iframe remote in _inproc_
// test and in-process in _oop_ test.
iframe.setAttribute('remote', 'true');
iframe.setAttribute('mozapp', 'http://example.org/manifest.webapp');
iframe.addEventListener('mozbrowserloadend', function(e) {
ok("mute" in iframe, "iframe.mute exists");
ok("unmute" in iframe, "iframe.unmute exists");
ok("getMuted" in iframe, "iframe.getMuted exists");
ok("getVolume" in iframe, "iframe.getVolume exists");
ok("setVolume" in iframe, "iframe.setVolume exists");
ok("allowedAudioChannels" in iframe, "allowedAudioChannels exist");
var channels = iframe.allowedAudioChannels;
is(channels.length, 9, "9 audio channel by default");
var ac = channels[0];
ok(ac instanceof BrowserElementAudioChannel, "Correct class");
ok("getVolume" in ac, "ac.getVolume exists");
ok("setVolume" in ac, "ac.setVolume exists");
ok("getMuted" in ac, "ac.getMuted exists");
ok("setMuted" in ac, "ac.setMuted exists");
ok("isActive" in ac, "ac.isActive exists");
ac.onactivestatechanged = function() {
ok(true, "activestatechanged event received.");
ac.getVolume().onsuccess = function(e) {
ok(e.target.result, 1, "Default volume is 1");
};
finish();
}
});
document.body.appendChild(iframe);
iframe.src = 'chrome://mochitests/content/chrome/dom/browser-element/mochitest/file_audio.html';
});
</script>
</head>
<body>
</body>
</html>
|