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

Unified Diff: test/descriptor.dart

Issue 1664903003: Properly include the hosted URL in all IDs. (Closed) Base URL: git@github.com:dart-lang/pub.git@master
Patch Set: Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/src/source/hosted.dart ('k') | test/get/hosted/get_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/descriptor.dart
diff --git a/test/descriptor.dart b/test/descriptor.dart
index b9a28b36c4a395da0a296bc607ae42d4ff89049a..de57c14b1ee83ae686139b09a77b4c175cf6aef0 100644
--- a/test/descriptor.dart
+++ b/test/descriptor.dart
@@ -127,12 +127,15 @@ Descriptor packagesDir(Map<String, String> packages) {
/// A package's value may also be a list of versions, in which case all
/// versions are expected to be downloaded.
///
+/// If [port] is passed, it's used as the port number of the local hosted server
+/// that this cache represents. It may be either an `int` or a `Future<int>`.
+///
/// If [includePubspecs] is `true`, then pubspecs will be created for each
/// package. Defaults to `false` so that the contents of pubspecs are not
/// validated since they will often lack the dependencies section that the
/// real pubspec being compared against has. You usually only need to pass
/// `true` for this if you plan to call [create] on the resulting descriptor.
-Descriptor cacheDir(Map packages, {bool includePubspecs: false}) {
+Descriptor cacheDir(Map packages, {port, bool includePubspecs: false}) {
var contents = <Descriptor>[];
packages.forEach((name, versions) {
if (versions is! List) versions = [versions];
@@ -145,15 +148,19 @@ Descriptor cacheDir(Map packages, {bool includePubspecs: false}) {
}
});
- return hostedCache(contents);
+ return hostedCache(contents, port: port);
}
/// Describes the main cache directory containing cached hosted packages
/// downloaded from the mock package server.
-Descriptor hostedCache(Iterable<Descriptor> contents) {
+///
+/// If [port] is passed, it's used as the port number of the local hosted server
+/// that this cache represents. It may be either an `int` or a `Future<int>`.
+Descriptor hostedCache(Iterable<Descriptor> contents, {port}) {
return dir(cachePath, [
dir('hosted', [
- async(globalServer.port.then((p) => dir('localhost%58$p', contents)))
+ async(awaitObject(port ?? globalServer.port)
+ .then((p) => dir('localhost%58$p', contents)))
])
]);
}
« no previous file with comments | « lib/src/source/hosted.dart ('k') | test/get/hosted/get_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698