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

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

Issue 26284002: Rename "install" -> "get" and "update" -> "upgrade". (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS d.file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS d.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 library pub_tests; 5 library pub_tests;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:http/http.dart' as http; 9 import 'package:http/http.dart' as http;
10 import 'package:scheduled_test/scheduled_process.dart'; 10 import 'package:scheduled_test/scheduled_process.dart';
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 return 'const TOKEN = "(\${match[1]}, \$TOKEN)";'; 80 return 'const TOKEN = "(\${match[1]}, \$TOKEN)";';
81 }))); 81 })));
82 }); 82 });
83 } 83 }
84 } 84 }
85 """; 85 """;
86 } 86 }
87 87
88 /// Schedules starting the "pub serve" process. 88 /// Schedules starting the "pub serve" process.
89 /// 89 ///
90 /// If [shouldInstallFirst] is `true`, validates that pub install is run first. 90 /// If [shouldGetFirst] is `true`, validates that pub get is run first. If
91 /// If [dart2js] is `false`, does not compile Dart entrypoints in "web" to 91 /// [dart2js] is `false`, does not compile Dart entrypoints in "web" to
92 /// JavaScript. 92 /// JavaScript.
93 /// 93 ///
94 /// Returns the `pub serve` process. 94 /// Returns the `pub serve` process.
95 ScheduledProcess startPubServe({bool shouldInstallFirst: false, 95 ScheduledProcess startPubServe({bool shouldGetFirst: false,
96 bool dart2js: true}) { 96 bool dart2js: true}) {
97 97
98 // Use port 0 to get an ephemeral port. 98 // Use port 0 to get an ephemeral port.
99 var args = ["serve", "--port=0", "--hostname=127.0.0.1"]; 99 var args = ["serve", "--port=0", "--hostname=127.0.0.1"];
100 100
101 if (!dart2js) args.add("--no-dart2js"); 101 if (!dart2js) args.add("--no-dart2js");
102 102
103 _pubServer = startPub(args: args); 103 _pubServer = startPub(args: args);
104 104
105 if (shouldInstallFirst) { 105 if (shouldGetFirst) {
106 expect(_pubServer.nextLine(), 106 expect(_pubServer.nextLine(),
107 completion(startsWith("Dependencies have changed"))); 107 completion(startsWith("Dependencies have changed")));
108 expect(_pubServer.nextLine(), 108 expect(_pubServer.nextLine(),
109 completion(startsWith("Resolving dependencies..."))); 109 completion(startsWith("Resolving dependencies...")));
110 expect(_pubServer.nextLine(), 110 expect(_pubServer.nextLine(),
111 completion(equals("Dependencies installed!"))); 111 completion(equals("Got dependencies!")));
112 } 112 }
113 113
114 expect(_pubServer.nextLine().then(_parsePort), completes); 114 expect(_pubServer.nextLine().then(_parsePort), completes);
115 return _pubServer; 115 return _pubServer;
116 } 116 }
117 117
118 /// Parses the port number from the "Serving blah on 127.0.0.1:1234" line 118 /// Parses the port number from the "Serving blah on 127.0.0.1:1234" line
119 /// printed by pub serve. 119 /// printed by pub serve.
120 void _parsePort(String line) { 120 void _parsePort(String line) {
121 var match = new RegExp(r"127\.0\.0\.1:(\d+)").firstMatch(line); 121 var match = new RegExp(r"127\.0\.0\.1:(\d+)").firstMatch(line);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 return _pubServer.nextLine().then((line) { 169 return _pubServer.nextLine().then((line) {
170 if (line.contains("successfully")) return; 170 if (line.contains("successfully")) return;
171 171
172 // This line wasn't it, so ignore it and keep trying. 172 // This line wasn't it, so ignore it and keep trying.
173 return nextLine(); 173 return nextLine();
174 }); 174 });
175 } 175 }
176 176
177 schedule(nextLine); 177 schedule(nextLine);
178 } 178 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698