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

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

Issue 13548002: Add Iterable.fold (and Stream.fold) which replace `reduce`. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 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 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import "dart:async"; 5 import "dart:async";
6 import "dart:io"; 6 import "dart:io";
7 import "dart:uri"; 7 import "dart:uri";
8 8
9 class Server { 9 class Server {
10 HttpServer server; 10 HttpServer server;
(...skipping 10 matching lines...) Expand all
21 ? HttpServer.bindSecure( 21 ? HttpServer.bindSecure(
22 "127.0.0.1", 0, certificateName: 'localhost_cert') 22 "127.0.0.1", 0, certificateName: 'localhost_cert')
23 : HttpServer.bind(); 23 : HttpServer.bind();
24 return f.then((s) { 24 return f.then((s) {
25 server = s; 25 server = s;
26 x.complete(this); 26 x.complete(this);
27 server.listen((request) { 27 server.listen((request) {
28 var response = request.response; 28 var response = request.response;
29 requestCount++; 29 requestCount++;
30 // Check whether a proxy or direct connection is expected. 30 // Check whether a proxy or direct connection is expected.
31 bool direct = directRequestPaths.reduce( 31 bool direct = directRequestPaths.fold(
32 false, 32 false,
33 (prev, path) => prev ? prev : path == request.uri.path); 33 (prev, path) => prev ? prev : path == request.uri.path);
34 if (!direct && proxyHops > 0) { 34 if (!direct && proxyHops > 0) {
35 Expect.isNotNull(request.headers[HttpHeaders.VIA]); 35 Expect.isNotNull(request.headers[HttpHeaders.VIA]);
36 Expect.equals(1, request.headers[HttpHeaders.VIA].length); 36 Expect.equals(1, request.headers[HttpHeaders.VIA].length);
37 Expect.equals( 37 Expect.equals(
38 proxyHops, 38 proxyHops,
39 request.headers[HttpHeaders.VIA][0].split(",").length); 39 request.headers[HttpHeaders.VIA][0].split(",").length);
40 } else { 40 } else {
41 Expect.isNull(request.headers[HttpHeaders.VIA]); 41 Expect.isNull(request.headers[HttpHeaders.VIA]);
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 InitializeSSL(); 412 InitializeSSL();
413 testInvalidProxy(); 413 testInvalidProxy();
414 testDirectProxy(); 414 testDirectProxy();
415 testProxy(); 415 testProxy();
416 testProxyChain(); 416 testProxyChain();
417 testProxyFromEnviroment(); 417 testProxyFromEnviroment();
418 // This test is not normally run. It can be used for locally testing 418 // This test is not normally run. It can be used for locally testing
419 // with a real proxy server (e.g. Apache). 419 // with a real proxy server (e.g. Apache).
420 //testRealProxy(); 420 //testRealProxy();
421 } 421 }
OLDNEW
« no previous file with comments | « tests/standalone/io/http_keep_alive_test.dart ('k') | tests/standalone/io/http_session_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698