Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(255)

Side by Side Diff: pkg/barback/test/utils.dart

Issue 556423002: Fix an analyzer error in barback. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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:convert' show Encoding; 8 import 'dart:convert' show Encoding;
9 9
10 import 'package:barback/barback.dart'; 10 import 'package:barback/barback.dart';
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 var id = new AssetId.parse(name); 553 var id = new AssetId.parse(name);
554 _errors.remove(id); 554 _errors.remove(id);
555 _syncErrors.remove(id); 555 _syncErrors.remove(id);
556 (_assets[id.package][id] as _MockAsset).contents = contents; 556 (_assets[id.package][id] as _MockAsset).contents = contents;
557 } 557 }
558 558
559 void _setAssetError(String name, bool async) { 559 void _setAssetError(String name, bool async) {
560 (async ? _errors : _syncErrors).add(new AssetId.parse(name)); 560 (async ? _errors : _syncErrors).add(new AssetId.parse(name));
561 } 561 }
562 562
563 List<AssetId> getAllAssets(String package) => 563 Stream<AssetId> getAllAssetIds(String package) =>
564 _assets[package].map((asset) => asset.id); 564 new Stream.fromIterable(_assets[package].map((asset) => asset.id));
565 565
566 Future<Asset> getAsset(AssetId id) { 566 Future<Asset> getAsset(AssetId id) {
567 // Eagerly load the asset so we can test an asset's value changing between 567 // Eagerly load the asset so we can test an asset's value changing between
568 // when a load starts and when it finishes. 568 // when a load starts and when it finishes.
569 var assets = _assets[id.package]; 569 var assets = _assets[id.package];
570 var asset; 570 var asset;
571 if (assets != null) asset = assets[id]; 571 if (assets != null) asset = assets[id];
572 572
573 if (_syncErrors.contains(id)) throw new MockLoadException(id); 573 if (_syncErrors.contains(id)) throw new MockLoadException(id);
574 var hasError = _errors.contains(id); 574 var hasError = _errors.contains(id);
(...skipping 29 matching lines...) Expand all
604 604
605 _MockAsset(this.id, this.contents); 605 _MockAsset(this.id, this.contents);
606 606
607 Future<String> readAsString({Encoding encoding}) => 607 Future<String> readAsString({Encoding encoding}) =>
608 new Future.value(contents); 608 new Future.value(contents);
609 609
610 Stream<List<int>> read() => throw new UnimplementedError(); 610 Stream<List<int>> read() => throw new UnimplementedError();
611 611
612 String toString() => "MockAsset $id $contents"; 612 String toString() => "MockAsset $id $contents";
613 } 613 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698