1116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch// Copyright 2014 The Chromium Authors. All rights reserved.
2116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch// Use of this source code is governed by a BSD-style license that can be
3116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch// found in the LICENSE file.
4116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch
51320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#ifndef COMPONENTS_COMPONENT_UPDATER_TEST_TEST_CONFIGURATOR_H_
61320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#define COMPONENTS_COMPONENT_UPDATER_TEST_TEST_CONFIGURATOR_H_
7116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch
8116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch#include <string>
9116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch#include <utility>
101320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#include <vector>
11116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch
12116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch#include "base/callback.h"
13116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch#include "base/compiler_specific.h"
141320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#include "base/macros.h"
15116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch#include "base/memory/ref_counted.h"
1603b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)#include "components/component_updater/component_updater_configurator.h"
17116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch#include "net/url_request/url_request_test_util.h"
18116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch
191320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucciclass GURL;
201320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
211320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tuccinamespace base {
221320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucciclass SequencedTaskRunner;
231320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucciclass SingleThreadTaskRunner;
241320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci}  // namespace base
251320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
26116680a4aac90f2aa7413d9095a592090648e557Ben Murdochnamespace component_updater {
27116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch
28116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch#define POST_INTERCEPT_SCHEME "https"
29116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch#define POST_INTERCEPT_HOSTNAME "localhost2"
30116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch#define POST_INTERCEPT_PATH "/update2"
31116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch
32116680a4aac90f2aa7413d9095a592090648e557Ben Murdochstruct CrxComponent;
33116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch
34116680a4aac90f2aa7413d9095a592090648e557Ben Murdochclass TestConfigurator : public Configurator {
35116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch public:
361320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  TestConfigurator(
371320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci      const scoped_refptr<base::SequencedTaskRunner>& worker_task_runner,
381320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci      const scoped_refptr<base::SingleThreadTaskRunner>& network_task_runner);
39116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  virtual ~TestConfigurator();
40116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch
41116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  // Overrrides for Configurator.
42116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  virtual int InitialDelay() const OVERRIDE;
43116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  virtual int NextCheckDelay() OVERRIDE;
44116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  virtual int StepDelay() const OVERRIDE;
45116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  virtual int StepDelayMedium() OVERRIDE;
46116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  virtual int MinimumReCheckWait() const OVERRIDE;
47116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  virtual int OnDemandDelay() const OVERRIDE;
481320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  virtual std::vector<GURL> UpdateUrl() const OVERRIDE;
491320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  virtual std::vector<GURL> PingUrl() const OVERRIDE;
50116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  virtual base::Version GetBrowserVersion() const OVERRIDE;
51116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  virtual std::string GetChannel() const OVERRIDE;
52116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  virtual std::string GetLang() const OVERRIDE;
53116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  virtual std::string GetOSLongName() const OVERRIDE;
54116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  virtual std::string ExtraRequestParams() const OVERRIDE;
55116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  virtual size_t UrlSizeLimit() const OVERRIDE;
56116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  virtual net::URLRequestContextGetter* RequestContext() const OVERRIDE;
575f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  virtual scoped_refptr<OutOfProcessPatcher> CreateOutOfProcessPatcher()
585f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)      const OVERRIDE;
59116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  virtual bool DeltasEnabled() const OVERRIDE;
60116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  virtual bool UseBackgroundDownloader() const OVERRIDE;
615f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  virtual scoped_refptr<base::SequencedTaskRunner> GetSequencedTaskRunner()
625f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)      const OVERRIDE;
635f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  virtual scoped_refptr<base::SingleThreadTaskRunner>
645f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)      GetSingleThreadTaskRunner() const OVERRIDE;
65116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch
66116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  void SetLoopCount(int times);
67116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  void SetRecheckTime(int seconds);
68116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  void SetOnDemandTime(int seconds);
69116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  void SetQuitClosure(const base::Closure& quit_closure);
70116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  void SetInitialDelay(int seconds);
71116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch
72116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch private:
731320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  scoped_refptr<base::SequencedTaskRunner> worker_task_runner_;
741320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_;
751320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
76116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  int initial_time_;
77116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  int times_;
78116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  int recheck_time_;
79116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  int ondemand_time_;
80116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch
81116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  scoped_refptr<net::TestURLRequestContextGetter> context_;
82116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  base::Closure quit_closure_;
83116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch
84116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  DISALLOW_COPY_AND_ASSIGN(TestConfigurator);
85116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch};
86116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch
87116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch}  // namespace component_updater
88116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch
891320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#endif  // COMPONENTS_COMPONENT_UPDATER_TEST_TEST_CONFIGURATOR_H_
90