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

Unified Diff: tests/standalone/io/http_connection_close_test.dart

Issue 2771453003: Format all tests. (Closed)
Patch Set: Format files Created 3 years, 8 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: tests/standalone/io/http_connection_close_test.dart
diff --git a/tests/standalone/io/http_connection_close_test.dart b/tests/standalone/io/http_connection_close_test.dart
index 70fbda053bc9fc54b577ffe4d6df50f06fc4d830..df6d3ea50347055976283b4767674945ccde6563 100644
--- a/tests/standalone/io/http_connection_close_test.dart
+++ b/tests/standalone/io/http_connection_close_test.dart
@@ -13,38 +13,32 @@ void testHttp10Close(bool closeRequest) {
request.response.close();
});
- Socket.connect("127.0.0.1", server.port)
- .then((socket) {
- socket.write("GET / HTTP/1.0\r\n\r\n");
- socket.listen(
- (data) {},
- onDone: () {
- if (!closeRequest) socket.destroy();
- server.close();
- });
- if (closeRequest) socket.close();
+ Socket.connect("127.0.0.1", server.port).then((socket) {
+ socket.write("GET / HTTP/1.0\r\n\r\n");
+ socket.listen((data) {}, onDone: () {
+ if (!closeRequest) socket.destroy();
+ server.close();
});
+ if (closeRequest) socket.close();
+ });
});
}
void testHttp11Close(bool closeRequest) {
HttpServer.bind("127.0.0.1", 0).then((server) {
server.listen((request) {
- request.response.close();
+ request.response.close();
});
- Socket.connect("127.0.0.1", server.port)
- .then((socket) {
- List<int> buffer = new List<int>(1024);
- socket.write("GET / HTTP/1.1\r\nConnection: close\r\n\r\n");
- socket.listen(
- (data) {},
- onDone: () {
- if (!closeRequest) socket.destroy();
- server.close();
- });
- if (closeRequest) socket.close();
+ Socket.connect("127.0.0.1", server.port).then((socket) {
+ List<int> buffer = new List<int>(1024);
+ socket.write("GET / HTTP/1.1\r\nConnection: close\r\n\r\n");
+ socket.listen((data) {}, onDone: () {
+ if (!closeRequest) socket.destroy();
+ server.close();
});
+ if (closeRequest) socket.close();
+ });
});
}
@@ -52,32 +46,29 @@ void testStreamResponse() {
HttpServer.bind("127.0.0.1", 0).then((server) {
server.listen((request) {
var timer = new Timer.periodic(const Duration(milliseconds: 0), (_) {
- request.response.write(
- 'data:${new DateTime.now().millisecondsSinceEpoch}\n\n');
+ request.response
+ .write('data:${new DateTime.now().millisecondsSinceEpoch}\n\n');
});
- request.response.done
- .whenComplete(() {
- timer.cancel();
- })
- .catchError((_) {});
+ request.response.done.whenComplete(() {
+ timer.cancel();
+ }).catchError((_) {});
});
var client = new HttpClient();
- client.getUrl(Uri.parse("http://127.0.0.1:${server.port}"))
- .then((request) => request.close())
- .then((response) {
- int bytes = 0;
- response.listen(
- (data) {
- bytes += data.length;
- if (bytes > 100) {
- client.close(force: true);
- }
- },
- onError: (error) {
- server.close();
- });
+ client
+ .getUrl(Uri.parse("http://127.0.0.1:${server.port}"))
+ .then((request) => request.close())
+ .then((response) {
+ int bytes = 0;
+ response.listen((data) {
+ bytes += data.length;
+ if (bytes > 100) {
+ client.close(force: true);
+ }
+ }, onError: (error) {
+ server.close();
});
+ });
});
}

Powered by Google App Engine
This is Rietveld 408576698