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

Side by Side Diff: test/package_server.dart

Issue 2172523002: Refactor version_solver_test. (Closed) Base URL: git@github.com:dart-lang/pub.git@master
Patch Set: Created 4 years, 5 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
« no previous file with comments | « lib/src/solver/backtracking_solver.dart ('k') | test/test_pub.dart » ('j') | 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 import 'dart:async'; 5 import 'dart:async';
6 import 'dart:convert'; 6 import 'dart:convert';
7 7
8 import 'package:path/path.dart' as p; 8 import 'package:path/path.dart' as p;
9 import 'package:pub/src/io.dart'; 9 import 'package:pub/src/io.dart';
10 import 'package:pub/src/utils.dart'; 10 import 'package:pub/src/utils.dart';
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 67
68 /// The current [PackageServerBuilder] that a user uses to specify which 68 /// The current [PackageServerBuilder] that a user uses to specify which
69 /// package to serve. 69 /// package to serve.
70 /// 70 ///
71 /// This is preserved so that additional packages can be added. 71 /// This is preserved so that additional packages can be added.
72 var _builder = new PackageServerBuilder._(); 72 var _builder = new PackageServerBuilder._();
73 73
74 /// A future that will complete to the port used for the server. 74 /// A future that will complete to the port used for the server.
75 Future<int> get port => _inner.port; 75 Future<int> get port => _inner.port;
76 76
77 /// A future that will complete to the URL for the server.
78 Future<String> get url async => 'http://localhost:${await port}';
79
77 /// Creates an HTTP server that replicates the structure of pub.dartlang.org. 80 /// Creates an HTTP server that replicates the structure of pub.dartlang.org.
78 /// 81 ///
79 /// Calls [callback] with a [PackageServerBuilder] that's used to specify 82 /// Calls [callback] with a [PackageServerBuilder] that's used to specify
80 /// which packages to serve. 83 /// which packages to serve.
81 PackageServer(void callback(PackageServerBuilder builder)) { 84 PackageServer(void callback(PackageServerBuilder builder)) {
82 _inner = new DescriptorServer([ 85 _inner = new DescriptorServer([
83 d.dir('api', [_servedApiPackageDir]), 86 d.dir('api', [_servedApiPackageDir]),
84 _servedPackageDir 87 _servedPackageDir
85 ]); 88 ]);
86 89
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 220
218 /// A package that's intended to be served. 221 /// A package that's intended to be served.
219 class _ServedPackage { 222 class _ServedPackage {
220 final Map pubspec; 223 final Map pubspec;
221 final List<d.Descriptor> contents; 224 final List<d.Descriptor> contents;
222 225
223 Version get version => new Version.parse(pubspec['version']); 226 Version get version => new Version.parse(pubspec['version']);
224 227
225 _ServedPackage(this.pubspec, this.contents); 228 _ServedPackage(this.pubspec, this.contents);
226 } 229 }
OLDNEW
« no previous file with comments | « lib/src/solver/backtracking_solver.dart ('k') | test/test_pub.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698