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

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

Issue 1970613003: Add a new app API to enable watchdog behavior restarts in kiosk apps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase + Convert browser tests to unit tests. Created 4 years, 6 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 #include "extensions/browser/test_extensions_browser_client.h" 5 #include "extensions/browser/test_extensions_browser_client.h"
6 6
7 #include "base/values.h" 7 #include "base/values.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "components/user_prefs/user_prefs.h"
9 #include "content/public/browser/browser_context.h" 10 #include "content/public/browser/browser_context.h"
10 #include "extensions/browser/extension_host_delegate.h" 11 #include "extensions/browser/extension_host_delegate.h"
11 #include "extensions/browser/test_runtime_api_delegate.h" 12 #include "extensions/browser/test_runtime_api_delegate.h"
12 #include "extensions/browser/updater/null_extension_cache.h" 13 #include "extensions/browser/updater/null_extension_cache.h"
13 14
14 using content::BrowserContext; 15 using content::BrowserContext;
15 16
16 namespace extensions { 17 namespace extensions {
17 18
18 TestExtensionsBrowserClient::TestExtensionsBrowserClient( 19 TestExtensionsBrowserClient::TestExtensionsBrowserClient(
19 BrowserContext* main_context) 20 BrowserContext* main_context)
20 : main_context_(main_context), 21 : main_context_(main_context),
21 incognito_context_(NULL), 22 incognito_context_(NULL),
22 process_manager_delegate_(NULL), 23 process_manager_delegate_(NULL),
23 extension_system_factory_(NULL), 24 extension_system_factory_(NULL),
24 extension_cache_(new NullExtensionCache) { 25 extension_cache_(new NullExtensionCache) {
25 DCHECK(main_context_); 26 DCHECK(main_context_);
26 DCHECK(!main_context_->IsOffTheRecord()); 27 DCHECK(!main_context_->IsOffTheRecord());
28 user_prefs::UserPrefs::Set(main_context_, &testing_pref_service_);
27 } 29 }
28 30
29 TestExtensionsBrowserClient::~TestExtensionsBrowserClient() {} 31 TestExtensionsBrowserClient::~TestExtensionsBrowserClient() {}
30 32
31 void TestExtensionsBrowserClient::SetUpdateClientFactory( 33 void TestExtensionsBrowserClient::SetUpdateClientFactory(
32 const base::Callback<update_client::UpdateClient*(void)>& factory) { 34 const base::Callback<update_client::UpdateClient*(void)>& factory) {
33 update_client_factory_ = factory; 35 update_client_factory_ = factory;
34 } 36 }
35 37
36 void TestExtensionsBrowserClient::SetIncognitoContext(BrowserContext* context) { 38 void TestExtensionsBrowserClient::SetIncognitoContext(BrowserContext* context) {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 bool TestExtensionsBrowserClient::AllowCrossRendererResourceLoad( 117 bool TestExtensionsBrowserClient::AllowCrossRendererResourceLoad(
116 net::URLRequest* request, 118 net::URLRequest* request,
117 bool is_incognito, 119 bool is_incognito,
118 const Extension* extension, 120 const Extension* extension,
119 InfoMap* extension_info_map) { 121 InfoMap* extension_info_map) {
120 return false; 122 return false;
121 } 123 }
122 124
123 PrefService* TestExtensionsBrowserClient::GetPrefServiceForContext( 125 PrefService* TestExtensionsBrowserClient::GetPrefServiceForContext(
124 BrowserContext* context) { 126 BrowserContext* context) {
125 return NULL; 127 return user_prefs::UserPrefs::Get(main_context_);
126 } 128 }
127 129
128 void TestExtensionsBrowserClient::GetEarlyExtensionPrefsObservers( 130 void TestExtensionsBrowserClient::GetEarlyExtensionPrefsObservers(
129 content::BrowserContext* context, 131 content::BrowserContext* context,
130 std::vector<ExtensionPrefsObserver*>* observers) const {} 132 std::vector<ExtensionPrefsObserver*>* observers) const {}
131 133
132 ProcessManagerDelegate* TestExtensionsBrowserClient::GetProcessManagerDelegate() 134 ProcessManagerDelegate* TestExtensionsBrowserClient::GetProcessManagerDelegate()
133 const { 135 const {
134 return process_manager_delegate_; 136 return process_manager_delegate_;
135 } 137 }
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 214
213 scoped_refptr<update_client::UpdateClient> 215 scoped_refptr<update_client::UpdateClient>
214 TestExtensionsBrowserClient::CreateUpdateClient( 216 TestExtensionsBrowserClient::CreateUpdateClient(
215 content::BrowserContext* context) { 217 content::BrowserContext* context) {
216 return update_client_factory_.is_null() 218 return update_client_factory_.is_null()
217 ? nullptr 219 ? nullptr
218 : make_scoped_refptr(update_client_factory_.Run()); 220 : make_scoped_refptr(update_client_factory_.Run());
219 } 221 }
220 222
221 } // namespace extensions 223 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698