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

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

Issue 2435593009: New WebAudio layout testing utility: audit.js (Closed)
Patch Set: more progress Created 4 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: third_party/WebKit/LayoutTests/webaudio/unit-tests/audit.html
diff --git a/third_party/WebKit/LayoutTests/webaudio/unit-tests/audit.html b/third_party/WebKit/LayoutTests/webaudio/unit-tests/audit.html
new file mode 100644
index 0000000000000000000000000000000000000000..a948e0c5c0598af3bf690a0f33fe007bcab665dd
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/webaudio/unit-tests/audit.html
@@ -0,0 +1,82 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>A simple unit testing for audio-test-utils.js and testharness.js</title>
+ <script src="../../resources/testharness.js"></script>
+ <script src="../../resources/testharnessreport.js"></script>
+ <script src="../resources/audit.js"></script>
+</head>
+<body>
+ <script>
+ var audit = Audit.createTaskRunner();
+
+ // Basic assertion testing.
+ audit.define('basic', function (task, should) {
+ task.describe('Simple unit tests for basic assertions.');
+
+ should(OfflineAudioContext, 'OfflineAudioContext').exist();
+
+ should(function () { var foo = 0; }, 'Setting foo to 0').notThrow();
+ should(function () { var foo = bar; }).throw('ReferenceError');
+
+ should(true).beTrue();
+ should(false).beFalse();
+
+ should(3).notBeNaN();
+ should(new Object(), 'A newly created object').notBeNaN();
+ should([1, 2, 3]).notBeNaN();
+ should([1, 2, 3, NaN, 4, 5, 6, NaN]).notBeNaN();
+
+ should(1).beEqualTo(1)
+ should(1).notBeEqualTo(2)
+ should(typeof AudioContext.prototype).beEqualTo('object');
+
+ should(2).beGreaterThan(1);
+ should(2).beGreaterThanOrEqualTo(2);
+
+ should(1).beLessThan(2);
+ should(1).beLessThanOrEqualTo(1);
+
+ let oac = new OfflineAudioContext(1, 128, 44100);
+
+ Promise.all([
+ should(oac.startRendering(), 'Start OAC rendering').beResolved(),
+ should(oac.decodeAudioData()).beRejected()
+ ]).then(function () {
+ task.done();
+ });
+ });
+
+
+ // Advanced, mostly array-based numerical testing.
+ audit.define('numerical', function (task, should) {
+ task.describe('Numerical assertion unit test.');
+
+ should(2.3).beCloseTo(2, 0.3);
+
+ should([1, 1, 1]).beConstantValueOf(1);
+ should([1, 8, 11, 18, 6, 5, 5, 5, 123, 49]).beConstantValueOf(5);
+
+ should([1, 1, 1]).beEqualToArray([1, 1, 1]);
+ should([1, 8, 11, 18, 6, 5, 5, 5, 123, 49])
+ .beEqualToArray([1, 8, 10, 18, 6, 5, 6, 5, 123, 48]);
+
+ should([1, 1, 1, 1, 2, 2, 3, 3, 3]).containValues([1, 2, 3]);
+ should([1, 1, 1, 1, 2, 2, 3, 3, 3]).containValues([1, 3, 2]);
+
+ should([0.5, 0.5, 0.55, 0.5, 0.45, 0.5]).notGlitch(0.06);
+ should([0.5, 0.5, 0.55, 0.5, 0.45, 0.5]).notGlitch(0.04);
+
+ should([0.11, 0.19]).beCloseToArray([0.1, 0.2], {
+ absoluteThreshold: 0.02,
+ relativeThreshold: 0.1
+ });
+
Raymond Toy 2016/11/08 21:14:18 Need test where this fails. To be thorough, need
+ task.done();
+ });
+
+
+ audit.run();
+ </script>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698