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

Unified Diff: third_party/WebKit/LayoutTests/webaudio/unit-tests/audit.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 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
index e83cb2fc78e8e46cd5dbb0b713c8746a25405502..27bc852522a96e9162b0804ab017e3be08495d9d 100644
--- a/third_party/WebKit/LayoutTests/webaudio/unit-tests/audit.html
+++ b/third_party/WebKit/LayoutTests/webaudio/unit-tests/audit.html
@@ -12,53 +12,69 @@
// Basic assertion testing.
- audit.define('basic', function (task, should) {
- task.describe('Simple unit tests for basic assertions.');
+ audit.define({
+ label: 'basic',
+ description: 'Simple unit tests for basic assertions.'
+ }, function (task, should) {
+ should(OfflineAudioContext, 'OfflineAudioContext').exist();
+ should(function () { var foo1 = 0; }, 'Setting foo1 to 0').notThrow();
+ should(function () { var foo2 = bar; }).throw();
+ should(function () { var foo3 = bar; }).throw('ReferenceError');
+ should(() => { should(); }, 'Calling should() with no argument')
+ .throw('Error');
+ should(3 < 5, '3 < 5').beTrue();
+ should(false).beFalse();
+ 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);
+ should(should(1).beEqualTo(1), 'should(1).beEqualTo(1)').beTrue();
+ should(true, 'The message is').message('truthful!', 'false!');
- should(OfflineAudioContext, 'OfflineAudioContext').exist();
- should(function () { var foo1 = 0; }, 'Setting foo1 to 0').notThrow();
- should(function () { var foo2 = bar; }).throw();
- should(function () { var foo3 = bar; }).throw('ReferenceError');
- should(() => { should(); }, 'Calling should() with no argument')
- .throw('Error');
- should(3 < 5, '3 < 5').beTrue();
- should(false).beFalse();
- 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);
- should(should(1).beEqualTo(1), 'should(1).beEqualTo(1)').beTrue();
- should(true, 'The message is').message('truthful!', 'false!');
-
- let oac = new OfflineAudioContext(1, 128, 44100);
- Promise.all([
- should(oac.startRendering(), 'Start OAC rendering').beResolved(),
- should(oac.decodeAudioData(), 'Decoding audio data with no argument')
- .beRejected(),
- should(oac.suspend(), 'Suspending OAC with no argument')
- .beRejectedWith('TypeError')
- ]).then(task.done.bind(task));
- });
+ let oac = new OfflineAudioContext(1, 128, 44100);
+ Promise.all([
+ should(oac.startRendering(), 'Start OAC rendering').beResolved(),
+ should(oac.decodeAudioData(), 'Decoding audio data with no argument')
+ .beRejected(),
+ should(oac.suspend(), 'Suspending OAC with no argument')
+ .beRejectedWith('TypeError')
+ ]).then(task.done.bind(task));
+ }
+ );
// Advanced, mostly array-based numerical testing. Note that some codes
// are commented out to avoid the trybot failure. These failures are
// intentional, to demonstrate how the detailed failure report works.
- audit.define('numerical', function (task, should) {
- task.describe('Numerical assertion unit test.');
+ audit.define({
+ label: 'numerical',
+ description: 'Numerical assertion unit test.'
+ }, function (task, should) {
+ should(2.3).beCloseTo(2, { threshold: 0.3 });
+ should([1, 1, 1]).beConstantValueOf(1);
+ should([1, 0, 1]).notBeConstantValueOf(1);
+ should([1, 0, 0, 1]).notBeConstantValueOf(1);
+ should([1, 1, 1]).beEqualToArray([1, 1, 1]);
+ should([1, 1, 1, 1, 2, 2, 3, 3, 3])
+ .containValues([1, 2, 3], 'one, two, three');
+ should([0.5, 0.5, 0.55, 0.5, 0.45, 0.5]).notGlitch(0.06);
+ task.done();
+ }
+ );
- should(2.3).beCloseTo(2, { threshold: 0.3 });
- should([1, 1, 1]).beConstantValueOf(1);
- should([1, 0, 1]).notBeConstantValueOf(1);
- should([1, 0, 0, 1]).notBeConstantValueOf(1);
- should([1, 1, 1]).beEqualToArray([1, 1, 1]);
- should([1, 1, 1, 1, 2, 2, 3, 3, 3])
- .containValues([1, 2, 3], 'one, two, three');
- should([0.5, 0.5, 0.55, 0.5, 0.45, 0.5]).notGlitch(0.06);
+ // The task headline needs to be printed even if there is no description is
+ // given.
+ audit.define('dummy-label-string', function (task) {
+ task.done();
+ });
+
+
+ // Test the same thing in a differen way.
+ audit.define({ label: 'dummy-label-object' }, function (task) {
task.done();
});
@@ -67,15 +83,13 @@
// runs. If you would like to see how failure cases get printed, include
// this task and launch the task runner.
audit.define('empty', function (task, should) {
- task.describe('This is an empty task.');
-
task.done();
});
// You can enumerate tasks you want to execute in the order, or simply pass
// no argument to run all the defined tasks.
- audit.run('numerical', 'basic');
+ audit.run('numerical', 'basic', 'dummy-label-string', 'dummy-label-object');
</script>
</body>
</html>

Powered by Google App Engine
This is Rietveld 408576698