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_COMPONENT_UPDATER_TEST_TEST_CONFIGURATOR_H_
6 #define COMPONENTS_COMPONENT_UPDATER_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/component_updater/component_updater_configurator.h"
17 #include "net/url_request/url_request_test_util.h"
22 class SequencedTaskRunner
;
23 class SingleThreadTaskRunner
;
26 namespace component_updater
{
28 #define POST_INTERCEPT_SCHEME "https"
29 #define POST_INTERCEPT_HOSTNAME "localhost2"
30 #define POST_INTERCEPT_PATH "/update2"
34 class TestConfigurator
: public Configurator
{
37 const scoped_refptr
<base::SequencedTaskRunner
>& worker_task_runner
,
38 const scoped_refptr
<base::SingleThreadTaskRunner
>& network_task_runner
);
39 ~TestConfigurator() override
;
41 // Overrrides for Configurator.
42 int InitialDelay() const override
;
43 int NextCheckDelay() override
;
44 int StepDelay() const override
;
45 int StepDelayMedium() override
;
46 int MinimumReCheckWait() const override
;
47 int OnDemandDelay() const override
;
48 std::vector
<GURL
> UpdateUrl() const override
;
49 std::vector
<GURL
> PingUrl() const override
;
50 base::Version
GetBrowserVersion() const override
;
51 std::string
GetChannel() const override
;
52 std::string
GetLang() const override
;
53 std::string
GetOSLongName() const override
;
54 std::string
ExtraRequestParams() const override
;
55 size_t UrlSizeLimit() const override
;
56 net::URLRequestContextGetter
* RequestContext() const override
;
57 scoped_refptr
<OutOfProcessPatcher
> CreateOutOfProcessPatcher() const override
;
58 bool DeltasEnabled() const override
;
59 bool UseBackgroundDownloader() const override
;
60 scoped_refptr
<base::SequencedTaskRunner
> GetSequencedTaskRunner()
62 scoped_refptr
<base::SingleThreadTaskRunner
> GetSingleThreadTaskRunner()
65 void SetLoopCount(int times
);
66 void SetRecheckTime(int seconds
);
67 void SetOnDemandTime(int seconds
);
68 void SetQuitClosure(const base::Closure
& quit_closure
);
69 void SetInitialDelay(int seconds
);
72 scoped_refptr
<base::SequencedTaskRunner
> worker_task_runner_
;
73 scoped_refptr
<base::SingleThreadTaskRunner
> network_task_runner_
;
80 scoped_refptr
<net::TestURLRequestContextGetter
> context_
;
81 base::Closure quit_closure_
;
83 DISALLOW_COPY_AND_ASSIGN(TestConfigurator
);
86 } // namespace component_updater
88 #endif // COMPONENTS_COMPONENT_UPDATER_TEST_TEST_CONFIGURATOR_H_