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

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

Issue 15188003: Allow proxy settings in environment variables to be full URLs (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 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
« no previous file with comments | « sdk/lib/io/http_impl.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
6 import "dart:io"; 6 import "dart:io";
7 import "dart:uri"; 7 import "dart:uri";
8 8
9 expect(expected, String uri, environment) { 9 expect(expected, String uri, environment) {
10 Expect.equals(expected, 10 Expect.equals(expected,
11 HttpClient.findProxyFromEnvironment(Uri.parse(uri), 11 HttpClient.findProxyFromEnvironment(Uri.parse(uri),
12 environment: environment)); 12 environment: environment));
13 } 13 }
14 14
15 expectDirect(String uri, environment) { 15 expectDirect(String uri, environment) {
16 Expect.equals("DIRECT", 16 Expect.equals("DIRECT",
17 HttpClient.findProxyFromEnvironment(Uri.parse(uri), 17 HttpClient.findProxyFromEnvironment(Uri.parse(uri),
18 environment: environment)); 18 environment: environment));
19 } 19 }
20 20
21 main() { 21 main() {
22 expectDirect("http://www.google.com", {}); 22 expectDirect("http://www.google.com", {});
23
23 expect("PROXY www.proxy.com:1080", 24 expect("PROXY www.proxy.com:1080",
24 "http://www.google.com", 25 "http://www.google.com",
25 {"http_proxy": "www.proxy.com"}); 26 {"http_proxy": "www.proxy.com"});
26 expect("PROXY www.proxys.com:1080", 27 expect("PROXY www.proxys.com:1080",
27 "https://www.google.com", 28 "https://www.google.com",
28 {"https_proxy": "www.proxys.com"}); 29 {"https_proxy": "www.proxys.com"});
29 expect("PROXY www.proxy.com:8080", 30 expect("PROXY www.proxy.com:8080",
30 "http://www.google.com", 31 "http://www.google.com",
31 {"http_proxy": "www.proxy.com:8080"}); 32 {"http_proxy": "www.proxy.com:8080"});
32 expect("PROXY www.proxys.com:8080", 33 expect("PROXY www.proxys.com:8080",
33 "https://www.google.com", 34 "https://www.google.com",
34 {"https_proxy": "www.proxys.com:8080"}); 35 {"https_proxy": "www.proxys.com:8080"});
35 expect("PROXY www.proxy.com:8080", 36 expect("PROXY www.proxy.com:8080",
36 "http://www.google.com", 37 "http://www.google.com",
37 {"http_proxy": "www.proxy.com:8080", 38 {"http_proxy": "www.proxy.com:8080",
38 "https_proxy": "www.proxy.com:8080"}); 39 "https_proxy": "www.proxy.com:8080"});
39 expect("PROXY www.proxys.com:8080", 40 expect("PROXY www.proxys.com:8080",
40 "https://www.google.com", 41 "https://www.google.com",
41 {"http_proxy": "www.proxy.com:8080", 42 {"http_proxy": "www.proxy.com:8080",
42 "https_proxy": "www.proxys.com:8080"}); 43 "https_proxy": "www.proxys.com:8080"});
44
45 expect("PROXY www.proxy.com:1080",
46 "http://www.google.com",
47 {"http_proxy": "http://www.proxy.com"});
48 expect("PROXY www.proxy.com:1080",
49 "http://www.google.com",
50 {"http_proxy": "http://www.proxy.com/"});
51 expect("PROXY www.proxy.com:8080",
52 "http://www.google.com",
53 {"http_proxy": "http://www.proxy.com:8080/"});
54 expect("PROXY www.proxy.com:8080",
55 "http://www.google.com",
56 {"http_proxy": "http://www.proxy.com:8080/index.html"});
57 expect("PROXY www.proxy.com:8080",
58 "http://www.google.com",
59 {"http_proxy": "http://www.proxy.com:8080/",
60 "https_proxy": "http://www.proxy.com:8080/"});
61 expect("PROXY www.proxys.com:8080",
62 "https://www.google.com",
63 {"http_proxy": "http://www.proxy.com:8080/",
64 "https_proxy": "http://www.proxys.com:8080/"});
65 expect("PROXY www.proxy.com:8080",
66 "http://www.google.com",
67 {"http_proxy": "http://www.proxy.com:8080/",
68 "https_proxy": "http://www.proxy.com:8080/index.html"});
69 expect("PROXY www.proxys.com:8080",
70 "https://www.google.com",
71 {"http_proxy": "http://www.proxy.com:8080/",
72 "https_proxy": "http://www.proxys.com:8080/index.html"});
73
43 expectDirect("http://www.google.com", 74 expectDirect("http://www.google.com",
44 {"http_proxy": "www.proxy.com:8080", 75 {"http_proxy": "www.proxy.com:8080",
45 "no_proxy": "www.google.com"}); 76 "no_proxy": "www.google.com"});
46 expectDirect("http://www.google.com", 77 expectDirect("http://www.google.com",
47 {"http_proxy": "www.proxy.com:8080", 78 {"http_proxy": "www.proxy.com:8080",
48 "no_proxy": "google.com"}); 79 "no_proxy": "google.com"});
49 expectDirect("http://www.google.com", 80 expectDirect("http://www.google.com",
50 {"http_proxy": "www.proxy.com:8080", 81 {"http_proxy": "www.proxy.com:8080",
51 "no_proxy": ".com"}); 82 "no_proxy": ".com"});
52 expectDirect("http://www.google.com", 83 expectDirect("http://www.google.com",
53 {"http_proxy": "www.proxy.com:8080", 84 {"http_proxy": "www.proxy.com:8080",
54 "no_proxy": ",, , www.google.edu,,.com "}); 85 "no_proxy": ",, , www.google.edu,,.com "});
55 expectDirect("http://www.google.edu", 86 expectDirect("http://www.google.edu",
56 {"http_proxy": "www.proxy.com:8080", 87 {"http_proxy": "www.proxy.com:8080",
57 "no_proxy": ",, , www.google.edu,,.com "}); 88 "no_proxy": ",, , www.google.edu,,.com "});
58 expectDirect("http://www.google.com", 89 expectDirect("http://www.google.com",
59 {"https_proxy": "www.proxy.com:8080"}); 90 {"https_proxy": "www.proxy.com:8080"});
60 } 91 }
OLDNEW
« no previous file with comments | « sdk/lib/io/http_impl.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698