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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
4 | 4 |
5 library testing.chain; | 5 library testing.chain; |
6 | 6 |
7 import 'dart:async' show Future, Stream; | 7 import 'dart:async' show Future, Stream; |
8 | 8 |
9 import 'dart:convert' show JSON, JsonEncoder; | 9 import 'dart:convert' show JSON, JsonEncoder; |
10 | 10 |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 | 142 |
143 Result result; | 143 Result result; |
144 // Records the outcome of the last step that was run. | 144 // Records the outcome of the last step that was run. |
145 Step lastStepRun; | 145 Step lastStepRun; |
146 | 146 |
147 /// Performs one step of [iterator]. | 147 /// Performs one step of [iterator]. |
148 /// | 148 /// |
149 /// If `step.isAsync` is true, the corresponding step is said to be | 149 /// If `step.isAsync` is true, the corresponding step is said to be |
150 /// asynchronous. | 150 /// asynchronous. |
151 /// | 151 /// |
152 /// If a step is asynchrouns the future returned from this function will | 152 /// If a step is asynchronous the future returned from this function will |
153 /// complete after the first asynchronous step is scheduled. This | 153 /// complete after the first asynchronous step is scheduled. This |
154 /// allows us to start processing the next test while an external process | 154 /// allows us to start processing the next test while an external process |
155 /// completes as steps can be interleaved. To ensure all steps are | 155 /// completes as steps can be interleaved. To ensure all steps are |
156 /// completed, wait for [futures]. | 156 /// completed, wait for [futures]. |
157 /// | 157 /// |
158 /// Otherwise, the future returned will complete when all steps are | 158 /// Otherwise, the future returned will complete when all steps are |
159 /// completed. This ensures that tests are run in sequence without | 159 /// completed. This ensures that tests are run in sequence without |
160 /// interleaving steps. | 160 /// interleaving steps. |
161 Future doStep(dynamic input) async { | 161 Future doStep(dynamic input) async { |
162 Future future; | 162 Future future; |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 /// This is called from generated code. | 341 /// This is called from generated code. |
342 Future<Null> runChain(CreateContext f, Map<String, String> environment, | 342 Future<Null> runChain(CreateContext f, Map<String, String> environment, |
343 Set<String> selectors, String json) { | 343 Set<String> selectors, String json) { |
344 return withErrorHandling(() async { | 344 return withErrorHandling(() async { |
345 Chain suite = new Suite.fromJsonMap(Uri.base, JSON.decode(json)); | 345 Chain suite = new Suite.fromJsonMap(Uri.base, JSON.decode(json)); |
346 print("Running ${suite.name}"); | 346 print("Running ${suite.name}"); |
347 ChainContext context = await f(suite, environment); | 347 ChainContext context = await f(suite, environment); |
348 return context.run(suite, selectors); | 348 return context.run(suite, selectors); |
349 }); | 349 }); |
350 } | 350 } |
OLD | NEW |