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 COMPONENTS_COMPONENT_UPDATER_TEST_TEST_CONFIGURATOR_H_ | 5 #ifndef COMPONENTS_COMPONENT_UPDATER_TEST_TEST_CONFIGURATOR_H_ |
6 #define COMPONENTS_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 #include <vector> | |
10 | 11 |
11 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
12 #include "base/callback.h" | 13 #include "base/callback.h" |
13 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
14 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
15 #include "components/component_updater/component_updater_configurator.h" | 16 #include "components/component_updater/component_updater_configurator.h" |
16 #include "net/url_request/url_request_test_util.h" | 17 #include "net/url_request/url_request_test_util.h" |
18 #include "url/gurl.h" | |
17 | 19 |
18 namespace component_updater { | 20 namespace component_updater { |
19 | 21 |
20 #define POST_INTERCEPT_SCHEME "https" | 22 #define POST_INTERCEPT_SCHEME "https" |
21 #define POST_INTERCEPT_HOSTNAME "localhost2" | 23 #define POST_INTERCEPT_HOSTNAME "localhost2" |
22 #define POST_INTERCEPT_PATH "/update2" | 24 #define POST_INTERCEPT_PATH "/update2" |
23 | 25 |
24 struct CrxComponent; | 26 struct CrxComponent; |
25 | 27 |
26 class TestConfigurator : public Configurator { | 28 class TestConfigurator : public Configurator { |
27 public: | 29 public: |
28 TestConfigurator( | 30 TestConfigurator( |
29 const scoped_refptr<base::SequencedTaskRunner>& worker_task_runner, | 31 const scoped_refptr<base::SequencedTaskRunner>& worker_task_runner, |
30 const scoped_refptr<base::SingleThreadTaskRunner>& network_task_runner); | 32 const scoped_refptr<base::SingleThreadTaskRunner>& network_task_runner); |
31 virtual ~TestConfigurator(); | 33 virtual ~TestConfigurator(); |
32 | 34 |
33 // Overrrides for Configurator. | 35 // Overrrides for Configurator. |
34 virtual int InitialDelay() const OVERRIDE; | 36 virtual int InitialDelay() const OVERRIDE; |
35 virtual int NextCheckDelay() OVERRIDE; | 37 virtual int NextCheckDelay() OVERRIDE; |
36 virtual int StepDelay() const OVERRIDE; | 38 virtual int StepDelay() const OVERRIDE; |
37 virtual int StepDelayMedium() OVERRIDE; | 39 virtual int StepDelayMedium() OVERRIDE; |
38 virtual int MinimumReCheckWait() const OVERRIDE; | 40 virtual int MinimumReCheckWait() const OVERRIDE; |
39 virtual int OnDemandDelay() const OVERRIDE; | 41 virtual int OnDemandDelay() const OVERRIDE; |
40 virtual GURL UpdateUrl() const OVERRIDE; | 42 virtual std::vector<GURL> UpdateUrl() const OVERRIDE; |
erikwright (departed)
2014/09/15 18:46:54
forward-decl should suffice.
Sorin Jianu
2014/09/15 22:17:57
Done.
| |
41 virtual GURL PingUrl() const OVERRIDE; | 43 virtual std::vector<GURL> PingUrl() const OVERRIDE; |
42 virtual base::Version GetBrowserVersion() const OVERRIDE; | 44 virtual base::Version GetBrowserVersion() const OVERRIDE; |
43 virtual std::string GetChannel() const OVERRIDE; | 45 virtual std::string GetChannel() const OVERRIDE; |
44 virtual std::string GetLang() const OVERRIDE; | 46 virtual std::string GetLang() const OVERRIDE; |
45 virtual std::string GetOSLongName() const OVERRIDE; | 47 virtual std::string GetOSLongName() const OVERRIDE; |
46 virtual std::string ExtraRequestParams() const OVERRIDE; | 48 virtual std::string ExtraRequestParams() const OVERRIDE; |
47 virtual size_t UrlSizeLimit() const OVERRIDE; | 49 virtual size_t UrlSizeLimit() const OVERRIDE; |
48 virtual net::URLRequestContextGetter* RequestContext() const OVERRIDE; | 50 virtual net::URLRequestContextGetter* RequestContext() const OVERRIDE; |
49 virtual scoped_refptr<OutOfProcessPatcher> CreateOutOfProcessPatcher() | 51 virtual scoped_refptr<OutOfProcessPatcher> CreateOutOfProcessPatcher() |
50 const OVERRIDE; | 52 const OVERRIDE; |
51 virtual bool DeltasEnabled() const OVERRIDE; | 53 virtual bool DeltasEnabled() const OVERRIDE; |
52 virtual bool UseBackgroundDownloader() const OVERRIDE; | 54 virtual bool UseBackgroundDownloader() const OVERRIDE; |
53 virtual scoped_refptr<base::SequencedTaskRunner> GetSequencedTaskRunner() | 55 virtual scoped_refptr<base::SequencedTaskRunner> GetSequencedTaskRunner() |
54 const OVERRIDE; | 56 const OVERRIDE; |
55 virtual scoped_refptr<base::SingleThreadTaskRunner> | 57 virtual scoped_refptr<base::SingleThreadTaskRunner> |
56 GetSingleThreadTaskRunner() const OVERRIDE; | 58 GetSingleThreadTaskRunner() const OVERRIDE; |
57 | 59 |
58 typedef std::pair<CrxComponent*, int> CheckAtLoopCount; | |
59 void SetLoopCount(int times); | 60 void SetLoopCount(int times); |
60 void SetRecheckTime(int seconds); | 61 void SetRecheckTime(int seconds); |
61 void SetOnDemandTime(int seconds); | 62 void SetOnDemandTime(int seconds); |
62 void SetQuitClosure(const base::Closure& quit_closure); | 63 void SetQuitClosure(const base::Closure& quit_closure); |
63 void SetInitialDelay(int seconds); | 64 void SetInitialDelay(int seconds); |
64 | 65 |
65 private: | 66 private: |
66 scoped_refptr<base::SequencedTaskRunner> worker_task_runner_; | 67 scoped_refptr<base::SequencedTaskRunner> worker_task_runner_; |
67 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; | 68 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; |
68 | 69 |
69 int initial_time_; | 70 int initial_time_; |
70 int times_; | 71 int times_; |
71 int recheck_time_; | 72 int recheck_time_; |
72 int ondemand_time_; | 73 int ondemand_time_; |
73 | 74 |
74 scoped_refptr<net::TestURLRequestContextGetter> context_; | 75 scoped_refptr<net::TestURLRequestContextGetter> context_; |
75 base::Closure quit_closure_; | 76 base::Closure quit_closure_; |
76 | 77 |
77 DISALLOW_COPY_AND_ASSIGN(TestConfigurator); | 78 DISALLOW_COPY_AND_ASSIGN(TestConfigurator); |
78 }; | 79 }; |
79 | 80 |
80 } // namespace component_updater | 81 } // namespace component_updater |
81 | 82 |
82 #endif // COMPONENTS_COMPONENT_UPDATER_TEST_TEST_CONFIGURATOR_H_ | 83 #endif // COMPONENTS_COMPONENT_UPDATER_TEST_TEST_CONFIGURATOR_H_ |
OLD | NEW |