OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 import 'dart:async'; | 5 import 'dart:async'; |
6 | 6 |
7 import 'package:async/async.dart' hide Result; | 7 import 'package:async/async.dart' hide Result; |
8 import 'package:collection/collection.dart'; | 8 import 'package:collection/collection.dart'; |
9 | 9 |
10 import '../backend/state.dart'; | 10 import '../backend/state.dart'; |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 | 114 |
115 assert(liveTest.suite == _suite); | 115 assert(liveTest.suite == _suite); |
116 assert(_active == null); | 116 assert(_active == null); |
117 | 117 |
118 _active = liveTest; | 118 _active = liveTest; |
119 | 119 |
120 liveTest.onStateChange.listen((state) { | 120 liveTest.onStateChange.listen((state) { |
121 if (state.status != Status.complete) return; | 121 if (state.status != Status.complete) return; |
122 _active = null; | 122 _active = null; |
123 | 123 |
124 if (state.result != Result.success) { | 124 if (state.result == Result.skipped) { |
| 125 _skipped.add(liveTest); |
| 126 } else if (state.result != Result.success) { |
125 _passed.remove(liveTest); | 127 _passed.remove(liveTest); |
126 _failed.add(liveTest); | 128 _failed.add(liveTest); |
127 } else if (liveTest.test.metadata.skip) { | |
128 _skipped.add(liveTest); | |
129 } else if (countSuccess) { | 129 } else if (countSuccess) { |
130 _passed.add(liveTest); | 130 _passed.add(liveTest); |
131 } | 131 } |
132 }); | 132 }); |
133 | 133 |
134 _onTestStartedController.add(liveTest); | 134 _onTestStartedController.add(liveTest); |
135 | 135 |
136 _onCompleteGroup.add(liveTest.onComplete); | 136 _onCompleteGroup.add(liveTest.onComplete); |
137 } | 137 } |
138 | 138 |
139 /// Indicates that all the live tests that are going to be provided for this | 139 /// Indicates that all the live tests that are going to be provided for this |
140 /// suite have already been provided. | 140 /// suite have already been provided. |
141 void noMoreLiveTests() { | 141 void noMoreLiveTests() { |
142 _onTestStartedController.close(); | 142 _onTestStartedController.close(); |
143 _onCompleteGroup.close(); | 143 _onCompleteGroup.close(); |
144 } | 144 } |
145 | 145 |
146 /// Closes the underlying suite. | 146 /// Closes the underlying suite. |
147 Future close() => _closeMemo.runOnce(() async { | 147 Future close() => _closeMemo.runOnce(() async { |
148 try { | 148 try { |
149 await _suite.close(); | 149 await _suite.close(); |
150 } finally { | 150 } finally { |
151 _onCloseCompleter.complete(); | 151 _onCloseCompleter.complete(); |
152 } | 152 } |
153 }); | 153 }); |
154 final _closeMemo = new AsyncMemoizer(); | 154 final _closeMemo = new AsyncMemoizer(); |
155 } | 155 } |
OLD | NEW |