Chromium Code Reviews| 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 /// This library is used for testing asynchronous tests. | 5 /// This library is used for testing asynchronous tests. |
| 6 /// If a test is asynchronous, it needs to notify the testing driver | 6 /// If a test is asynchronous, it needs to notify the testing driver |
| 7 /// about this (otherwise tests may get reported as passing [after main() | 7 /// about this (otherwise tests may get reported as passing [after main() |
| 8 /// finished] even if the asynchronous operations fail). | 8 /// finished] even if the asynchronous operations fail). |
| 9 /// Tests which can't use the unittest framework should use the helper functions | 9 /// Tests which can't use the unittest framework should use the helper functions |
| 10 /// in this library. | 10 /// in this library. |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 55 } | 55 } |
| 56 } | 56 } |
| 57 _asyncLevel--; | 57 _asyncLevel--; |
| 58 if (_asyncLevel == 0) { | 58 if (_asyncLevel == 0) { |
| 59 _port.close(); | 59 _port.close(); |
| 60 _port = null; | 60 _port = null; |
| 61 print('unittest-suite-success'); | 61 print('unittest-suite-success'); |
| 62 } | 62 } |
| 63 } | 63 } |
| 64 | 64 |
| 65 void asyncTest(Future f()) { | 65 void asyncTest(f()) { |
|
kustermann
2013/09/03 13:53:03
You could add some documentation to the top of the
| |
| 66 asyncStart(); | 66 asyncStart(); |
| 67 f().whenComplete(() => asyncEnd()); | 67 f().whenComplete(() => asyncEnd()); |
| 68 } | 68 } |
|
ahe
2013/09/03 08:28:51
No newline at end of file. Stop production! DANGER
| |
| OLD | NEW |