OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 * Tests that an observation matches the expected value. | 6 * Tests that an observation matches the expected value. |
7 * @param {Object} expected The expected value. | 7 * @param {Object} expected The expected value. |
8 * @param {Object} observed The actual value. | 8 * @param {Object} observed The actual value. |
9 * @param {string=} opt_message Optional message to include with a test | 9 * @param {string=} opt_message Optional message to include with a test |
10 * failure. | 10 * failure. |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 if (!isAsyncTest) | 191 if (!isAsyncTest) |
192 continueTesting(); | 192 continueTesting(); |
193 } else { | 193 } else { |
194 done = true; | 194 done = true; |
195 endTests(cleanTestRun); | 195 endTests(cleanTestRun); |
196 } | 196 } |
197 if (!done) { | 197 if (!done) { |
198 domAutomationController.setAutomationId(1); | 198 domAutomationController.setAutomationId(1); |
199 domAutomationController.send('PENDING'); | 199 domAutomationController.send('PENDING'); |
200 } | 200 } |
201 }; | 201 } |
202 | 202 |
203 exports.runTests = runTests; | 203 exports.runTests = runTests; |
204 })(this); | 204 })(this); |
205 | 205 |
206 /** | 206 /** |
207 * Signals completion of a test. | 207 * Signals completion of a test. |
208 * @param {boolean} success Indicates if the test completed successfully. | 208 * @param {boolean} success Indicates if the test completed successfully. |
209 */ | 209 */ |
210 function endTests(success) { | 210 function endTests(success) { |
211 domAutomationController.setAutomationId(1); | 211 domAutomationController.setAutomationId(1); |
212 domAutomationController.send(success ? 'SUCCESS' : 'FAILURE'); | 212 domAutomationController.send(success ? 'SUCCESS' : 'FAILURE'); |
213 } | 213 } |
214 | 214 |
215 window.onerror = function() { | 215 window.onerror = function() { |
216 endTests(false); | 216 endTests(false); |
217 }; | 217 }; |
OLD | NEW |