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

Side by Side Diff: components/proxy_config/pref_proxy_config_tracker_impl_unittest.cc

Issue 1921923002: Convert //components/[o-t]* from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 7 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
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 "components/proxy_config/pref_proxy_config_tracker_impl.h" 5 #include "components/proxy_config/pref_proxy_config_tracker_impl.h"
6 6
7 #include <memory>
7 #include <string> 8 #include <string>
8 9
9 #include "base/command_line.h" 10 #include "base/command_line.h"
10 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
11 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
12 #include "base/test/histogram_tester.h" 13 #include "base/test/histogram_tester.h"
13 #include "base/thread_task_runner_handle.h" 14 #include "base/thread_task_runner_handle.h"
14 #include "components/prefs/pref_registry_simple.h" 15 #include "components/prefs/pref_registry_simple.h"
15 #include "components/prefs/testing_pref_service.h" 16 #include "components/prefs/testing_pref_service.h"
16 #include "components/proxy_config/proxy_config_dictionary.h" 17 #include "components/proxy_config/proxy_config_dictionary.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 pref_service_.reset(new TestingPrefServiceSimple()); 79 pref_service_.reset(new TestingPrefServiceSimple());
79 PrefProxyConfigTrackerImpl::RegisterPrefs(pref_service_->registry()); 80 PrefProxyConfigTrackerImpl::RegisterPrefs(pref_service_->registry());
80 fixed_config_.set_pac_url(GURL(kFixedPacUrl)); 81 fixed_config_.set_pac_url(GURL(kFixedPacUrl));
81 delegate_service_ = 82 delegate_service_ =
82 new TestProxyConfigService(fixed_config_, 83 new TestProxyConfigService(fixed_config_,
83 net::ProxyConfigService::CONFIG_VALID); 84 net::ProxyConfigService::CONFIG_VALID);
84 proxy_config_tracker_.reset(new PrefProxyConfigTrackerImpl( 85 proxy_config_tracker_.reset(new PrefProxyConfigTrackerImpl(
85 pref_service_.get(), base::ThreadTaskRunnerHandle::Get())); 86 pref_service_.get(), base::ThreadTaskRunnerHandle::Get()));
86 proxy_config_service_ = 87 proxy_config_service_ =
87 proxy_config_tracker_->CreateTrackingProxyConfigService( 88 proxy_config_tracker_->CreateTrackingProxyConfigService(
88 scoped_ptr<net::ProxyConfigService>(delegate_service_)); 89 std::unique_ptr<net::ProxyConfigService>(delegate_service_));
89 // SetProxyConfigServiceImpl triggers update of initial prefs proxy 90 // SetProxyConfigServiceImpl triggers update of initial prefs proxy
90 // config by tracker to chrome proxy config service, so flush all pending 91 // config by tracker to chrome proxy config service, so flush all pending
91 // tasks so that tests start fresh. 92 // tasks so that tests start fresh.
92 loop_.RunUntilIdle(); 93 loop_.RunUntilIdle();
93 } 94 }
94 95
95 ~PrefProxyConfigTrackerImplTest() override { 96 ~PrefProxyConfigTrackerImplTest() override {
96 proxy_config_tracker_->DetachFromPrefService(); 97 proxy_config_tracker_->DetachFromPrefService();
97 loop_.RunUntilIdle(); 98 loop_.RunUntilIdle();
98 proxy_config_tracker_.reset(); 99 proxy_config_tracker_.reset();
99 proxy_config_service_.reset(); 100 proxy_config_service_.reset();
100 } 101 }
101 102
102 base::MessageLoop loop_; 103 base::MessageLoop loop_;
103 scoped_ptr<TestingPrefServiceSimple> pref_service_; 104 std::unique_ptr<TestingPrefServiceSimple> pref_service_;
104 TestProxyConfigService* delegate_service_; // weak 105 TestProxyConfigService* delegate_service_; // weak
105 scoped_ptr<net::ProxyConfigService> proxy_config_service_; 106 std::unique_ptr<net::ProxyConfigService> proxy_config_service_;
106 net::ProxyConfig fixed_config_; 107 net::ProxyConfig fixed_config_;
107 108
108 private: 109 private:
109 scoped_ptr<PrefProxyConfigTrackerImpl> proxy_config_tracker_; 110 std::unique_ptr<PrefProxyConfigTrackerImpl> proxy_config_tracker_;
110 }; 111 };
111 112
112 TEST_F(PrefProxyConfigTrackerImplTest, BaseConfiguration) { 113 TEST_F(PrefProxyConfigTrackerImplTest, BaseConfiguration) {
113 net::ProxyConfig actual_config; 114 net::ProxyConfig actual_config;
114 EXPECT_EQ(net::ProxyConfigService::CONFIG_VALID, 115 EXPECT_EQ(net::ProxyConfigService::CONFIG_VALID,
115 proxy_config_service_->GetLatestProxyConfig(&actual_config)); 116 proxy_config_service_->GetLatestProxyConfig(&actual_config));
116 EXPECT_EQ(GURL(kFixedPacUrl), actual_config.pac_url()); 117 EXPECT_EQ(GURL(kFixedPacUrl), actual_config.pac_url());
117 } 118 }
118 119
119 TEST_F(PrefProxyConfigTrackerImplTest, DynamicPrefOverrides) { 120 TEST_F(PrefProxyConfigTrackerImplTest, DynamicPrefOverrides) {
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 CheckResolvedProxyMatches(&config, GURL("http://google.com"), 357 CheckResolvedProxyMatches(&config, GURL("http://google.com"),
357 test.http_proxy_info); 358 test.http_proxy_info);
358 CheckResolvedProxyMatches(&config, GURL("https://google.com"), 359 CheckResolvedProxyMatches(&config, GURL("https://google.com"),
359 test.https_proxy_info); 360 test.https_proxy_info);
360 CheckResolvedProxyMatches(&config, GURL("ftp://google.com"), 361 CheckResolvedProxyMatches(&config, GURL("ftp://google.com"),
361 test.ftp_proxy_info); 362 test.ftp_proxy_info);
362 } 363 }
363 } 364 }
364 365
365 } // namespace 366 } // namespace
OLDNEW
« no previous file with comments | « components/proxy_config/pref_proxy_config_tracker_impl.cc ('k') | components/proxy_config/proxy_config_dictionary.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698