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

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

Issue 598453003: Add HttpServer:autoCompress option, to disable auto gzip compression. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix test. Created 6 years, 3 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
« sdk/lib/io/http.dart ('K') | « sdk/lib/io/http_impl.dart ('k') | no next file » | 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 83e2faeecdf59fbacde2900a4d44879d29d4a687..fc04b84242f226f37a1189bc193a986b946cebec 100644
--- a/tests/standalone/io/http_compression_test.dart
+++ b/tests/standalone/io/http_compression_test.dart
@@ -14,6 +14,7 @@ import 'dart:typed_data';
void testServerCompress({bool clientAutoUncompress: true}) {
void test(List<int> data) {
HttpServer.bind("127.0.0.1", 0).then((server) {
+ server.autoCompress = true;
server.listen((request) {
request.response.add(data);
request.response.close();
@@ -55,6 +56,7 @@ void testServerCompress({bool clientAutoUncompress: true}) {
void testAcceptEncodingHeader() {
void test(String encoding, bool valid) {
HttpServer.bind("127.0.0.1", 0).then((server) {
+ server.autoCompress = true;
server.listen((request) {
request.response.write("data");
request.response.close();
@@ -92,8 +94,33 @@ void testAcceptEncodingHeader() {
test('gzipx;', false);
}
+void testDisableCompressTest() {
+ HttpServer.bind("127.0.0.1", 0).then((server) {
+ Expect.equals(false, server.autoCompress);
+ server.listen((request) {
+ Expect.equals('gzip', request.headers.value(HttpHeaders.ACCEPT_ENCODING));
+ request.response.write("data");
+ request.response.close();
+ });
+ var client = new HttpClient();
+ 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();
+ });
+ });
+ });
+}
+
void main() {
testServerCompress();
testServerCompress(clientAutoUncompress: false);
testAcceptEncodingHeader();
+ testDisableCompressTest();
}
« sdk/lib/io/http.dart ('K') | « sdk/lib/io/http_impl.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698