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

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

Issue 612423003: Move ExtensionCache to //extensions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test setup Created 6 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 "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "extensions/browser/extensions_browser_client.h" 9 #include "extensions/browser/extensions_browser_client.h"
10 #include "extensions/browser/updater/extension_cache.h"
10 11
11 namespace extensions { 12 namespace extensions {
12 13
13 // A simplified ExtensionsBrowserClient for a single normal browser context and 14 // A simplified ExtensionsBrowserClient for a single normal browser context and
14 // an optional incognito browser context associated with it. A test that uses 15 // an optional incognito browser context associated with it. A test that uses
15 // this class should call ExtensionsBrowserClient::Set() with its instance. 16 // this class should call ExtensionsBrowserClient::Set() with its instance.
16 class TestExtensionsBrowserClient : public ExtensionsBrowserClient { 17 class TestExtensionsBrowserClient : public ExtensionsBrowserClient {
17 public: 18 public:
18 // |main_context| is required and must not be an incognito context. 19 // |main_context| is required and must not be an incognito context.
19 explicit TestExtensionsBrowserClient(content::BrowserContext* main_context); 20 explicit TestExtensionsBrowserClient(content::BrowserContext* main_context);
20 virtual ~TestExtensionsBrowserClient(); 21 virtual ~TestExtensionsBrowserClient();
21 22
22 void set_process_manager_delegate(ProcessManagerDelegate* delegate) { 23 void set_process_manager_delegate(ProcessManagerDelegate* delegate) {
23 process_manager_delegate_ = delegate; 24 process_manager_delegate_ = delegate;
24 } 25 }
25 void set_extension_system_factory(ExtensionSystemProvider* factory) { 26 void set_extension_system_factory(ExtensionSystemProvider* factory) {
26 extension_system_factory_ = factory; 27 extension_system_factory_ = factory;
27 } 28 }
29 void set_extension_cache(scoped_ptr<ExtensionCache> extension_cache) {
30 extension_cache_ = extension_cache.Pass();
31 }
28 32
29 // Associates an incognito context with |main_context_|. 33 // Associates an incognito context with |main_context_|.
30 void SetIncognitoContext(content::BrowserContext* incognito_context); 34 void SetIncognitoContext(content::BrowserContext* incognito_context);
31 35
32 // ExtensionsBrowserClient overrides: 36 // ExtensionsBrowserClient overrides:
33 virtual bool IsShuttingDown() override; 37 virtual bool IsShuttingDown() override;
34 virtual bool AreExtensionsDisabled(const base::CommandLine& command_line, 38 virtual bool AreExtensionsDisabled(const base::CommandLine& command_line,
35 content::BrowserContext* context) override; 39 content::BrowserContext* context) override;
36 virtual bool IsValidContext(content::BrowserContext* context) override; 40 virtual bool IsValidContext(content::BrowserContext* context) override;
37 virtual bool IsSameContext(content::BrowserContext* first, 41 virtual bool IsSameContext(content::BrowserContext* first,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 virtual void RegisterExtensionFunctions( 82 virtual void RegisterExtensionFunctions(
79 ExtensionFunctionRegistry* registry) const override; 83 ExtensionFunctionRegistry* registry) const override;
80 virtual scoped_ptr<RuntimeAPIDelegate> CreateRuntimeAPIDelegate( 84 virtual scoped_ptr<RuntimeAPIDelegate> CreateRuntimeAPIDelegate(
81 content::BrowserContext* context) const override; 85 content::BrowserContext* context) const override;
82 virtual ComponentExtensionResourceManager* 86 virtual ComponentExtensionResourceManager*
83 GetComponentExtensionResourceManager() override; 87 GetComponentExtensionResourceManager() override;
84 virtual void BroadcastEventToRenderers( 88 virtual void BroadcastEventToRenderers(
85 const std::string& event_name, 89 const std::string& event_name,
86 scoped_ptr<base::ListValue> args) override; 90 scoped_ptr<base::ListValue> args) override;
87 virtual net::NetLog* GetNetLog() override; 91 virtual net::NetLog* GetNetLog() override;
92 virtual ExtensionCache* GetExtensionCache() override;
88 93
89 private: 94 private:
90 content::BrowserContext* main_context_; // Not owned. 95 content::BrowserContext* main_context_; // Not owned.
91 content::BrowserContext* incognito_context_; // Not owned, defaults to NULL. 96 content::BrowserContext* incognito_context_; // Not owned, defaults to NULL.
92 97
93 // Not owned, defaults to NULL. 98 // Not owned, defaults to NULL.
94 ProcessManagerDelegate* process_manager_delegate_; 99 ProcessManagerDelegate* process_manager_delegate_;
95 100
96 // Not owned, defaults to NULL. 101 // Not owned, defaults to NULL.
97 ExtensionSystemProvider* extension_system_factory_; 102 ExtensionSystemProvider* extension_system_factory_;
98 103
104 scoped_ptr<ExtensionCache> extension_cache_;
105
99 DISALLOW_COPY_AND_ASSIGN(TestExtensionsBrowserClient); 106 DISALLOW_COPY_AND_ASSIGN(TestExtensionsBrowserClient);
100 }; 107 };
101 108
102 } // namespace extensions 109 } // namespace extensions
103 110
104 #endif // EXTENSIONS_BROWSER_TEST_EXTENSIONS_BROWSER_CLIENT_H_ 111 #endif // EXTENSIONS_BROWSER_TEST_EXTENSIONS_BROWSER_CLIENT_H_
OLDNEW
« no previous file with comments | « extensions/browser/extensions_browser_client.h ('k') | extensions/browser/test_extensions_browser_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698