| 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:convert' show Encoding; | 9 import 'dart:convert' show Encoding; |
| 10 | 10 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 // by MockProvider to exist. | 91 // by MockProvider to exist. |
| 92 for (var package in transformers.keys) { | 92 for (var package in transformers.keys) { |
| 93 assetMap.putIfAbsent(package, () => new AssetSet()); | 93 assetMap.putIfAbsent(package, () => new AssetSet()); |
| 94 } | 94 } |
| 95 | 95 |
| 96 _provider = new MockProvider(assetMap); | 96 _provider = new MockProvider(assetMap); |
| 97 _barback = new Barback(_provider); | 97 _barback = new Barback(_provider); |
| 98 _nextBuildResult = 0; | 98 _nextBuildResult = 0; |
| 99 _nextLog = 0; | 99 _nextLog = 0; |
| 100 | 100 |
| 101 transformers.forEach(_barback.updateTransformers); | 101 schedule(() => transformers.forEach(_barback.updateTransformers)); |
| 102 | 102 |
| 103 // There should be one successful build after adding all the transformers but | 103 // There should be one successful build after adding all the transformers but |
| 104 // before adding any sources. | 104 // before adding any sources. |
| 105 if (!transformers.isEmpty) buildShouldSucceed(); | 105 if (!transformers.isEmpty) buildShouldSucceed(); |
| 106 } | 106 } |
| 107 | 107 |
| 108 /// Updates [assets] in the current [PackageProvider]. | 108 /// Updates [assets] in the current [PackageProvider]. |
| 109 /// | 109 /// |
| 110 /// Each item in the list may either be an [AssetId] or a string that can be | 110 /// Each item in the list may either be an [AssetId] or a string that can be |
| 111 /// parsed as one. | 111 /// parsed as one. |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 | 564 |
| 565 _MockAsset(this.id, this.contents); | 565 _MockAsset(this.id, this.contents); |
| 566 | 566 |
| 567 Future<String> readAsString({Encoding encoding}) => | 567 Future<String> readAsString({Encoding encoding}) => |
| 568 new Future.value(contents); | 568 new Future.value(contents); |
| 569 | 569 |
| 570 Stream<List<int>> read() => throw new UnimplementedError(); | 570 Stream<List<int>> read() => throw new UnimplementedError(); |
| 571 | 571 |
| 572 String toString() => "MockAsset $id $contents"; | 572 String toString() => "MockAsset $id $contents"; |
| 573 } | 573 } |
| OLD | NEW |