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

Side by Side Diff: chrome/browser/prefs/chrome_command_line_pref_store_proxy_unittest.cc

Issue 2459823002: [Sync] Rename syncable_prefs to sync_preferences. (Closed)
Patch Set: Created 4 years, 1 month 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/prefs/chrome_command_line_pref_store.h" 5 #include "chrome/browser/prefs/chrome_command_line_pref_store.h"
6 6
7 #include <gtest/gtest.h> 7 #include <gtest/gtest.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "chrome/common/chrome_switches.h" 13 #include "chrome/common/chrome_switches.h"
14 #include "components/prefs/pref_registry_simple.h" 14 #include "components/prefs/pref_registry_simple.h"
15 #include "components/prefs/pref_service.h" 15 #include "components/prefs/pref_service.h"
16 #include "components/proxy_config/pref_proxy_config_tracker_impl.h" 16 #include "components/proxy_config/pref_proxy_config_tracker_impl.h"
17 #include "components/syncable_prefs/pref_service_mock_factory.h" 17 #include "components/sync_preferences/pref_service_mock_factory.h"
18 #include "net/proxy/proxy_config_service_common_unittest.h" 18 #include "net/proxy/proxy_config_service_common_unittest.h"
19 #include "url/gurl.h" 19 #include "url/gurl.h"
20 20
21 namespace { 21 namespace {
22 22
23 // Test parameter object for testing command line proxy configuration. 23 // Test parameter object for testing command line proxy configuration.
24 struct CommandLineTestParams { 24 struct CommandLineTestParams {
25 // Short description to identify the test. 25 // Short description to identify the test.
26 const char* description; 26 const char* description;
27 27
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 for (size_t i = 0; i < arraysize(GetParam().switches); i++) { 164 for (size_t i = 0; i < arraysize(GetParam().switches); i++) {
165 const char* name = GetParam().switches[i].name; 165 const char* name = GetParam().switches[i].name;
166 const char* value = GetParam().switches[i].value; 166 const char* value = GetParam().switches[i].value;
167 if (name && value) 167 if (name && value)
168 command_line_.AppendSwitchASCII(name, value); 168 command_line_.AppendSwitchASCII(name, value);
169 else if (name) 169 else if (name)
170 command_line_.AppendSwitch(name); 170 command_line_.AppendSwitch(name);
171 } 171 }
172 scoped_refptr<PrefRegistrySimple> registry = new PrefRegistrySimple; 172 scoped_refptr<PrefRegistrySimple> registry = new PrefRegistrySimple;
173 PrefProxyConfigTrackerImpl::RegisterPrefs(registry.get()); 173 PrefProxyConfigTrackerImpl::RegisterPrefs(registry.get());
174 syncable_prefs::PrefServiceMockFactory factory; 174 sync_preferences::PrefServiceMockFactory factory;
175 factory.set_command_line_prefs( 175 factory.set_command_line_prefs(
176 new ChromeCommandLinePrefStore(&command_line_)); 176 new ChromeCommandLinePrefStore(&command_line_));
177 pref_service_ = factory.Create(registry.get()); 177 pref_service_ = factory.Create(registry.get());
178 PrefProxyConfigTrackerImpl::ReadPrefConfig(pref_service_.get(), 178 PrefProxyConfigTrackerImpl::ReadPrefConfig(pref_service_.get(),
179 &proxy_config_); 179 &proxy_config_);
180 } 180 }
181 181
182 private: 182 private:
183 base::CommandLine command_line_; 183 base::CommandLine command_line_;
184 std::unique_ptr<PrefService> pref_service_; 184 std::unique_ptr<PrefService> pref_service_;
185 net::ProxyConfig proxy_config_; 185 net::ProxyConfig proxy_config_;
186 }; 186 };
187 187
188 TEST_P(ChromeCommandLinePrefStoreProxyTest, CommandLine) { 188 TEST_P(ChromeCommandLinePrefStoreProxyTest, CommandLine) {
189 EXPECT_EQ(GetParam().auto_detect, proxy_config()->auto_detect()); 189 EXPECT_EQ(GetParam().auto_detect, proxy_config()->auto_detect());
190 EXPECT_EQ(GetParam().pac_url, proxy_config()->pac_url()); 190 EXPECT_EQ(GetParam().pac_url, proxy_config()->pac_url());
191 EXPECT_TRUE(GetParam().proxy_rules.Matches(proxy_config()->proxy_rules())); 191 EXPECT_TRUE(GetParam().proxy_rules.Matches(proxy_config()->proxy_rules()));
192 } 192 }
193 193
194 INSTANTIATE_TEST_CASE_P(ChromeCommandLinePrefStoreProxyTestInstance, 194 INSTANTIATE_TEST_CASE_P(ChromeCommandLinePrefStoreProxyTestInstance,
195 ChromeCommandLinePrefStoreProxyTest, 195 ChromeCommandLinePrefStoreProxyTest,
196 testing::ValuesIn(kCommandLineTestParams)); 196 testing::ValuesIn(kCommandLineTestParams));
OLDNEW
« no previous file with comments | « chrome/browser/prefs/browser_prefs.cc ('k') | chrome/browser/prefs/chrome_command_line_pref_store_ssl_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698