ServiceWorker: Consolidate version manipulation functions in SWProviderContext
[chromium-blink-merge.git] / components / component_updater / test / test_configurator.h
blob264b7c9ce8a378ff171cd665842cf880f2fc88d1
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_
8 #include <string>
9 #include <utility>
10 #include <vector>
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"
19 class GURL;
21 namespace base {
22 class SequencedTaskRunner;
23 class SingleThreadTaskRunner;
24 } // namespace base
26 namespace component_updater {
28 #define POST_INTERCEPT_SCHEME "https"
29 #define POST_INTERCEPT_HOSTNAME "localhost2"
30 #define POST_INTERCEPT_PATH "/update2"
32 struct CrxComponent;
34 class TestConfigurator : public Configurator {
35 public:
36 TestConfigurator(
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()
61 const override;
62 scoped_refptr<base::SingleThreadTaskRunner> GetSingleThreadTaskRunner()
63 const override;
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);
71 private:
72 scoped_refptr<base::SequencedTaskRunner> worker_task_runner_;
73 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_;
75 int initial_time_;
76 int times_;
77 int recheck_time_;
78 int ondemand_time_;
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_