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

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

Issue 12866005: Add a function for finding the HTTP proxy server from environment variables (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/io/http_impl.dart ('k') | tests/standalone/io/http_proxy_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/http_proxy_configuration_test.dart
diff --git a/tests/standalone/io/http_proxy_configuration_test.dart b/tests/standalone/io/http_proxy_configuration_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..b5016ee026cde9a77be61ddfc3b87bbc1c060093
--- /dev/null
+++ b/tests/standalone/io/http_proxy_configuration_test.dart
@@ -0,0 +1,59 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import "dart:io";
+import "dart:uri";
+
+expect(expected, String uri, environment) {
+ Expect.equals(expected,
+ HttpClient.findProxyFromEnvironment(Uri.parse(uri),
+ environment: environment));
+}
+
+expectDirect(String uri, environment) {
+ Expect.equals("DIRECT",
+ HttpClient.findProxyFromEnvironment(Uri.parse(uri),
+ environment: environment));
+}
+
+main() {
+ expectDirect("http://www.google.com", {});
+ expect("PROXY www.proxy.com:1080",
+ "http://www.google.com",
+ {"http_proxy": "www.proxy.com"});
+ expect("PROXY www.proxys.com:1080",
+ "https://www.google.com",
+ {"https_proxy": "www.proxys.com"});
+ expect("PROXY www.proxy.com:8080",
+ "http://www.google.com",
+ {"http_proxy": "www.proxy.com:8080"});
+ expect("PROXY www.proxys.com:8080",
+ "https://www.google.com",
+ {"https_proxy": "www.proxys.com:8080"});
+ expect("PROXY www.proxy.com:8080",
+ "http://www.google.com",
+ {"http_proxy": "www.proxy.com:8080",
+ "https_proxy": "www.proxy.com:8080"});
+ expect("PROXY www.proxys.com:8080",
+ "https://www.google.com",
+ {"http_proxy": "www.proxy.com:8080",
+ "https_proxy": "www.proxys.com:8080"});
+ expectDirect("http://www.google.com",
+ {"http_proxy": "www.proxy.com:8080",
+ "no_proxy": "www.google.com"});
+ expectDirect("http://www.google.com",
+ {"http_proxy": "www.proxy.com:8080",
+ "no_proxy": "google.com"});
+ expectDirect("http://www.google.com",
+ {"http_proxy": "www.proxy.com:8080",
+ "no_proxy": ".com"});
+ expectDirect("http://www.google.com",
+ {"http_proxy": "www.proxy.com:8080",
+ "no_proxy": ",, , www.google.edu,,.com "});
+ expectDirect("http://www.google.edu",
+ {"http_proxy": "www.proxy.com:8080",
+ "no_proxy": ",, , www.google.edu,,.com "});
+ expectDirect("http://www.google.com",
+ {"https_proxy": "www.proxy.com:8080"});
+}
« no previous file with comments | « sdk/lib/io/http_impl.dart ('k') | tests/standalone/io/http_proxy_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698