Chromium Code Reviews| 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..eded51c0d32e8baf24b7f07a0c4ce8b68f64c13a 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 ???. |
|
nweiz
2013/04/18 22:50:03
???
Bob Nystrom
2013/04/18 23:07:10
Oops. Wrote that comment before I figured out what
|
| +var _requestedPaths; |
|
nweiz
2013/04/18 22:50:03
This should have a type annotation since it doesn'
Bob Nystrom
2013/04/18 23:07:10
Done.
|
| + |
| /// The cached value for [_portCompleter]. |
| Completer<int> _portCompleterCache; |
| @@ -73,6 +77,18 @@ 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). Since |
| +/// this method is synchronous, make sure to call it from within [schedule] to |
| +/// ensure it's scheduled with other tasks. |
|
nweiz
2013/04/18 22:50:03
It would be cleaner to make this return a Future<L
Bob Nystrom
2013/04/18 23:07:10
Done.
|
| +List<String> getRequestedPaths() { |
| + if (_requestedPaths == null) return []; |
| + |
| + var paths = _requestedPaths; |
| + _requestedPaths = null; |
| + 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 +104,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); |