| 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 test.backend.invoker; | 5 library test.backend.invoker; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:stack_trace/stack_trace.dart'; | 9 import 'package:stack_trace/stack_trace.dart'; |
| 10 | 10 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 : _body = body, | 38 : _body = body, |
| 39 _tearDown = tearDown; | 39 _tearDown = tearDown; |
| 40 | 40 |
| 41 /// Loads a single runnable instance of this test. | 41 /// Loads a single runnable instance of this test. |
| 42 LiveTest load(Suite suite) { | 42 LiveTest load(Suite suite) { |
| 43 var invoker = new Invoker._(suite, this); | 43 var invoker = new Invoker._(suite, this); |
| 44 return invoker.liveTest; | 44 return invoker.liveTest; |
| 45 } | 45 } |
| 46 | 46 |
| 47 Test change({String name, Metadata metadata}) { | 47 Test change({String name, Metadata metadata}) { |
| 48 if (name == name && metadata == this.metadata) return this; |
| 48 if (name == null) name = this.name; | 49 if (name == null) name = this.name; |
| 49 if (metadata == null) metadata = this.metadata; | 50 if (metadata == null) metadata = this.metadata; |
| 50 return new LocalTest(name, metadata, _body, tearDown: _tearDown); | 51 return new LocalTest(name, metadata, _body, tearDown: _tearDown); |
| 51 } | 52 } |
| 52 } | 53 } |
| 53 | 54 |
| 54 /// The class responsible for managing the lifecycle of a single local test. | 55 /// The class responsible for managing the lifecycle of a single local test. |
| 55 /// | 56 /// |
| 56 /// The current invoker is accessible within the zone scope of the running test | 57 /// The current invoker is accessible within the zone scope of the running test |
| 57 /// using [Invoker.current]. It's used to track asynchronous callbacks and | 58 /// using [Invoker.current]. It's used to track asynchronous callbacks and |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 // Use the invoker as a key so that multiple invokers can have different | 247 // Use the invoker as a key so that multiple invokers can have different |
| 247 // outstanding callback counters at once. | 248 // outstanding callback counters at once. |
| 248 this: outstandingCallbacksForBody | 249 this: outstandingCallbacksForBody |
| 249 }, | 250 }, |
| 250 zoneSpecification: new ZoneSpecification( | 251 zoneSpecification: new ZoneSpecification( |
| 251 print: (self, parent, zone, line) => _controller.print(line)), | 252 print: (self, parent, zone, line) => _controller.print(line)), |
| 252 onError: _handleError); | 253 onError: _handleError); |
| 253 }); | 254 }); |
| 254 } | 255 } |
| 255 } | 256 } |
| OLD | NEW |