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

Side by Side Diff: tests/standalone/io/http_compression_test.dart

Issue 12758009: Support GZip encoding on the http server. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add new test 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4 //
5 // VMOptions=
6 // VMOptions=--short_socket_read
7 // VMOptions=--short_socket_write
8 // VMOptions=--short_socket_read --short_socket_write
9
10 import 'dart:io';
11
12 void testServerCompress() {
13 var data = "My raw server provided data";
Søren Gjesse 2013/03/12 08:54:09 Extend the test with a huge body ad well.
Anders Johnsen 2013/03/12 10:04:59 Done.
14 HttpServer.bind().then((server) {
15 server.listen((request) {
16 request.response.write(data);
17 request.response.close();
18 });
19 var client = new HttpClient();
20 client.get("localhost", server.port, "/")
21 .then((request) {
22 request.headers.set(HttpHeaders.ACCEPT_ENCODING, "gzip");
23 return request.close();
24 })
25 .then((response) {
Søren Gjesse 2013/03/12 08:54:09 Check that Content-Encoding is gzip.
Anders Johnsen 2013/03/12 10:04:59 Done.
26 response
27 .transform(new ZLibInflater())
28 .transform(new StringDecoder())
29 .reduce(new StringBuffer(), (buffer, str) {
30 buffer.write(str);
31 return buffer;
32 }).then((buffer) {
33 Expect.equals(data, buffer.toString());
34 server.close();
35 client.close();
36 });
37 });
38 });
39 }
40
41 void main() {
42 testServerCompress();
43 }
OLDNEW
« sdk/lib/io/http_impl.dart ('K') | « tests/standalone/io/http_10_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698