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

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

Issue 11741003: Remove PrefServiceSimple, replacing it with PrefService and PrefRegistrySimple. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/pref_proxy_config_tracker_impl.h" 5 #include "chrome/browser/net/pref_proxy_config_tracker_impl.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "chrome/browser/net/chrome_url_request_context.h" 10 #include "chrome/browser/net/chrome_url_request_context.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 net::ProxyConfigService::ConfigAvailability)); 70 net::ProxyConfigService::ConfigAvailability));
71 }; 71 };
72 72
73 template<typename TESTBASE> 73 template<typename TESTBASE>
74 class PrefProxyConfigTrackerImplTestBase : public TESTBASE { 74 class PrefProxyConfigTrackerImplTestBase : public TESTBASE {
75 protected: 75 protected:
76 PrefProxyConfigTrackerImplTestBase() 76 PrefProxyConfigTrackerImplTestBase()
77 : ui_thread_(BrowserThread::UI, &loop_), 77 : ui_thread_(BrowserThread::UI, &loop_),
78 io_thread_(BrowserThread::IO, &loop_) {} 78 io_thread_(BrowserThread::IO, &loop_) {}
79 79
80 virtual void Init(PrefServiceSimple* pref_service) { 80 virtual void Init(PrefService* pref_service) {
81 ASSERT_TRUE(pref_service); 81 ASSERT_TRUE(pref_service);
82 PrefProxyConfigTrackerImpl::RegisterPrefs(pref_service); 82 PrefRegistrarSimple registrar(pref_service);
83 PrefProxyConfigTrackerImpl::RegisterPrefs(&registrar);
83 fixed_config_.set_pac_url(GURL(kFixedPacUrl)); 84 fixed_config_.set_pac_url(GURL(kFixedPacUrl));
84 delegate_service_ = 85 delegate_service_ =
85 new TestProxyConfigService(fixed_config_, 86 new TestProxyConfigService(fixed_config_,
86 net::ProxyConfigService::CONFIG_VALID); 87 net::ProxyConfigService::CONFIG_VALID);
87 proxy_config_service_.reset( 88 proxy_config_service_.reset(
88 new ChromeProxyConfigService(delegate_service_, true)); 89 new ChromeProxyConfigService(delegate_service_, true));
89 proxy_config_tracker_.reset(new PrefProxyConfigTrackerImpl(pref_service)); 90 proxy_config_tracker_.reset(new PrefProxyConfigTrackerImpl(pref_service));
90 proxy_config_tracker_->SetChromeProxyConfigService( 91 proxy_config_tracker_->SetChromeProxyConfigService(
91 proxy_config_service_.get()); 92 proxy_config_service_.get());
92 // SetChromeProxyConfigService triggers update of initial prefs proxy 93 // SetChromeProxyConfigService triggers update of initial prefs proxy
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 command_line_.AppendSwitch(name); 340 command_line_.AppendSwitch(name);
340 } 341 }
341 pref_service_.reset( 342 pref_service_.reset(
342 PrefServiceMockBuilder().WithCommandLine( 343 PrefServiceMockBuilder().WithCommandLine(
343 &command_line_).CreateSimple()); 344 &command_line_).CreateSimple());
344 Init(pref_service_.get()); 345 Init(pref_service_.get());
345 } 346 }
346 347
347 private: 348 private:
348 CommandLine command_line_; 349 CommandLine command_line_;
349 scoped_ptr<PrefServiceSimple> pref_service_; 350 scoped_ptr<PrefService> pref_service_;
350 }; 351 };
351 352
352 TEST_P(PrefProxyConfigTrackerImplCommandLineTest, CommandLine) { 353 TEST_P(PrefProxyConfigTrackerImplCommandLineTest, CommandLine) {
353 net::ProxyConfig config; 354 net::ProxyConfig config;
354 EXPECT_EQ(net::ProxyConfigService::CONFIG_VALID, 355 EXPECT_EQ(net::ProxyConfigService::CONFIG_VALID,
355 proxy_config_service_->GetLatestProxyConfig(&config)); 356 proxy_config_service_->GetLatestProxyConfig(&config));
356 357
357 if (GetParam().is_null) { 358 if (GetParam().is_null) {
358 EXPECT_EQ(GURL(kFixedPacUrl), config.pac_url()); 359 EXPECT_EQ(GURL(kFixedPacUrl), config.pac_url());
359 } else { 360 } else {
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 net::ProxyRulesExpectation::Empty(), 474 net::ProxyRulesExpectation::Empty(),
474 }, 475 },
475 }; 476 };
476 477
477 INSTANTIATE_TEST_CASE_P( 478 INSTANTIATE_TEST_CASE_P(
478 PrefProxyConfigTrackerImplCommandLineTestInstance, 479 PrefProxyConfigTrackerImplCommandLineTestInstance,
479 PrefProxyConfigTrackerImplCommandLineTest, 480 PrefProxyConfigTrackerImplCommandLineTest,
480 testing::ValuesIn(kCommandLineTestParams)); 481 testing::ValuesIn(kCommandLineTestParams));
481 482
482 } // namespace 483 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698