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

Side by Side Diff: net/proxy/proxy_config_unittest.cc

Issue 115029: Making command-line specified proxy settings more flexible - allowing for set... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 | « net/proxy/proxy_config_service_linux.cc ('k') | net/proxy/proxy_script_fetcher_unittest.cc » ('j') | 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/proxy/proxy_config.h" 5 #include "net/proxy/proxy_config.h"
6 #include "net/proxy/proxy_config_service_common_unittest.h"
6 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
7 8
8 namespace { 9 namespace {
9 static void ExpectProxyServerEquals(const char* expectation, 10 static void ExpectProxyServerEquals(const char* expectation,
10 const net::ProxyServer& proxy_server) { 11 const net::ProxyServer& proxy_server) {
11 if (expectation == NULL) { 12 if (expectation == NULL) {
12 EXPECT_FALSE(proxy_server.is_valid()); 13 EXPECT_FALSE(proxy_server.is_valid());
13 } else { 14 } else {
14 EXPECT_EQ(expectation, proxy_server.ToURI()); 15 EXPECT_EQ(expectation, proxy_server.ToURI());
15 } 16 }
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 ExpectProxyServerEquals(tests[i].single_proxy, 191 ExpectProxyServerEquals(tests[i].single_proxy,
191 config.proxy_rules.single_proxy); 192 config.proxy_rules.single_proxy);
192 ExpectProxyServerEquals(tests[i].proxy_for_http, 193 ExpectProxyServerEquals(tests[i].proxy_for_http,
193 config.proxy_rules.proxy_for_http); 194 config.proxy_rules.proxy_for_http);
194 ExpectProxyServerEquals(tests[i].proxy_for_https, 195 ExpectProxyServerEquals(tests[i].proxy_for_https,
195 config.proxy_rules.proxy_for_https); 196 config.proxy_rules.proxy_for_https);
196 ExpectProxyServerEquals(tests[i].proxy_for_ftp, 197 ExpectProxyServerEquals(tests[i].proxy_for_ftp,
197 config.proxy_rules.proxy_for_ftp); 198 config.proxy_rules.proxy_for_ftp);
198 } 199 }
199 } 200 }
201
202 TEST(ProxyConfigTest, ParseProxyBypassList) {
203 struct bypass_test {
204 const char* proxy_bypass_input;
205 const char* flattened_output;
206 };
207
208 const struct {
209 const char* proxy_bypass_input;
210 const char* flattened_output;
211 } tests[] = {
212 {
213 "*",
214 "*\n"
215 },
216 {
217 ".google.com, .foo.com:42",
218 "*.google.com\n*.foo.com:42\n"
219 },
220 {
221 ".google.com, foo.com:99, 1.2.3.4:22, 127.0.0.1/8",
222 "*.google.com\n*foo.com:99\n1.2.3.4:22\n127.0.0.1/8\n"
223 }
224 };
225
226 net::ProxyConfig config;
227
228 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) {
229 config.ParseNoProxyList(tests[i].proxy_bypass_input);
230 EXPECT_EQ(tests[i].flattened_output,
231 net::FlattenProxyBypass(config.proxy_bypass));
232 }
233 }
OLDNEW
« no previous file with comments | « net/proxy/proxy_config_service_linux.cc ('k') | net/proxy/proxy_script_fetcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698