| 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.runner; | 5 library test.runner; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:io'; | 8 import 'dart:io'; |
| 9 | 9 |
| 10 import 'backend/metadata.dart'; | 10 import 'backend/metadata.dart'; |
| 11 import 'backend/test_platform.dart'; | 11 import 'backend/test_platform.dart'; |
| 12 import 'frontend/timeout.dart'; |
| 12 import 'runner/application_exception.dart'; | 13 import 'runner/application_exception.dart'; |
| 13 import 'runner/configuration.dart'; | 14 import 'runner/configuration.dart'; |
| 14 import 'runner/engine.dart'; | 15 import 'runner/engine.dart'; |
| 15 import 'runner/load_exception.dart'; | 16 import 'runner/load_exception.dart'; |
| 16 import 'runner/load_suite.dart'; | 17 import 'runner/load_suite.dart'; |
| 17 import 'runner/loader.dart'; | 18 import 'runner/loader.dart'; |
| 18 import 'runner/reporter.dart'; | 19 import 'runner/reporter.dart'; |
| 19 import 'runner/reporter/compact.dart'; | 20 import 'runner/reporter/compact.dart'; |
| 20 import 'runner/reporter/expanded.dart'; | 21 import 'runner/reporter/expanded.dart'; |
| 21 import 'runner/runner_suite.dart'; | 22 import 'runner/runner_suite.dart'; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 48 /// The subscription to the stream returned by [_loadSuites]. | 49 /// The subscription to the stream returned by [_loadSuites]. |
| 49 StreamSubscription _suiteSubscription; | 50 StreamSubscription _suiteSubscription; |
| 50 | 51 |
| 51 /// The thunk for ensuring [close] only runs once. | 52 /// The thunk for ensuring [close] only runs once. |
| 52 final _closeThunk = new AsyncThunk(); | 53 final _closeThunk = new AsyncThunk(); |
| 53 bool get _closed => _closeThunk.hasRun; | 54 bool get _closed => _closeThunk.hasRun; |
| 54 | 55 |
| 55 /// Creates a new runner based on [configuration]. | 56 /// Creates a new runner based on [configuration]. |
| 56 factory Runner(Configuration configuration) { | 57 factory Runner(Configuration configuration) { |
| 57 var metadata = new Metadata( | 58 var metadata = new Metadata( |
| 59 timeout: configuration.pauseAfterLoad ? Timeout.none : null, |
| 58 verboseTrace: configuration.verboseTrace); | 60 verboseTrace: configuration.verboseTrace); |
| 59 var loader = new Loader(configuration.platforms, | 61 var loader = new Loader(configuration.platforms, |
| 60 pubServeUrl: configuration.pubServeUrl, | 62 pubServeUrl: configuration.pubServeUrl, |
| 61 packageRoot: configuration.packageRoot, | 63 packageRoot: configuration.packageRoot, |
| 62 color: configuration.color, | 64 color: configuration.color, |
| 63 metadata: metadata, | 65 metadata: metadata, |
| 64 jsTrace: configuration.jsTrace); | 66 jsTrace: configuration.jsTrace); |
| 65 | 67 |
| 66 var engine = new Engine(concurrency: configuration.concurrency); | 68 var engine = new Engine(concurrency: configuration.concurrency); |
| 67 | 69 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 88 /// or not they ran successfully. | 90 /// or not they ran successfully. |
| 89 Future<bool> run() async { | 91 Future<bool> run() async { |
| 90 if (_closed) { | 92 if (_closed) { |
| 91 throw new StateError("run() may not be called on a closed Runner."); | 93 throw new StateError("run() may not be called on a closed Runner."); |
| 92 } | 94 } |
| 93 | 95 |
| 94 var suites = _loadSuites(); | 96 var suites = _loadSuites(); |
| 95 | 97 |
| 96 var success; | 98 var success; |
| 97 if (_configuration.pauseAfterLoad) { | 99 if (_configuration.pauseAfterLoad) { |
| 98 // TODO(nweiz): disable timeouts when debugging. | |
| 99 success = await _loadThenPause(suites); | 100 success = await _loadThenPause(suites); |
| 100 } else { | 101 } else { |
| 101 _suiteSubscription = suites.listen(_engine.suiteSink.add); | 102 _suiteSubscription = suites.listen(_engine.suiteSink.add); |
| 102 var results = await Future.wait([ | 103 var results = await Future.wait([ |
| 103 _suiteSubscription.asFuture().then((_) => _engine.suiteSink.close()), | 104 _suiteSubscription.asFuture().then((_) => _engine.suiteSink.close()), |
| 104 _engine.run() | 105 _engine.run() |
| 105 ], eagerError: true); | 106 ], eagerError: true); |
| 106 success = results.last; | 107 success = results.last; |
| 107 } | 108 } |
| 108 | 109 |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 | 239 |
| 239 // TODO(nweiz): Display something in the paused browsers indicating that | 240 // TODO(nweiz): Display something in the paused browsers indicating that |
| 240 // they're paused. | 241 // they're paused. |
| 241 | 242 |
| 242 await stdinLines.next; | 243 await stdinLines.next; |
| 243 } finally { | 244 } finally { |
| 244 _reporter.resume(); | 245 _reporter.resume(); |
| 245 } | 246 } |
| 246 } | 247 } |
| 247 } | 248 } |
| OLD | NEW |