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

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

Issue 3323022: Create a DefaultPrefStore to hold registered application-default preference v... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 3 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
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/policy/configuration_policy_pref_store.h" 9 #include "chrome/browser/policy/configuration_policy_pref_store.h"
10 #include "chrome/browser/prefs/default_pref_store.h"
10 #include "chrome/browser/prefs/pref_value_store.h" 11 #include "chrome/browser/prefs/pref_value_store.h"
11 #include "chrome/common/chrome_switches.h" 12 #include "chrome/common/chrome_switches.h"
12 #include "chrome/test/testing_pref_service.h" 13 #include "chrome/test/testing_pref_service.h"
13 #include "net/proxy/proxy_config.h" 14 #include "net/proxy/proxy_config.h"
14 #include "net/proxy/proxy_config_service_common_unittest.h" 15 #include "net/proxy/proxy_config_service_common_unittest.h"
15 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
16 17
17 // Builds an identifier for each test in an array. 18 // Builds an identifier for each test in an array.
18 #define TEST_DESC(desc) StringPrintf("at line %d <%s>", __LINE__, desc) 19 #define TEST_DESC(desc) StringPrintf("at line %d <%s>", __LINE__, desc)
19 20
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 true, // auto_detect 152 true, // auto_detect
152 GURL(), // pac_url 153 GURL(), // pac_url
153 net::ProxyRulesExpectation::Empty(), 154 net::ProxyRulesExpectation::Empty(),
154 } 155 }
155 }; 156 };
156 157
157 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); i++) { 158 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); i++) {
158 SCOPED_TRACE(StringPrintf("Test[%" PRIuS "] %s", i, 159 SCOPED_TRACE(StringPrintf("Test[%" PRIuS "] %s", i,
159 tests[i].description.c_str())); 160 tests[i].description.c_str()));
160 CommandLine command_line(tests[i].command_line); 161 CommandLine command_line(tests[i].command_line);
162 // Only configuration-policy and default prefs are needed.
161 PrefService prefs(new TestingPrefService::TestingPrefValueStore( 163 PrefService prefs(new TestingPrefService::TestingPrefValueStore(
162 new policy::ConfigurationPolicyPrefStore(&command_line, NULL), 164 new policy::ConfigurationPolicyPrefStore(&command_line, NULL),
163 NULL, NULL, NULL, NULL)); // Only configuration-policy prefs. 165 NULL, NULL, NULL, NULL,
166 new DefaultPrefStore()));
164 ChromeURLRequestContextGetter::RegisterUserPrefs(&prefs); 167 ChromeURLRequestContextGetter::RegisterUserPrefs(&prefs);
165 scoped_ptr<net::ProxyConfig> config(CreateProxyConfig(&prefs)); 168 scoped_ptr<net::ProxyConfig> config(CreateProxyConfig(&prefs));
166 169
167 if (tests[i].is_null) { 170 if (tests[i].is_null) {
168 EXPECT_TRUE(config == NULL); 171 EXPECT_TRUE(config == NULL);
169 } else { 172 } else {
170 EXPECT_TRUE(config != NULL); 173 EXPECT_TRUE(config != NULL);
171 EXPECT_EQ(tests[i].auto_detect, config->auto_detect()); 174 EXPECT_EQ(tests[i].auto_detect, config->auto_detect());
172 EXPECT_EQ(tests[i].pac_url, config->pac_url()); 175 EXPECT_EQ(tests[i].pac_url, config->pac_url());
173 EXPECT_TRUE(tests[i].proxy_rules.Matches(config->proxy_rules())); 176 EXPECT_TRUE(tests[i].proxy_rules.Matches(config->proxy_rules()));
174 } 177 }
175 } 178 }
176 } 179 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698