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.
5 #ifndef COMPONENTS_UPDATE_CLIENT_TEST_TEST_CONFIGURATOR_H_
6 #define COMPONENTS_UPDATE_CLIENT_TEST_TEST_CONFIGURATOR_H_
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"
22 class SequencedTaskRunner
;
23 class SingleThreadTaskRunner
;
26 namespace update_client
{
28 #define POST_INTERCEPT_SCHEME "https"
29 #define POST_INTERCEPT_HOSTNAME "localhost2"
30 #define POST_INTERCEPT_PATH "/update2"
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};
53 class TestConfigurator
: public Configurator
{
56 const scoped_refptr
<base::SequencedTaskRunner
>& worker_task_runner
,
57 const scoped_refptr
<base::SingleThreadTaskRunner
>& network_task_runner
);
58 ~TestConfigurator() override
;
60 // Overrrides for Configurator.
61 int InitialDelay() const override
;
62 int NextCheckDelay() override
;
63 int StepDelay() const override
;
64 int StepDelayMedium() override
;
65 int MinimumReCheckWait() const override
;
66 int OnDemandDelay() 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()
81 scoped_refptr
<base::SingleThreadTaskRunner
> GetSingleThreadTaskRunner()
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
);
91 scoped_refptr
<base::SequencedTaskRunner
> worker_task_runner_
;
92 scoped_refptr
<base::SingleThreadTaskRunner
> network_task_runner_
;
99 scoped_refptr
<net::TestURLRequestContextGetter
> context_
;
100 base::Closure quit_closure_
;
102 DISALLOW_COPY_AND_ASSIGN(TestConfigurator
);
105 } // namespace update_client
107 #endif // COMPONENTS_UPDATE_CLIENT_TEST_TEST_CONFIGURATOR_H_