Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / components / component_updater / test / test_configurator.h
blob7afa918412df9fed176750a426293b2fa47b4e39
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>
11 #include "base/basictypes.h"
12 #include "base/callback.h"
13 #include "base/compiler_specific.h"
14 #include "base/memory/ref_counted.h"
15 #include "components/component_updater/component_updater_configurator.h"
16 #include "net/url_request/url_request_test_util.h"
18 namespace component_updater {
20 #define POST_INTERCEPT_SCHEME "https"
21 #define POST_INTERCEPT_HOSTNAME "localhost2"
22 #define POST_INTERCEPT_PATH "/update2"
24 struct CrxComponent;
26 class TestConfigurator : public Configurator {
27 public:
28 TestConfigurator(
29 const scoped_refptr<base::SequencedTaskRunner>& worker_task_runner,
30 const scoped_refptr<base::SingleThreadTaskRunner>& network_task_runner);
31 virtual ~TestConfigurator();
33 // Overrrides for Configurator.
34 virtual int InitialDelay() const OVERRIDE;
35 virtual int NextCheckDelay() OVERRIDE;
36 virtual int StepDelay() const OVERRIDE;
37 virtual int StepDelayMedium() OVERRIDE;
38 virtual int MinimumReCheckWait() const OVERRIDE;
39 virtual int OnDemandDelay() const OVERRIDE;
40 virtual GURL UpdateUrl() const OVERRIDE;
41 virtual GURL PingUrl() const OVERRIDE;
42 virtual base::Version GetBrowserVersion() const OVERRIDE;
43 virtual std::string GetChannel() const OVERRIDE;
44 virtual std::string GetLang() const OVERRIDE;
45 virtual std::string GetOSLongName() const OVERRIDE;
46 virtual std::string ExtraRequestParams() const OVERRIDE;
47 virtual size_t UrlSizeLimit() const OVERRIDE;
48 virtual net::URLRequestContextGetter* RequestContext() const OVERRIDE;
49 virtual scoped_refptr<OutOfProcessPatcher> CreateOutOfProcessPatcher()
50 const OVERRIDE;
51 virtual bool DeltasEnabled() const OVERRIDE;
52 virtual bool UseBackgroundDownloader() const OVERRIDE;
53 virtual scoped_refptr<base::SequencedTaskRunner> GetSequencedTaskRunner()
54 const OVERRIDE;
55 virtual scoped_refptr<base::SingleThreadTaskRunner>
56 GetSingleThreadTaskRunner() const OVERRIDE;
58 typedef std::pair<CrxComponent*, int> CheckAtLoopCount;
59 void SetLoopCount(int times);
60 void SetRecheckTime(int seconds);
61 void SetOnDemandTime(int seconds);
62 void SetQuitClosure(const base::Closure& quit_closure);
63 void SetInitialDelay(int seconds);
65 private:
66 scoped_refptr<base::SequencedTaskRunner> worker_task_runner_;
67 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_;
69 int initial_time_;
70 int times_;
71 int recheck_time_;
72 int ondemand_time_;
74 scoped_refptr<net::TestURLRequestContextGetter> context_;
75 base::Closure quit_closure_;
77 DISALLOW_COPY_AND_ASSIGN(TestConfigurator);
80 } // namespace component_updater
82 #endif // COMPONENTS_COMPONENT_UPDATER_TEST_TEST_CONFIGURATOR_H_