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

Unified Diff: third_party/WebKit/LayoutTests/webaudio/unit-tests/jstest-test.html

Issue 2212023002: Modifying audio-testing.js to support testharness.js. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changing js-test.js loading order Created 4 years, 4 months 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: third_party/WebKit/LayoutTests/webaudio/unit-tests/jstest-test.html
diff --git a/third_party/WebKit/LayoutTests/webaudio/unit-tests/jstest-test.html b/third_party/WebKit/LayoutTests/webaudio/unit-tests/jstest-test.html
new file mode 100644
index 0000000000000000000000000000000000000000..5c3b6946dcb42af596009df86a50ac11fc8c8495
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/webaudio/unit-tests/jstest-test.html
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>A simple unit testing for audio-testing.js and js-test.js</title>
+ <script src="../../resources/js-test.js"></script>
+ <script src="../resources/audio-testing.js"></script>
+</head>
+<body>
+ <script>
+ description('A simple unit testing for audio-testing.js and js-test.js');
+ window.jsTestIsAsync = true;
+
+ var audit = Audit.createTaskRunner();
+
+ audit.defineTask('foo', function (taskDone) {
+ Should('Zero', 0).beEqualTo(0);
+ Should('One', 1).notBeEqualTo(0);
+ Should('Expected SNR', 110).beGreaterThanOrEqualTo(100);
+ taskDone();
+ });
+
+ audit.defineTask('bar', function (taskDone) {
+ var maxError = 1e-6;
+ Should("Maximum error value", maxError).beLessThanOrEqualTo(1e-5);
+ Should("max error", maxError).beLessThanOrEqualTo(-1);
+ Should('One point double zero one', 1.001).beCloseTo(1, .1);
+ Should('Two', 2).beCloseTo(1, .1);
+ taskDone();
+ });
+
+ audit.defineTask('boo', function (taskDone) {
+ Should('[2, 2, 2]', [2, 2, 2]).beConstantValueOf(2);
+ Should('[1, 2, 3]', [1, 2, 3]).beEqualToArray([1, 2, 3]);
+ Should('My array', [0.11, 0.19]).beCloseToArray([0.1, 0.2], 0.02);
+ Should('My random array', [1, 1, 3, 3, 2]).containValues([1, 3, 2]);
+ taskDone();
+ });
+
+ audit.defineTask("finish", function (done) {
+ finishJSTest();
+ done();
+ });
+
+ audit.runTasks();
+ </script>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698