| 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 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 // simulates the real world, where there'll always be at least the | 459 // simulates the real world, where there'll always be at least the |
| 460 // entrypoint package. | 460 // entrypoint package. |
| 461 if (_assets.isEmpty) { | 461 if (_assets.isEmpty) { |
| 462 _assets = {"app": new AssetSet()}; | 462 _assets = {"app": new AssetSet()}; |
| 463 } | 463 } |
| 464 } | 464 } |
| 465 | 465 |
| 466 void _modifyAsset(String name, String contents) { | 466 void _modifyAsset(String name, String contents) { |
| 467 var id = new AssetId.parse(name); | 467 var id = new AssetId.parse(name); |
| 468 _errors.remove(id); | 468 _errors.remove(id); |
| 469 _assets[id.package][id].contents = contents; | 469 (_assets[id.package][id] as _MockAsset).contents = contents; |
| 470 } | 470 } |
| 471 | 471 |
| 472 void _setAssetError(String name) { | 472 void _setAssetError(String name) { |
| 473 _errors.add(new AssetId.parse(name)); | 473 _errors.add(new AssetId.parse(name)); |
| 474 } | 474 } |
| 475 | 475 |
| 476 List<AssetId> listAssets(String package, {String within}) { | 476 List<AssetId> listAssets(String package, {String within}) { |
| 477 if (within != null) { | 477 if (within != null) { |
| 478 throw new UnimplementedError("Doesn't handle 'within' yet."); | 478 throw new UnimplementedError("Doesn't handle 'within' yet."); |
| 479 } | 479 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 | 521 |
| 522 _MockAsset(this.id, this.contents); | 522 _MockAsset(this.id, this.contents); |
| 523 | 523 |
| 524 Future<String> readAsString({Encoding encoding}) => | 524 Future<String> readAsString({Encoding encoding}) => |
| 525 new Future.value(contents); | 525 new Future.value(contents); |
| 526 | 526 |
| 527 Stream<List<int>> read() => throw new UnimplementedError(); | 527 Stream<List<int>> read() => throw new UnimplementedError(); |
| 528 | 528 |
| 529 String toString() => "MockAsset $id $contents"; | 529 String toString() => "MockAsset $id $contents"; |
| 530 } | 530 } |
| OLD | NEW |