| 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/version.h" | 7 #include "base/version.h" |
| 8 #include "components/prefs/pref_service.h" | 8 #include "components/prefs/pref_service.h" |
| 9 #include "components/update_client/component_patcher_operation.h" | 9 #include "components/update_client/component_patcher_operation.h" |
| 10 #include "url/gurl.h" | 10 #include "url/gurl.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 } // namespace | 23 } // namespace |
| 24 | 24 |
| 25 TestConfigurator::TestConfigurator( | 25 TestConfigurator::TestConfigurator( |
| 26 const scoped_refptr<base::SequencedTaskRunner>& worker_task_runner, | 26 const scoped_refptr<base::SequencedTaskRunner>& worker_task_runner, |
| 27 const scoped_refptr<base::SingleThreadTaskRunner>& network_task_runner) | 27 const scoped_refptr<base::SingleThreadTaskRunner>& network_task_runner) |
| 28 : worker_task_runner_(worker_task_runner), | 28 : worker_task_runner_(worker_task_runner), |
| 29 brand_("TEST"), | 29 brand_("TEST"), |
| 30 initial_time_(0), | 30 initial_time_(0), |
| 31 ondemand_time_(0), | 31 ondemand_time_(0), |
| 32 use_cup_signing_(false), | 32 enabled_cup_signing_(false), |
| 33 enabled_component_updates_(false), |
| 33 context_(new net::TestURLRequestContextGetter(network_task_runner)) {} | 34 context_(new net::TestURLRequestContextGetter(network_task_runner)) {} |
| 34 | 35 |
| 35 TestConfigurator::~TestConfigurator() { | 36 TestConfigurator::~TestConfigurator() { |
| 36 } | 37 } |
| 37 | 38 |
| 38 int TestConfigurator::InitialDelay() const { | 39 int TestConfigurator::InitialDelay() const { |
| 39 return initial_time_; | 40 return initial_time_; |
| 40 } | 41 } |
| 41 | 42 |
| 42 int TestConfigurator::NextCheckDelay() const { | 43 int TestConfigurator::NextCheckDelay() const { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 scoped_refptr<OutOfProcessPatcher> TestConfigurator::CreateOutOfProcessPatcher() | 106 scoped_refptr<OutOfProcessPatcher> TestConfigurator::CreateOutOfProcessPatcher() |
| 106 const { | 107 const { |
| 107 return NULL; | 108 return NULL; |
| 108 } | 109 } |
| 109 | 110 |
| 110 bool TestConfigurator::EnabledDeltas() const { | 111 bool TestConfigurator::EnabledDeltas() const { |
| 111 return true; | 112 return true; |
| 112 } | 113 } |
| 113 | 114 |
| 114 bool TestConfigurator::EnabledComponentUpdates() const { | 115 bool TestConfigurator::EnabledComponentUpdates() const { |
| 115 return true; | 116 return enabled_component_updates_; |
| 116 } | 117 } |
| 117 | 118 |
| 118 bool TestConfigurator::EnabledBackgroundDownloader() const { | 119 bool TestConfigurator::EnabledBackgroundDownloader() const { |
| 119 return false; | 120 return false; |
| 120 } | 121 } |
| 121 | 122 |
| 122 bool TestConfigurator::EnabledCupSigning() const { | 123 bool TestConfigurator::EnabledCupSigning() const { |
| 123 return use_cup_signing_; | 124 return enabled_cup_signing_; |
| 124 } | 125 } |
| 125 | 126 |
| 126 void TestConfigurator::SetBrand(const std::string& brand) { | 127 void TestConfigurator::SetBrand(const std::string& brand) { |
| 127 brand_ = brand; | 128 brand_ = brand; |
| 128 } | 129 } |
| 129 | 130 |
| 130 void TestConfigurator::SetOnDemandTime(int seconds) { | 131 void TestConfigurator::SetOnDemandTime(int seconds) { |
| 131 ondemand_time_ = seconds; | 132 ondemand_time_ = seconds; |
| 132 } | 133 } |
| 133 | 134 |
| 134 void TestConfigurator::SetInitialDelay(int seconds) { | 135 void TestConfigurator::SetInitialDelay(int seconds) { |
| 135 initial_time_ = seconds; | 136 initial_time_ = seconds; |
| 136 } | 137 } |
| 137 | 138 |
| 138 void TestConfigurator::SetEnabledCupSigning(bool use_cup_signing) { | 139 void TestConfigurator::SetEnabledCupSigning(bool enabled_cup_signing) { |
| 139 use_cup_signing_ = use_cup_signing; | 140 enabled_cup_signing_ = enabled_cup_signing; |
| 141 } |
| 142 |
| 143 void TestConfigurator::SetEnabledComponentUpdates( |
| 144 bool enabled_component_updates) { |
| 145 enabled_component_updates_ = enabled_component_updates; |
| 140 } | 146 } |
| 141 | 147 |
| 142 void TestConfigurator::SetDownloadPreference( | 148 void TestConfigurator::SetDownloadPreference( |
| 143 const std::string& download_preference) { | 149 const std::string& download_preference) { |
| 144 download_preference_ = download_preference; | 150 download_preference_ = download_preference; |
| 145 } | 151 } |
| 146 | 152 |
| 147 void TestConfigurator::SetUpdateCheckUrl(const GURL& url) { | 153 void TestConfigurator::SetUpdateCheckUrl(const GURL& url) { |
| 148 update_check_url_ = url; | 154 update_check_url_ = url; |
| 149 } | 155 } |
| 150 | 156 |
| 151 void TestConfigurator::SetPingUrl(const GURL& url) { | 157 void TestConfigurator::SetPingUrl(const GURL& url) { |
| 152 ping_url_ = url; | 158 ping_url_ = url; |
| 153 } | 159 } |
| 154 | 160 |
| 155 scoped_refptr<base::SequencedTaskRunner> | 161 scoped_refptr<base::SequencedTaskRunner> |
| 156 TestConfigurator::GetSequencedTaskRunner() const { | 162 TestConfigurator::GetSequencedTaskRunner() const { |
| 157 DCHECK(worker_task_runner_.get()); | 163 DCHECK(worker_task_runner_.get()); |
| 158 return worker_task_runner_; | 164 return worker_task_runner_; |
| 159 } | 165 } |
| 160 | 166 |
| 161 PrefService* TestConfigurator::GetPrefService() const { | 167 PrefService* TestConfigurator::GetPrefService() const { |
| 162 return nullptr; | 168 return nullptr; |
| 163 } | 169 } |
| 164 | 170 |
| 165 } // namespace update_client | 171 } // namespace update_client |
| OLD | NEW |