OLD | NEW |
---|---|
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 library unittest.engine; | 5 library unittest.engine; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:collection'; | 8 import 'dart:collection'; |
9 | 9 |
10 import 'live_test.dart'; | 10 import 'live_test.dart'; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
57 _onTestStartedController.add(liveTest); | 57 _onTestStartedController.add(liveTest); |
58 | 58 |
59 // First, schedule a microtask to ensure that [onTestStarted] fires before | 59 // First, schedule a microtask to ensure that [onTestStarted] fires before |
60 // the first [LiveTest.onStateChange] event. Once the test finishes, use | 60 // the first [LiveTest.onStateChange] event. Once the test finishes, use |
61 // [new Future] to do a coarse-grained event loop pump to avoid starving | 61 // [new Future] to do a coarse-grained event loop pump to avoid starving |
62 // the DOM or other non-microtask events. | 62 // the DOM or other non-microtask events. |
63 return new Future.microtask(liveTest.run).then((_) => new Future(() {})); | 63 return new Future.microtask(liveTest.run).then((_) => new Future(() {})); |
64 }).then((_) => | 64 }).then((_) => |
65 liveTests.every((liveTest) => liveTest.state.result == Result.success)); | 65 liveTests.every((liveTest) => liveTest.state.result == Result.success)); |
66 } | 66 } |
67 | |
68 /// Signals that the caller is done paying attention to test results and the | |
69 /// engine should release any resources it has allocated. | |
70 Future close() => | |
71 Future.wait(liveTests.map((liveTest) => liveTest.close())); | |
kevmoo
2015/02/19 01:54:08
Could this be huge? Do we want to "pool" this?
nweiz
2015/02/19 02:10:18
It's important for the API that the caller have ac
| |
67 } | 72 } |
OLD | NEW |