| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_service_win.h" | 5 #include "net/proxy/proxy_config_service_win.h" |
| 6 | 6 |
| 7 #include "net/base/net_errors.h" | 7 #include "net/base/net_errors.h" |
| 8 #include "net/proxy/proxy_config.h" | 8 #include "net/proxy/proxy_config.h" |
| 9 #include "net/proxy/proxy_config_service_common_unittest.h" | 9 #include "net/proxy/proxy_config_service_common_unittest.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 | 11 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 NULL, // lpszAutoConfigUrl | 135 NULL, // lpszAutoConfigUrl |
| 136 NULL, // lpszProxy | 136 NULL, // lpszProxy |
| 137 L"<local>", // lpszProxy_bypass | 137 L"<local>", // lpszProxy_bypass |
| 138 }, | 138 }, |
| 139 | 139 |
| 140 true, // auto_detect | 140 true, // auto_detect |
| 141 GURL(), // pac_url | 141 GURL(), // pac_url |
| 142 ProxyRulesExpectation::EmptyWithBypass("<local>"), | 142 ProxyRulesExpectation::EmptyWithBypass("<local>"), |
| 143 }, | 143 }, |
| 144 | 144 |
| 145 // Bypass "google.com" and local names, using semicolon as delimeter | 145 // Bypass "google.com" and local names, using semicolon as delimiter |
| 146 // (ignoring white space). | 146 // (ignoring white space). |
| 147 { | 147 { |
| 148 { // Input. | 148 { // Input. |
| 149 TRUE, // fAutoDetect | 149 TRUE, // fAutoDetect |
| 150 NULL, // lpszAutoConfigUrl | 150 NULL, // lpszAutoConfigUrl |
| 151 NULL, // lpszProxy | 151 NULL, // lpszProxy |
| 152 L"<local> ; google.com", // lpszProxy_bypass | 152 L"<local> ; google.com", // lpszProxy_bypass |
| 153 }, | 153 }, |
| 154 | 154 |
| 155 // Expected result. | 155 // Expected result. |
| 156 true, // auto_detect | 156 true, // auto_detect |
| 157 GURL(), // pac_url | 157 GURL(), // pac_url |
| 158 ProxyRulesExpectation::EmptyWithBypass("<local>,google.com"), | 158 ProxyRulesExpectation::EmptyWithBypass("<local>,google.com"), |
| 159 }, | 159 }, |
| 160 | 160 |
| 161 // Bypass "foo.com" and "google.com", using lines as delimeter. | 161 // Bypass "foo.com" and "google.com", using lines as delimiter. |
| 162 { | 162 { |
| 163 { // Input. | 163 { // Input. |
| 164 TRUE, // fAutoDetect | 164 TRUE, // fAutoDetect |
| 165 NULL, // lpszAutoConfigUrl | 165 NULL, // lpszAutoConfigUrl |
| 166 NULL, // lpszProxy | 166 NULL, // lpszProxy |
| 167 L"foo.com\r\ngoogle.com", // lpszProxy_bypass | 167 L"foo.com\r\ngoogle.com", // lpszProxy_bypass |
| 168 }, | 168 }, |
| 169 | 169 |
| 170 // Expected result. | 170 // Expected result. |
| 171 true, // auto_detect | 171 true, // auto_detect |
| 172 GURL(), // pac_url | 172 GURL(), // pac_url |
| 173 ProxyRulesExpectation::EmptyWithBypass("foo.com,google.com"), | 173 ProxyRulesExpectation::EmptyWithBypass("foo.com,google.com"), |
| 174 }, | 174 }, |
| 175 |
| 176 // Bypass "foo.com" and "google.com", using commas as delimiter. |
| 177 { |
| 178 { // Input. |
| 179 TRUE, // fAutoDetect |
| 180 NULL, // lpszAutoConfigUrl |
| 181 NULL, // lpszProxy |
| 182 L"foo.com, google.com", // lpszProxy_bypass |
| 183 }, |
| 184 |
| 185 // Expected result. |
| 186 true, // auto_detect |
| 187 GURL(), // pac_url |
| 188 ProxyRulesExpectation::EmptyWithBypass("foo.com,google.com"), |
| 189 }, |
| 175 }; | 190 }; |
| 176 | 191 |
| 177 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { | 192 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { |
| 178 ProxyConfig config; | 193 ProxyConfig config; |
| 179 ProxyConfigServiceWin::SetFromIEConfig(&config, tests[i].ie_config); | 194 ProxyConfigServiceWin::SetFromIEConfig(&config, tests[i].ie_config); |
| 180 | 195 |
| 181 EXPECT_EQ(tests[i].auto_detect, config.auto_detect()); | 196 EXPECT_EQ(tests[i].auto_detect, config.auto_detect()); |
| 182 EXPECT_EQ(tests[i].pac_url, config.pac_url()); | 197 EXPECT_EQ(tests[i].pac_url, config.pac_url()); |
| 183 EXPECT_TRUE(tests[i].proxy_rules.Matches(config.proxy_rules())); | 198 EXPECT_TRUE(tests[i].proxy_rules.Matches(config.proxy_rules())); |
| 184 } | 199 } |
| 185 } | 200 } |
| 186 | 201 |
| 187 } // namespace net | 202 } // namespace net |
| OLD | NEW |