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

Unified Diff: sdk/lib/_internal/pub/test/serve/utils.dart

Issue 21147002: Install before starting the server if the lockfile is out of date. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revise. Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/_internal/pub/test/serve/installs_first_if_source_changed_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/pub/test/serve/utils.dart
diff --git a/sdk/lib/_internal/pub/test/serve/utils.dart b/sdk/lib/_internal/pub/test/serve/utils.dart
index a74498ba9460d6d75fc07e74d2e3314d3d99307a..e03edd0d1037b476ffecfd9fc4c1efbf401f9b77 100644
--- a/sdk/lib/_internal/pub/test/serve/utils.dart
+++ b/sdk/lib/_internal/pub/test/serve/utils.dart
@@ -21,15 +21,30 @@ ScheduledProcess _pubServer;
int _port;
/// Schedules starting the "pub serve" process.
-void startPubServe() {
+///
+/// If [shouldInstallFirst] is `true`, validates that pub install is run first.
+void startPubServe({bool shouldInstallFirst: false}) {
// Use port 0 to get an ephemeral port.
_pubServer = startPub(args: ["serve", "--port=0"]);
- expect(_pubServer.nextLine().then((line) {
- var match = new RegExp(r"localhost:(\d+)").firstMatch(line);
- assert(match != null);
- _port = int.parse(match[1]);
- }), completes);
+ if (shouldInstallFirst) {
+ expect(_pubServer.nextLine(),
+ completion(startsWith("Dependencies have changed")));
+ expect(_pubServer.nextLine(),
+ completion(startsWith("Resolving dependencies...")));
+ expect(_pubServer.nextLine(),
+ completion(equals("Dependencies installed!")));
+ }
+
+ expect(_pubServer.nextLine().then(_parsePort), completes);
+}
+
+/// Parses the port number from the "Serving blah on localhost:1234" line
+/// printed by pub serve.
+void _parsePort(String line) {
+ var match = new RegExp(r"localhost:(\d+)").firstMatch(line);
+ assert(match != null);
+ _port = int.parse(match[1]);
}
void endPubServe() {
« no previous file with comments | « sdk/lib/_internal/pub/test/serve/installs_first_if_source_changed_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698