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

Unified Diff: tests/standalone/io/http_compression_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_compression_test.dart
diff --git a/tests/standalone/io/http_compression_test.dart b/tests/standalone/io/http_compression_test.dart
index fc04b84242f226f37a1189bc193a986b946cebec..651d5fa48bfafd3ff2ad307c0e23bf01b71ff64a 100644
--- a/tests/standalone/io/http_compression_test.dart
+++ b/tests/standalone/io/http_compression_test.dart
@@ -21,30 +21,28 @@ void testServerCompress({bool clientAutoUncompress: true}) {
});
var client = new HttpClient();
client.autoUncompress = clientAutoUncompress;
- client.get("127.0.0.1", server.port, "/")
- .then((request) {
- request.headers.set(HttpHeaders.ACCEPT_ENCODING, "gzip,deflate");
- return request.close();
- })
- .then((response) {
- Expect.equals("gzip",
- response.headers.value(HttpHeaders.CONTENT_ENCODING));
- response
- .fold([], (list, b) {
- list.addAll(b);
- return list;
- }).then((list) {
- if (clientAutoUncompress) {
- Expect.listEquals(data, list);
- } else {
- Expect.listEquals(data, GZIP.decode(list));
- }
- server.close();
- client.close();
- });
- });
+ client.get("127.0.0.1", server.port, "/").then((request) {
+ request.headers.set(HttpHeaders.ACCEPT_ENCODING, "gzip,deflate");
+ return request.close();
+ }).then((response) {
+ Expect.equals(
+ "gzip", response.headers.value(HttpHeaders.CONTENT_ENCODING));
+ response.fold([], (list, b) {
+ list.addAll(b);
+ return list;
+ }).then((list) {
+ if (clientAutoUncompress) {
+ Expect.listEquals(data, list);
+ } else {
+ Expect.listEquals(data, GZIP.decode(list));
+ }
+ server.close();
+ client.close();
+ });
+ });
});
}
+
test("My raw server provided data".codeUnits);
var longBuffer = new Uint8List(1024 * 1024);
for (int i = 0; i < longBuffer.length; i++) {
@@ -62,24 +60,20 @@ void testAcceptEncodingHeader() {
request.response.close();
});
var client = new HttpClient();
- client.get("127.0.0.1", server.port, "/")
- .then((request) {
- request.headers.set(HttpHeaders.ACCEPT_ENCODING, encoding);
- return request.close();
- })
- .then((response) {
- Expect.equals(
- valid,
- ("gzip" == response.headers.value(HttpHeaders.CONTENT_ENCODING)));
- response.listen(
- (_) {},
- onDone: () {
- server.close();
- client.close();
- });
- });
+ client.get("127.0.0.1", server.port, "/").then((request) {
+ request.headers.set(HttpHeaders.ACCEPT_ENCODING, encoding);
+ return request.close();
+ }).then((response) {
+ Expect.equals(valid,
+ ("gzip" == response.headers.value(HttpHeaders.CONTENT_ENCODING)));
+ response.listen((_) {}, onDone: () {
+ server.close();
+ client.close();
+ });
+ });
});
}
+
test('gzip', true);
test('deflate', false);
test('gzip, deflate', true);
@@ -103,18 +97,16 @@ void testDisableCompressTest() {
request.response.close();
});
var client = new HttpClient();
- client.get("127.0.0.1", server.port, "/")
+ client
+ .get("127.0.0.1", server.port, "/")
.then((request) => request.close())
.then((response) {
- Expect.equals(null,
- response.headers.value(HttpHeaders.CONTENT_ENCODING));
- response.listen(
- (_) {},
- onDone: () {
- server.close();
- client.close();
- });
- });
+ Expect.equals(null, response.headers.value(HttpHeaders.CONTENT_ENCODING));
+ response.listen((_) {}, onDone: () {
+ server.close();
+ client.close();
+ });
+ });
});
}

Powered by Google App Engine
This is Rietveld 408576698