| 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 "content/public/browser/browser_thread.h" | |
| 12 #include "url/gurl.h" | 11 #include "url/gurl.h" |
| 13 | 12 |
| 14 using content::BrowserThread; | |
| 15 | |
| 16 namespace component_updater { | 13 namespace component_updater { |
| 17 | 14 |
| 18 TestConfigurator::TestConfigurator() | 15 TestConfigurator::TestConfigurator( |
| 19 : initial_time_(0), | 16 const scoped_refptr<base::SequencedTaskRunner>& worker_task_runner, |
| 17 const scoped_refptr<base::SingleThreadTaskRunner>& network_task_runner) |
| 18 : worker_task_runner_(worker_task_runner), |
| 19 initial_time_(0), |
| 20 times_(1), | 20 times_(1), |
| 21 recheck_time_(0), | 21 recheck_time_(0), |
| 22 ondemand_time_(0), | 22 ondemand_time_(0), |
| 23 context_(new net::TestURLRequestContextGetter( | 23 context_(new net::TestURLRequestContextGetter(network_task_runner)) { |
| 24 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))) { | |
| 25 } | 24 } |
| 26 | 25 |
| 27 TestConfigurator::~TestConfigurator() { | 26 TestConfigurator::~TestConfigurator() { |
| 28 } | 27 } |
| 29 | 28 |
| 30 int TestConfigurator::InitialDelay() const { | 29 int TestConfigurator::InitialDelay() const { |
| 31 return initial_time_; | 30 return initial_time_; |
| 32 } | 31 } |
| 33 | 32 |
| 34 int TestConfigurator::NextCheckDelay() { | 33 int TestConfigurator::NextCheckDelay() { |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 void TestConfigurator::SetQuitClosure(const base::Closure& quit_closure) { | 125 void TestConfigurator::SetQuitClosure(const base::Closure& quit_closure) { |
| 127 quit_closure_ = quit_closure; | 126 quit_closure_ = quit_closure; |
| 128 } | 127 } |
| 129 | 128 |
| 130 void TestConfigurator::SetInitialDelay(int seconds) { | 129 void TestConfigurator::SetInitialDelay(int seconds) { |
| 131 initial_time_ = seconds; | 130 initial_time_ = seconds; |
| 132 } | 131 } |
| 133 | 132 |
| 134 scoped_refptr<base::SequencedTaskRunner> | 133 scoped_refptr<base::SequencedTaskRunner> |
| 135 TestConfigurator::GetSequencedTaskRunner() const { | 134 TestConfigurator::GetSequencedTaskRunner() const { |
| 136 return content::BrowserThread::GetBlockingPool() | 135 DCHECK(worker_task_runner_.get()); |
| 137 ->GetSequencedTaskRunnerWithShutdownBehavior( | 136 return worker_task_runner_; |
| 138 content::BrowserThread::GetBlockingPool()->GetSequenceToken(), | |
| 139 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN); | |
| 140 } | 137 } |
| 141 | 138 |
| 142 scoped_refptr<base::SingleThreadTaskRunner> | 139 scoped_refptr<base::SingleThreadTaskRunner> |
| 143 TestConfigurator::GetSingleThreadTaskRunner() const { | 140 TestConfigurator::GetSingleThreadTaskRunner() const { |
| 144 return content::BrowserThread::GetMessageLoopProxyForThread( | 141 // This is NULL because tests do not use the background downloader. |
| 145 content::BrowserThread::FILE); | 142 return NULL; |
| 146 } | 143 } |
| 147 | 144 |
| 148 } // namespace component_updater | 145 } // namespace component_updater |
| OLD | NEW |