| 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 // |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) { | |
| 23 process_manager_delegate_ = delegate; | |
| 24 } | |
| 25 | |
| 26 // Associates an incognito context with |main_context_|. | 22 // Associates an incognito context with |main_context_|. |
| 27 void SetIncognitoContext(content::BrowserContext* incognito_context); | 23 void SetIncognitoContext(content::BrowserContext* incognito_context); |
| 28 | 24 |
| 29 // ExtensionsBrowserClient overrides: | 25 // ExtensionsBrowserClient overrides: |
| 30 virtual bool IsShuttingDown() OVERRIDE; | 26 virtual bool IsShuttingDown() OVERRIDE; |
| 31 virtual bool AreExtensionsDisabled(const base::CommandLine& command_line, | 27 virtual bool AreExtensionsDisabled(const base::CommandLine& command_line, |
| 32 content::BrowserContext* context) OVERRIDE; | 28 content::BrowserContext* context) OVERRIDE; |
| 33 virtual bool IsValidContext(content::BrowserContext* context) OVERRIDE; | 29 virtual bool IsValidContext(content::BrowserContext* context) OVERRIDE; |
| 34 virtual bool IsSameContext(content::BrowserContext* first, | 30 virtual bool IsSameContext(content::BrowserContext* first, |
| 35 content::BrowserContext* second) OVERRIDE; | 31 content::BrowserContext* second) OVERRIDE; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 56 virtual bool AllowCrossRendererResourceLoad(net::URLRequest* request, | 52 virtual bool AllowCrossRendererResourceLoad(net::URLRequest* request, |
| 57 bool is_incognito, | 53 bool is_incognito, |
| 58 const Extension* extension, | 54 const Extension* extension, |
| 59 InfoMap* extension_info_map) | 55 InfoMap* extension_info_map) |
| 60 OVERRIDE; | 56 OVERRIDE; |
| 61 virtual PrefService* GetPrefServiceForContext( | 57 virtual PrefService* GetPrefServiceForContext( |
| 62 content::BrowserContext* context) OVERRIDE; | 58 content::BrowserContext* context) OVERRIDE; |
| 63 virtual void GetEarlyExtensionPrefsObservers( | 59 virtual void GetEarlyExtensionPrefsObservers( |
| 64 content::BrowserContext* context, | 60 content::BrowserContext* context, |
| 65 std::vector<ExtensionPrefsObserver*>* observers) const OVERRIDE; | 61 std::vector<ExtensionPrefsObserver*>* observers) const OVERRIDE; |
| 66 virtual ProcessManagerDelegate* GetProcessManagerDelegate() const OVERRIDE; | 62 virtual bool DeferLoadingBackgroundHosts( |
| 63 content::BrowserContext* context) const OVERRIDE; |
| 64 virtual bool IsBackgroundPageAllowed(content::BrowserContext* context) const |
| 65 OVERRIDE; |
| 67 virtual scoped_ptr<ExtensionHostDelegate> CreateExtensionHostDelegate() | 66 virtual scoped_ptr<ExtensionHostDelegate> CreateExtensionHostDelegate() |
| 68 OVERRIDE; | 67 OVERRIDE; |
| 69 virtual bool DidVersionUpdate(content::BrowserContext* context) OVERRIDE; | 68 virtual bool DidVersionUpdate(content::BrowserContext* context) OVERRIDE; |
| 70 virtual scoped_ptr<AppSorting> CreateAppSorting() OVERRIDE; | 69 virtual scoped_ptr<AppSorting> CreateAppSorting() OVERRIDE; |
| 71 virtual bool IsRunningInForcedAppMode() OVERRIDE; | 70 virtual bool IsRunningInForcedAppMode() OVERRIDE; |
| 72 virtual ApiActivityMonitor* GetApiActivityMonitor( | 71 virtual ApiActivityMonitor* GetApiActivityMonitor( |
| 73 content::BrowserContext* context) OVERRIDE; | 72 content::BrowserContext* context) OVERRIDE; |
| 74 virtual ExtensionSystemProvider* GetExtensionSystemFactory() OVERRIDE; | 73 virtual ExtensionSystemProvider* GetExtensionSystemFactory() OVERRIDE; |
| 75 virtual void RegisterExtensionFunctions( | 74 virtual void RegisterExtensionFunctions( |
| 76 ExtensionFunctionRegistry* registry) const OVERRIDE; | 75 ExtensionFunctionRegistry* registry) const OVERRIDE; |
| 77 virtual scoped_ptr<RuntimeAPIDelegate> CreateRuntimeAPIDelegate( | 76 virtual scoped_ptr<RuntimeAPIDelegate> CreateRuntimeAPIDelegate( |
| 78 content::BrowserContext* context) const OVERRIDE; | 77 content::BrowserContext* context) const OVERRIDE; |
| 79 virtual ComponentExtensionResourceManager* | 78 virtual ComponentExtensionResourceManager* |
| 80 GetComponentExtensionResourceManager() OVERRIDE; | 79 GetComponentExtensionResourceManager() OVERRIDE; |
| 81 | 80 |
| 82 private: | 81 private: |
| 83 content::BrowserContext* main_context_; // Not owned. | 82 content::BrowserContext* main_context_; // Not owned. |
| 84 content::BrowserContext* incognito_context_; // Not owned, defaults to NULL. | 83 content::BrowserContext* incognito_context_; // Not owned, defaults to NULL. |
| 85 | 84 |
| 86 // Not owned, defaults to NULL. | |
| 87 ProcessManagerDelegate* process_manager_delegate_; | |
| 88 | |
| 89 DISALLOW_COPY_AND_ASSIGN(TestExtensionsBrowserClient); | 85 DISALLOW_COPY_AND_ASSIGN(TestExtensionsBrowserClient); |
| 90 }; | 86 }; |
| 91 | 87 |
| 92 } // namespace extensions | 88 } // namespace extensions |
| 93 | 89 |
| 94 #endif // EXTENSIONS_BROWSER_TEST_EXTENSIONS_BROWSER_CLIENT_H_ | 90 #endif // EXTENSIONS_BROWSER_TEST_EXTENSIONS_BROWSER_CLIENT_H_ |
| OLD | NEW |