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

Side by Side Diff: utils/tests/pub/version_solver_test.dart

Issue 14241005: Use the cached pubspec if possible for describing hosted packages. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Redo after realizing SystemCache already has this logic. Created 7 years, 8 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 | « utils/tests/pub/test_pub.dart ('k') | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 pub_update_test; 5 library pub_update_test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:io'; 8 import 'dart:io';
9 9
10 import 'package:unittest/unittest.dart'; 10 import 'package:unittest/unittest.dart';
(...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 /// Keeps track of which package pubspecs have been requested. Ensures that a 861 /// Keeps track of which package pubspecs have been requested. Ensures that a
862 /// source is only hit once for a given package and that pub internally 862 /// source is only hit once for a given package and that pub internally
863 /// caches the results. 863 /// caches the results.
864 final _requestedPubspecs = new Map<String, Set<Version>>(); 864 final _requestedPubspecs = new Map<String, Set<Version>>();
865 865
866 final String name; 866 final String name;
867 bool get shouldCache => true; 867 bool get shouldCache => true;
868 868
869 MockSource(this.name); 869 MockSource(this.name);
870 870
871 Future<String> systemCacheDirectory(PackageId id) {
872 return new Future.value('${id.name}-${id.version}');
873 }
874
871 Future<List<Version>> getVersions(String name, String description) { 875 Future<List<Version>> getVersions(String name, String description) {
872 return new Future.sync(() { 876 return new Future.sync(() {
873 // Make sure the solver doesn't request the same thing twice. 877 // Make sure the solver doesn't request the same thing twice.
874 if (_requestedVersions.contains(description)) { 878 if (_requestedVersions.contains(description)) {
875 throw new Exception('Version list for $description was already ' 879 throw new Exception('Version list for $description was already '
876 'requested.'); 880 'requested.');
877 } 881 }
878 882
879 _requestedVersions.add(description); 883 _requestedVersions.add(description);
880 884
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
965 }; 969 };
966 970
967 var match = new RegExp(r"(.*) from (.*)").firstMatch(description); 971 var match = new RegExp(r"(.*) from (.*)").firstMatch(description);
968 if (match != null) { 972 if (match != null) {
969 name = match[1]; 973 name = match[1];
970 source = sourceNames[match[2]]; 974 source = sourceNames[match[2]];
971 } 975 }
972 976
973 callback(isDev, name, source); 977 callback(isDev, name, source);
974 } 978 }
OLDNEW
« no previous file with comments | « utils/tests/pub/test_pub.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698