| 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 // |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_defer_loading_background_hosts(bool defer) { |
| 23 defer_loading_background_hosts_ = defer; |
| 24 } |
| 25 void set_extension_system_factory(ExtensionSystemProvider* factory) { |
| 26 extension_system_factory_ = factory; |
| 27 } |
| 28 |
| 22 // Associates an incognito context with |main_context_|. | 29 // Associates an incognito context with |main_context_|. |
| 23 void SetIncognitoContext(content::BrowserContext* incognito_context); | 30 void SetIncognitoContext(content::BrowserContext* incognito_context); |
| 24 | 31 |
| 25 // ExtensionsBrowserClient overrides: | 32 // ExtensionsBrowserClient overrides: |
| 26 virtual bool IsShuttingDown() OVERRIDE; | 33 virtual bool IsShuttingDown() OVERRIDE; |
| 27 virtual bool AreExtensionsDisabled(const base::CommandLine& command_line, | 34 virtual bool AreExtensionsDisabled(const base::CommandLine& command_line, |
| 28 content::BrowserContext* context) OVERRIDE; | 35 content::BrowserContext* context) OVERRIDE; |
| 29 virtual bool IsValidContext(content::BrowserContext* context) OVERRIDE; | 36 virtual bool IsValidContext(content::BrowserContext* context) OVERRIDE; |
| 30 virtual bool IsSameContext(content::BrowserContext* first, | 37 virtual bool IsSameContext(content::BrowserContext* first, |
| 31 content::BrowserContext* second) OVERRIDE; | 38 content::BrowserContext* second) OVERRIDE; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 ExtensionFunctionRegistry* registry) const OVERRIDE; | 82 ExtensionFunctionRegistry* registry) const OVERRIDE; |
| 76 virtual scoped_ptr<RuntimeAPIDelegate> CreateRuntimeAPIDelegate( | 83 virtual scoped_ptr<RuntimeAPIDelegate> CreateRuntimeAPIDelegate( |
| 77 content::BrowserContext* context) const OVERRIDE; | 84 content::BrowserContext* context) const OVERRIDE; |
| 78 virtual ComponentExtensionResourceManager* | 85 virtual ComponentExtensionResourceManager* |
| 79 GetComponentExtensionResourceManager() OVERRIDE; | 86 GetComponentExtensionResourceManager() OVERRIDE; |
| 80 | 87 |
| 81 private: | 88 private: |
| 82 content::BrowserContext* main_context_; // Not owned. | 89 content::BrowserContext* main_context_; // Not owned. |
| 83 content::BrowserContext* incognito_context_; // Not owned, defaults to NULL. | 90 content::BrowserContext* incognito_context_; // Not owned, defaults to NULL. |
| 84 | 91 |
| 92 // The return value for DeferLoadingBackgroundHosts(). |
| 93 bool defer_loading_background_hosts_; |
| 94 |
| 95 // The return value for GetExtensionSystemFactory(). |
| 96 ExtensionSystemProvider* extension_system_factory_; |
| 97 |
| 85 DISALLOW_COPY_AND_ASSIGN(TestExtensionsBrowserClient); | 98 DISALLOW_COPY_AND_ASSIGN(TestExtensionsBrowserClient); |
| 86 }; | 99 }; |
| 87 | 100 |
| 88 } // namespace extensions | 101 } // namespace extensions |
| 89 | 102 |
| 90 #endif // EXTENSIONS_BROWSER_TEST_EXTENSIONS_BROWSER_CLIENT_H_ | 103 #endif // EXTENSIONS_BROWSER_TEST_EXTENSIONS_BROWSER_CLIENT_H_ |
| OLD | NEW |