| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 barback.test.utils; | 5 library barback.test.utils; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 import 'dart:io'; | 9 import 'dart:io'; |
| 10 | 10 |
| 11 import 'package:barback/barback.dart'; | 11 import 'package:barback/barback.dart'; |
| 12 import 'package:barback/src/asset_graph.dart'; | 12 import 'package:barback/src/asset_graph.dart'; |
| 13 import 'package:pathos/path.dart' as pathos; | 13 import 'package:pathos/path.dart' as pathos; |
| 14 import 'package:scheduled_test/scheduled_test.dart'; | 14 import 'package:scheduled_test/scheduled_test.dart'; |
| 15 | 15 import 'package:unittest/compact_vm_config.dart'; |
| 16 // TODO(rnystrom): Get rid of this or find a better path for it. | |
| 17 import '../../../sdk/lib/_internal/pub/test/command_line_config.dart'; | |
| 18 | 16 |
| 19 var _configured = false; | 17 var _configured = false; |
| 20 | 18 |
| 21 MockProvider _provider; | 19 MockProvider _provider; |
| 22 AssetGraph _graph; | 20 AssetGraph _graph; |
| 23 | 21 |
| 24 /// Calls to [buildShouldSucceed] and [buildShouldFail] set expectations on | 22 /// Calls to [buildShouldSucceed] and [buildShouldFail] set expectations on |
| 25 /// successive [BuildResult]s from [_graph]. This keeps track of how many calls | 23 /// successive [BuildResult]s from [_graph]. This keeps track of how many calls |
| 26 /// have already been made so later calls know which result to look for. | 24 /// have already been made so later calls know which result to look for. |
| 27 int _nextBuildResult; | 25 int _nextBuildResult; |
| 28 | 26 |
| 29 void initConfig() { | 27 void initConfig() { |
| 30 if (_configured) return; | 28 if (_configured) return; |
| 31 _configured = true; | 29 _configured = true; |
| 32 unittestConfiguration = new CommandLineConfiguration(); | 30 useCompactVMConfiguration(); |
| 33 } | 31 } |
| 34 | 32 |
| 35 /// Creates a new [AssetProvider] and [AssetGraph] with the given [assets] and | 33 /// Creates a new [AssetProvider] and [AssetGraph] with the given [assets] and |
| 36 /// [transformers]. | 34 /// [transformers]. |
| 37 /// | 35 /// |
| 38 /// This graph is used internally by most of the other functions in this | 36 /// This graph is used internally by most of the other functions in this |
| 39 /// library so you must call it in the test before calling any of the other | 37 /// library so you must call it in the test before calling any of the other |
| 40 /// functions. | 38 /// functions. |
| 41 /// | 39 /// |
| 42 /// [assets] may either be an [Iterable] or a [Map]. If it's an [Iterable], | 40 /// [assets] may either be an [Iterable] or a [Map]. If it's an [Iterable], |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 | 456 |
| 459 MockAsset(this.id, this.contents); | 457 MockAsset(this.id, this.contents); |
| 460 | 458 |
| 461 Future<String> readAsString({Encoding encoding}) => | 459 Future<String> readAsString({Encoding encoding}) => |
| 462 new Future.value(contents); | 460 new Future.value(contents); |
| 463 | 461 |
| 464 Stream<List<int>> read() => throw new UnimplementedError(); | 462 Stream<List<int>> read() => throw new UnimplementedError(); |
| 465 | 463 |
| 466 String toString() => "MockAsset $id $contents"; | 464 String toString() => "MockAsset $id $contents"; |
| 467 } | 465 } |
| OLD | NEW |