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.runner.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 '../backend/live_test.dart'; |
11 import 'state.dart'; | 11 import '../backend/state.dart'; |
12 import 'suite.dart'; | 12 import '../backend/suite.dart'; |
13 import 'utils.dart'; | 13 import '../utils.dart'; |
14 | 14 |
15 /// An [Engine] manages a run that encompasses multiple test suites. | 15 /// An [Engine] manages a run that encompasses multiple test suites. |
16 /// | 16 /// |
17 /// The current status of every test is visible via [liveTests]. [onTestStarted] | 17 /// The current status of every test is visible via [liveTests]. [onTestStarted] |
18 /// can also be used to be notified when a test is about to be run. | 18 /// can also be used to be notified when a test is about to be run. |
19 /// | 19 /// |
20 /// Suites will be run in the order they're provided to [new Engine]. Tests | 20 /// Suites will be run in the order they're provided to [new Engine]. Tests |
21 /// within those suites will likewise be run in the order of [Suite.tests]. | 21 /// within those suites will likewise be run in the order of [Suite.tests]. |
22 class Engine { | 22 class Engine { |
23 /// Whether [run] has been called yet. | 23 /// Whether [run] has been called yet. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 | 67 |
68 /// Signals that the caller is done paying attention to test results and the | 68 /// Signals that the caller is done paying attention to test results and the |
69 /// engine should release any resources it has allocated. | 69 /// engine should release any resources it has allocated. |
70 Future close() => | 70 Future close() => |
71 Future.wait(liveTests.map((liveTest) => liveTest.close())); | 71 Future.wait(liveTests.map((liveTest) => liveTest.close())); |
72 } | 72 } |
OLD | NEW |