Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 | 5 |
| 6 /** | 6 /** |
| 7 * @fileOverview WebAudio layout test utility library. Built around W3C's | 7 * @fileOverview WebAudio layout test utility library. Built around W3C's |
| 8 * testharness.js. Includes asynchronous test task manager, | 8 * testharness.js. Includes asynchronous test task manager, |
| 9 * assertion utilities. | 9 * assertion utilities. |
| 10 * @dependency testharness.js | 10 * @dependency testharness.js |
| (...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 927 this._label = taskLabel; | 927 this._label = taskLabel; |
| 928 this._description = ''; | 928 this._description = ''; |
| 929 this._state = TaskState.PENDING; | 929 this._state = TaskState.PENDING; |
| 930 this._result = true; | 930 this._result = true; |
| 931 | 931 |
| 932 this._totalAssertions = 0; | 932 this._totalAssertions = 0; |
| 933 this._failedAssertions = 0; | 933 this._failedAssertions = 0; |
| 934 } | 934 } |
| 935 | 935 |
| 936 // Set the description of this task. This is printed out in the test | 936 // Set the description of this task. This is printed out in the test |
| 937 // result. | 937 // result right after the task starts. |
| 938 describe (message) { | 938 describe (message) { |
| 939 this._description = message; | 939 this._description = message; |
| 940 _logPassed('> [' + this._label + '] ' | 940 _logPassed(' : ' + this._description); |
| 941 + this._description); | |
| 942 } | 941 } |
| 943 | 942 |
| 944 get state () { | 943 get state () { |
| 945 return this._state; | 944 return this._state; |
| 946 } | 945 } |
| 947 | 946 |
| 948 get result () { | 947 get result () { |
| 949 return this._result; | 948 return this._result; |
| 950 } | 949 } |
| 951 | 950 |
| 952 // Start the assertion chain. | 951 // Start the assertion chain. |
| 953 should (actual, actualDescription) { | 952 should (actual, actualDescription) { |
| 954 // If no argument is given, we cannot proceed. Halt. | 953 // If no argument is given, we cannot proceed. Halt. |
| 955 if (arguments.length === 0) | 954 if (arguments.length === 0) |
| 956 _throwException('Task.should:: requires at least 1 argument.'); | 955 _throwException('Task.should:: requires at least 1 argument.'); |
| 957 | 956 |
| 958 return new Should(this, actual, actualDescription); | 957 return new Should(this, actual, actualDescription); |
| 959 } | 958 } |
| 960 | 959 |
| 961 // Run this task. |this| task will be passed into the user-supplied test | 960 // Run this task. |this| task will be passed into the user-supplied test |
| 962 // task function. | 961 // task function. |
| 963 run () { | 962 run () { |
| 964 this._state = TaskState.STARTED; | 963 this._state = TaskState.STARTED; |
| 964 _logPassed('> [' + this._label + '] task started.'); | |
|
Raymond Toy
2017/02/16 21:50:40
I think I'd prefer nothing be printed. Because wh
hongchan
2017/02/16 23:54:49
If your description is undefined or null, you'll g
| |
| 965 this._taskFunction( | 965 this._taskFunction( |
| 966 this, | 966 this, |
| 967 this.should.bind(this)); | 967 this.should.bind(this)); |
| 968 } | 968 } |
| 969 | 969 |
| 970 // Update the task success based on the individual assertion/test inside. | 970 // Update the task success based on the individual assertion/test inside. |
| 971 update (subTask) { | 971 update (subTask) { |
| 972 // After one of tests fails within a task, the result is irreversible. | 972 // After one of tests fails within a task, the result is irreversible. |
| 973 if (subTask.result === false) { | 973 if (subTask.result === false) { |
| 974 this._result = false; | 974 this._result = false; |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1127 _logError('this test requires the explicit comparison with the ' | 1127 _logError('this test requires the explicit comparison with the ' |
| 1128 + 'expected result when it runs with run-webkit-tests.'); | 1128 + 'expected result when it runs with run-webkit-tests.'); |
| 1129 } | 1129 } |
| 1130 | 1130 |
| 1131 return new TaskRunner(); | 1131 return new TaskRunner(); |
| 1132 } | 1132 } |
| 1133 | 1133 |
| 1134 }; | 1134 }; |
| 1135 | 1135 |
| 1136 })(); | 1136 })(); |
| OLD | NEW |