OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/update_client/test_configurator.h" | 5 #include "components/update_client/test_configurator.h" |
6 | 6 |
7 #include "base/sequenced_task_runner.h" | 7 #include "base/sequenced_task_runner.h" |
8 #include "base/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
9 #include "base/version.h" | 9 #include "base/version.h" |
10 #include "components/prefs/pref_service.h" | 10 #include "components/prefs/pref_service.h" |
11 #include "components/update_client/out_of_process_patcher.h" | 11 #include "components/update_client/component_patcher_operation.h" |
| 12 #include "components/update_client/persisted_data.h" |
12 #include "net/url_request/url_request_test_util.h" | 13 #include "net/url_request/url_request_test_util.h" |
13 #include "url/gurl.h" | 14 #include "url/gurl.h" |
14 | 15 |
15 namespace update_client { | 16 namespace update_client { |
16 | 17 |
17 namespace { | 18 namespace { |
18 | 19 |
19 std::vector<GURL> MakeDefaultUrls() { | 20 std::vector<GURL> MakeDefaultUrls() { |
20 std::vector<GURL> urls; | 21 std::vector<GURL> urls; |
21 urls.push_back(GURL(POST_INTERCEPT_SCHEME | 22 urls.push_back(GURL(POST_INTERCEPT_SCHEME |
22 "://" POST_INTERCEPT_HOSTNAME POST_INTERCEPT_PATH)); | 23 "://" POST_INTERCEPT_HOSTNAME POST_INTERCEPT_PATH)); |
23 return urls; | 24 return urls; |
24 } | 25 } |
25 | 26 |
26 } // namespace | 27 } // namespace |
27 | 28 |
28 TestConfigurator::TestConfigurator( | 29 TestConfigurator::TestConfigurator( |
29 const scoped_refptr<base::SequencedTaskRunner>& worker_task_runner, | 30 const scoped_refptr<base::SequencedTaskRunner>& worker_task_runner, |
30 const scoped_refptr<base::SingleThreadTaskRunner>& network_task_runner) | 31 const scoped_refptr<base::SingleThreadTaskRunner>& network_task_runner) |
31 : worker_task_runner_(worker_task_runner), | 32 : worker_task_runner_(worker_task_runner), |
32 brand_("TEST"), | 33 brand_("TEST"), |
33 initial_time_(0), | 34 initial_time_(0), |
34 ondemand_time_(0), | 35 ondemand_time_(0), |
35 enabled_cup_signing_(false), | 36 enabled_cup_signing_(false), |
36 enabled_component_updates_(true), | 37 enabled_component_updates_(true), |
| 38 pref_service_(nullptr), |
37 context_(new net::TestURLRequestContextGetter(network_task_runner)) {} | 39 context_(new net::TestURLRequestContextGetter(network_task_runner)) {} |
38 | 40 |
39 TestConfigurator::~TestConfigurator() { | 41 TestConfigurator::~TestConfigurator() { |
40 } | 42 } |
41 | 43 |
42 int TestConfigurator::InitialDelay() const { | 44 int TestConfigurator::InitialDelay() const { |
43 return initial_time_; | 45 return initial_time_; |
44 } | 46 } |
45 | 47 |
46 int TestConfigurator::NextCheckDelay() const { | 48 int TestConfigurator::NextCheckDelay() const { |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 } | 156 } |
155 | 157 |
156 void TestConfigurator::SetUpdateCheckUrl(const GURL& url) { | 158 void TestConfigurator::SetUpdateCheckUrl(const GURL& url) { |
157 update_check_url_ = url; | 159 update_check_url_ = url; |
158 } | 160 } |
159 | 161 |
160 void TestConfigurator::SetPingUrl(const GURL& url) { | 162 void TestConfigurator::SetPingUrl(const GURL& url) { |
161 ping_url_ = url; | 163 ping_url_ = url; |
162 } | 164 } |
163 | 165 |
| 166 void TestConfigurator::SetPrefService(PrefService* pref_service) { |
| 167 pref_service_ = pref_service; |
| 168 } |
| 169 |
164 scoped_refptr<base::SequencedTaskRunner> | 170 scoped_refptr<base::SequencedTaskRunner> |
165 TestConfigurator::GetSequencedTaskRunner() const { | 171 TestConfigurator::GetSequencedTaskRunner() const { |
166 DCHECK(worker_task_runner_.get()); | 172 DCHECK(worker_task_runner_.get()); |
167 return worker_task_runner_; | 173 return worker_task_runner_; |
168 } | 174 } |
169 | 175 |
170 PrefService* TestConfigurator::GetPrefService() const { | |
171 return nullptr; | |
172 } | |
173 | |
174 bool TestConfigurator::IsPerUserInstall() const { | 176 bool TestConfigurator::IsPerUserInstall() const { |
175 return true; | 177 return true; |
176 } | 178 } |
177 | 179 |
| 180 std::unique_ptr<PersistedData> TestConfigurator::CreateMetadata() const { |
| 181 return base::MakeUnique<PersistedData>(pref_service_); |
| 182 } |
| 183 |
178 } // namespace update_client | 184 } // namespace update_client |
OLD | NEW |