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

Side by Side Diff: chrome/browser/net/chrome_url_request_context_unittest.cc

Issue 3012021: CommandLine: add a CopySwitchesFrom() for copying from another CommandLine (Closed)
Patch Set: minor cleanups Created 10 years, 4 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
« no previous file with comments | « chrome/browser/nacl_host/nacl_process_host.cc ('k') | chrome/browser/plugin_process_host.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) 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" 5 #include "chrome/browser/net/chrome_url_request_context.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/format_macros.h" 8 #include "base/format_macros.h"
9 #include "chrome/browser/configuration_policy_pref_store.h" 9 #include "chrome/browser/configuration_policy_pref_store.h"
10 #include "chrome/browser/pref_value_store.h" 10 #include "chrome/browser/pref_value_store.h"
11 #include "chrome/common/chrome_switches.h" 11 #include "chrome/common/chrome_switches.h"
12 #include "net/proxy/proxy_config.h" 12 #include "net/proxy/proxy_config.h"
13 #include "net/proxy/proxy_config_service_common_unittest.h" 13 #include "net/proxy/proxy_config_service_common_unittest.h"
14 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
15 15
16 // Builds an identifier for each test in an array. 16 // Builds an identifier for each test in an array.
17 #define TEST_DESC(desc) StringPrintf("at line %d <%s>", __LINE__, desc) 17 #define TEST_DESC(desc) StringPrintf("at line %d <%s>", __LINE__, desc)
18 18
19 TEST(ChromeURLRequestContextTest, CreateProxyConfigTest) { 19 TEST(ChromeURLRequestContextTest, CreateProxyConfigTest) {
20 FilePath unused_path(FILE_PATH_LITERAL("foo.exe")); 20 FilePath unused_path(FILE_PATH_LITERAL("foo.exe"));
21 // Build the input command lines here. 21 // Build the input command lines here.
22 CommandLine empty(unused_path); 22 CommandLine empty(unused_path);
23 CommandLine no_proxy(unused_path); 23 CommandLine no_proxy(unused_path);
24 no_proxy.AppendSwitch(switches::kNoProxyServer); 24 no_proxy.AppendSwitch(switches::kNoProxyServer);
25 CommandLine no_proxy_extra_params(unused_path); 25 CommandLine no_proxy_extra_params(unused_path);
26 no_proxy_extra_params.AppendSwitch(switches::kNoProxyServer); 26 no_proxy_extra_params.AppendSwitch(switches::kNoProxyServer);
27 no_proxy_extra_params.AppendSwitchWithValue(switches::kProxyServer, 27 no_proxy_extra_params.AppendSwitchWithValue(switches::kProxyServer,
28 L"http://proxy:8888"); 28 "http://proxy:8888");
29 CommandLine single_proxy(unused_path); 29 CommandLine single_proxy(unused_path);
30 single_proxy.AppendSwitchWithValue(switches::kProxyServer, 30 single_proxy.AppendSwitchWithValue(switches::kProxyServer,
31 L"http://proxy:8888"); 31 "http://proxy:8888");
32 CommandLine per_scheme_proxy(unused_path); 32 CommandLine per_scheme_proxy(unused_path);
33 per_scheme_proxy.AppendSwitchWithValue(switches::kProxyServer, 33 per_scheme_proxy.AppendSwitchWithValue(switches::kProxyServer,
34 L"http=httpproxy:8888;ftp=ftpproxy:8889"); 34 "http=httpproxy:8888;ftp=ftpproxy:8889");
35 CommandLine per_scheme_proxy_bypass(unused_path); 35 CommandLine per_scheme_proxy_bypass(unused_path);
36 per_scheme_proxy_bypass.AppendSwitchWithValue(switches::kProxyServer, 36 per_scheme_proxy_bypass.AppendSwitchWithValue(switches::kProxyServer,
37 L"http=httpproxy:8888;ftp=ftpproxy:8889"); 37 "http=httpproxy:8888;ftp=ftpproxy:8889");
38 per_scheme_proxy_bypass.AppendSwitchWithValue( 38 per_scheme_proxy_bypass.AppendSwitchWithValue(
39 switches::kProxyBypassList, 39 switches::kProxyBypassList,
40 L".google.com, foo.com:99, 1.2.3.4:22, 127.0.0.1/8"); 40 ".google.com, foo.com:99, 1.2.3.4:22, 127.0.0.1/8");
41 CommandLine with_pac_url(unused_path); 41 CommandLine with_pac_url(unused_path);
42 with_pac_url.AppendSwitchWithValue(switches::kProxyPacUrl, 42 with_pac_url.AppendSwitchWithValue(switches::kProxyPacUrl,
43 L"http://wpad/wpad.dat"); 43 "http://wpad/wpad.dat");
44 with_pac_url.AppendSwitchWithValue( 44 with_pac_url.AppendSwitchWithValue(
45 switches::kProxyBypassList, 45 switches::kProxyBypassList,
46 L".google.com, foo.com:99, 1.2.3.4:22, 127.0.0.1/8"); 46 ".google.com, foo.com:99, 1.2.3.4:22, 127.0.0.1/8");
47 CommandLine with_auto_detect(unused_path); 47 CommandLine with_auto_detect(unused_path);
48 with_auto_detect.AppendSwitch(switches::kProxyAutoDetect); 48 with_auto_detect.AppendSwitch(switches::kProxyAutoDetect);
49 49
50 // Inspired from proxy_config_service_win_unittest.cc. 50 // Inspired from proxy_config_service_win_unittest.cc.
51 const struct { 51 const struct {
52 // Short description to identify the test 52 // Short description to identify the test
53 std::string description; 53 std::string description;
54 54
55 // The command line to build a ProxyConfig from. 55 // The command line to build a ProxyConfig from.
56 const CommandLine& command_line; 56 const CommandLine& command_line;
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 EXPECT_TRUE(config == NULL); 168 EXPECT_TRUE(config == NULL);
169 } else { 169 } else {
170 EXPECT_TRUE(config != NULL); 170 EXPECT_TRUE(config != NULL);
171 EXPECT_EQ(tests[i].auto_detect, config->auto_detect()); 171 EXPECT_EQ(tests[i].auto_detect, config->auto_detect());
172 EXPECT_EQ(tests[i].pac_url, config->pac_url()); 172 EXPECT_EQ(tests[i].pac_url, config->pac_url());
173 EXPECT_TRUE(tests[i].proxy_rules.Matches(config->proxy_rules())); 173 EXPECT_TRUE(tests[i].proxy_rules.Matches(config->proxy_rules()));
174 } 174 }
175 } 175 }
176 } 176 }
177 177
OLDNEW
« no previous file with comments | « chrome/browser/nacl_host/nacl_process_host.cc ('k') | chrome/browser/plugin_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698