Index: LayoutTests/webaudio/osc-custom-sweep-snr.html |
diff --git a/LayoutTests/webaudio/osc-custom-sweep-snr.html b/LayoutTests/webaudio/osc-custom-sweep-snr.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..1ccd271f5ff7f1821713552d4d01c99cb056e740 |
--- /dev/null |
+++ b/LayoutTests/webaudio/osc-custom-sweep-snr.html |
@@ -0,0 +1,44 @@ |
+<!doctype html> |
+<html> |
+ <head> |
+ <title>Test Oscillator Node: custom</title> |
+ <script src="resources/compatibility.js"></script> |
+ <script src="resources/buffer-loader.js"></script> |
+ <script src="../resources/js-test.js"></script> |
+ <script src="resources/oscillator-testing.js"></script> |
+ </head> |
+ |
+ <body> |
+ <script> |
+ // Scaling factor for converting the 16-bit WAV data to float (and vice-versa). |
+ var waveScaleFactor = 32768; |
+ |
+ // Thresholds for verifying the test passes. The thresholds are experimentally determined. |
+ |
+ // SNR must be greater than this to pass the test. |
+ // Q: Why is the SNR threshold not infinity? |
+ // A: The reference result is a 16-bit WAV file, so it won't compare exactly with the |
+ // floating point result. |
+ var thresholdSNR = 83.89; |
+ |
+ // Max diff must be less than this to pass the test. |
+ var thresholdDiff = 2.22 / waveScaleFactor; |
+ |
+ // Count the number of differences between the expected and actual result. The tests passes |
+ // if the count is less than this threshold. |
+ var thresholdDiffCount = 4450; |
Ken Russell (switch to Gerrit)
2014/11/17 23:52:24
I'd suggest you think of different ways to factor
|
+ |
+ function runTest () { |
+ window.jsTestIsAsync = true; |
+ |
+ // Create offline audio context. |
+ context = new OfflineAudioContext(1, sampleRate * lengthInSeconds, sampleRate); |
+ |
+ loadReferenceAndRunTest("custom"); |
+ } |
+ |
+ runTest(); |
+ successfullyParsed = true; |
+ </script> |
+ </body> |
+</html> |