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

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

Issue 887223007: Revert "Use native async/await support in pub." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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
Index: sdk/lib/_internal/pub_generated/test/serve/utils.dart
diff --git a/sdk/lib/_internal/pub/test/serve/utils.dart b/sdk/lib/_internal/pub_generated/test/serve/utils.dart
similarity index 93%
copy from sdk/lib/_internal/pub/test/serve/utils.dart
copy to sdk/lib/_internal/pub_generated/test/serve/utils.dart
index f84eb9a353f97c13dc97df922401882306a2451d..a0ac7cc57044c306a05bc99d91b4a4666e7ea28f 100644
--- a/sdk/lib/_internal/pub/test/serve/utils.dart
+++ b/sdk/lib/_internal/pub_generated/test/serve/utils.dart
@@ -149,14 +149,10 @@ class DartTransformer extends Transformer {
/// so may be used to test for errors in the initialization process.
///
/// Returns the `pub serve` process.
-ScheduledProcess startPubServe({Iterable<String> args,
- bool createWebDir: true}) {
- var pubArgs = [
- "serve",
- "--port=0", // Use port 0 to get an ephemeral port.
- "--force-poll",
- "--log-admin-url"
- ];
+ScheduledProcess startPubServe({Iterable<String> args, bool createWebDir: true})
+ {
+ var pubArgs = ["serve", "--port=0", // Use port 0 to get an ephemeral port.
+ "--force-poll", "--log-admin-url"];
if (args != null) pubArgs.addAll(args);
@@ -194,10 +190,9 @@ ScheduledProcess pubServe({bool shouldGetFirst: false, bool createWebDir: true,
});
if (shouldGetFirst) {
- _pubServer.stdout.expect(consumeThrough(anyOf([
- "Got dependencies!",
- matches(new RegExp(r"^Changed \d+ dependenc"))
- ])));
+ _pubServer.stdout.expect(
+ consumeThrough(
+ anyOf(["Got dependencies!", matches(new RegExp(r"^Changed \d+ dependenc"))])));
}
_pubServer.stdout.expect(startsWith("Loading source assets..."));
@@ -284,8 +279,8 @@ void requestShould404(String urlPath, {String root}) {
/// "web".
void requestShouldRedirect(String urlPath, redirectTarget, {String root}) {
schedule(() {
- var request = new http.Request("GET",
- Uri.parse(_getServerUrlSync(root, urlPath)));
+ var request =
+ new http.Request("GET", Uri.parse(_getServerUrlSync(root, urlPath)));
request.followRedirects = false;
return request.send().then((response) {
expect(response.statusCode ~/ 100, equals(3));
@@ -312,7 +307,8 @@ void postShould405(String urlPath, {String root}) {
/// [root] indicates which server should be accessed, and defaults to "web".
void requestShouldNotConnect(String urlPath, {String root}) {
schedule(() {
- return expect(http.get(_getServerUrlSync(root, urlPath)),
+ return expect(
+ http.get(_getServerUrlSync(root, urlPath)),
throwsA(new isInstanceOf<SocketException>()));
}, "request $urlPath");
}
@@ -323,7 +319,7 @@ void requestShouldNotConnect(String urlPath, {String root}) {
/// The schedule will not proceed until the output is found. If not found, it
/// will eventually time out.
void waitForBuildSuccess() =>
- _pubServer.stdout.expect(consumeThrough(contains("successfully")));
+ _pubServer.stdout.expect(consumeThrough(contains("successfully")));
/// Schedules opening a web socket connection to the currently running pub
/// serve.
@@ -346,8 +342,8 @@ Future _ensureWebSocket() {
/// serve.
void closeWebSocket() {
schedule(() {
- return _ensureWebSocket().then((_) => _webSocket.close())
- .then((_) => _webSocket = null);
+ return _ensureWebSocket().then((_) => _webSocket.close()).then((_) => _webSocket =
+ null);
}, "closing web socket");
}
@@ -363,10 +359,8 @@ void closeWebSocket() {
Future<Map> webSocketRequest(String method, [Map params]) {
var completer = new Completer();
schedule(() {
- return Future.wait([
- _ensureWebSocket(),
- awaitObject(params),
- ]).then((results) {
+ return Future.wait(
+ [_ensureWebSocket(), awaitObject(params),]).then((results) {
var resolvedParams = results[1];
chainToCompleter(
currentSchedule.wrapFuture(_jsonRpcRequest(method, resolvedParams)),
@@ -390,10 +384,8 @@ Future<Map> webSocketRequest(String method, [Map params]) {
/// Returns a [Future] that completes to the call's result.
Future<Map> expectWebSocketResult(String method, Map params, result) {
return schedule(() {
- return Future.wait([
- webSocketRequest(method, params),
- awaitObject(result)
- ]).then((results) {
+ return Future.wait(
+ [webSocketRequest(method, params), awaitObject(result)]).then((results) {
var response = results[0];
var resolvedResult = results[1];
expect(response["result"], resolvedResult);
@@ -418,8 +410,8 @@ Future<Map> expectWebSocketResult(String method, Map params, result) {
/// "data" value of the error response.
///
/// Returns a [Future] that completes to the error's [data] field.
-Future expectWebSocketError(String method, Map params, errorCode,
- errorMessage, {data}) {
+Future expectWebSocketError(String method, Map params, errorCode, errorMessage,
+ {data}) {
return schedule(() {
return webSocketRequest(method, params).then((response) {
expect(response["error"]["code"], errorCode);
@@ -457,11 +449,10 @@ Future<Map> _jsonRpcRequest(String method, [Map params]) {
if (params != null) message["params"] = params;
_webSocket.add(JSON.encode(message));
- return _webSocketBroadcastStream
- .firstWhere((response) => response["id"] == id).then((value) {
+ return _webSocketBroadcastStream.firstWhere(
+ (response) => response["id"] == id).then((value) {
currentSchedule.addDebugInfo(
- "Web Socket request $method with params $params\n"
- "Result: $value");
+ "Web Socket request $method with params $params\n" "Result: $value");
expect(value["id"], equals(id));
return value;

Powered by Google App Engine
This is Rietveld 408576698