| 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 #ifndef CHROME_BROWSER_COMPONENT_UPDATER_TEST_TEST_CONFIGURATOR_H_ | 5 #ifndef COMPONENTS_COMPONENT_UPDATER_TEST_TEST_CONFIGURATOR_H_ |
| 6 #define CHROME_BROWSER_COMPONENT_UPDATER_TEST_TEST_CONFIGURATOR_H_ | 6 #define COMPONENTS_COMPONENT_UPDATER_TEST_TEST_CONFIGURATOR_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "components/component_updater/component_updater_configurator.h" | 15 #include "components/component_updater/component_updater_configurator.h" |
| 16 #include "net/url_request/url_request_test_util.h" | 16 #include "net/url_request/url_request_test_util.h" |
| 17 | 17 |
| 18 namespace component_updater { | 18 namespace component_updater { |
| 19 | 19 |
| 20 #define POST_INTERCEPT_SCHEME "https" | 20 #define POST_INTERCEPT_SCHEME "https" |
| 21 #define POST_INTERCEPT_HOSTNAME "localhost2" | 21 #define POST_INTERCEPT_HOSTNAME "localhost2" |
| 22 #define POST_INTERCEPT_PATH "/update2" | 22 #define POST_INTERCEPT_PATH "/update2" |
| 23 | 23 |
| 24 struct CrxComponent; | 24 struct CrxComponent; |
| 25 | 25 |
| 26 class TestConfigurator : public Configurator { | 26 class TestConfigurator : public Configurator { |
| 27 public: | 27 public: |
| 28 TestConfigurator(); | 28 TestConfigurator( |
| 29 const scoped_refptr<base::SequencedTaskRunner>& worker_task_runner, |
| 30 const scoped_refptr<base::SingleThreadTaskRunner>& network_task_runner); |
| 29 virtual ~TestConfigurator(); | 31 virtual ~TestConfigurator(); |
| 30 | 32 |
| 31 // Overrrides for Configurator. | 33 // Overrrides for Configurator. |
| 32 virtual int InitialDelay() const OVERRIDE; | 34 virtual int InitialDelay() const OVERRIDE; |
| 33 virtual int NextCheckDelay() OVERRIDE; | 35 virtual int NextCheckDelay() OVERRIDE; |
| 34 virtual int StepDelay() const OVERRIDE; | 36 virtual int StepDelay() const OVERRIDE; |
| 35 virtual int StepDelayMedium() OVERRIDE; | 37 virtual int StepDelayMedium() OVERRIDE; |
| 36 virtual int MinimumReCheckWait() const OVERRIDE; | 38 virtual int MinimumReCheckWait() const OVERRIDE; |
| 37 virtual int OnDemandDelay() const OVERRIDE; | 39 virtual int OnDemandDelay() const OVERRIDE; |
| 38 virtual GURL UpdateUrl() const OVERRIDE; | 40 virtual GURL UpdateUrl() const OVERRIDE; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 54 GetSingleThreadTaskRunner() const OVERRIDE; | 56 GetSingleThreadTaskRunner() const OVERRIDE; |
| 55 | 57 |
| 56 typedef std::pair<CrxComponent*, int> CheckAtLoopCount; | 58 typedef std::pair<CrxComponent*, int> CheckAtLoopCount; |
| 57 void SetLoopCount(int times); | 59 void SetLoopCount(int times); |
| 58 void SetRecheckTime(int seconds); | 60 void SetRecheckTime(int seconds); |
| 59 void SetOnDemandTime(int seconds); | 61 void SetOnDemandTime(int seconds); |
| 60 void SetQuitClosure(const base::Closure& quit_closure); | 62 void SetQuitClosure(const base::Closure& quit_closure); |
| 61 void SetInitialDelay(int seconds); | 63 void SetInitialDelay(int seconds); |
| 62 | 64 |
| 63 private: | 65 private: |
| 66 scoped_refptr<base::SequencedTaskRunner> worker_task_runner_; |
| 67 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; |
| 68 |
| 64 int initial_time_; | 69 int initial_time_; |
| 65 int times_; | 70 int times_; |
| 66 int recheck_time_; | 71 int recheck_time_; |
| 67 int ondemand_time_; | 72 int ondemand_time_; |
| 68 | 73 |
| 69 scoped_refptr<net::TestURLRequestContextGetter> context_; | 74 scoped_refptr<net::TestURLRequestContextGetter> context_; |
| 70 base::Closure quit_closure_; | 75 base::Closure quit_closure_; |
| 71 | 76 |
| 72 DISALLOW_COPY_AND_ASSIGN(TestConfigurator); | 77 DISALLOW_COPY_AND_ASSIGN(TestConfigurator); |
| 73 }; | 78 }; |
| 74 | 79 |
| 75 } // namespace component_updater | 80 } // namespace component_updater |
| 76 | 81 |
| 77 #endif // CHROME_BROWSER_COMPONENT_UPDATER_TEST_TEST_CONFIGURATOR_H_ | 82 #endif // COMPONENTS_COMPONENT_UPDATER_TEST_TEST_CONFIGURATOR_H_ |
| OLD | NEW |