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

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

Issue 413763003: clang/win: Fix most -Wwriteable-strings warnings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 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 | Annotate | Revision Log
« no previous file with comments | « net/cert/cert_verify_proc_win.cc ('k') | printing/backend/win_helper.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) 2012 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_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
12 namespace net { 12 namespace net {
13 13
14 TEST(ProxyConfigServiceWinTest, SetFromIEConfig) { 14 TEST(ProxyConfigServiceWinTest, SetFromIEConfig) {
15 // Like WINHTTP_CURRENT_USER_IE_PROXY_CONFIG, but with const strings.
16 struct IEProxyConfig {
17 BOOL auto_detect;
18 const wchar_t* auto_config_url;
19 const wchar_t* proxy;
20 const wchar_t* proxy_bypass;;
Reid Kleckner 2014/07/23 22:02:15 Double semi-colon?
Nico 2014/07/23 22:04:17 Done, thanks.
21 };
15 const struct { 22 const struct {
16 // Input. 23 // Input.
17 WINHTTP_CURRENT_USER_IE_PROXY_CONFIG ie_config; 24 IEProxyConfig ie_config;
18 25
19 // Expected outputs (fields of the ProxyConfig). 26 // Expected outputs (fields of the ProxyConfig).
20 bool auto_detect; 27 bool auto_detect;
21 GURL pac_url; 28 GURL pac_url;
22 ProxyRulesExpectation proxy_rules; 29 ProxyRulesExpectation proxy_rules;
23 const char* proxy_bypass_list; // newline separated 30 const char* proxy_bypass_list; // newline separated
24 } tests[] = { 31 } tests[] = {
25 // Auto detect. 32 // Auto detect.
26 { 33 {
27 { // Input. 34 { // Input.
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 }, 190 },
184 191
185 // Expected result. 192 // Expected result.
186 true, // auto_detect 193 true, // auto_detect
187 GURL(), // pac_url 194 GURL(), // pac_url
188 ProxyRulesExpectation::EmptyWithBypass("foo.com,google.com"), 195 ProxyRulesExpectation::EmptyWithBypass("foo.com,google.com"),
189 }, 196 },
190 }; 197 };
191 198
192 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { 199 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) {
200 WINHTTP_CURRENT_USER_IE_PROXY_CONFIG ie_config = {
201 tests[i].ie_config.auto_detect,
202 const_cast<wchar_t*>(tests[i].ie_config.auto_config_url),
203 const_cast<wchar_t*>(tests[i].ie_config.proxy),
204 const_cast<wchar_t*>(tests[i].ie_config.proxy_bypass)};
193 ProxyConfig config; 205 ProxyConfig config;
194 ProxyConfigServiceWin::SetFromIEConfig(&config, tests[i].ie_config); 206 ProxyConfigServiceWin::SetFromIEConfig(&config, ie_config);
195 207
196 EXPECT_EQ(tests[i].auto_detect, config.auto_detect()); 208 EXPECT_EQ(tests[i].auto_detect, config.auto_detect());
197 EXPECT_EQ(tests[i].pac_url, config.pac_url()); 209 EXPECT_EQ(tests[i].pac_url, config.pac_url());
198 EXPECT_TRUE(tests[i].proxy_rules.Matches(config.proxy_rules())); 210 EXPECT_TRUE(tests[i].proxy_rules.Matches(config.proxy_rules()));
199 EXPECT_EQ(PROXY_CONFIG_SOURCE_SYSTEM, config.source()); 211 EXPECT_EQ(PROXY_CONFIG_SOURCE_SYSTEM, config.source());
200 } 212 }
201 } 213 }
202 214
203 } // namespace net 215 } // namespace net
OLDNEW
« no previous file with comments | « net/cert/cert_verify_proc_win.cc ('k') | printing/backend/win_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698