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_CONFIGURATOR_H_
6 #define COMPONENTS_UPDATE_CLIENT_TEST_CONFIGURATOR_H_
12 #include "base/macros.h"
13 #include "base/memory/ref_counted.h"
14 #include "components/update_client/configurator.h"
15 #include "net/url_request/url_request_test_util.h"
20 class SequencedTaskRunner
;
21 class SingleThreadTaskRunner
;
24 namespace update_client
{
26 #define POST_INTERCEPT_SCHEME "https"
27 #define POST_INTERCEPT_HOSTNAME "localhost2"
28 #define POST_INTERCEPT_PATH "/update2"
32 // component 1 has extension id "jebgalgnebhfojomionfpkfelancnnkf", and
33 // the RSA public key the following hash:
34 const uint8_t jebg_hash
[] = {0x94, 0x16, 0x0b, 0x6d, 0x41, 0x75, 0xe9, 0xec,
35 0x8e, 0xd5, 0xfa, 0x54, 0xb0, 0xd2, 0xdd, 0xa5,
36 0x6e, 0x05, 0x6b, 0xe8, 0x73, 0x47, 0xf6, 0xc4,
37 0x11, 0x9f, 0xbc, 0xb3, 0x09, 0xb3, 0x5b, 0x40};
38 // component 2 has extension id "abagagagagagagagagagagagagagagag", and
39 // the RSA public key the following hash:
40 const uint8_t abag_hash
[] = {0x01, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
41 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
42 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
43 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x01};
44 // component 3 has extension id "ihfokbkgjpifnbbojhneepfflplebdkc", and
45 // the RSA public key the following hash:
46 const uint8_t ihfo_hash
[] = {0x87, 0x5e, 0xa1, 0xa6, 0x9f, 0x85, 0xd1, 0x1e,
47 0x97, 0xd4, 0x4f, 0x55, 0xbf, 0xb4, 0x13, 0xa2,
48 0xe7, 0xc5, 0xc8, 0xf5, 0x60, 0x19, 0x78, 0x1b,
49 0x6d, 0xe9, 0x4c, 0xeb, 0x96, 0x05, 0x42, 0x17};
51 class TestConfigurator
: public Configurator
{
54 const scoped_refptr
<base::SequencedTaskRunner
>& worker_task_runner
,
55 const scoped_refptr
<base::SingleThreadTaskRunner
>& network_task_runner
);
57 // Overrrides for Configurator.
58 int InitialDelay() const override
;
59 int NextCheckDelay() const override
;
60 int StepDelay() const override
;
61 int OnDemandDelay() const override
;
62 int UpdateDelay() const override
;
63 std::vector
<GURL
> UpdateUrl() const override
;
64 std::vector
<GURL
> PingUrl() const override
;
65 base::Version
GetBrowserVersion() const override
;
66 std::string
GetChannel() const override
;
67 std::string
GetLang() const override
;
68 std::string
GetOSLongName() const override
;
69 std::string
ExtraRequestParams() const override
;
70 net::URLRequestContextGetter
* RequestContext() const override
;
71 scoped_refptr
<OutOfProcessPatcher
> CreateOutOfProcessPatcher() const override
;
72 bool DeltasEnabled() const override
;
73 bool UseBackgroundDownloader() const override
;
74 scoped_refptr
<base::SequencedTaskRunner
> GetSequencedTaskRunner()
76 scoped_refptr
<base::SingleThreadTaskRunner
> GetSingleThreadTaskRunner()
79 void SetOnDemandTime(int seconds
);
80 void SetInitialDelay(int seconds
);
83 friend class base::RefCountedThreadSafe
<TestConfigurator
>;
85 ~TestConfigurator() override
;
87 scoped_refptr
<base::SequencedTaskRunner
> worker_task_runner_
;
88 scoped_refptr
<base::SingleThreadTaskRunner
> network_task_runner_
;
93 scoped_refptr
<net::TestURLRequestContextGetter
> context_
;
95 DISALLOW_COPY_AND_ASSIGN(TestConfigurator
);
98 } // namespace update_client
100 #endif // COMPONENTS_UPDATE_CLIENT_TEST_CONFIGURATOR_H_