OLD | NEW |
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 "chrome/browser/chromeos/proxy_config_service_impl.h" | 5 #include "chrome/browser/chromeos/proxy_config_service_impl.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 }, | 228 }, |
229 }; // tests | 229 }; // tests |
230 | 230 |
231 template<typename TESTBASE> | 231 template<typename TESTBASE> |
232 class ProxyConfigServiceImplTestBase : public TESTBASE { | 232 class ProxyConfigServiceImplTestBase : public TESTBASE { |
233 protected: | 233 protected: |
234 ProxyConfigServiceImplTestBase() | 234 ProxyConfigServiceImplTestBase() |
235 : ui_thread_(BrowserThread::UI, &loop_), | 235 : ui_thread_(BrowserThread::UI, &loop_), |
236 io_thread_(BrowserThread::IO, &loop_) {} | 236 io_thread_(BrowserThread::IO, &loop_) {} |
237 | 237 |
238 virtual void Init(PrefService* pref_service) { | 238 virtual void Init(PrefServiceSimple* pref_service) { |
239 ASSERT_TRUE(pref_service); | 239 ASSERT_TRUE(pref_service); |
240 DBusThreadManager::Initialize(); | 240 DBusThreadManager::Initialize(); |
241 PrefProxyConfigTrackerImpl::RegisterPrefs(pref_service); | 241 PrefProxyConfigTrackerImpl::RegisterPrefs(pref_service); |
242 ProxyConfigServiceImpl::RegisterPrefs(pref_service); | 242 ProxyConfigServiceImpl::RegisterPrefs(pref_service); |
243 proxy_config_service_.reset(new ChromeProxyConfigService(NULL, true)); | 243 proxy_config_service_.reset(new ChromeProxyConfigService(NULL, true)); |
244 config_service_impl_.reset(new ProxyConfigServiceImpl(pref_service)); | 244 config_service_impl_.reset(new ProxyConfigServiceImpl(pref_service)); |
245 config_service_impl_->SetChromeProxyConfigService( | 245 config_service_impl_->SetChromeProxyConfigService( |
246 proxy_config_service_.get()); | 246 proxy_config_service_.get()); |
247 // SetChromeProxyConfigService triggers update of initial prefs proxy | 247 // SetChromeProxyConfigService triggers update of initial prefs proxy |
248 // config by tracker to chrome proxy config service, so flush all pending | 248 // config by tracker to chrome proxy config service, so flush all pending |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 content::TestBrowserThread io_thread_; | 333 content::TestBrowserThread io_thread_; |
334 }; | 334 }; |
335 | 335 |
336 class ProxyConfigServiceImplTest | 336 class ProxyConfigServiceImplTest |
337 : public ProxyConfigServiceImplTestBase<testing::Test> { | 337 : public ProxyConfigServiceImplTestBase<testing::Test> { |
338 protected: | 338 protected: |
339 virtual void SetUp() { | 339 virtual void SetUp() { |
340 Init(&pref_service_); | 340 Init(&pref_service_); |
341 } | 341 } |
342 | 342 |
343 TestingPrefService pref_service_; | 343 TestingPrefServiceSimple pref_service_; |
344 }; | 344 }; |
345 | 345 |
346 TEST_F(ProxyConfigServiceImplTest, NetworkProxy) { | 346 TEST_F(ProxyConfigServiceImplTest, NetworkProxy) { |
347 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { | 347 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { |
348 SCOPED_TRACE(StringPrintf("Test[%" PRIuS "] %s", i, | 348 SCOPED_TRACE(StringPrintf("Test[%" PRIuS "] %s", i, |
349 tests[i].description.c_str())); | 349 tests[i].description.c_str())); |
350 | 350 |
351 ProxyConfigServiceImpl::ProxyConfig test_config; | 351 ProxyConfigServiceImpl::ProxyConfig test_config; |
352 InitConfigWithTestInput(tests[i].input, &test_config); | 352 InitConfigWithTestInput(tests[i].input, &test_config); |
353 config_service_impl_->SetTesting(&test_config); | 353 config_service_impl_->SetTesting(&test_config); |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 EXPECT_EQ(network_params.auto_detect, actual_config.auto_detect()); | 552 EXPECT_EQ(network_params.auto_detect, actual_config.auto_detect()); |
553 EXPECT_EQ(network_params.pac_url, actual_config.pac_url()); | 553 EXPECT_EQ(network_params.pac_url, actual_config.pac_url()); |
554 EXPECT_TRUE(network_params.proxy_rules.Matches( | 554 EXPECT_TRUE(network_params.proxy_rules.Matches( |
555 actual_config.proxy_rules())); | 555 actual_config.proxy_rules())); |
556 } | 556 } |
557 } | 557 } |
558 | 558 |
559 } // namespace | 559 } // namespace |
560 | 560 |
561 } // namespace chromeos | 561 } // namespace chromeos |
OLD | NEW |