Chromium Code Reviews| 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 <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
| 17 #include "components/pref_registry/testing_pref_service_syncable.h" | |
| 17 #include "components/update_client/update_client.h" | 18 #include "components/update_client/update_client.h" |
| 18 #include "extensions/browser/extensions_browser_client.h" | 19 #include "extensions/browser/extensions_browser_client.h" |
| 19 #include "extensions/browser/updater/extension_cache.h" | 20 #include "extensions/browser/updater/extension_cache.h" |
| 20 | 21 |
| 21 namespace extensions { | 22 namespace extensions { |
| 22 | 23 |
| 23 // A simplified ExtensionsBrowserClient for a single normal browser context and | 24 // A simplified ExtensionsBrowserClient for a single normal browser context and |
| 24 // an optional incognito browser context associated with it. A test that uses | 25 // an optional incognito browser context associated with it. A test that uses |
| 25 // this class should call ExtensionsBrowserClient::Set() with its instance. | 26 // this class should call ExtensionsBrowserClient::Set() with its instance. |
| 26 class TestExtensionsBrowserClient : public ExtensionsBrowserClient { | 27 class TestExtensionsBrowserClient : public ExtensionsBrowserClient { |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 107 std::unique_ptr<base::ListValue> args) override; | 108 std::unique_ptr<base::ListValue> args) override; |
| 108 net::NetLog* GetNetLog() override; | 109 net::NetLog* GetNetLog() override; |
| 109 ExtensionCache* GetExtensionCache() override; | 110 ExtensionCache* GetExtensionCache() override; |
| 110 bool IsBackgroundUpdateAllowed() override; | 111 bool IsBackgroundUpdateAllowed() override; |
| 111 bool IsMinBrowserVersionSupported(const std::string& min_version) override; | 112 bool IsMinBrowserVersionSupported(const std::string& min_version) override; |
| 112 ExtensionWebContentsObserver* GetExtensionWebContentsObserver( | 113 ExtensionWebContentsObserver* GetExtensionWebContentsObserver( |
| 113 content::WebContents* web_contents) override; | 114 content::WebContents* web_contents) override; |
| 114 scoped_refptr<update_client::UpdateClient> CreateUpdateClient( | 115 scoped_refptr<update_client::UpdateClient> CreateUpdateClient( |
| 115 content::BrowserContext* context) override; | 116 content::BrowserContext* context) override; |
| 116 | 117 |
| 118 user_prefs::TestingPrefServiceSyncable* testing_pref_service() { | |
| 119 return &testing_pref_service_; | |
| 120 } | |
| 121 | |
| 117 private: | 122 private: |
| 118 content::BrowserContext* main_context_; // Not owned. | 123 content::BrowserContext* main_context_; // Not owned. |
| 119 content::BrowserContext* incognito_context_; // Not owned, defaults to NULL. | 124 content::BrowserContext* incognito_context_; // Not owned, defaults to NULL. |
| 120 | 125 |
| 121 // Not owned, defaults to NULL. | 126 // Not owned, defaults to NULL. |
| 122 ProcessManagerDelegate* process_manager_delegate_; | 127 ProcessManagerDelegate* process_manager_delegate_; |
| 123 | 128 |
| 124 // Not owned, defaults to NULL. | 129 // Not owned, defaults to NULL. |
| 125 ExtensionSystemProvider* extension_system_factory_; | 130 ExtensionSystemProvider* extension_system_factory_; |
| 126 | 131 |
| 127 std::unique_ptr<ExtensionCache> extension_cache_; | 132 std::unique_ptr<ExtensionCache> extension_cache_; |
| 128 | 133 |
| 129 base::Callback<update_client::UpdateClient*(void)> update_client_factory_; | 134 base::Callback<update_client::UpdateClient*(void)> update_client_factory_; |
| 130 | 135 |
| 136 user_prefs::TestingPrefServiceSyncable testing_pref_service_; | |
|
Devlin
2016/06/01 21:29:15
Can we lazily initialize this?
afakhry
2016/06/02 01:43:40
What's the point? It will be needed in the constru
Devlin
2016/06/03 21:26:47
My thought was that we could move the UserPrefs::S
| |
| 137 | |
| 131 DISALLOW_COPY_AND_ASSIGN(TestExtensionsBrowserClient); | 138 DISALLOW_COPY_AND_ASSIGN(TestExtensionsBrowserClient); |
| 132 }; | 139 }; |
| 133 | 140 |
| 134 } // namespace extensions | 141 } // namespace extensions |
| 135 | 142 |
| 136 #endif // EXTENSIONS_BROWSER_TEST_EXTENSIONS_BROWSER_CLIENT_H_ | 143 #endif // EXTENSIONS_BROWSER_TEST_EXTENSIONS_BROWSER_CLIENT_H_ |
| OLD | NEW |