Bug 1408456 - Convert test_analyserNodeMinimum.html to a web-platform-test: test-analyser-minimum.html. r?karlt
MozReview-Commit-ID: F6VNiYBXr7Z
--- a/dom/media/webaudio/test/mochitest.ini
+++ b/dom/media/webaudio/test/mochitest.ini
@@ -35,16 +35,17 @@ support-files =
skip-if = !asan || toolkit != android
[test_analyserScale.html]
skip-if = !asan || toolkit != android
[test_analyserNodeOutput.html]
[test_analyserNodePassThrough.html]
[test_analyserNodeWithGain.html]
skip-if = !asan || toolkit != android
[test_analyserNodeMinimum.html]
+skip-if = !asan || toolkit != android
[test_AudioBuffer.html]
[test_audioBufferSourceNode.html]
[test_audioBufferSourceNodeEnded.html]
[test_audioBufferSourceNodeLazyLoopParam.html]
[test_audioBufferSourceNodeLoop.html]
[test_audioBufferSourceNodeLoopStartEnd.html]
[test_audioBufferSourceNodeLoopStartEndSame.html]
[test_audioBufferSourceNodeDetached.html]
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -380073,16 +380073,22 @@
]
],
"webaudio/the-audio-api/the-analysernode-interface/test-analyser-gain.html": [
[
"/webaudio/the-audio-api/the-analysernode-interface/test-analyser-gain.html",
{}
]
],
+ "webaudio/the-audio-api/the-analysernode-interface/test-analyser-minimum.html": [
+ [
+ "/webaudio/the-audio-api/the-analysernode-interface/test-analyser-minimum.html",
+ {}
+ ]
+ ],
"webaudio/the-audio-api/the-analysernode-interface/test-analyser-scale.html": [
[
"/webaudio/the-audio-api/the-analysernode-interface/test-analyser-scale.html",
{}
]
],
"webaudio/the-audio-api/the-analysernode-interface/test-analysernode.html": [
[
@@ -631580,16 +631586,20 @@
"webaudio/the-audio-api/the-analysernode-interface/.gitkeep": [
"da39a3ee5e6b4b0d3255bfef95601890afd80709",
"support"
],
"webaudio/the-audio-api/the-analysernode-interface/test-analyser-gain.html": [
"c3f5f5969ed0ab58a9df332196e138aef8e693f3",
"testharness"
],
+ "webaudio/the-audio-api/the-analysernode-interface/test-analyser-minimum.html": [
+ "cfbeb7283e7375974943ccf689cca73942e6259f",
+ "testharness"
+ ],
"webaudio/the-audio-api/the-analysernode-interface/test-analyser-scale.html": [
"1909a2970f0529ad0433c8e6e75733695d44d3e0",
"testharness"
],
"webaudio/the-audio-api/the-analysernode-interface/test-analysernode.html": [
"8478aa405a4641a9c47554529762e85a37d7593a",
"testharness"
],
copy from dom/media/webaudio/test/test_analyserNodeMinimum.html
copy to testing/web-platform/tests/webaudio/the-audio-api/the-analysernode-interface/test-analyser-minimum.html
--- a/dom/media/webaudio/test/test_analyserNodeMinimum.html
+++ b/testing/web-platform/tests/webaudio/the-audio-api/the-analysernode-interface/test-analyser-minimum.html
@@ -1,51 +1,42 @@
-<!DOCTYPE HTML>
+<!DOCTYPE html>
<html>
<head>
+ <meta charset="utf-8">
<title>Test AnalyserNode when the input is silent</title>
- <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
- <script type="text/javascript" src="webaudio.js"></script>
- <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
-</head>
-<body>
-<pre id="test">
-<script class="testbody" type="text/javascript">
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ <script>
-SimpleTest.waitForExplicitFinish();
-addLoadEvent(function() {
+ var ac = new AudioContext();
+ var analyser = ac.createAnalyser();
+ var constant = ac.createConstantSource();
+ var sp = ac.createScriptProcessor(2048, 1, 0);
- var ac = new AudioContext();
- var analyser = ac.createAnalyser();
- var constant = ac.createConstantSource();
- var sp = ac.createScriptProcessor(2048, 1, 0);
+ constant.offset.value = 0.0;
- constant.offset.value = 0.0;
+ constant.connect(analyser).connect(ac.destination);
- constant.connect(analyser)
- .connect(ac.destination);
+ constant.connect(sp);
- constant.connect(sp);
+ var buf = new Float32Array(analyser.frequencyBinCount);
+ var iteration_count = 10;
+ sp.onaudioprocess = function() {
+ analyser.getFloatFrequencyData(buf);
+ var correct = true;
+ for (var i = 0; i < buf.length; i++) {
+ correct &= buf[i] == -Infinity;
+ }
+ assert_true(!!correct, "silent input process -Infinity in decibel bins");
+ if (!iteration_count--) {
+ sp.onaudioprocess = null;
+ constant.stop();
+ ac.close();
+ done();
+ }
+ };
- var buf = new Float32Array(analyser.frequencyBinCount);
- var iteration_count = 10;
- sp.onaudioprocess = function() {
- analyser.getFloatFrequencyData(buf);
- var correct = true;
- for (var i = 0; i < buf.length; i++) {
- correct &= buf[i] == -Infinity;
- }
- ok(correct, "silent input process -Infinity in decibel bins");
- if(!(iteration_count--)) {
- sp.onaudioprocess = null;
- constant.stop();
- ac.close();
- SimpleTest.finish();
- }
- }
-
- constant.start();
-});
-
-</script>
-</pre>
+ constant.start();
+ </script>
+</head>
</body>
</html>