Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/webaudio/unit-tests/audit-failures.html |
| diff --git a/third_party/WebKit/LayoutTests/webaudio/unit-tests/audit-failures.html b/third_party/WebKit/LayoutTests/webaudio/unit-tests/audit-failures.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..6901c903d576f29017c16ff05a3d4f7f417cad9a |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/webaudio/unit-tests/audit-failures.html |
| @@ -0,0 +1,67 @@ |
| +<!DOCTYPE html> |
| +<html> |
| +<head> |
| + <title>audit.js: handling failures</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(); |
| + |
| + |
| + // These assertions are supposed to be failed. The WPT (testharness) fails |
| + // because the assertions are failing, but the existence of expected test |
| + // result makes this test pass as long as the actual and the expected match. |
| + // See the expected result file to see the logging message from Audit. |
| + |
| + // Basic assertions. |
| + audit.define('basic-failure', function (task, should) { |
| + task.describe('Testing basic assertion failures.'); |
| + |
| + should(function () { var foo = bar; }, 'Setting foo to bar').notThrow(); |
| + should(function () { var foo = 0; }).throw('ReferenceError'); |
| + should(3 > 5, '3 < 5').beTrue(); |
| + should(true).beFalse(); |
| + should(1).beEqualTo(2) |
| + should(1).notBeEqualTo(1) |
| + should(typeof 3.141592).beEqualTo('string'); |
|
Raymond Toy
2016/12/09 22:10:26
Add description: "typeof 3.14"
hongchan
2016/12/19 22:14:06
Done.
|
| + should(1).beGreaterThan(2); |
| + should(1).beGreaterThanOrEqualTo(2); |
| + should(2).beLessThan(1); |
| + should(2).beLessThanOrEqualTo(1); |
| + |
| + let oac = new OfflineAudioContext(1, 128, 44100); |
| + Promise.all([ |
| + should(oac.decodeAudioData(), 'Start OAC rendering').beResolved(), |
|
Raymond Toy
2016/12/09 22:10:26
'Start OAC rendering' doesn't actually describe th
hongchan
2016/12/19 22:14:06
Sorry this was a typo.
|
| + should(oac.startRendering()).beRejected() |
| + ]).then(task.done.bind(task)); |
| + }); |
| + |
| + |
| + // Numerical assertions. |
| + audit.define('numerical-failures', function (task, should) { |
| + task.describe('Testing numerical assertion failures.'); |
| + |
| + should(0).beCloseTo(0.1, { threshold: 0 }); |
| + should([1, 8, 11, 18, 6, 5, 5, 5, 123, 49]).beConstantValueOf(5); |
| + 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, 3, 2]); |
| + should([0.5, 0.5, 0.55, 0.5, 0.45, 0.5]).notGlitch(0.04); |
| + should([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.9]) |
| + .beCloseToArray([0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1], { |
| + absoluteThreshold: 0.02, |
| + relativeThreshold: 0.1 |
|
Raymond Toy
2016/12/09 22:10:26
Add a test using only relativeThreshold and one us
hongchan
2016/12/19 22:14:06
Done.
|
| + }); |
| + |
| + task.done(); |
| + }); |
| + |
| + |
| + // With no argument, this executes all tasks in the order defined. |
| + audit.run(); |
| + </script> |
| +</body> |
| +</html> |