OLD | NEW |
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 | 10 |
11 namespace extensions { | 11 namespace extensions { |
12 | 12 |
13 // A simplified ExtensionsBrowserClient for a single normal browser context and | 13 // A simplified ExtensionsBrowserClient for a single normal browser context and |
14 // an optional incognito browser context associated with it. A test that uses | 14 // an optional incognito browser context associated with it. A test that uses |
15 // this class should call ExtensionsBrowserClient::Set() with its instance. | 15 // this class should call ExtensionsBrowserClient::Set() with its instance. |
16 class TestExtensionsBrowserClient : public ExtensionsBrowserClient { | 16 class TestExtensionsBrowserClient : public ExtensionsBrowserClient { |
17 public: | 17 public: |
18 // |main_context| is required and must not be an incognito context. | 18 // |main_context| is required and must not be an incognito context. |
19 explicit TestExtensionsBrowserClient(content::BrowserContext* main_context); | 19 explicit TestExtensionsBrowserClient(content::BrowserContext* main_context); |
20 virtual ~TestExtensionsBrowserClient(); | 20 virtual ~TestExtensionsBrowserClient(); |
21 | 21 |
22 void set_process_manager_delegate(ProcessManagerDelegate* delegate) { | 22 void set_process_manager_delegate(ProcessManagerDelegate* delegate) { |
23 process_manager_delegate_ = delegate; | 23 process_manager_delegate_ = delegate; |
24 } | 24 } |
| 25 void set_extension_system_factory(ExtensionSystemProvider* factory) { |
| 26 extension_system_factory_ = factory; |
| 27 } |
25 | 28 |
26 // Associates an incognito context with |main_context_|. | 29 // Associates an incognito context with |main_context_|. |
27 void SetIncognitoContext(content::BrowserContext* incognito_context); | 30 void SetIncognitoContext(content::BrowserContext* incognito_context); |
28 | 31 |
29 // ExtensionsBrowserClient overrides: | 32 // ExtensionsBrowserClient overrides: |
30 virtual bool IsShuttingDown() OVERRIDE; | 33 virtual bool IsShuttingDown() OVERRIDE; |
31 virtual bool AreExtensionsDisabled(const base::CommandLine& command_line, | 34 virtual bool AreExtensionsDisabled(const base::CommandLine& command_line, |
32 content::BrowserContext* context) OVERRIDE; | 35 content::BrowserContext* context) OVERRIDE; |
33 virtual bool IsValidContext(content::BrowserContext* context) OVERRIDE; | 36 virtual bool IsValidContext(content::BrowserContext* context) OVERRIDE; |
34 virtual bool IsSameContext(content::BrowserContext* first, | 37 virtual bool IsSameContext(content::BrowserContext* first, |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 GetComponentExtensionResourceManager() OVERRIDE; | 84 GetComponentExtensionResourceManager() OVERRIDE; |
82 virtual net::NetLog* GetNetLog() OVERRIDE; | 85 virtual net::NetLog* GetNetLog() OVERRIDE; |
83 | 86 |
84 private: | 87 private: |
85 content::BrowserContext* main_context_; // Not owned. | 88 content::BrowserContext* main_context_; // Not owned. |
86 content::BrowserContext* incognito_context_; // Not owned, defaults to NULL. | 89 content::BrowserContext* incognito_context_; // Not owned, defaults to NULL. |
87 | 90 |
88 // Not owned, defaults to NULL. | 91 // Not owned, defaults to NULL. |
89 ProcessManagerDelegate* process_manager_delegate_; | 92 ProcessManagerDelegate* process_manager_delegate_; |
90 | 93 |
| 94 // Not owned, defaults to NULL. |
| 95 ExtensionSystemProvider* extension_system_factory_; |
| 96 |
91 DISALLOW_COPY_AND_ASSIGN(TestExtensionsBrowserClient); | 97 DISALLOW_COPY_AND_ASSIGN(TestExtensionsBrowserClient); |
92 }; | 98 }; |
93 | 99 |
94 } // namespace extensions | 100 } // namespace extensions |
95 | 101 |
96 #endif // EXTENSIONS_BROWSER_TEST_EXTENSIONS_BROWSER_CLIENT_H_ | 102 #endif // EXTENSIONS_BROWSER_TEST_EXTENSIONS_BROWSER_CLIENT_H_ |
OLD | NEW |