| 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 brand_("TEST"), |
| 28 initial_time_(0), | 29 initial_time_(0), |
| 29 ondemand_time_(0), | 30 ondemand_time_(0), |
| 30 use_cup_signing_(false), | 31 use_cup_signing_(false), |
| 31 context_(new net::TestURLRequestContextGetter(network_task_runner)) {} | 32 context_(new net::TestURLRequestContextGetter(network_task_runner)) {} |
| 32 | 33 |
| 33 TestConfigurator::~TestConfigurator() { | 34 TestConfigurator::~TestConfigurator() { |
| 34 } | 35 } |
| 35 | 36 |
| 36 int TestConfigurator::InitialDelay() const { | 37 int TestConfigurator::InitialDelay() const { |
| 37 return initial_time_; | 38 return initial_time_; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 63 | 64 |
| 64 base::Version TestConfigurator::GetBrowserVersion() const { | 65 base::Version TestConfigurator::GetBrowserVersion() const { |
| 65 // Needs to be larger than the required version in tested component manifests. | 66 // Needs to be larger than the required version in tested component manifests. |
| 66 return base::Version("30.0"); | 67 return base::Version("30.0"); |
| 67 } | 68 } |
| 68 | 69 |
| 69 std::string TestConfigurator::GetChannel() const { | 70 std::string TestConfigurator::GetChannel() const { |
| 70 return "fake_channel_string"; | 71 return "fake_channel_string"; |
| 71 } | 72 } |
| 72 | 73 |
| 74 std::string TestConfigurator::GetBrand() const { |
| 75 return brand_; |
| 76 } |
| 77 |
| 73 std::string TestConfigurator::GetLang() const { | 78 std::string TestConfigurator::GetLang() const { |
| 74 return "fake_lang"; | 79 return "fake_lang"; |
| 75 } | 80 } |
| 76 | 81 |
| 77 std::string TestConfigurator::GetOSLongName() const { | 82 std::string TestConfigurator::GetOSLongName() const { |
| 78 return "Fake Operating System"; | 83 return "Fake Operating System"; |
| 79 } | 84 } |
| 80 | 85 |
| 81 std::string TestConfigurator::ExtraRequestParams() const { | 86 std::string TestConfigurator::ExtraRequestParams() const { |
| 82 return "extra=\"foo\""; | 87 return "extra=\"foo\""; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 100 } | 105 } |
| 101 | 106 |
| 102 bool TestConfigurator::UseBackgroundDownloader() const { | 107 bool TestConfigurator::UseBackgroundDownloader() const { |
| 103 return false; | 108 return false; |
| 104 } | 109 } |
| 105 | 110 |
| 106 bool TestConfigurator::UseCupSigning() const { | 111 bool TestConfigurator::UseCupSigning() const { |
| 107 return use_cup_signing_; | 112 return use_cup_signing_; |
| 108 } | 113 } |
| 109 | 114 |
| 115 void TestConfigurator::SetBrand(const std::string& brand) { |
| 116 brand_ = brand; |
| 117 } |
| 118 |
| 110 void TestConfigurator::SetOnDemandTime(int seconds) { | 119 void TestConfigurator::SetOnDemandTime(int seconds) { |
| 111 ondemand_time_ = seconds; | 120 ondemand_time_ = seconds; |
| 112 } | 121 } |
| 113 | 122 |
| 114 void TestConfigurator::SetInitialDelay(int seconds) { | 123 void TestConfigurator::SetInitialDelay(int seconds) { |
| 115 initial_time_ = seconds; | 124 initial_time_ = seconds; |
| 116 } | 125 } |
| 117 | 126 |
| 118 void TestConfigurator::SetUseCupSigning(bool use_cup_signing) { | 127 void TestConfigurator::SetUseCupSigning(bool use_cup_signing) { |
| 119 use_cup_signing_ = use_cup_signing; | 128 use_cup_signing_ = use_cup_signing; |
| 120 } | 129 } |
| 121 | 130 |
| 122 void TestConfigurator::SetDownloadPreference( | 131 void TestConfigurator::SetDownloadPreference( |
| 123 const std::string& download_preference) { | 132 const std::string& download_preference) { |
| 124 download_preference_ = download_preference; | 133 download_preference_ = download_preference; |
| 125 } | 134 } |
| 126 | 135 |
| 127 scoped_refptr<base::SequencedTaskRunner> | 136 scoped_refptr<base::SequencedTaskRunner> |
| 128 TestConfigurator::GetSequencedTaskRunner() const { | 137 TestConfigurator::GetSequencedTaskRunner() const { |
| 129 DCHECK(worker_task_runner_.get()); | 138 DCHECK(worker_task_runner_.get()); |
| 130 return worker_task_runner_; | 139 return worker_task_runner_; |
| 131 } | 140 } |
| 132 | 141 |
| 133 } // namespace update_client | 142 } // namespace update_client |
| OLD | NEW |