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

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

Issue 2705483002: Print out label and description on task entry in Audit task runner (Closed)
Patch Set: Rebased after l-g-t-m Created 3 years, 10 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
« no previous file with comments | « third_party/WebKit/LayoutTests/webaudio/unit-tests/audit-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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({
24 task.describe('Testing basic assertion failures.'); 24 label: 'basic-failure',
25 description: 'Testing basic assertion failures.'
26 }, function (task, should) {
27 should(function () { var foo = bar; }, 'Setting foo to bar').notThrow();
28 should(function () { var foo = 0; }).throw('ReferenceError');
29 should(3 > 5, '3 < 5').beTrue();
30 should(true).beFalse();
31 should(1, 'The number of channels').beEqualTo(2);
32 should(1).notBeEqualTo(1);
33 should(typeof 3.141592, 'typeof 3.141592').beEqualTo('string');
34 should(1).beGreaterThan(2);
35 should(1).beGreaterThanOrEqualTo(2);
36 should(2).beLessThan(1);
37 should(2).beLessThanOrEqualTo(1);
38 should(should(1).beEqualTo(2), 'should(1).beEqualTo(2)').beTrue();
39 should(false, 'The message is').message('truthful!', 'false!');
25 40
26 should(function () { var foo = bar; }, 'Setting foo to bar').notThrow(); 41 let oac = new OfflineAudioContext(1, 128, 44100);
27 should(function () { var foo = 0; }).throw('ReferenceError'); 42 Promise.all([
28 should(3 > 5, '3 < 5').beTrue(); 43 should(oac.decodeAudioData(), 'Decoding audio data with no argument' )
29 should(true).beFalse(); 44 .beResolved(),
30 should(1, 'The number of channels').beEqualTo(2); 45 should(oac.startRendering(), 'Start OAC rendering').beRejected(),
31 should(1).notBeEqualTo(1); 46 should(oac.suspend(), 'Suspending OAC with no argument')
32 should(typeof 3.141592, 'typeof 3.141592').beEqualTo('string'); 47 .beRejectedWith('IndexSizeError')
33 should(1).beGreaterThan(2); 48 ]).then(task.done.bind(task));
34 should(1).beGreaterThanOrEqualTo(2); 49 }
35 should(2).beLessThan(1); 50 );
36 should(2).beLessThanOrEqualTo(1);
37 should(should(1).beEqualTo(2), 'should(1).beEqualTo(2)').beTrue();
38 should(false, 'The message is').message('truthful!', 'false!');
39
40 let oac = new OfflineAudioContext(1, 128, 44100);
41 Promise.all([
42 should(oac.decodeAudioData(), 'Decoding audio data with no argument')
43 .beResolved(),
44 should(oac.startRendering(), 'Start OAC rendering').beRejected(),
45 should(oac.suspend(), 'Suspending OAC with no argument')
46 .beRejectedWith('IndexSizeError')
47 ]).then(task.done.bind(task));
48 });
49 51
50 52
51 // Numerical assertions. 53 // Numerical assertions.
52 audit.define('numerical-failures', function (task, should) { 54 audit.define({
53 task.describe('Testing numerical assertion failures.'); 55 label: 'numerical-failures',
54 56 description: 'Testing numerical assertion failures.'
55 should(0).beCloseTo(0.1, { threshold: 0 }); 57 }, function (task, should) {
56 should(59, 'The measured decibel').beCloseTo(62, { threshold: 0.01 }); 58 should(0).beCloseTo(0.1, { threshold: 0 });
57 should([1, 8, 11, 18, 6, 5, 5, 5, 123, 49]).beConstantValueOf(5); 59 should(59, 'The measured decibel').beCloseTo(62, { threshold: 0.01 });
58 should([0, 0, 0]).notBeConstantValueOf(0); 60 should([1, 8, 11, 18, 6, 5, 5, 5, 123, 49]).beConstantValueOf(5);
59 should([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) 61 should([0, 0, 0]).notBeConstantValueOf(0);
60 .beEqualToArray([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]); 62 should([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
61 should([1, 1, 1, 1, 2, 2, 3, 3, 3]).containValues([1, 3, 2]); 63 .beEqualToArray([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
62 should([0.5, 0.5, 0.55, 0.5, 0.45, 0.5]).notGlitch(0.04); 64 should([1, 1, 1, 1, 2, 2, 3, 3, 3]).containValues([1, 3, 2]);
63 should([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.9]) 65 should([0.5, 0.5, 0.55, 0.5, 0.45, 0.5]).notGlitch(0.04);
64 .beCloseToArray([0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1], { 66 should([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.9])
65 absoluteThreshold: 0.02 67 .beCloseToArray([0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1], {
66 }); 68 absoluteThreshold: 0.02
67 should([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.9]) 69 });
68 .beCloseToArray([0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1], { 70 should([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.9])
69 relativeThreshold: 0.1 71 .beCloseToArray([0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1], {
70 }); 72 relativeThreshold: 0.1
71 should([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.9]) 73 });
72 .beCloseToArray([0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1], { 74 should([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.9])
73 absoluteThreshold: 0.02, 75 .beCloseToArray([0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1], {
74 relativeThreshold: 0.1 76 absoluteThreshold: 0.02,
75 }); 77 relativeThreshold: 0.1
78 });
76 79
77 // Tests extra info 80 // Tests extra info
78 should([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) 81 should([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11])
79 .beCloseToArray([2, 3, 4, 5, 6, 7, 800, 900, 1000, 1100, 1200], { 82 .beCloseToArray([2, 3, 4, 5, 6, 7, 800, 900, 1000, 1100, 1200], {
80 absoluteThreshold: 0 83 absoluteThreshold: 0
81 }); 84 });
82 task.done(); 85 task.done();
83 }); 86 });
84 87
85
86 // With no argument, this executes all tasks in the order defined. 88 // With no argument, this executes all tasks in the order defined.
87 audit.run(); 89 audit.run();
88 </script> 90 </script>
89 </body> 91 </body>
90 </html> 92 </html>
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/webaudio/unit-tests/audit-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698