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

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

Issue 291333009: network_time: Remove NetworkTimeService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
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/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.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"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 // g_browser_process must be NULL during its own destruction. 61 // g_browser_process must be NULL during its own destruction.
62 BrowserProcess* browser_process = g_browser_process; 62 BrowserProcess* browser_process = g_browser_process;
63 g_browser_process = NULL; 63 g_browser_process = NULL;
64 delete browser_process; 64 delete browser_process;
65 } 65 }
66 66
67 TestingBrowserProcess::TestingBrowserProcess() 67 TestingBrowserProcess::TestingBrowserProcess()
68 : notification_service_(content::NotificationService::Create()), 68 : notification_service_(content::NotificationService::Create()),
69 module_ref_count_(0), 69 module_ref_count_(0),
70 app_locale_("en"), 70 app_locale_("en"),
71 network_time_tracker_(new NetworkTimeTracker(
72 scoped_ptr<base::TickClock>(new base::DefaultTickClock))),
73 local_state_(NULL), 71 local_state_(NULL),
74 io_thread_(NULL), 72 io_thread_(NULL),
75 system_request_context_(NULL), 73 system_request_context_(NULL),
76 platform_part_(new TestingBrowserProcessPlatformPart()), 74 platform_part_(new TestingBrowserProcessPlatformPart()),
77 extensions_browser_client_( 75 extensions_browser_client_(
78 new extensions::ChromeExtensionsBrowserClient) { 76 new extensions::ChromeExtensionsBrowserClient) {
79 extensions::ExtensionsBrowserClient::Set(extensions_browser_client_.get()); 77 extensions::ExtensionsBrowserClient::Set(extensions_browser_client_.get());
80 apps::AppsClient::Set(ChromeAppsClient::GetInstance()); 78 apps::AppsClient::Set(ChromeAppsClient::GetInstance());
81 } 79 }
82 80
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 return (local_state_ != NULL); 356 return (local_state_ != NULL);
359 } 357 }
360 358
361 #if defined(ENABLE_WEBRTC) 359 #if defined(ENABLE_WEBRTC)
362 WebRtcLogUploader* TestingBrowserProcess::webrtc_log_uploader() { 360 WebRtcLogUploader* TestingBrowserProcess::webrtc_log_uploader() {
363 return NULL; 361 return NULL;
364 } 362 }
365 #endif 363 #endif
366 364
367 NetworkTimeTracker* TestingBrowserProcess::network_time_tracker() { 365 NetworkTimeTracker* TestingBrowserProcess::network_time_tracker() {
366 if (!network_time_tracker_) {
367 DCHECK(local_state_);
368 network_time_tracker_.reset(new NetworkTimeTracker(
369 scoped_ptr<base::TickClock>(new base::DefaultTickClock()),
370 local_state_));
371 }
368 return network_time_tracker_.get(); 372 return network_time_tracker_.get();
369 } 373 }
370 374
371 void TestingBrowserProcess::SetSystemRequestContext( 375 void TestingBrowserProcess::SetSystemRequestContext(
372 net::URLRequestContextGetter* context_getter) { 376 net::URLRequestContextGetter* context_getter) {
373 system_request_context_ = context_getter; 377 system_request_context_ = context_getter;
374 } 378 }
375 379
376 void TestingBrowserProcess::SetLocalState(PrefService* local_state) { 380 void TestingBrowserProcess::SetLocalState(PrefService* local_state) {
377 if (!local_state) { 381 if (!local_state) {
378 // The local_state_ PrefService is owned outside of TestingBrowserProcess, 382 // The local_state_ PrefService is owned outside of TestingBrowserProcess,
379 // but some of the members of TestingBrowserProcess hold references to it 383 // but some of the members of TestingBrowserProcess hold references to it
380 // (for example, via PrefNotifier members). But given our test 384 // (for example, via PrefNotifier members). But given our test
381 // infrastructure which tears down individual tests before freeing the 385 // infrastructure which tears down individual tests before freeing the
382 // TestingBrowserProcess, there's not a good way to make local_state outlive 386 // TestingBrowserProcess, there's not a good way to make local_state outlive
383 // these dependencies. As a workaround, whenever local_state_ is cleared 387 // these dependencies. As a workaround, whenever local_state_ is cleared
384 // (assumedly as part of exiting the test and freeing TestingBrowserProcess) 388 // (assumedly as part of exiting the test and freeing TestingBrowserProcess)
385 // any components owned by TestingBrowserProcess that depend on local_state 389 // any components owned by TestingBrowserProcess that depend on local_state
386 // are also freed. 390 // are also freed.
391 network_time_tracker_.reset();
387 #if !defined(OS_IOS) 392 #if !defined(OS_IOS)
388 notification_ui_manager_.reset(); 393 notification_ui_manager_.reset();
389 #endif 394 #endif
390 #if defined(ENABLE_CONFIGURATION_POLICY) 395 #if defined(ENABLE_CONFIGURATION_POLICY)
391 SetBrowserPolicyConnector(NULL); 396 SetBrowserPolicyConnector(NULL);
392 #endif 397 #endif
393 } 398 }
394 local_state_ = local_state; 399 local_state_ = local_state;
395 } 400 }
396 401
(...skipping 23 matching lines...) Expand all
420 425
421 /////////////////////////////////////////////////////////////////////////////// 426 ///////////////////////////////////////////////////////////////////////////////
422 427
423 TestingBrowserProcessInitializer::TestingBrowserProcessInitializer() { 428 TestingBrowserProcessInitializer::TestingBrowserProcessInitializer() {
424 TestingBrowserProcess::CreateInstance(); 429 TestingBrowserProcess::CreateInstance();
425 } 430 }
426 431
427 TestingBrowserProcessInitializer::~TestingBrowserProcessInitializer() { 432 TestingBrowserProcessInitializer::~TestingBrowserProcessInitializer() {
428 TestingBrowserProcess::DeleteInstance(); 433 TestingBrowserProcess::DeleteInstance();
429 } 434 }
OLDNEW
« chrome/browser/network_time/network_time_tracker.cc ('K') | « chrome/common/pref_names.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698