| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>audit.js: basic tests</title> | 4 <title>audit.js: basic tests</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> |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 should([1, 0, 1]).notBeConstantValueOf(1); | 58 should([1, 0, 1]).notBeConstantValueOf(1); |
| 59 should([1, 0, 0, 1]).notBeConstantValueOf(1); | 59 should([1, 0, 0, 1]).notBeConstantValueOf(1); |
| 60 should([1, 1, 1]).beEqualToArray([1, 1, 1]); | 60 should([1, 1, 1]).beEqualToArray([1, 1, 1]); |
| 61 should([1, 1, 1, 1, 2, 2, 3, 3, 3]) | 61 should([1, 1, 1, 1, 2, 2, 3, 3, 3]) |
| 62 .containValues([1, 2, 3], 'one, two, three'); | 62 .containValues([1, 2, 3], 'one, two, three'); |
| 63 should([0.5, 0.5, 0.55, 0.5, 0.45, 0.5]).notGlitch(0.06); | 63 should([0.5, 0.5, 0.55, 0.5, 0.45, 0.5]).notGlitch(0.06); |
| 64 task.done(); | 64 task.done(); |
| 65 } | 65 } |
| 66 ); | 66 ); |
| 67 | 67 |
| 68 // Test Audit.loadFileFromUrl() within |should| assertion. |
| 69 // See: crbug.com/701813 |
| 70 audit.define({ |
| 71 label: 'load-file-in-should', |
| 72 description: 'Test Audit.loadFileFromUrl() within |should| assertion.' |
| 73 }, (task, should) => { |
| 74 let url = '../resources/hyper-reality/laughter.wav'; |
| 75 let promise = should(Audit.loadFileFromUrl(url), |
| 76 'Loading file within should().beResolved()') |
| 77 .beResolved(); |
| 78 promise.then(() => { task.done() }); |
| 79 } |
| 80 ); |
| 81 |
| 68 | 82 |
| 69 // The task headline needs to be printed even if there is no description is | 83 // The task headline needs to be printed even if there is no description is |
| 70 // given. | 84 // given. |
| 71 audit.define('dummy-label-string', function (task) { | 85 audit.define('dummy-label-string', function (task) { |
| 72 task.done(); | 86 task.done(); |
| 73 }); | 87 }); |
| 74 | 88 |
| 75 | 89 |
| 76 // Test the same thing in a differen way. | 90 // Test the same thing in a differen way. |
| 77 audit.define({ label: 'dummy-label-object' }, function (task) { | 91 audit.define({ label: 'dummy-label-object' }, function (task) { |
| 78 task.done(); | 92 task.done(); |
| 79 }); | 93 }); |
| 80 | 94 |
| 81 | 95 |
| 82 // This task is defined, but you can selectively opt it out when the task | 96 // This task is defined, but you can selectively opt it out when the task |
| 83 // runs. If you would like to see how failure cases get printed, include | 97 // runs. If you would like to see how failure cases get printed, include |
| 84 // this task and launch the task runner. | 98 // this task and launch the task runner. |
| 85 audit.define('empty', function (task, should) { | 99 audit.define('empty', function (task, should) { |
| 86 task.done(); | 100 task.done(); |
| 87 }); | 101 }); |
| 88 | 102 |
| 89 | 103 |
| 90 // You can enumerate tasks you want to execute in the order, or simply pass | 104 // You can enumerate tasks you want to execute in the order, or simply pass |
| 91 // no argument to run all the defined tasks. | 105 // no argument to run all the defined tasks. |
| 92 audit.run('numerical', 'basic', 'dummy-label-string', 'dummy-label-object'); | 106 audit.run('numerical', 'basic', 'load-file-in-should', |
| 107 'dummy-label-string', 'dummy-label-object'); |
| 93 </script> | 108 </script> |
| 94 </body> | 109 </body> |
| 95 </html> | 110 </html> |
| OLD | NEW |