OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef COMPONENTS_UPDATE_CLIENT_TEST_TEST_CONFIGURATOR_H_ | |
6 #define COMPONENTS_UPDATE_CLIENT_TEST_TEST_CONFIGURATOR_H_ | |
7 | |
8 #include <string> | |
9 #include <utility> | |
10 #include <vector> | |
11 | |
12 #include "base/callback.h" | |
13 #include "base/compiler_specific.h" | |
14 #include "base/macros.h" | |
15 #include "base/memory/ref_counted.h" | |
16 #include "components/update_client/configurator.h" | |
17 #include "net/url_request/url_request_test_util.h" | |
18 | |
19 class GURL; | |
20 | |
21 namespace base { | |
22 class SequencedTaskRunner; | |
23 class SingleThreadTaskRunner; | |
24 } // namespace base | |
25 | |
26 namespace update_client { | |
27 | |
28 #define POST_INTERCEPT_SCHEME "https" | |
29 #define POST_INTERCEPT_HOSTNAME "localhost2" | |
30 #define POST_INTERCEPT_PATH "/update2" | |
31 | |
32 struct CrxComponent; | |
33 | |
34 // component 1 has extension id "jebgalgnebhfojomionfpkfelancnnkf", and | |
35 // the RSA public key the following hash: | |
36 const uint8_t jebg_hash[] = {0x94, 0x16, 0x0b, 0x6d, 0x41, 0x75, 0xe9, 0xec, | |
37 0x8e, 0xd5, 0xfa, 0x54, 0xb0, 0xd2, 0xdd, 0xa5, | |
38 0x6e, 0x05, 0x6b, 0xe8, 0x73, 0x47, 0xf6, 0xc4, | |
39 0x11, 0x9f, 0xbc, 0xb3, 0x09, 0xb3, 0x5b, 0x40}; | |
40 // component 2 has extension id "abagagagagagagagagagagagagagagag", and | |
41 // the RSA public key the following hash: | |
42 const uint8_t abag_hash[] = {0x01, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, | |
43 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, | |
44 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, | |
45 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x01}; | |
46 // component 3 has extension id "ihfokbkgjpifnbbojhneepfflplebdkc", and | |
47 // the RSA public key the following hash: | |
48 const uint8_t ihfo_hash[] = {0x87, 0x5e, 0xa1, 0xa6, 0x9f, 0x85, 0xd1, 0x1e, | |
49 0x97, 0xd4, 0x4f, 0x55, 0xbf, 0xb4, 0x13, 0xa2, | |
50 0xe7, 0xc5, 0xc8, 0xf5, 0x60, 0x19, 0x78, 0x1b, | |
51 0x6d, 0xe9, 0x4c, 0xeb, 0x96, 0x05, 0x42, 0x17}; | |
52 | |
53 class TestConfigurator : public Configurator { | |
54 public: | |
55 TestConfigurator( | |
56 const scoped_refptr<base::SequencedTaskRunner>& worker_task_runner, | |
57 const scoped_refptr<base::SingleThreadTaskRunner>& network_task_runner); | |
58 | |
59 // Overrrides for Configurator. | |
60 int InitialDelay() const override; | |
61 int NextCheckDelay() override; | |
62 int StepDelay() const override; | |
63 int StepDelayMedium() override; | |
64 int MinimumReCheckWait() const override; | |
65 int OnDemandDelay() const override; | |
66 int UpdateDelay() const override; | |
67 std::vector<GURL> UpdateUrl() const override; | |
68 std::vector<GURL> PingUrl() const override; | |
69 base::Version GetBrowserVersion() const override; | |
70 std::string GetChannel() const override; | |
71 std::string GetLang() const override; | |
72 std::string GetOSLongName() const override; | |
73 std::string ExtraRequestParams() const override; | |
74 size_t UrlSizeLimit() const override; | |
75 net::URLRequestContextGetter* RequestContext() const override; | |
76 scoped_refptr<OutOfProcessPatcher> CreateOutOfProcessPatcher() const override; | |
77 bool DeltasEnabled() const override; | |
78 bool UseBackgroundDownloader() const override; | |
79 scoped_refptr<base::SequencedTaskRunner> GetSequencedTaskRunner() | |
80 const override; | |
81 scoped_refptr<base::SingleThreadTaskRunner> GetSingleThreadTaskRunner() | |
82 const override; | |
83 | |
84 void SetLoopCount(int times); | |
85 void SetRecheckTime(int seconds); | |
86 void SetOnDemandTime(int seconds); | |
87 void SetQuitClosure(const base::Closure& quit_closure); | |
88 void SetInitialDelay(int seconds); | |
89 | |
90 private: | |
91 friend class base::RefCountedThreadSafe<TestConfigurator>; | |
92 | |
93 ~TestConfigurator() override; | |
94 | |
95 scoped_refptr<base::SequencedTaskRunner> worker_task_runner_; | |
96 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; | |
97 | |
98 int initial_time_; | |
99 int times_; | |
100 int recheck_time_; | |
101 int ondemand_time_; | |
102 | |
103 scoped_refptr<net::TestURLRequestContextGetter> context_; | |
104 base::Closure quit_closure_; | |
105 | |
106 DISALLOW_COPY_AND_ASSIGN(TestConfigurator); | |
107 }; | |
108 | |
109 } // namespace update_client | |
110 | |
111 #endif // COMPONENTS_UPDATE_CLIENT_TEST_TEST_CONFIGURATOR_H_ | |
OLD | NEW |