| OLD | NEW |
| 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/command_line_pref_store.h" | 5 #include "chrome/browser/prefs/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" |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 const char* value = GetParam().switches[i].value; | 167 const char* value = GetParam().switches[i].value; |
| 168 if (name && value) | 168 if (name && value) |
| 169 command_line_.AppendSwitchASCII(name, value); | 169 command_line_.AppendSwitchASCII(name, value); |
| 170 else if (name) | 170 else if (name) |
| 171 command_line_.AppendSwitch(name); | 171 command_line_.AppendSwitch(name); |
| 172 } | 172 } |
| 173 scoped_refptr<PrefRegistrySimple> registry = new PrefRegistrySimple; | 173 scoped_refptr<PrefRegistrySimple> registry = new PrefRegistrySimple; |
| 174 PrefProxyConfigTrackerImpl::RegisterPrefs(registry.get()); | 174 PrefProxyConfigTrackerImpl::RegisterPrefs(registry.get()); |
| 175 syncable_prefs::PrefServiceMockFactory factory; | 175 syncable_prefs::PrefServiceMockFactory factory; |
| 176 factory.set_command_line_prefs(new CommandLinePrefStore(&command_line_)); | 176 factory.set_command_line_prefs(new CommandLinePrefStore(&command_line_)); |
| 177 pref_service_ = factory.Create(registry.get()).Pass(); | 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 scoped_ptr<PrefService> pref_service_; | 184 scoped_ptr<PrefService> pref_service_; |
| 185 net::ProxyConfig proxy_config_; | 185 net::ProxyConfig proxy_config_; |
| 186 }; | 186 }; |
| 187 | 187 |
| 188 TEST_P(CommandLinePrefStoreProxyTest, CommandLine) { | 188 TEST_P(CommandLinePrefStoreProxyTest, 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(CommandLinePrefStoreProxyTestInstance, | 194 INSTANTIATE_TEST_CASE_P(CommandLinePrefStoreProxyTestInstance, |
| 195 CommandLinePrefStoreProxyTest, | 195 CommandLinePrefStoreProxyTest, |
| 196 testing::ValuesIn(kCommandLineTestParams)); | 196 testing::ValuesIn(kCommandLineTestParams)); |
| OLD | NEW |