| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-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 "chrome/browser/net/chrome_url_request_context.h" |
| 6 |
| 5 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 6 #include "chrome/browser/net/chrome_url_request_context.h" | 8 #include "base/format_macros.h" |
| 7 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
| 8 #include "net/proxy/proxy_config.h" | 10 #include "net/proxy/proxy_config.h" |
| 9 #include "net/proxy/proxy_config_service_common_unittest.h" | 11 #include "net/proxy/proxy_config_service_common_unittest.h" |
| 10 | |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 13 |
| 13 // Builds an identifier for each test in an array. | 14 // Builds an identifier for each test in an array. |
| 14 #define TEST_DESC(desc) StringPrintf("at line %d <%s>", __LINE__, desc) | 15 #define TEST_DESC(desc) StringPrintf("at line %d <%s>", __LINE__, desc) |
| 15 | 16 |
| 16 TEST(ChromeUrlRequestContextTest, CreateProxyConfigTest) { | 17 TEST(ChromeUrlRequestContextTest, CreateProxyConfigTest) { |
| 17 FilePath unused_path(FILE_PATH_LITERAL("foo.exe")); | 18 FilePath unused_path(FILE_PATH_LITERAL("foo.exe")); |
| 18 // Build the input command lines here. | 19 // Build the input command lines here. |
| 19 CommandLine empty(unused_path); | 20 CommandLine empty(unused_path); |
| 20 CommandLine no_proxy(unused_path); | 21 CommandLine no_proxy(unused_path); |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 false, // is_null | 157 false, // is_null |
| 157 true, // auto_detect | 158 true, // auto_detect |
| 158 GURL(), // pac_url | 159 GURL(), // pac_url |
| 159 net::ProxyConfig::ProxyRules(), // proxy_rules | 160 net::ProxyConfig::ProxyRules(), // proxy_rules |
| 160 "", // proxy_bypass_list | 161 "", // proxy_bypass_list |
| 161 false // bypass_local_names | 162 false // bypass_local_names |
| 162 } | 163 } |
| 163 }; | 164 }; |
| 164 | 165 |
| 165 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); i++) { | 166 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); i++) { |
| 166 SCOPED_TRACE(StringPrintf("Test[%d] %s", i, tests[i].description.c_str())); | 167 SCOPED_TRACE(StringPrintf("Test[%" PRIuS "] %s", i, |
| 168 tests[i].description.c_str())); |
| 167 scoped_ptr<net::ProxyConfig> config(CreateProxyConfig( | 169 scoped_ptr<net::ProxyConfig> config(CreateProxyConfig( |
| 168 CommandLine(tests[i].command_line))); | 170 CommandLine(tests[i].command_line))); |
| 169 | 171 |
| 170 if (tests[i].is_null) { | 172 if (tests[i].is_null) { |
| 171 EXPECT_TRUE(config == NULL); | 173 EXPECT_TRUE(config == NULL); |
| 172 } else { | 174 } else { |
| 173 EXPECT_TRUE(config != NULL); | 175 EXPECT_TRUE(config != NULL); |
| 174 EXPECT_EQ(tests[i].auto_detect, config->auto_detect); | 176 EXPECT_EQ(tests[i].auto_detect, config->auto_detect); |
| 175 EXPECT_EQ(tests[i].pac_url, config->pac_url); | 177 EXPECT_EQ(tests[i].pac_url, config->pac_url); |
| 176 EXPECT_EQ(tests[i].proxy_bypass_list, | 178 EXPECT_EQ(tests[i].proxy_bypass_list, |
| 177 net::FlattenProxyBypass(config->proxy_bypass)); | 179 net::FlattenProxyBypass(config->proxy_bypass)); |
| 178 EXPECT_EQ(tests[i].bypass_local_names, config->proxy_bypass_local_names); | 180 EXPECT_EQ(tests[i].bypass_local_names, config->proxy_bypass_local_names); |
| 179 EXPECT_EQ(tests[i].proxy_rules, config->proxy_rules); | 181 EXPECT_EQ(tests[i].proxy_rules, config->proxy_rules); |
| 180 } | 182 } |
| 181 } | 183 } |
| 182 } | 184 } |
| OLD | NEW |