Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(279)

Unified Diff: LayoutTests/webaudio/osc-custom-sweep-snr.html

Issue 720293002: Replace oscillator tests with more robust tests (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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>

Powered by Google App Engine
This is Rietveld 408576698