Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 [shouldInstallFirst] is `true`, validates that pub install is run first. |
| 91 /// If [dart2js] is `false` does not compiles Dart entrypoints in "web" to | |
|
nweiz
2013/10/04 20:26:10
Comma after "`false`", "compiles" -> "compile".
Bob Nystrom
2013/10/04 23:23:59
Done.
| |
| 92 /// JavaScript. | |
| 91 /// | 93 /// |
| 92 /// Returns the `pub serve` process. | 94 /// Returns the `pub serve` process. |
| 93 ScheduledProcess startPubServe({bool shouldInstallFirst: false}) { | 95 ScheduledProcess startPubServe({bool shouldInstallFirst: false, |
| 96 bool dart2js: true}) { | |
| 97 | |
| 94 // Use port 0 to get an ephemeral port. | 98 // Use port 0 to get an ephemeral port. |
| 95 _pubServer = startPub(args: ["serve", "--port=0", "--hostname=127.0.0.1"]); | 99 var args = ["serve", "--port=0", "--hostname=127.0.0.1"]; |
| 100 | |
| 101 if (!dart2js) args.add("--no-dart2js"); | |
| 102 | |
| 103 _pubServer = startPub(args: args); | |
| 96 | 104 |
| 97 if (shouldInstallFirst) { | 105 if (shouldInstallFirst) { |
| 98 expect(_pubServer.nextLine(), | 106 expect(_pubServer.nextLine(), |
| 99 completion(startsWith("Dependencies have changed"))); | 107 completion(startsWith("Dependencies have changed"))); |
| 100 expect(_pubServer.nextLine(), | 108 expect(_pubServer.nextLine(), |
| 101 completion(startsWith("Resolving dependencies..."))); | 109 completion(startsWith("Resolving dependencies..."))); |
| 102 expect(_pubServer.nextLine(), | 110 expect(_pubServer.nextLine(), |
| 103 completion(equals("Dependencies installed!"))); | 111 completion(equals("Dependencies installed!"))); |
| 104 } | 112 } |
| 105 | 113 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 161 return _pubServer.nextLine().then((line) { | 169 return _pubServer.nextLine().then((line) { |
| 162 if (line.contains("successfully")) return; | 170 if (line.contains("successfully")) return; |
| 163 | 171 |
| 164 // This line wasn't it, so ignore it and keep trying. | 172 // This line wasn't it, so ignore it and keep trying. |
| 165 return nextLine(); | 173 return nextLine(); |
| 166 }); | 174 }); |
| 167 } | 175 } |
| 168 | 176 |
| 169 schedule(nextLine); | 177 schedule(nextLine); |
| 170 } | 178 } |
| OLD | NEW |