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

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

Issue 12661003: Fix empty zlib deflate and early close of responses. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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
« no previous file with comments | « sdk/lib/io/http_impl.dart ('k') | tests/standalone/io/zlib_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 364be20b8ed550083a21e42c965917d35df92ba7..772006325af88e44fe1219ebe53ef7e710848be6 100644
--- a/tests/standalone/io/http_compression_test.dart
+++ b/tests/standalone/io/http_compression_test.dart
@@ -20,7 +20,7 @@ void testServerCompress() {
var client = new HttpClient();
client.get("localhost", server.port, "/")
.then((request) {
- request.headers.set(HttpHeaders.ACCEPT_ENCODING, "gzip");
+ request.headers.set(HttpHeaders.ACCEPT_ENCODING, "gzip,deflate");
return request.close();
})
.then((response) {
@@ -47,6 +47,47 @@ void testServerCompress() {
test(longBuffer);
}
+void testAcceptEncodingHeader() {
+ void test(String encoding, bool valid) {
+ HttpServer.bind().then((server) {
+ server.listen((request) {
+ request.response.write("data");
+ request.response.close();
+ });
+ var client = new HttpClient();
+ client.get("localhost", 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);
+ test('gzip ,deflate', true);
+ test('gzip , deflate', true);
+ test('deflate,gzip', true);
+ test('deflate, gzip', true);
+ test('deflate ,gzip', true);
+ test('deflate , gzip', true);
+ test('abc,deflate , gzip,def,,,ghi ,jkl', true);
+ test('xgzip', false);
+ test('gzipx;', false);
+}
+
void main() {
testServerCompress();
+ testAcceptEncodingHeader();
}
« no previous file with comments | « sdk/lib/io/http_impl.dart ('k') | tests/standalone/io/zlib_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698