Chromium Code Reviews| 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 import 'dart:async'; | 5 import 'dart:async'; |
| 6 | 6 |
| 7 import 'package:stack_trace/stack_trace.dart'; | 7 import 'package:stack_trace/stack_trace.dart'; |
| 8 | 8 |
| 9 import '../../test.dart'; | 9 import '../../test.dart'; |
| 10 import '../backend/group.dart'; | 10 import '../backend/group.dart'; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 59 Test get test => this.group.entries.single as Test; | 59 Test get test => this.group.entries.single as Test; |
| 60 | 60 |
| 61 /// Creates a load suite named [name] on [platform]. | 61 /// Creates a load suite named [name] on [platform]. |
| 62 /// | 62 /// |
| 63 /// [body] may return either a [RunnerSuite] or a [Future] that completes to a | 63 /// [body] may return either a [RunnerSuite] or a [Future] that completes to a |
| 64 /// [RunnerSuite]. Its return value is forwarded through [suite], although if | 64 /// [RunnerSuite]. Its return value is forwarded through [suite], although if |
| 65 /// it throws an error that will be forwarded through the suite's test. | 65 /// it throws an error that will be forwarded through the suite's test. |
| 66 /// | 66 /// |
| 67 /// If the the load test is closed before [body] is complete, it will close | 67 /// If the the load test is closed before [body] is complete, it will close |
| 68 /// the suite returned by [body] once it completes. | 68 /// the suite returned by [body] once it completes. |
| 69 factory LoadSuite(String name, SuiteConfiguration config, body(), | 69 factory LoadSuite(String name, SuiteConfiguration config, FutureOr<RunnerSuite > body(), |
|
nweiz
2017/03/10 21:24:34
Long line.
keertip
2017/03/10 21:30:37
Done.
| |
| 70 {String path, TestPlatform platform}) { | 70 {String path, TestPlatform platform}) { |
| 71 var completer = new Completer<Pair<RunnerSuite, Zone>>.sync(); | 71 var completer = new Completer<Pair<RunnerSuite, Zone>>.sync(); |
| 72 return new LoadSuite._(name, config, () { | 72 return new LoadSuite._(name, config, () { |
| 73 var invoker = Invoker.current; | 73 var invoker = Invoker.current; |
| 74 invoker.addOutstandingCallback(); | 74 invoker.addOutstandingCallback(); |
| 75 | 75 |
| 76 invoke(() async { | 76 invoke(() async { |
| 77 try { | 77 try { |
| 78 var suite = await body(); | 78 var suite = await body(); |
| 79 if (completer.isCompleted) { | 79 if (completer.isCompleted) { |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 176 } | 176 } |
| 177 | 177 |
| 178 LoadSuite filter(bool callback(Test test)) { | 178 LoadSuite filter(bool callback(Test test)) { |
| 179 var filtered = this.group.filter(callback); | 179 var filtered = this.group.filter(callback); |
| 180 if (filtered == null) filtered = new Group.root([], metadata: metadata); | 180 if (filtered == null) filtered = new Group.root([], metadata: metadata); |
| 181 return new LoadSuite._filtered(this, filtered); | 181 return new LoadSuite._filtered(this, filtered); |
| 182 } | 182 } |
| 183 | 183 |
| 184 Future close() async {} | 184 Future close() async {} |
| 185 } | 185 } |
| OLD | NEW |