2012-08-31 13:59:37 -07:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Test whether we can create an AudioContext interface</title>
|
|
|
|
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<pre id="test">
|
|
|
|
<script class="testbody" type="text/javascript">
|
|
|
|
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
addLoadEvent(function() {
|
2012-09-07 15:13:26 -07:00
|
|
|
ok(!window.mozAudioContext, "mozAudioContext should be hidden behind a pref");
|
|
|
|
var accessThrows = false;
|
|
|
|
try {
|
|
|
|
new mozAudioContext();
|
|
|
|
} catch (e) {
|
|
|
|
accessThrows = true;
|
|
|
|
}
|
|
|
|
ok(accessThrows, "mozAudioContext should be hidden behind a pref");
|
|
|
|
SpecialPowers.setBoolPref("media.webaudio.enabled", true);
|
2012-08-31 13:59:37 -07:00
|
|
|
var ac = new mozAudioContext();
|
|
|
|
ok(ac, "Create a mozAudioContext object");
|
2012-11-29 19:31:39 -08:00
|
|
|
is(ac.sampleRate, 44100, "Correct sample rate");
|
2012-09-07 15:13:26 -07:00
|
|
|
SpecialPowers.clearUserPref("media.webaudio.enabled");
|
2012-08-31 13:59:37 -07:00
|
|
|
SimpleTest.finish();
|
|
|
|
});
|
|
|
|
|
|
|
|
</script>
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
</html>
|