Chromium Code Reviews

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

Issue 5204006: Renamed DefaultPrefStore into InMemoryPrefStore because it can be used in further contexts. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | | 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/command_line_pref_store.h" 10 #include "chrome/browser/prefs/command_line_pref_store.h"
11 #include "chrome/browser/prefs/default_pref_store.h" 11 #include "chrome/browser/prefs/in_memory_pref_store.h"
12 #include "chrome/browser/prefs/pref_value_store.h" 12 #include "chrome/browser/prefs/pref_value_store.h"
13 #include "chrome/common/chrome_switches.h" 13 #include "chrome/common/chrome_switches.h"
14 #include "chrome/test/testing_pref_service.h" 14 #include "chrome/test/testing_pref_service.h"
15 #include "net/proxy/proxy_config.h" 15 #include "net/proxy/proxy_config.h"
16 #include "net/proxy/proxy_config_service_common_unittest.h" 16 #include "net/proxy/proxy_config_service_common_unittest.h"
17 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
18 18
19 // Builds an identifier for each test in an array. 19 // Builds an identifier for each test in an array.
20 #define TEST_DESC(desc) StringPrintf("at line %d <%s>", __LINE__, desc) 20 #define TEST_DESC(desc) StringPrintf("at line %d <%s>", __LINE__, desc)
21 21
(...skipping 136 matching lines...)
158 158
159 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); i++) { 159 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); i++) {
160 SCOPED_TRACE(StringPrintf("Test[%" PRIuS "] %s", i, 160 SCOPED_TRACE(StringPrintf("Test[%" PRIuS "] %s", i,
161 tests[i].description.c_str())); 161 tests[i].description.c_str()));
162 CommandLine command_line(tests[i].command_line); 162 CommandLine command_line(tests[i].command_line);
163 // Only configuration-policy and default prefs are needed. 163 // Only configuration-policy and default prefs are needed.
164 PrefService prefs(new TestingPrefService::TestingPrefValueStore( 164 PrefService prefs(new TestingPrefService::TestingPrefValueStore(
165 new policy::ConfigurationPolicyPrefStore(NULL), 165 new policy::ConfigurationPolicyPrefStore(NULL),
166 new policy::ConfigurationPolicyPrefStore(NULL), NULL, 166 new policy::ConfigurationPolicyPrefStore(NULL), NULL,
167 new CommandLinePrefStore(&command_line), NULL, NULL, 167 new CommandLinePrefStore(&command_line), NULL, NULL,
168 new DefaultPrefStore())); 168 new InMemoryPrefStore()));
169 ChromeURLRequestContextGetter::RegisterUserPrefs(&prefs); 169 ChromeURLRequestContextGetter::RegisterUserPrefs(&prefs);
170 scoped_ptr<net::ProxyConfig> config(CreateProxyConfig(&prefs)); 170 scoped_ptr<net::ProxyConfig> config(CreateProxyConfig(&prefs));
171 171
172 if (tests[i].is_null) { 172 if (tests[i].is_null) {
173 EXPECT_TRUE(config == NULL); 173 EXPECT_TRUE(config == NULL);
174 } else { 174 } else {
175 EXPECT_TRUE(config != NULL); 175 EXPECT_TRUE(config != NULL);
176 EXPECT_EQ(tests[i].auto_detect, config->auto_detect()); 176 EXPECT_EQ(tests[i].auto_detect, config->auto_detect());
177 EXPECT_EQ(tests[i].pac_url, config->pac_url()); 177 EXPECT_EQ(tests[i].pac_url, config->pac_url());
178 EXPECT_TRUE(tests[i].proxy_rules.Matches(config->proxy_rules())); 178 EXPECT_TRUE(tests[i].proxy_rules.Matches(config->proxy_rules()));
179 } 179 }
180 } 180 }
181 } 181 }
OLDNEW

Powered by Google App Engine