Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(175)

Side by Side Diff: components/component_updater/test/test_configurator.h

Issue 565363002: Implement support for fallback update check urls in the component updater (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_COMPONENT_UPDATER_TEST_TEST_CONFIGURATOR_H_ 5 #ifndef COMPONENTS_COMPONENT_UPDATER_TEST_TEST_CONFIGURATOR_H_
6 #define COMPONENTS_COMPONENT_UPDATER_TEST_TEST_CONFIGURATOR_H_ 6 #define COMPONENTS_COMPONENT_UPDATER_TEST_TEST_CONFIGURATOR_H_
7 7
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector>
10 11
11 #include "base/basictypes.h" 12 #include "base/basictypes.h"
12 #include "base/callback.h" 13 #include "base/callback.h"
13 #include "base/compiler_specific.h" 14 #include "base/compiler_specific.h"
14 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
15 #include "components/component_updater/component_updater_configurator.h" 16 #include "components/component_updater/component_updater_configurator.h"
16 #include "net/url_request/url_request_test_util.h" 17 #include "net/url_request/url_request_test_util.h"
17 18
19 class GURL;
20
18 namespace component_updater { 21 namespace component_updater {
19 22
20 #define POST_INTERCEPT_SCHEME "https" 23 #define POST_INTERCEPT_SCHEME "https"
21 #define POST_INTERCEPT_HOSTNAME "localhost2" 24 #define POST_INTERCEPT_HOSTNAME "localhost2"
22 #define POST_INTERCEPT_PATH "/update2" 25 #define POST_INTERCEPT_PATH "/update2"
23 26
24 struct CrxComponent; 27 struct CrxComponent;
25 28
26 class TestConfigurator : public Configurator { 29 class TestConfigurator : public Configurator {
27 public: 30 public:
28 TestConfigurator( 31 TestConfigurator(
29 const scoped_refptr<base::SequencedTaskRunner>& worker_task_runner, 32 const scoped_refptr<base::SequencedTaskRunner>& worker_task_runner,
30 const scoped_refptr<base::SingleThreadTaskRunner>& network_task_runner); 33 const scoped_refptr<base::SingleThreadTaskRunner>& network_task_runner);
31 virtual ~TestConfigurator(); 34 virtual ~TestConfigurator();
32 35
33 // Overrrides for Configurator. 36 // Overrrides for Configurator.
34 virtual int InitialDelay() const OVERRIDE; 37 virtual int InitialDelay() const OVERRIDE;
35 virtual int NextCheckDelay() OVERRIDE; 38 virtual int NextCheckDelay() OVERRIDE;
36 virtual int StepDelay() const OVERRIDE; 39 virtual int StepDelay() const OVERRIDE;
37 virtual int StepDelayMedium() OVERRIDE; 40 virtual int StepDelayMedium() OVERRIDE;
38 virtual int MinimumReCheckWait() const OVERRIDE; 41 virtual int MinimumReCheckWait() const OVERRIDE;
39 virtual int OnDemandDelay() const OVERRIDE; 42 virtual int OnDemandDelay() const OVERRIDE;
40 virtual GURL UpdateUrl() const OVERRIDE; 43 virtual std::vector<GURL> UpdateUrl() const OVERRIDE;
41 virtual GURL PingUrl() const OVERRIDE; 44 virtual std::vector<GURL> PingUrl() const OVERRIDE;
42 virtual base::Version GetBrowserVersion() const OVERRIDE; 45 virtual base::Version GetBrowserVersion() const OVERRIDE;
43 virtual std::string GetChannel() const OVERRIDE; 46 virtual std::string GetChannel() const OVERRIDE;
44 virtual std::string GetLang() const OVERRIDE; 47 virtual std::string GetLang() const OVERRIDE;
45 virtual std::string GetOSLongName() const OVERRIDE; 48 virtual std::string GetOSLongName() const OVERRIDE;
46 virtual std::string ExtraRequestParams() const OVERRIDE; 49 virtual std::string ExtraRequestParams() const OVERRIDE;
47 virtual size_t UrlSizeLimit() const OVERRIDE; 50 virtual size_t UrlSizeLimit() const OVERRIDE;
48 virtual net::URLRequestContextGetter* RequestContext() const OVERRIDE; 51 virtual net::URLRequestContextGetter* RequestContext() const OVERRIDE;
49 virtual scoped_refptr<OutOfProcessPatcher> CreateOutOfProcessPatcher() 52 virtual scoped_refptr<OutOfProcessPatcher> CreateOutOfProcessPatcher()
50 const OVERRIDE; 53 const OVERRIDE;
51 virtual bool DeltasEnabled() const OVERRIDE; 54 virtual bool DeltasEnabled() const OVERRIDE;
52 virtual bool UseBackgroundDownloader() const OVERRIDE; 55 virtual bool UseBackgroundDownloader() const OVERRIDE;
53 virtual scoped_refptr<base::SequencedTaskRunner> GetSequencedTaskRunner() 56 virtual scoped_refptr<base::SequencedTaskRunner> GetSequencedTaskRunner()
54 const OVERRIDE; 57 const OVERRIDE;
55 virtual scoped_refptr<base::SingleThreadTaskRunner> 58 virtual scoped_refptr<base::SingleThreadTaskRunner>
56 GetSingleThreadTaskRunner() const OVERRIDE; 59 GetSingleThreadTaskRunner() const OVERRIDE;
57 60
58 typedef std::pair<CrxComponent*, int> CheckAtLoopCount;
59 void SetLoopCount(int times); 61 void SetLoopCount(int times);
60 void SetRecheckTime(int seconds); 62 void SetRecheckTime(int seconds);
61 void SetOnDemandTime(int seconds); 63 void SetOnDemandTime(int seconds);
62 void SetQuitClosure(const base::Closure& quit_closure); 64 void SetQuitClosure(const base::Closure& quit_closure);
63 void SetInitialDelay(int seconds); 65 void SetInitialDelay(int seconds);
64 66
65 private: 67 private:
66 scoped_refptr<base::SequencedTaskRunner> worker_task_runner_; 68 scoped_refptr<base::SequencedTaskRunner> worker_task_runner_;
67 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; 69 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_;
68 70
69 int initial_time_; 71 int initial_time_;
70 int times_; 72 int times_;
71 int recheck_time_; 73 int recheck_time_;
72 int ondemand_time_; 74 int ondemand_time_;
73 75
74 scoped_refptr<net::TestURLRequestContextGetter> context_; 76 scoped_refptr<net::TestURLRequestContextGetter> context_;
75 base::Closure quit_closure_; 77 base::Closure quit_closure_;
76 78
77 DISALLOW_COPY_AND_ASSIGN(TestConfigurator); 79 DISALLOW_COPY_AND_ASSIGN(TestConfigurator);
78 }; 80 };
79 81
80 } // namespace component_updater 82 } // namespace component_updater
81 83
82 #endif // COMPONENTS_COMPONENT_UPDATER_TEST_TEST_CONFIGURATOR_H_ 84 #endif // COMPONENTS_COMPONENT_UPDATER_TEST_TEST_CONFIGURATOR_H_
OLDNEW
« no previous file with comments | « components/component_updater/test/request_sender_unittest.cc ('k') | components/component_updater/test/test_configurator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698