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

Side by Side Diff: chrome/test/base/testing_browser_process.cc

Issue 1895473002: PlatformNotificationService layering cleanup. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@display_manager2
Patch Set: Created 4 years, 7 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/test/base/testing_browser_process.h" 5 #include "chrome/test/base/testing_browser_process.h"
6 6
7 #include "base/strings/string_util.h" 7 #include "base/strings/string_util.h"
8 #include "base/time/default_clock.h" 8 #include "base/time/default_clock.h"
9 #include "base/time/default_tick_clock.h" 9 #include "base/time/default_tick_clock.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
11 #include "chrome/browser/browser_process.h" 11 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/browser_process_impl.h" 12 #include "chrome/browser/browser_process_impl.h"
13 #include "chrome/browser/lifetime/application_lifetime.h" 13 #include "chrome/browser/lifetime/application_lifetime.h"
14 #include "chrome/browser/notifications/notification_platform_bridge.h"
14 #include "chrome/browser/notifications/notification_ui_manager.h" 15 #include "chrome/browser/notifications/notification_ui_manager.h"
15 #include "chrome/browser/printing/print_job_manager.h" 16 #include "chrome/browser/printing/print_job_manager.h"
16 #include "chrome/browser/profiles/profile_manager.h" 17 #include "chrome/browser/profiles/profile_manager.h"
17 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 18 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
18 #include "chrome/common/features.h" 19 #include "chrome/common/features.h"
19 #include "chrome/test/base/testing_browser_process_platform_part.h" 20 #include "chrome/test/base/testing_browser_process_platform_part.h"
20 #include "components/network_time/network_time_tracker.h" 21 #include "components/network_time/network_time_tracker.h"
21 #include "components/policy/core/browser/browser_policy_connector.h" 22 #include "components/policy/core/browser/browser_policy_connector.h"
22 #include "components/prefs/pref_service.h" 23 #include "components/prefs/pref_service.h"
23 #include "content/public/browser/notification_service.h" 24 #include "content/public/browser/notification_service.h"
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 NotificationUIManager::Create(local_state())); 221 NotificationUIManager::Create(local_state()));
221 return notification_ui_manager_.get(); 222 return notification_ui_manager_.get();
222 #else 223 #else
223 NOTIMPLEMENTED(); 224 NOTIMPLEMENTED();
224 return nullptr; 225 return nullptr;
225 #endif 226 #endif
226 } 227 }
227 228
228 NotificationPlatformBridge* 229 NotificationPlatformBridge*
229 TestingBrowserProcess::notification_platform_bridge() { 230 TestingBrowserProcess::notification_platform_bridge() {
230 return nullptr; 231 return notification_platform_bridge_.get();
231 } 232 }
232 233
233 message_center::MessageCenter* TestingBrowserProcess::message_center() { 234 message_center::MessageCenter* TestingBrowserProcess::message_center() {
234 return message_center::MessageCenter::Get(); 235 return message_center::MessageCenter::Get();
235 } 236 }
236 237
237 IntranetRedirectDetector* TestingBrowserProcess::intranet_redirect_detector() { 238 IntranetRedirectDetector* TestingBrowserProcess::intranet_redirect_detector() {
238 return nullptr; 239 return nullptr;
239 } 240 }
240 241
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 void TestingBrowserProcess::SetSystemRequestContext( 377 void TestingBrowserProcess::SetSystemRequestContext(
377 net::URLRequestContextGetter* context_getter) { 378 net::URLRequestContextGetter* context_getter) {
378 system_request_context_ = context_getter; 379 system_request_context_ = context_getter;
379 } 380 }
380 381
381 void TestingBrowserProcess::SetNotificationUIManager( 382 void TestingBrowserProcess::SetNotificationUIManager(
382 std::unique_ptr<NotificationUIManager> notification_ui_manager) { 383 std::unique_ptr<NotificationUIManager> notification_ui_manager) {
383 notification_ui_manager_.swap(notification_ui_manager); 384 notification_ui_manager_.swap(notification_ui_manager);
384 } 385 }
385 386
387 void TestingBrowserProcess::SetNotificationPlatformBridge(
388 std::unique_ptr<NotificationPlatformBridge> notification_platform_bridge) {
389 notification_platform_bridge_.swap(notification_platform_bridge);
390 }
391
386 void TestingBrowserProcess::SetLocalState(PrefService* local_state) { 392 void TestingBrowserProcess::SetLocalState(PrefService* local_state) {
387 if (!local_state) { 393 if (!local_state) {
388 // The local_state_ PrefService is owned outside of TestingBrowserProcess, 394 // The local_state_ PrefService is owned outside of TestingBrowserProcess,
389 // but some of the members of TestingBrowserProcess hold references to it 395 // but some of the members of TestingBrowserProcess hold references to it
390 // (for example, via PrefNotifier members). But given our test 396 // (for example, via PrefNotifier members). But given our test
391 // infrastructure which tears down individual tests before freeing the 397 // infrastructure which tears down individual tests before freeing the
392 // TestingBrowserProcess, there's not a good way to make local_state outlive 398 // TestingBrowserProcess, there's not a good way to make local_state outlive
393 // these dependencies. As a workaround, whenever local_state_ is cleared 399 // these dependencies. As a workaround, whenever local_state_ is cleared
394 // (assumedly as part of exiting the test and freeing TestingBrowserProcess) 400 // (assumedly as part of exiting the test and freeing TestingBrowserProcess)
395 // any components owned by TestingBrowserProcess that depend on local_state 401 // any components owned by TestingBrowserProcess that depend on local_state
(...skipping 28 matching lines...) Expand all
424 430
425 /////////////////////////////////////////////////////////////////////////////// 431 ///////////////////////////////////////////////////////////////////////////////
426 432
427 TestingBrowserProcessInitializer::TestingBrowserProcessInitializer() { 433 TestingBrowserProcessInitializer::TestingBrowserProcessInitializer() {
428 TestingBrowserProcess::CreateInstance(); 434 TestingBrowserProcess::CreateInstance();
429 } 435 }
430 436
431 TestingBrowserProcessInitializer::~TestingBrowserProcessInitializer() { 437 TestingBrowserProcessInitializer::~TestingBrowserProcessInitializer() {
432 TestingBrowserProcess::DeleteInstance(); 438 TestingBrowserProcess::DeleteInstance();
433 } 439 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698