| 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/update_client/component_patcher_operation.h" | 8 #include "components/update_client/component_patcher_operation.h" |
| 9 #include "url/gurl.h" | 9 #include "url/gurl.h" |
| 10 | 10 |
| 11 namespace update_client { | 11 namespace update_client { |
| 12 | 12 |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 std::vector<GURL> MakeDefaultUrls() { | 15 std::vector<GURL> MakeDefaultUrls() { |
| 16 std::vector<GURL> urls; | 16 std::vector<GURL> urls; |
| 17 urls.push_back(GURL(POST_INTERCEPT_SCHEME | 17 urls.push_back(GURL(POST_INTERCEPT_SCHEME |
| 18 "://" POST_INTERCEPT_HOSTNAME POST_INTERCEPT_PATH)); | 18 "://" POST_INTERCEPT_HOSTNAME POST_INTERCEPT_PATH)); |
| 19 return urls; | 19 return urls; |
| 20 } | 20 } |
| 21 | 21 |
| 22 } // namespace | 22 } // namespace |
| 23 | 23 |
| 24 TestConfigurator::TestConfigurator( | 24 TestConfigurator::TestConfigurator( |
| 25 const scoped_refptr<base::SequencedTaskRunner>& worker_task_runner, | 25 const scoped_refptr<base::SequencedTaskRunner>& worker_task_runner, |
| 26 const scoped_refptr<base::SingleThreadTaskRunner>& network_task_runner) | 26 const scoped_refptr<base::SingleThreadTaskRunner>& network_task_runner) |
| 27 : worker_task_runner_(worker_task_runner), | 27 : worker_task_runner_(worker_task_runner), |
| 28 initial_time_(0), | 28 initial_time_(0), |
| 29 ondemand_time_(0), | 29 ondemand_time_(0), |
| 30 context_(new net::TestURLRequestContextGetter(network_task_runner)) { | 30 use_cup_signing_(false), |
| 31 } | 31 context_(new net::TestURLRequestContextGetter(network_task_runner)) {} |
| 32 | 32 |
| 33 TestConfigurator::~TestConfigurator() { | 33 TestConfigurator::~TestConfigurator() { |
| 34 } | 34 } |
| 35 | 35 |
| 36 int TestConfigurator::InitialDelay() const { | 36 int TestConfigurator::InitialDelay() const { |
| 37 return initial_time_; | 37 return initial_time_; |
| 38 } | 38 } |
| 39 | 39 |
| 40 int TestConfigurator::NextCheckDelay() const { | 40 int TestConfigurator::NextCheckDelay() const { |
| 41 return 1; | 41 return 1; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 } | 96 } |
| 97 | 97 |
| 98 bool TestConfigurator::DeltasEnabled() const { | 98 bool TestConfigurator::DeltasEnabled() const { |
| 99 return true; | 99 return true; |
| 100 } | 100 } |
| 101 | 101 |
| 102 bool TestConfigurator::UseBackgroundDownloader() const { | 102 bool TestConfigurator::UseBackgroundDownloader() const { |
| 103 return false; | 103 return false; |
| 104 } | 104 } |
| 105 | 105 |
| 106 bool TestConfigurator::UseCupSigning() const { |
| 107 return use_cup_signing_; |
| 108 } |
| 109 |
| 106 void TestConfigurator::SetOnDemandTime(int seconds) { | 110 void TestConfigurator::SetOnDemandTime(int seconds) { |
| 107 ondemand_time_ = seconds; | 111 ondemand_time_ = seconds; |
| 108 } | 112 } |
| 109 | 113 |
| 110 void TestConfigurator::SetInitialDelay(int seconds) { | 114 void TestConfigurator::SetInitialDelay(int seconds) { |
| 111 initial_time_ = seconds; | 115 initial_time_ = seconds; |
| 112 } | 116 } |
| 113 | 117 |
| 118 void TestConfigurator::SetUseCupSigning(bool use_cup_signing) { |
| 119 use_cup_signing_ = use_cup_signing; |
| 120 } |
| 121 |
| 114 void TestConfigurator::SetDownloadPreference( | 122 void TestConfigurator::SetDownloadPreference( |
| 115 const std::string& download_preference) { | 123 const std::string& download_preference) { |
| 116 download_preference_ = download_preference; | 124 download_preference_ = download_preference; |
| 117 } | 125 } |
| 118 | 126 |
| 119 scoped_refptr<base::SequencedTaskRunner> | 127 scoped_refptr<base::SequencedTaskRunner> |
| 120 TestConfigurator::GetSequencedTaskRunner() const { | 128 TestConfigurator::GetSequencedTaskRunner() const { |
| 121 DCHECK(worker_task_runner_.get()); | 129 DCHECK(worker_task_runner_.get()); |
| 122 return worker_task_runner_; | 130 return worker_task_runner_; |
| 123 } | 131 } |
| 124 | 132 |
| 125 } // namespace update_client | 133 } // namespace update_client |
| OLD | NEW |