OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "net/proxy/proxy_config_service_common_unittest.h" |
7 #include "net/proxy/proxy_info.h" | 7 #include "net/proxy/proxy_info.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 | 9 |
10 namespace net { | 10 namespace net { |
11 namespace { | 11 namespace { |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 config.proxy_rules().proxy_for_http); | 244 config.proxy_rules().proxy_for_http); |
245 ExpectProxyServerEquals(tests[i].proxy_for_https, | 245 ExpectProxyServerEquals(tests[i].proxy_for_https, |
246 config.proxy_rules().proxy_for_https); | 246 config.proxy_rules().proxy_for_https); |
247 ExpectProxyServerEquals(tests[i].proxy_for_ftp, | 247 ExpectProxyServerEquals(tests[i].proxy_for_ftp, |
248 config.proxy_rules().proxy_for_ftp); | 248 config.proxy_rules().proxy_for_ftp); |
249 ExpectProxyServerEquals(tests[i].fallback_proxy, | 249 ExpectProxyServerEquals(tests[i].fallback_proxy, |
250 config.proxy_rules().fallback_proxy); | 250 config.proxy_rules().fallback_proxy); |
251 } | 251 } |
252 } | 252 } |
253 | 253 |
| 254 TEST(ProxyConfigTest, ProxyRulesSetBypassFlag) { |
| 255 // Test whether the did_bypass_proxy() flag is set in proxy info correctly. |
| 256 ProxyConfig::ProxyRules rules; |
| 257 ProxyInfo result; |
| 258 |
| 259 rules.ParseFromString("http=httpproxy:80"); |
| 260 rules.bypass_rules.AddRuleFromString(".com"); |
| 261 |
| 262 rules.Apply(GURL("http://example.com"), &result); |
| 263 EXPECT_TRUE(result.is_direct_only()); |
| 264 EXPECT_TRUE(result.did_bypass_proxy()); |
| 265 |
| 266 rules.Apply(GURL("http://example.org"), &result); |
| 267 EXPECT_FALSE(result.is_direct()); |
| 268 EXPECT_FALSE(result.did_bypass_proxy()); |
| 269 |
| 270 // Try with reversed bypass rules. |
| 271 rules.reverse_bypass = true; |
| 272 |
| 273 rules.Apply(GURL("http://example.org"), &result); |
| 274 EXPECT_TRUE(result.is_direct_only()); |
| 275 EXPECT_TRUE(result.did_bypass_proxy()); |
| 276 |
| 277 rules.Apply(GURL("http://example.com"), &result); |
| 278 EXPECT_FALSE(result.is_direct()); |
| 279 EXPECT_FALSE(result.did_bypass_proxy()); |
| 280 } |
| 281 |
254 } // namespace | 282 } // namespace |
255 } // namespace net | 283 } // namespace net |
256 | |
OLD | NEW |