| 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
| 8 #include "base/version.h" | 8 #include "base/version.h" |
| 9 #include "components/component_updater/component_patcher_operation.h" | 9 #include "components/component_updater/component_patcher_operation.h" |
| 10 #include "components/component_updater/test/test_configurator.h" | 10 #include "components/component_updater/test/test_configurator.h" |
| 11 #include "url/gurl.h" | 11 #include "url/gurl.h" |
| 12 | 12 |
| 13 namespace component_updater { | 13 namespace component_updater { |
| 14 | 14 |
| 15 namespace { |
| 16 |
| 17 std::vector<GURL> MakeDefaultUrls() { |
| 18 std::vector<GURL> urls; |
| 19 urls.push_back(GURL(POST_INTERCEPT_SCHEME |
| 20 "://" POST_INTERCEPT_HOSTNAME POST_INTERCEPT_PATH)); |
| 21 return urls; |
| 22 } |
| 23 |
| 24 } // namespace |
| 15 TestConfigurator::TestConfigurator( | 25 TestConfigurator::TestConfigurator( |
| 16 const scoped_refptr<base::SequencedTaskRunner>& worker_task_runner, | 26 const scoped_refptr<base::SequencedTaskRunner>& worker_task_runner, |
| 17 const scoped_refptr<base::SingleThreadTaskRunner>& network_task_runner) | 27 const scoped_refptr<base::SingleThreadTaskRunner>& network_task_runner) |
| 18 : worker_task_runner_(worker_task_runner), | 28 : worker_task_runner_(worker_task_runner), |
| 19 initial_time_(0), | 29 initial_time_(0), |
| 20 times_(1), | 30 times_(1), |
| 21 recheck_time_(0), | 31 recheck_time_(0), |
| 22 ondemand_time_(0), | 32 ondemand_time_(0), |
| 23 context_(new net::TestURLRequestContextGetter(network_task_runner)) { | 33 context_(new net::TestURLRequestContextGetter(network_task_runner)) { |
| 24 } | 34 } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 51 } | 61 } |
| 52 | 62 |
| 53 int TestConfigurator::MinimumReCheckWait() const { | 63 int TestConfigurator::MinimumReCheckWait() const { |
| 54 return recheck_time_; | 64 return recheck_time_; |
| 55 } | 65 } |
| 56 | 66 |
| 57 int TestConfigurator::OnDemandDelay() const { | 67 int TestConfigurator::OnDemandDelay() const { |
| 58 return ondemand_time_; | 68 return ondemand_time_; |
| 59 } | 69 } |
| 60 | 70 |
| 61 GURL TestConfigurator::UpdateUrl() const { | 71 std::vector<GURL> TestConfigurator::UpdateUrl() const { |
| 62 return GURL(POST_INTERCEPT_SCHEME | 72 return MakeDefaultUrls(); |
| 63 "://" POST_INTERCEPT_HOSTNAME POST_INTERCEPT_PATH); | |
| 64 } | 73 } |
| 65 | 74 |
| 66 GURL TestConfigurator::PingUrl() const { | 75 std::vector<GURL> TestConfigurator::PingUrl() const { |
| 67 return UpdateUrl(); | 76 return UpdateUrl(); |
| 68 } | 77 } |
| 69 | 78 |
| 70 base::Version TestConfigurator::GetBrowserVersion() const { | 79 base::Version TestConfigurator::GetBrowserVersion() const { |
| 71 // Needs to be larger than the required version in tested component manifests. | 80 // Needs to be larger than the required version in tested component manifests. |
| 72 return base::Version("30.0"); | 81 return base::Version("30.0"); |
| 73 } | 82 } |
| 74 | 83 |
| 75 std::string TestConfigurator::GetChannel() const { | 84 std::string TestConfigurator::GetChannel() const { |
| 76 return "fake_channel_string"; | 85 return "fake_channel_string"; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 return worker_task_runner_; | 145 return worker_task_runner_; |
| 137 } | 146 } |
| 138 | 147 |
| 139 scoped_refptr<base::SingleThreadTaskRunner> | 148 scoped_refptr<base::SingleThreadTaskRunner> |
| 140 TestConfigurator::GetSingleThreadTaskRunner() const { | 149 TestConfigurator::GetSingleThreadTaskRunner() const { |
| 141 // This is NULL because tests do not use the background downloader. | 150 // This is NULL because tests do not use the background downloader. |
| 142 return NULL; | 151 return NULL; |
| 143 } | 152 } |
| 144 | 153 |
| 145 } // namespace component_updater | 154 } // namespace component_updater |
| OLD | NEW |