| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 /* | 5 /* |
| 6 * The communication protocol between test_controller.js and the driving | 6 * The communication protocol between test_controller.js and the driving |
| 7 * page are JSON encoded messages of the following form: | 7 * page are JSON encoded messages of the following form: |
| 8 * message = { | 8 * message = { |
| 9 * is_first_message: true/false, | 9 * is_first_message: true/false, |
| 10 * is_status_update: true/false, | 10 * is_status_update: true/false, |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 // | 274 // |
| 275 // Our tests will be wrapped, so we can detect when [main] is called and when | 275 // Our tests will be wrapped, so we can detect when [main] is called and when |
| 276 // it has ended. | 276 // it has ended. |
| 277 // The wrapping happens either via "dartMainRunner" (for dart2js) or wrapped | 277 // The wrapping happens either via "dartMainRunner" (for dart2js) or wrapped |
| 278 // tests for dartium. | 278 // tests for dartium. |
| 279 // | 279 // |
| 280 // The following messages are handled specially: | 280 // The following messages are handled specially: |
| 281 // dart-calling-main: signals that the dart [main] function will be invoked | 281 // dart-calling-main: signals that the dart [main] function will be invoked |
| 282 // dart-main-done: signals that the dart [main] function has finished | 282 // dart-main-done: signals that the dart [main] function has finished |
| 283 // unittest-suite-wait-for-done: signals the start of an asynchronous test | 283 // unittest-suite-wait-for-done: signals the start of an asynchronous test |
| 284 // unittest-suite-success: signals the end of an asynchrounous test | 284 // unittest-suite-success: signals the end of an asynchronous test |
| 285 // unittest-suite-fail: signals that the asynchronous test failed | 285 // unittest-suite-fail: signals that the asynchronous test failed |
| 286 // unittest-suite-done: signals the end of an asynchronous test, the outcome | 286 // unittest-suite-done: signals the end of an asynchronous test, the outcome |
| 287 // is unknown | 287 // is unknown |
| 288 // | 288 // |
| 289 // These messages are used to communicate with the test and will be posted so | 289 // These messages are used to communicate with the test and will be posted so |
| 290 // [processMessage] above can see it. | 290 // [processMessage] above can see it. |
| 291 function dartPrint(message) { | 291 function dartPrint(message) { |
| 292 recordEvent('print', message); | 292 recordEvent('print', message); |
| 293 if ((message === 'unittest-suite-wait-for-done') || | 293 if ((message === 'unittest-suite-wait-for-done') || |
| 294 (message === 'unittest-suite-success') || | 294 (message === 'unittest-suite-success') || |
| (...skipping 14 matching lines...) Expand all Loading... |
| 309 dartPrint('dart-calling-main'); | 309 dartPrint('dart-calling-main'); |
| 310 try { | 310 try { |
| 311 main(); | 311 main(); |
| 312 } catch (e) { | 312 } catch (e) { |
| 313 recordEvent('sync_exception', 'Exception: ' + e + '\nStack: ' + e.stack); | 313 recordEvent('sync_exception', 'Exception: ' + e + '\nStack: ' + e.stack); |
| 314 notifyDone('FAIL'); | 314 notifyDone('FAIL'); |
| 315 return; | 315 return; |
| 316 } | 316 } |
| 317 dartPrint('dart-main-done'); | 317 dartPrint('dart-main-done'); |
| 318 } | 318 } |
| OLD | NEW |