| 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 | 125 |
| 126 /// Removes [assets] from the current [PackageProvider]. | 126 /// Removes [assets] from the current [PackageProvider]. |
| 127 /// | 127 /// |
| 128 /// Each item in the list may either be an [AssetId] or a string that can be | 128 /// Each item in the list may either be an [AssetId] or a string that can be |
| 129 /// parsed as one. Unlike [removeSources], this is not automatically scheduled | 129 /// parsed as one. Unlike [removeSources], this is not automatically scheduled |
| 130 /// and will be run synchronously when called. | 130 /// and will be run synchronously when called. |
| 131 void removeSourcesSync(Iterable assets) => | 131 void removeSourcesSync(Iterable assets) => |
| 132 _barback.removeSources(_parseAssets(assets)); | 132 _barback.removeSources(_parseAssets(assets)); |
| 133 | 133 |
| 134 /// Sets the transformers for [package] to [transformers]. | 134 /// Sets the transformers for [package] to [transformers]. |
| 135 void updateTransformers(String package, | 135 void updateTransformers(String package, Iterable<Iterable> transformers) { |
| 136 Iterable<Iterable<Transformer>> transformers) { | |
| 137 schedule(() => _barback.updateTransformers(package, transformers), | 136 schedule(() => _barback.updateTransformers(package, transformers), |
| 138 "updating transformers for $package"); | 137 "updating transformers for $package"); |
| 139 } | 138 } |
| 140 | 139 |
| 141 /// Parse a list of strings or [AssetId]s into a list of [AssetId]s. | 140 /// Parse a list of strings or [AssetId]s into a list of [AssetId]s. |
| 142 List<AssetId> _parseAssets(Iterable assets) { | 141 List<AssetId> _parseAssets(Iterable assets) { |
| 143 return assets.map((asset) { | 142 return assets.map((asset) { |
| 144 if (asset is String) return new AssetId.parse(asset); | 143 if (asset is String) return new AssetId.parse(asset); |
| 145 return asset; | 144 return asset; |
| 146 }).toList(); | 145 }).toList(); |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 | 518 |
| 520 _MockAsset(this.id, this.contents); | 519 _MockAsset(this.id, this.contents); |
| 521 | 520 |
| 522 Future<String> readAsString({Encoding encoding}) => | 521 Future<String> readAsString({Encoding encoding}) => |
| 523 new Future.value(contents); | 522 new Future.value(contents); |
| 524 | 523 |
| 525 Stream<List<int>> read() => throw new UnimplementedError(); | 524 Stream<List<int>> read() => throw new UnimplementedError(); |
| 526 | 525 |
| 527 String toString() => "MockAsset $id $contents"; | 526 String toString() => "MockAsset $id $contents"; |
| 528 } | 527 } |
| OLD | NEW |