OLD | NEW |
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 "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
6 import "dart:async"; | 6 import "dart:async"; |
7 import 'dart:crypto'; | 7 import 'dart:crypto'; |
8 import "dart:io"; | 8 import "dart:io"; |
9 import "dart:uri"; | 9 import "dart:uri"; |
10 import 'dart:utf'; | 10 import 'dart:utf'; |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 client.findProxy = (Uri uri) { | 487 client.findProxy = (Uri uri) { |
488 return "PROXY localhost:${proxyServer.port}"; | 488 return "PROXY localhost:${proxyServer.port}"; |
489 }; | 489 }; |
490 | 490 |
491 client.authenticateProxy = (host, port, scheme, realm) { | 491 client.authenticateProxy = (host, port, scheme, realm) { |
492 client.addProxyCredentials( | 492 client.addProxyCredentials( |
493 "localhost", | 493 "localhost", |
494 proxyServer.port, | 494 proxyServer.port, |
495 "realm", | 495 "realm", |
496 new HttpClientBasicCredentials("test", "test")); | 496 new HttpClientBasicCredentials("test", "test")); |
497 return new Future.immediate(true); | 497 return new Future.value(true); |
498 }; | 498 }; |
499 | 499 |
500 for (int i = 0; i < loopCount; i++) { | 500 for (int i = 0; i < loopCount; i++) { |
501 test(bool secure) { | 501 test(bool secure) { |
502 String url = secure | 502 String url = secure |
503 ? "https://localhost:${secureServer.port}/A" | 503 ? "https://localhost:${secureServer.port}/A" |
504 : "http://127.0.0.1:${server.port}/A"; | 504 : "http://127.0.0.1:${server.port}/A"; |
505 | 505 |
506 client.postUrl(Uri.parse(url)) | 506 client.postUrl(Uri.parse(url)) |
507 .then((HttpClientRequest clientRequest) { | 507 .then((HttpClientRequest clientRequest) { |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 testDirectProxy(); | 627 testDirectProxy(); |
628 testProxy(); | 628 testProxy(); |
629 testProxyChain(); | 629 testProxyChain(); |
630 testProxyFromEnviroment(); | 630 testProxyFromEnviroment(); |
631 testProxyAuthenticate(); | 631 testProxyAuthenticate(); |
632 // This test is not normally run. It can be used for locally testing | 632 // This test is not normally run. It can be used for locally testing |
633 // with a real proxy server (e.g. Apache). | 633 // with a real proxy server (e.g. Apache). |
634 //testRealProxy(); | 634 //testRealProxy(); |
635 //testRealProxyAuth(); | 635 //testRealProxyAuth(); |
636 } | 636 } |
OLD | NEW |