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

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

Issue 12262056: Clean up some warnings and deprecated calls. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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/validator_test.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 '../../pub/lock_file.dart'; 10 import '../../pub/lock_file.dart';
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 class MockSource extends Source { 458 class MockSource extends Source {
459 final Map<String, Map<Version, Package>> _packages; 459 final Map<String, Map<Version, Package>> _packages;
460 460
461 final String name; 461 final String name;
462 bool get shouldCache => true; 462 bool get shouldCache => true;
463 463
464 MockSource(this.name) 464 MockSource(this.name)
465 : _packages = <String, Map<Version, Package>>{}; 465 : _packages = <String, Map<Version, Package>>{};
466 466
467 Future<List<Version>> getVersions(String name, String description) { 467 Future<List<Version>> getVersions(String name, String description) {
468 return fakeAsync(() => _packages[description].keys.toList()); 468 return defer(() => _packages[description].keys.toList());
469 } 469 }
470 470
471 Future<Pubspec> describe(PackageId id) { 471 Future<Pubspec> describe(PackageId id) {
472 return fakeAsync(() { 472 return defer(() {
473 return _packages[id.name][id.version].pubspec; 473 return _packages[id.name][id.version].pubspec;
474 }); 474 });
475 } 475 }
476 476
477 Future<bool> install(PackageId id, String path) { 477 Future<bool> install(PackageId id, String path) {
478 throw 'no'; 478 throw 'no';
479 } 479 }
480 480
481 Package mockPackage(String description, String version, 481 Package mockPackage(String description, String version,
482 Map dependencyStrings) { 482 Map dependencyStrings) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 519
520 Future<Pubspec> describe(PackageId id) { 520 Future<Pubspec> describe(PackageId id) {
521 return new Future<Pubspec>.immediate(_packages[id.description].pubspec); 521 return new Future<Pubspec>.immediate(_packages[id.description].pubspec);
522 } 522 }
523 523
524 void addPackage(Package package) { 524 void addPackage(Package package) {
525 _packages[package.name] = package; 525 _packages[package.name] = package;
526 } 526 }
527 } 527 }
528 528
529 Future fakeAsync(callback()) {
530 var completer = new Completer();
531 Timer.run(() {
532 completer.complete(callback());
533 });
534
535 return completer.future;
536 }
537
538 Pair<String, Source> parseSource(String name) { 529 Pair<String, Source> parseSource(String name) {
539 var match = new RegExp(r"(.*) from (.*)").firstMatch(name); 530 var match = new RegExp(r"(.*) from (.*)").firstMatch(name);
540 if (match == null) return new Pair<String, Source>(name, source1); 531 if (match == null) return new Pair<String, Source>(name, source1);
541 switch (match[2]) { 532 switch (match[2]) {
542 case 'mock1': return new Pair<String, Source>(match[1], source1); 533 case 'mock1': return new Pair<String, Source>(match[1], source1);
543 case 'mock2': return new Pair<String, Source>(match[1], source2); 534 case 'mock2': return new Pair<String, Source>(match[1], source2);
544 case 'root': return new Pair<String, Source>(match[1], null); 535 case 'root': return new Pair<String, Source>(match[1], null);
545 case 'versionless': 536 case 'versionless':
546 return new Pair<String, Source>(match[1], versionlessSource); 537 return new Pair<String, Source>(match[1], versionlessSource);
547 } 538 }
548 } 539 }
OLDNEW
« no previous file with comments | « utils/tests/pub/validator_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698