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

Unified Diff: utils/tests/pub/test_pub.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « utils/tests/pub/install/hosted/cached_pubspec_test.dart ('k') | utils/tests/pub/version_solver_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/tests/pub/test_pub.dart
diff --git a/utils/tests/pub/test_pub.dart b/utils/tests/pub/test_pub.dart
index d7fdb1df41008667b6c52025cb2b55cfba6f6edb..f5cb82c3841bebf3b36463419229bd949daa74ac 100644
--- a/utils/tests/pub/test_pub.dart
+++ b/utils/tests/pub/test_pub.dart
@@ -57,6 +57,10 @@ bool get runningOnBuildbot =>
/// The current [HttpServer] created using [serve].
var _server;
+/// The list of paths that have been requested from the server since the last
+/// call to [getRequestedPaths].
+final _requestedPaths = <String>[];
+
/// The cached value for [_portCompleter].
Completer<int> _portCompleterCache;
@@ -73,6 +77,16 @@ Completer<int> get _portCompleter {
/// A future that will complete to the port used for the current server.
Future<int> get port => _portCompleter.future;
+/// Gets the list of paths that have been requested from the server since the
+/// last time this was called (or since the server was first spun up).
+Future<List<String>> getRequestedPaths() {
+ return schedule(() {
+ var paths = _requestedPaths.toList();
+ _requestedPaths.clear();
+ return paths;
+ });
+}
+
/// Creates an HTTP server to serve [contents] as static files. This server will
/// exist only for the duration of the pub run.
///
@@ -88,6 +102,10 @@ void serve([List<d.Descriptor> contents]) {
var response = request.response;
try {
var path = request.uri.path.replaceFirst("/", "");
+
+ if (_requestedPaths == null) _requestedPaths = <String>[];
+ _requestedPaths.add(path);
+
response.persistentConnection = false;
var stream = baseDir.load(path);
« no previous file with comments | « utils/tests/pub/install/hosted/cached_pubspec_test.dart ('k') | utils/tests/pub/version_solver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698