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

Side by Side Diff: extensions/browser/test_extensions_browser_client.h

Issue 1362043005: Add extensions code to use common updater in components/update_client/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merged latest origin/master Created 5 years, 2 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 EXTENSIONS_BROWSER_TEST_EXTENSIONS_BROWSER_CLIENT_H_ 5 #ifndef EXTENSIONS_BROWSER_TEST_EXTENSIONS_BROWSER_CLIENT_H_
6 #define EXTENSIONS_BROWSER_TEST_EXTENSIONS_BROWSER_CLIENT_H_ 6 #define EXTENSIONS_BROWSER_TEST_EXTENSIONS_BROWSER_CLIENT_H_
7 7
8 #include <string>
9 #include <vector>
10
11 #include "base/callback.h"
8 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/memory/ref_counted.h"
14 #include "components/update_client/update_client.h"
9 #include "extensions/browser/extensions_browser_client.h" 15 #include "extensions/browser/extensions_browser_client.h"
10 #include "extensions/browser/updater/extension_cache.h" 16 #include "extensions/browser/updater/extension_cache.h"
11 17
12 namespace extensions { 18 namespace extensions {
13 19
14 // A simplified ExtensionsBrowserClient for a single normal browser context and 20 // A simplified ExtensionsBrowserClient for a single normal browser context and
15 // an optional incognito browser context associated with it. A test that uses 21 // an optional incognito browser context associated with it. A test that uses
16 // this class should call ExtensionsBrowserClient::Set() with its instance. 22 // this class should call ExtensionsBrowserClient::Set() with its instance.
17 class TestExtensionsBrowserClient : public ExtensionsBrowserClient { 23 class TestExtensionsBrowserClient : public ExtensionsBrowserClient {
18 public: 24 public:
19 // |main_context| is required and must not be an incognito context. 25 // |main_context| is required and must not be an incognito context.
20 explicit TestExtensionsBrowserClient(content::BrowserContext* main_context); 26 explicit TestExtensionsBrowserClient(content::BrowserContext* main_context);
21 ~TestExtensionsBrowserClient() override; 27 ~TestExtensionsBrowserClient() override;
22 28
23 void set_process_manager_delegate(ProcessManagerDelegate* delegate) { 29 void set_process_manager_delegate(ProcessManagerDelegate* delegate) {
24 process_manager_delegate_ = delegate; 30 process_manager_delegate_ = delegate;
25 } 31 }
26 void set_extension_system_factory(ExtensionSystemProvider* factory) { 32 void set_extension_system_factory(ExtensionSystemProvider* factory) {
27 extension_system_factory_ = factory; 33 extension_system_factory_ = factory;
28 } 34 }
29 void set_extension_cache(scoped_ptr<ExtensionCache> extension_cache) { 35 void set_extension_cache(scoped_ptr<ExtensionCache> extension_cache) {
30 extension_cache_ = extension_cache.Pass(); 36 extension_cache_ = extension_cache.Pass();
31 } 37 }
32 38
39 // Sets a factory to respond to calls of the CreateUpdateClient method.
40 void SetUpdateClientFactory(
41 const base::Callback<update_client::UpdateClient*(void)>& factory);
42
33 // Associates an incognito context with |main_context_|. 43 // Associates an incognito context with |main_context_|.
34 void SetIncognitoContext(content::BrowserContext* incognito_context); 44 void SetIncognitoContext(content::BrowserContext* incognito_context);
35 45
36 // ExtensionsBrowserClient overrides: 46 // ExtensionsBrowserClient overrides:
37 bool IsShuttingDown() override; 47 bool IsShuttingDown() override;
38 bool AreExtensionsDisabled(const base::CommandLine& command_line, 48 bool AreExtensionsDisabled(const base::CommandLine& command_line,
39 content::BrowserContext* context) override; 49 content::BrowserContext* context) override;
40 bool IsValidContext(content::BrowserContext* context) override; 50 bool IsValidContext(content::BrowserContext* context) override;
41 bool IsSameContext(content::BrowserContext* first, 51 bool IsSameContext(content::BrowserContext* first,
42 content::BrowserContext* second) override; 52 content::BrowserContext* second) override;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 GetComponentExtensionResourceManager() override; 100 GetComponentExtensionResourceManager() override;
91 void BroadcastEventToRenderers(events::HistogramValue histogram_value, 101 void BroadcastEventToRenderers(events::HistogramValue histogram_value,
92 const std::string& event_name, 102 const std::string& event_name,
93 scoped_ptr<base::ListValue> args) override; 103 scoped_ptr<base::ListValue> args) override;
94 net::NetLog* GetNetLog() override; 104 net::NetLog* GetNetLog() override;
95 ExtensionCache* GetExtensionCache() override; 105 ExtensionCache* GetExtensionCache() override;
96 bool IsBackgroundUpdateAllowed() override; 106 bool IsBackgroundUpdateAllowed() override;
97 bool IsMinBrowserVersionSupported(const std::string& min_version) override; 107 bool IsMinBrowserVersionSupported(const std::string& min_version) override;
98 ExtensionWebContentsObserver* GetExtensionWebContentsObserver( 108 ExtensionWebContentsObserver* GetExtensionWebContentsObserver(
99 content::WebContents* web_contents) override; 109 content::WebContents* web_contents) override;
110 scoped_refptr<update_client::UpdateClient> CreateUpdateClient(
111 content::BrowserContext* context) override;
100 112
101 private: 113 private:
102 content::BrowserContext* main_context_; // Not owned. 114 content::BrowserContext* main_context_; // Not owned.
103 content::BrowserContext* incognito_context_; // Not owned, defaults to NULL. 115 content::BrowserContext* incognito_context_; // Not owned, defaults to NULL.
104 116
105 // Not owned, defaults to NULL. 117 // Not owned, defaults to NULL.
106 ProcessManagerDelegate* process_manager_delegate_; 118 ProcessManagerDelegate* process_manager_delegate_;
107 119
108 // Not owned, defaults to NULL. 120 // Not owned, defaults to NULL.
109 ExtensionSystemProvider* extension_system_factory_; 121 ExtensionSystemProvider* extension_system_factory_;
110 122
111 scoped_ptr<ExtensionCache> extension_cache_; 123 scoped_ptr<ExtensionCache> extension_cache_;
112 124
125 base::Callback<update_client::UpdateClient*(void)> update_client_factory_;
126
113 DISALLOW_COPY_AND_ASSIGN(TestExtensionsBrowserClient); 127 DISALLOW_COPY_AND_ASSIGN(TestExtensionsBrowserClient);
114 }; 128 };
115 129
116 } // namespace extensions 130 } // namespace extensions
117 131
118 #endif // EXTENSIONS_BROWSER_TEST_EXTENSIONS_BROWSER_CLIENT_H_ 132 #endif // EXTENSIONS_BROWSER_TEST_EXTENSIONS_BROWSER_CLIENT_H_
OLDNEW
« no previous file with comments | « extensions/browser/mock_extension_system.cc ('k') | extensions/browser/test_extensions_browser_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698