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

Side by Side Diff: third_party/WebKit/LayoutTests/webaudio/unit-tests/audit-failures.html

Issue 2591233004: Provide detailed information on the test failure (Closed)
Patch Set: Fixing nits after l-g-t-m Created 3 years, 12 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 unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <title>audit.js: handling failures</title> 4 <title>audit.js: handling failures</title>
5 <script src="../../resources/testharness.js"></script> 5 <script src="../../resources/testharness.js"></script>
6 <script src="../../resources/testharnessreport.js"></script> 6 <script src="../../resources/testharnessreport.js"></script>
7 <script src="../resources/audit.js"></script> 7 <script src="../resources/audit.js"></script>
8 </head> 8 </head>
9 <body> 9 <body>
10 <script> 10 <script>
11 // The task runner will print out a console message to ensure the text file 11 // The task runner will print out a console message to ensure the text file
12 // comparison. 12 // comparison.
13 var audit = Audit.createTaskRunner({ requireResultFile: true }); 13 var audit = Audit.createTaskRunner({ requireResultFile: true });
14 14
15 15
16 // These assertions are supposed to be failed. The WPT (testharness) fails 16 // These assertions are supposed to be failed. The WPT (testharness) fails
17 // because the assertions are failing, but the existence of expected test 17 // because the assertions are failing, but the existence of expected test
18 // result makes this test pass as long as the actual and the expected match. 18 // result makes this test pass as long as the actual and the expected match.
19 // See the expected result file to see the logging message from Audit. 19 // See the expected result file to see the logging message from Audit.
20 20
21 21
22 // Basic assertions. 22 // Basic assertions.
23 audit.define('basic-failure', function (task, should) { 23 audit.define('basic-failure', function (task, should) {
24 task.describe('Testing basic assertion failures.'); 24 task.describe('Testing basic assertion failures.');
25 25
26 should(function () { var foo = bar; }, 'Setting foo to bar').notThrow(); 26 should(function () { var foo = bar; }, 'Setting foo to bar').notThrow();
27 should(function () { var foo = 0; }).throw('ReferenceError'); 27 should(function () { var foo = 0; }).throw('ReferenceError');
28 should(3 > 5, '3 < 5').beTrue(); 28 should(3 > 5, '3 < 5').beTrue();
29 should(true).beFalse(); 29 should(true).beFalse();
30 should(1).beEqualTo(2) 30 should(1, 'The number of channels').beEqualTo(2);
31 should(1).notBeEqualTo(1) 31 should(1).notBeEqualTo(1);
32 should(typeof 3.141592, 'typeof 3.141592').beEqualTo('string'); 32 should(typeof 3.141592, 'typeof 3.141592').beEqualTo('string');
33 should(1).beGreaterThan(2); 33 should(1).beGreaterThan(2);
34 should(1).beGreaterThanOrEqualTo(2); 34 should(1).beGreaterThanOrEqualTo(2);
35 should(2).beLessThan(1); 35 should(2).beLessThan(1);
36 should(2).beLessThanOrEqualTo(1); 36 should(2).beLessThanOrEqualTo(1);
37 37
38 let oac = new OfflineAudioContext(1, 128, 44100); 38 let oac = new OfflineAudioContext(1, 128, 44100);
39 Promise.all([ 39 Promise.all([
40 should(oac.decodeAudioData(), 'Decoding audio data with no argument') 40 should(oac.decodeAudioData(), 'Decoding audio data with no argument')
41 .beResolved(), 41 .beResolved(),
42 should(oac.startRendering()).beRejected() 42 should(oac.startRendering()).beRejected()
43 ]).then(task.done.bind(task)); 43 ]).then(task.done.bind(task));
44 }); 44 });
45 45
46 46
47 // Numerical assertions. 47 // Numerical assertions.
48 audit.define('numerical-failures', function (task, should) { 48 audit.define('numerical-failures', function (task, should) {
49 task.describe('Testing numerical assertion failures.'); 49 task.describe('Testing numerical assertion failures.');
50 50
51 should(0).beCloseTo(0.1, { threshold: 0 }); 51 should(0).beCloseTo(0.1, { threshold: 0 });
52 should(59, 'The measured decibel').beCloseTo(62, { threshold: 0.01 });
52 should([1, 8, 11, 18, 6, 5, 5, 5, 123, 49]).beConstantValueOf(5); 53 should([1, 8, 11, 18, 6, 5, 5, 5, 123, 49]).beConstantValueOf(5);
53 should([1, 8, 11, 18, 6, 5, 5, 5, 123, 49]) 54 should([1, 8, 11, 18, 6, 5, 5, 5, 123, 49])
54 .beEqualToArray([1, 8, 10, 18, 6, 5, 6, 5, 123, 48]); 55 .beEqualToArray([1, 8, 10, 18, 6, 5, 6, 5, 123, 48]);
55 should([1, 1, 1, 1, 2, 2, 3, 3, 3]).containValues([1, 3, 2]); 56 should([1, 1, 1, 1, 2, 2, 3, 3, 3]).containValues([1, 3, 2]);
56 should([0.5, 0.5, 0.55, 0.5, 0.45, 0.5]).notGlitch(0.04); 57 should([0.5, 0.5, 0.55, 0.5, 0.45, 0.5]).notGlitch(0.04);
57 should([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.9]) 58 should([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.9])
58 .beCloseToArray([0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1], { 59 .beCloseToArray([0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1], {
59 absoluteThreshold: 0.02 60 absoluteThreshold: 0.02
60 }); 61 });
61 should([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.9]) 62 should([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.9])
62 .beCloseToArray([0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1], { 63 .beCloseToArray([0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1], {
63 relativeThreshold: 0.1 64 relativeThreshold: 0.1
64 }); 65 });
65 should([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.9]) 66 should([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.9])
66 .beCloseToArray([0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1], { 67 .beCloseToArray([0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1], {
67 absoluteThreshold: 0.02, 68 absoluteThreshold: 0.02,
68 relativeThreshold: 0.1 69 relativeThreshold: 0.1
69 }); 70 });
70 71
71 task.done(); 72 task.done();
72 }); 73 });
73 74
74 75
75 // With no argument, this executes all tasks in the order defined. 76 // With no argument, this executes all tasks in the order defined.
76 audit.run(); 77 audit.run();
77 </script> 78 </script>
78 </body> 79 </body>
79 </html> 80 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698