summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordbeam@chromium.org <dbeam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-04 20:41:22 +0000
committerdbeam@chromium.org <dbeam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-04 20:41:22 +0000
commitc494d08784a4a733765a98dc726668ed9f32b4db (patch)
tree6d7c69e515f888d2390a2ad0b507e30078418905
parent54fc973c13c32ac6777efb4c5219ccc33b12675f (diff)
downloadchromium_src-c494d08784a4a733765a98dc726668ed9f32b4db.zip
chromium_src-c494d08784a4a733765a98dc726668ed9f32b4db.tar.gz
chromium_src-c494d08784a4a733765a98dc726668ed9f32b4db.tar.bz2
Update other unittests to use newly added TestingBrowserProcess::GetGlobal().
R=jcivelli@chromium.org,rsesek@chromium.org,thestig@chromium.org BUG=None TEST=green tests Review URL: https://chromiumcodereview.appspot.com/11759019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@175189 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/autocomplete/contact_provider_chromeos_unittest.cc3
-rw-r--r--chrome/browser/background/background_mode_manager_unittest.cc3
-rw-r--r--chrome/browser/browsing_data/browsing_data_remover_unittest.cc3
-rw-r--r--chrome/browser/chromeos/contacts/contact_manager_unittest.cc3
-rw-r--r--chrome/browser/chromeos/cros/onc_network_parser_unittest.cc3
-rw-r--r--chrome/browser/chromeos/display/display_preferences_unittest.cc8
-rw-r--r--chrome/browser/chromeos/input_method/input_method_persistence_unittest.cc4
-rw-r--r--chrome/browser/chromeos/login/login_utils_browsertest.cc3
-rw-r--r--chrome/browser/chromeos/power/session_length_limiter_unittest.cc5
-rw-r--r--chrome/browser/chromeos/settings/cros_settings_unittest.cc2
-rw-r--r--chrome/browser/chromeos/settings/device_settings_provider_unittest.cc2
-rw-r--r--chrome/browser/extensions/event_router_forwarder_unittest.cc2
-rw-r--r--chrome/browser/history/android/android_history_provider_service_unittest.cc2
-rw-r--r--chrome/browser/history/android/android_provider_backend_unittest.cc2
-rw-r--r--chrome/browser/history/android/bookmark_model_sql_handler_unittest.cc2
-rw-r--r--chrome/browser/history/android/sqlite_cursor_unittest.cc2
-rw-r--r--chrome/browser/policy/auto_enrollment_client_unittest.cc2
-rw-r--r--chrome/browser/policy/cloud_policy_subsystem_unittest.cc2
-rw-r--r--chrome/browser/policy/user_policy_signin_service_unittest.cc4
-rw-r--r--chrome/browser/printing/cloud_print/test/cloud_print_proxy_process_browsertest.cc4
-rw-r--r--chrome/browser/profiles/avatar_menu_model_unittest.cc2
-rw-r--r--chrome/browser/profiles/off_the_record_profile_impl_unittest.cc2
-rw-r--r--chrome/browser/profiles/profile_info_cache_unittest.cc2
-rw-r--r--chrome/browser/profiles/profile_manager_unittest.cc13
-rw-r--r--chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc2
-rw-r--r--chrome/browser/signin/signin_manager_unittest.cc4
-rw-r--r--chrome/browser/signin/signin_names_io_thread_unittest.cc2
-rw-r--r--chrome/browser/ui/bookmarks/bookmark_prompt_controller_unittest.cc4
-rw-r--r--chrome/browser/ui/browser_command_controller_unittest.cc2
-rw-r--r--chrome/browser/ui/chrome_select_file_policy_unittest.cc2
-rw-r--r--chrome/browser/ui/cocoa/browser/avatar_menu_bubble_controller_unittest.mm2
-rw-r--r--chrome/browser/ui/cocoa/cocoa_profile_test.mm4
-rw-r--r--chrome/browser/ui/sync/one_click_signin_helper_unittest.cc2
-rw-r--r--chrome/browser/ui/tab_contents/tab_contents_iterator_unittest.cc2
-rw-r--r--chrome/browser/web_resource/promo_resource_service_mobile_ntp_unittest.cc12
-rw-r--r--chrome/browser/web_resource/promo_resource_service_unittest.cc12
-rw-r--r--chrome/test/base/testing_browser_process.cc5
-rw-r--r--chrome/test/base/testing_browser_process.h3
38 files changed, 61 insertions, 77 deletions
diff --git a/chrome/browser/autocomplete/contact_provider_chromeos_unittest.cc b/chrome/browser/autocomplete/contact_provider_chromeos_unittest.cc
index 703d456..d6a9206 100644
--- a/chrome/browser/autocomplete/contact_provider_chromeos_unittest.cc
+++ b/chrome/browser/autocomplete/contact_provider_chromeos_unittest.cc
@@ -54,8 +54,7 @@ class ContactProviderTest : public testing::Test {
// testing::Test implementation.
virtual void SetUp() OVERRIDE {
profile_manager_.reset(
- new TestingProfileManager(
- static_cast<TestingBrowserProcess*>(g_browser_process)));
+ new TestingProfileManager(TestingBrowserProcess::GetGlobal()));
ASSERT_TRUE(profile_manager_->SetUp());
profile_ = profile_manager_->CreateTestingProfile("test_profile");
contact_manager_.reset(new contacts::ContactManagerStub(profile_));
diff --git a/chrome/browser/background/background_mode_manager_unittest.cc b/chrome/browser/background/background_mode_manager_unittest.cc
index 9acd91f..b03339a 100644
--- a/chrome/browser/background/background_mode_manager_unittest.cc
+++ b/chrome/browser/background/background_mode_manager_unittest.cc
@@ -19,8 +19,7 @@
class BackgroundModeManagerTest : public testing::Test {
public:
BackgroundModeManagerTest()
- : profile_manager_(
- static_cast<TestingBrowserProcess*>(g_browser_process)) {}
+ : profile_manager_(TestingBrowserProcess::GetGlobal()) {}
~BackgroundModeManagerTest() {}
void SetUp() {
command_line_.reset(new CommandLine(CommandLine::NO_PROGRAM));
diff --git a/chrome/browser/browsing_data/browsing_data_remover_unittest.cc b/chrome/browser/browsing_data/browsing_data_remover_unittest.cc
index 6ad351b..88e69d7 100644
--- a/chrome/browser/browsing_data/browsing_data_remover_unittest.cc
+++ b/chrome/browser/browsing_data/browsing_data_remover_unittest.cc
@@ -231,8 +231,7 @@ class RemoveProfileCookieTester : public RemoveCookieTester {
class RemoveSafeBrowsingCookieTester : public RemoveCookieTester {
public:
RemoveSafeBrowsingCookieTester()
- : browser_process_(
- static_cast<TestingBrowserProcess*>(g_browser_process)) {
+ : browser_process_(TestingBrowserProcess::GetGlobal()) {
scoped_refptr<SafeBrowsingService> sb_service =
SafeBrowsingService::CreateSafeBrowsingService();
browser_process_->SetSafeBrowsingService(sb_service);
diff --git a/chrome/browser/chromeos/contacts/contact_manager_unittest.cc b/chrome/browser/chromeos/contacts/contact_manager_unittest.cc
index 3884501..c6a5b2e8 100644
--- a/chrome/browser/chromeos/contacts/contact_manager_unittest.cc
+++ b/chrome/browser/chromeos/contacts/contact_manager_unittest.cc
@@ -70,8 +70,7 @@ class ContactManagerTest : public testing::Test {
// testing::Test implementation.
virtual void SetUp() OVERRIDE {
profile_manager_.reset(
- new TestingProfileManager(
- static_cast<TestingBrowserProcess*>(g_browser_process)));
+ new TestingProfileManager(TestingBrowserProcess::GetGlobal()));
ASSERT_TRUE(profile_manager_->SetUp());
contact_manager_.reset(new ContactManager);
diff --git a/chrome/browser/chromeos/cros/onc_network_parser_unittest.cc b/chrome/browser/chromeos/cros/onc_network_parser_unittest.cc
index 1d668bb..9f388bd 100644
--- a/chrome/browser/chromeos/cros/onc_network_parser_unittest.cc
+++ b/chrome/browser/chromeos/cros/onc_network_parser_unittest.cc
@@ -552,8 +552,7 @@ TEST(OncNetworkParserUserExpansionTest, GetUserExpandedValue) {
MessageLoop loop;
content::TestBrowserThread ui_thread(content::BrowserThread::UI, &loop);
base::ShadowingAtExitManager at_exit_manager;
- ScopedTestingLocalState local_state(
- static_cast<TestingBrowserProcess*>(g_browser_process));
+ ScopedTestingLocalState local_state(TestingBrowserProcess::GetGlobal());
base::StringValue login_id_pattern("a ${LOGIN_ID} b");
base::StringValue login_email_pattern("a ${LOGIN_EMAIL} b");
diff --git a/chrome/browser/chromeos/display/display_preferences_unittest.cc b/chrome/browser/chromeos/display/display_preferences_unittest.cc
index bf01c31..4143285 100644
--- a/chrome/browser/chromeos/display/display_preferences_unittest.cc
+++ b/chrome/browser/chromeos/display/display_preferences_unittest.cc
@@ -28,15 +28,11 @@ class DisplayPreferencesTest : public ash::test::AshTestBase {
virtual void SetUp() OVERRIDE {
ash::test::AshTestBase::SetUp();
RegisterDisplayLocalStatePrefs(&local_state_);
- TestingBrowserProcess* browser_process =
- static_cast<TestingBrowserProcess*>(g_browser_process);
- browser_process->SetLocalState(&local_state_);
+ TestingBrowserProcess::GetGlobal()->SetLocalState(&local_state_);
}
virtual void TearDown() OVERRIDE {
- TestingBrowserProcess* browser_process =
- static_cast<TestingBrowserProcess*>(g_browser_process);
- browser_process->SetLocalState(NULL);
+ TestingBrowserProcess::GetGlobal()->SetLocalState(NULL);
ash::test::AshTestBase::TearDown();
}
diff --git a/chrome/browser/chromeos/input_method/input_method_persistence_unittest.cc b/chrome/browser/chromeos/input_method/input_method_persistence_unittest.cc
index 606ad6f..0546523 100644
--- a/chrome/browser/chromeos/input_method/input_method_persistence_unittest.cc
+++ b/chrome/browser/chromeos/input_method/input_method_persistence_unittest.cc
@@ -30,9 +30,7 @@ const char kProfileName[] = "input_method_test";
class InputMethodPersistenceTest : public testing::Test {
protected:
InputMethodPersistenceTest()
- : mock_profile_manager_(
- static_cast<TestingBrowserProcess*>(g_browser_process)) {
- }
+ : mock_profile_manager_(TestingBrowserProcess::GetGlobal()) {}
virtual void SetUp() OVERRIDE {
// Set up a profile that will be returned by
diff --git a/chrome/browser/chromeos/login/login_utils_browsertest.cc b/chrome/browser/chromeos/login/login_utils_browsertest.cc
index 80092e9..dc25efd 100644
--- a/chrome/browser/chromeos/login/login_utils_browsertest.cc
+++ b/chrome/browser/chromeos/login/login_utils_browsertest.cc
@@ -137,8 +137,7 @@ class LoginUtilsTest : public testing::Test,
: fake_io_thread_completion_(false, false),
fake_io_thread_("fake_io_thread"),
loop_(MessageLoop::TYPE_IO),
- browser_process_(
- static_cast<TestingBrowserProcess*>(g_browser_process)),
+ browser_process_(TestingBrowserProcess::GetGlobal()),
local_state_(browser_process_),
ui_thread_(BrowserThread::UI, &loop_),
db_thread_(BrowserThread::DB),
diff --git a/chrome/browser/chromeos/power/session_length_limiter_unittest.cc b/chrome/browser/chromeos/power/session_length_limiter_unittest.cc
index 60a52a4..f527f08 100644
--- a/chrome/browser/chromeos/power/session_length_limiter_unittest.cc
+++ b/chrome/browser/chromeos/power/session_length_limiter_unittest.cc
@@ -98,8 +98,7 @@ class SessionLengthLimiterTest : public testing::Test {
}
virtual void SetUp() {
- static_cast<TestingBrowserProcess*>(g_browser_process)->
- SetLocalState(&local_state_);
+ TestingBrowserProcess::GetGlobal()->SetLocalState(&local_state_);
SessionLengthLimiter::RegisterPrefs(&local_state_);
delegate_ = new NiceMock<MockSessionLengthLimiterDelegate>;
@@ -115,7 +114,7 @@ class SessionLengthLimiterTest : public testing::Test {
}
virtual void TearDown() {
- static_cast<TestingBrowserProcess*>(g_browser_process)->SetLocalState(NULL);
+ TestingBrowserProcess::GetGlobal()->SetLocalState(NULL);
}
void SetSessionStartTimePref(int64 session_start_time) {
diff --git a/chrome/browser/chromeos/settings/cros_settings_unittest.cc b/chrome/browser/chromeos/settings/cros_settings_unittest.cc
index fe76ec3..9c43c42 100644
--- a/chrome/browser/chromeos/settings/cros_settings_unittest.cc
+++ b/chrome/browser/chromeos/settings/cros_settings_unittest.cc
@@ -31,7 +31,7 @@ class CrosSettingsTest : public testing::Test {
CrosSettingsTest()
: message_loop_(MessageLoop::TYPE_UI),
ui_thread_(content::BrowserThread::UI, &message_loop_),
- local_state_(static_cast<TestingBrowserProcess*>(g_browser_process)),
+ local_state_(TestingBrowserProcess::GetGlobal()),
weak_factory_(this) {}
virtual ~CrosSettingsTest() {}
diff --git a/chrome/browser/chromeos/settings/device_settings_provider_unittest.cc b/chrome/browser/chromeos/settings/device_settings_provider_unittest.cc
index 3e27cc4..d9d6c69 100644
--- a/chrome/browser/chromeos/settings/device_settings_provider_unittest.cc
+++ b/chrome/browser/chromeos/settings/device_settings_provider_unittest.cc
@@ -38,7 +38,7 @@ class DeviceSettingsProviderTest : public DeviceSettingsTestBase {
protected:
DeviceSettingsProviderTest()
- : local_state_(static_cast<TestingBrowserProcess*>(g_browser_process)),
+ : local_state_(TestingBrowserProcess::GetGlobal()),
user_data_dir_override_(chrome::DIR_USER_DATA) {}
virtual void SetUp() OVERRIDE {
diff --git a/chrome/browser/extensions/event_router_forwarder_unittest.cc b/chrome/browser/extensions/event_router_forwarder_unittest.cc
index c2f25f8..1e14b98 100644
--- a/chrome/browser/extensions/event_router_forwarder_unittest.cc
+++ b/chrome/browser/extensions/event_router_forwarder_unittest.cc
@@ -90,7 +90,7 @@ class EventRouterForwarderTest : public testing::Test {
: ui_thread_(BrowserThread::UI, &message_loop_),
io_thread_(BrowserThread::IO),
profile_manager_(
- static_cast<TestingBrowserProcess*>(g_browser_process)) {
+ TestingBrowserProcess::GetGlobal()) {
#if defined(OS_MACOSX)
base::SystemMonitor::AllocateSystemIOPorts();
#endif
diff --git a/chrome/browser/history/android/android_history_provider_service_unittest.cc b/chrome/browser/history/android/android_history_provider_service_unittest.cc
index e17781c..c891622 100644
--- a/chrome/browser/history/android/android_history_provider_service_unittest.cc
+++ b/chrome/browser/history/android/android_history_provider_service_unittest.cc
@@ -33,7 +33,7 @@ class AndroidHistoryProviderServiceTest : public testing::Test {
public:
AndroidHistoryProviderServiceTest()
: profile_manager_(
- static_cast<TestingBrowserProcess*>(g_browser_process)),
+ TestingBrowserProcess::GetGlobal()),
ui_thread_(BrowserThread::UI, &message_loop_),
file_thread_(BrowserThread::FILE, &message_loop_) {
}
diff --git a/chrome/browser/history/android/android_provider_backend_unittest.cc b/chrome/browser/history/android/android_provider_backend_unittest.cc
index d5496cc..fe034eb 100644
--- a/chrome/browser/history/android/android_provider_backend_unittest.cc
+++ b/chrome/browser/history/android/android_provider_backend_unittest.cc
@@ -109,7 +109,7 @@ class AndroidProviderBackendTest : public testing::Test {
public:
AndroidProviderBackendTest()
: profile_manager_(
- static_cast<TestingBrowserProcess*>(g_browser_process)),
+ TestingBrowserProcess::GetGlobal()),
bookmark_model_(NULL),
ui_thread_(BrowserThread::UI, &message_loop_),
file_thread_(BrowserThread::FILE, &message_loop_) {
diff --git a/chrome/browser/history/android/bookmark_model_sql_handler_unittest.cc b/chrome/browser/history/android/bookmark_model_sql_handler_unittest.cc
index b10b3ba..8ae87bb 100644
--- a/chrome/browser/history/android/bookmark_model_sql_handler_unittest.cc
+++ b/chrome/browser/history/android/bookmark_model_sql_handler_unittest.cc
@@ -27,7 +27,7 @@ class BookmarkModelSQLHandlerTest : public testing::Test {
public:
BookmarkModelSQLHandlerTest()
: profile_manager_(
- static_cast<TestingBrowserProcess*>(g_browser_process)),
+ TestingBrowserProcess::GetGlobal()),
bookmark_model_(NULL),
ui_thread_(BrowserThread::UI, &message_loop_),
file_thread_(BrowserThread::FILE, &message_loop_) {
diff --git a/chrome/browser/history/android/sqlite_cursor_unittest.cc b/chrome/browser/history/android/sqlite_cursor_unittest.cc
index c9e4d67..523f91a 100644
--- a/chrome/browser/history/android/sqlite_cursor_unittest.cc
+++ b/chrome/browser/history/android/sqlite_cursor_unittest.cc
@@ -41,7 +41,7 @@ class SQLiteCursorTest : public testing::Test,
public:
SQLiteCursorTest()
: profile_manager_(
- static_cast<TestingBrowserProcess*>(g_browser_process)),
+ TestingBrowserProcess::GetGlobal()),
ui_thread_(BrowserThread::UI, &message_loop_),
file_thread_(BrowserThread::FILE, &message_loop_) {
}
diff --git a/chrome/browser/policy/auto_enrollment_client_unittest.cc b/chrome/browser/policy/auto_enrollment_client_unittest.cc
index f27aecf..6525372 100644
--- a/chrome/browser/policy/auto_enrollment_client_unittest.cc
+++ b/chrome/browser/policy/auto_enrollment_client_unittest.cc
@@ -36,7 +36,7 @@ class AutoEnrollmentClientTest : public testing::Test {
protected:
AutoEnrollmentClientTest()
: scoped_testing_local_state_(
- static_cast<TestingBrowserProcess*>(g_browser_process)),
+ TestingBrowserProcess::GetGlobal()),
local_state_(scoped_testing_local_state_.Get()),
service_(NULL),
completion_callback_count_(0) {}
diff --git a/chrome/browser/policy/cloud_policy_subsystem_unittest.cc b/chrome/browser/policy/cloud_policy_subsystem_unittest.cc
index 12147c9..261bf1d 100644
--- a/chrome/browser/policy/cloud_policy_subsystem_unittest.cc
+++ b/chrome/browser/policy/cloud_policy_subsystem_unittest.cc
@@ -140,7 +140,7 @@ class CloudPolicySubsystemTestBase : public testing::Test {
}
virtual void TearDown() {
- static_cast<TestingBrowserProcess*>(g_browser_process)->SetLocalState(NULL);
+ TestingBrowserProcess::GetGlobal()->SetLocalState(NULL);
cloud_policy_subsystem_->Shutdown();
cloud_policy_subsystem_.reset();
data_store_.reset();
diff --git a/chrome/browser/policy/user_policy_signin_service_unittest.cc b/chrome/browser/policy/user_policy_signin_service_unittest.cc
index 878c2b8..8a310f0 100644
--- a/chrome/browser/policy/user_policy_signin_service_unittest.cc
+++ b/chrome/browser/policy/user_policy_signin_service_unittest.cc
@@ -77,7 +77,7 @@ class UserPolicySigninServiceTest : public testing::Test {
local_state_.reset(new TestingPrefServiceSimple);
chrome::RegisterLocalState(local_state_.get());
- static_cast<TestingBrowserProcess*>(g_browser_process)->SetLocalState(
+ TestingBrowserProcess::GetGlobal()->SetLocalState(
local_state_.get());
// Create a testing profile with cloud-policy-on-signin enabled, and bring
@@ -110,7 +110,7 @@ class UserPolicySigninServiceTest : public testing::Test {
// Free the profile before we clear out the browser prefs.
profile_.reset();
TestingBrowserProcess* testing_browser_process =
- static_cast<TestingBrowserProcess*>(g_browser_process);
+ TestingBrowserProcess::GetGlobal();
testing_browser_process->SetLocalState(NULL);
local_state_.reset();
testing_browser_process->SetBrowserPolicyConnector(NULL);
diff --git a/chrome/browser/printing/cloud_print/test/cloud_print_proxy_process_browsertest.cc b/chrome/browser/printing/cloud_print/test/cloud_print_proxy_process_browsertest.cc
index 61cb2b8..321cc4d 100644
--- a/chrome/browser/printing/cloud_print/test/cloud_print_proxy_process_browsertest.cc
+++ b/chrome/browser/printing/cloud_print/test/cloud_print_proxy_process_browsertest.cc
@@ -463,7 +463,7 @@ TEST_F(CloudPrintProxyPolicyStartupTest, StartBrowserWithoutPolicy) {
Launch("CloudPrintMockService_StartEnabledWaitForQuit");
TestingBrowserProcess* browser_process =
- static_cast<TestingBrowserProcess*>(g_browser_process);
+ TestingBrowserProcess::GetGlobal();
TestingProfileManager profile_manager(browser_process);
ASSERT_TRUE(profile_manager.SetUp());
@@ -503,7 +503,7 @@ TEST_F(CloudPrintProxyPolicyStartupTest, StartBrowserWithPolicy) {
Launch("CloudPrintMockService_StartEnabledExpectDisabled");
TestingBrowserProcess* browser_process =
- static_cast<TestingBrowserProcess*>(g_browser_process);
+ TestingBrowserProcess::GetGlobal();
TestingProfileManager profile_manager(browser_process);
ASSERT_TRUE(profile_manager.SetUp());
diff --git a/chrome/browser/profiles/avatar_menu_model_unittest.cc b/chrome/browser/profiles/avatar_menu_model_unittest.cc
index 93d1c85..2f74f07 100644
--- a/chrome/browser/profiles/avatar_menu_model_unittest.cc
+++ b/chrome/browser/profiles/avatar_menu_model_unittest.cc
@@ -33,7 +33,7 @@ class MockObserver : public AvatarMenuModelObserver {
class AvatarMenuModelTest : public testing::Test {
public:
AvatarMenuModelTest()
- : manager_(static_cast<TestingBrowserProcess*>(g_browser_process)) {
+ : manager_(TestingBrowserProcess::GetGlobal()) {
}
virtual void SetUp() {
diff --git a/chrome/browser/profiles/off_the_record_profile_impl_unittest.cc b/chrome/browser/profiles/off_the_record_profile_impl_unittest.cc
index 7586981..69e1104 100644
--- a/chrome/browser/profiles/off_the_record_profile_impl_unittest.cc
+++ b/chrome/browser/profiles/off_the_record_profile_impl_unittest.cc
@@ -102,7 +102,7 @@ class OffTheRecordProfileImplTest : public BrowserWithTestWindowTest {
private:
TestingBrowserProcess* browser_process() {
- return static_cast<TestingBrowserProcess*>(g_browser_process);
+ return TestingBrowserProcess::GetGlobal();
}
scoped_ptr<PrefServiceSimple> prefs_;
diff --git a/chrome/browser/profiles/profile_info_cache_unittest.cc b/chrome/browser/profiles/profile_info_cache_unittest.cc
index 9b85561..3fd38f9 100644
--- a/chrome/browser/profiles/profile_info_cache_unittest.cc
+++ b/chrome/browser/profiles/profile_info_cache_unittest.cc
@@ -78,7 +78,7 @@ ProfileInfoCache* ProfileNameVerifierObserver::GetCache() {
ProfileInfoCacheTest::ProfileInfoCacheTest()
: testing_profile_manager_(
- static_cast<TestingBrowserProcess*>(g_browser_process)),
+ TestingBrowserProcess::GetGlobal()),
ui_thread_(BrowserThread::UI, &ui_loop_),
file_thread_(BrowserThread::FILE, &ui_loop_),
name_observer_(&testing_profile_manager_) {
diff --git a/chrome/browser/profiles/profile_manager_unittest.cc b/chrome/browser/profiles/profile_manager_unittest.cc
index 60c605e..a1463c5 100644
--- a/chrome/browser/profiles/profile_manager_unittest.cc
+++ b/chrome/browser/profiles/profile_manager_unittest.cc
@@ -90,7 +90,7 @@ class ProfileManagerTest : public testing::Test {
};
ProfileManagerTest()
- : local_state_(static_cast<TestingBrowserProcess*>(g_browser_process)),
+ : local_state_(TestingBrowserProcess::GetGlobal()),
extension_event_router_forwarder_(new extensions::EventRouterForwarder),
ui_thread_(BrowserThread::UI, &message_loop_),
db_thread_(BrowserThread::DB, &message_loop_),
@@ -101,14 +101,13 @@ class ProfileManagerTest : public testing::Test {
base::SystemMonitor::AllocateSystemIOPorts();
#endif
system_monitor_dummy_.reset(new base::SystemMonitor);
- static_cast<TestingBrowserProcess*>(g_browser_process)->SetIOThread(
- &io_thread_);
+ TestingBrowserProcess::GetGlobal()->SetIOThread(&io_thread_);
}
virtual void SetUp() {
// Create a new temporary directory, and store the path
ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
- static_cast<TestingBrowserProcess*>(g_browser_process)->SetProfileManager(
+ TestingBrowserProcess::GetGlobal()->SetProfileManager(
new testing::ProfileManager(temp_dir_.path()));
#if defined(OS_CHROMEOS)
@@ -118,8 +117,7 @@ class ProfileManagerTest : public testing::Test {
}
virtual void TearDown() {
- static_cast<TestingBrowserProcess*>(g_browser_process)->SetProfileManager(
- NULL);
+ TestingBrowserProcess::GetGlobal()->SetProfileManager(NULL);
message_loop_.RunUntilIdle();
}
@@ -227,8 +225,7 @@ TEST_F(ProfileManagerTest, CreateAndUseTwoProfiles) {
// Make sure any pending tasks run before we destroy the profiles.
message_loop_.RunUntilIdle();
- static_cast<TestingBrowserProcess*>(g_browser_process)->SetProfileManager(
- NULL);
+ TestingBrowserProcess::GetGlobal()->SetProfileManager(NULL);
// Make sure history cleans up correctly.
message_loop_.RunUntilIdle();
diff --git a/chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc b/chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc
index a232de9..47bda74 100644
--- a/chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc
+++ b/chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc
@@ -44,7 +44,7 @@ class ProfileShortcutManagerTest : public testing::Test {
ASSERT_TRUE(distribution_ != NULL);
TestingBrowserProcess* browser_process =
- static_cast<TestingBrowserProcess*>(g_browser_process);
+ TestingBrowserProcess::GetGlobal();
profile_manager_.reset(new TestingProfileManager(browser_process));
ASSERT_TRUE(profile_manager_->SetUp());
profile_info_cache_ = profile_manager_->profile_info_cache();
diff --git a/chrome/browser/signin/signin_manager_unittest.cc b/chrome/browser/signin/signin_manager_unittest.cc
index cc8e974..75aeafc 100644
--- a/chrome/browser/signin/signin_manager_unittest.cc
+++ b/chrome/browser/signin/signin_manager_unittest.cc
@@ -47,7 +47,7 @@ class SigninManagerTest : public TokenServiceTestHarness {
virtual void SetUp() OVERRIDE {
prefs_.reset(new TestingPrefServiceSimple);
chrome::RegisterLocalState(prefs_.get());
- static_cast<TestingBrowserProcess*>(g_browser_process)->SetLocalState(
+ TestingBrowserProcess::GetGlobal()->SetLocalState(
prefs_.get());
TokenServiceTestHarness::SetUp();
manager_.reset(new SigninManager());
@@ -62,7 +62,7 @@ class SigninManagerTest : public TokenServiceTestHarness {
// Destroy the SigninManager here, because it relies on profile_ which is
// freed in the base class.
manager_.reset(NULL);
- static_cast<TestingBrowserProcess*>(g_browser_process)->SetLocalState(NULL);
+ TestingBrowserProcess::GetGlobal()->SetLocalState(NULL);
prefs_.reset(NULL);
TokenServiceTestHarness::TearDown();
}
diff --git a/chrome/browser/signin/signin_names_io_thread_unittest.cc b/chrome/browser/signin/signin_names_io_thread_unittest.cc
index 4e03f53..db81724 100644
--- a/chrome/browser/signin/signin_names_io_thread_unittest.cc
+++ b/chrome/browser/signin/signin_names_io_thread_unittest.cc
@@ -39,7 +39,7 @@ SigninNamesOnIOThreadTest::SigninNamesOnIOThreadTest()
: ui_thread_(content::BrowserThread::UI, &message_loop_),
io_thread_(content::BrowserThread::IO, &message_loop_),
testing_profile_manager_(
- static_cast<TestingBrowserProcess*>(g_browser_process)) {
+ TestingBrowserProcess::GetGlobal()) {
}
void SigninNamesOnIOThreadTest::SetUp() {
diff --git a/chrome/browser/ui/bookmarks/bookmark_prompt_controller_unittest.cc b/chrome/browser/ui/bookmarks/bookmark_prompt_controller_unittest.cc
index 3b9bcd9..350fe1a 100644
--- a/chrome/browser/ui/bookmarks/bookmark_prompt_controller_unittest.cc
+++ b/chrome/browser/ui/bookmarks/bookmark_prompt_controller_unittest.cc
@@ -62,7 +62,7 @@ class BookmarkPromptControllerTest : public BrowserWithTestWindowTest {
virtual void SetUp() OVERRIDE {
set_window(new MyTestBrowserWindow);
- static_cast<TestingBrowserProcess*>(g_browser_process)->
+ TestingBrowserProcess::GetGlobal()->
SetBookmarkPromptController(new BookmarkPromptController);
BrowserWithTestWindowTest::SetUp();
static_cast<TestingProfile*>(browser()->profile())->
@@ -74,7 +74,7 @@ class BookmarkPromptControllerTest : public BrowserWithTestWindowTest {
}
virtual void TearDown() OVERRIDE {
- static_cast<TestingBrowserProcess*>(g_browser_process)->
+ TestingBrowserProcess::GetGlobal()->
SetBookmarkPromptController(NULL);
static_cast<TestingProfile*>(browser()->profile())->
DestroyHistoryService();
diff --git a/chrome/browser/ui/browser_command_controller_unittest.cc b/chrome/browser/ui/browser_command_controller_unittest.cc
index 447d2bd..9cc87b7 100644
--- a/chrome/browser/ui/browser_command_controller_unittest.cc
+++ b/chrome/browser/ui/browser_command_controller_unittest.cc
@@ -155,7 +155,7 @@ TEST_F(BrowserCommandControllerTest, AvatarMenuDisabledWhenOnlyOneProfile) {
return;
TestingProfileManager testing_profile_manager(
- static_cast<TestingBrowserProcess*>(g_browser_process));
+ TestingBrowserProcess::GetGlobal());
ASSERT_TRUE(testing_profile_manager.SetUp());
ProfileManager* profile_manager = testing_profile_manager.profile_manager();
diff --git a/chrome/browser/ui/chrome_select_file_policy_unittest.cc b/chrome/browser/ui/chrome_select_file_policy_unittest.cc
index 03c3e40..c6d220d 100644
--- a/chrome/browser/ui/chrome_select_file_policy_unittest.cc
+++ b/chrome/browser/ui/chrome_select_file_policy_unittest.cc
@@ -93,7 +93,7 @@ TEST_F(ChromeSelectFilePolicyTest, MAYBE_ExpectAsynchronousListenerCall) {
content::TestBrowserThread ui_thread(BrowserThread::UI, &message_loop);
ScopedTestingLocalState local_state(
- static_cast<TestingBrowserProcess*>(g_browser_process));
+ TestingBrowserProcess::GetGlobal());
scoped_ptr<FileSelectionUser> file_selection_user(new FileSelectionUser());
diff --git a/chrome/browser/ui/cocoa/browser/avatar_menu_bubble_controller_unittest.mm b/chrome/browser/ui/cocoa/browser/avatar_menu_bubble_controller_unittest.mm
index 9abbaa1..b4dd723 100644
--- a/chrome/browser/ui/cocoa/browser/avatar_menu_bubble_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/browser/avatar_menu_bubble_controller_unittest.mm
@@ -20,7 +20,7 @@
class AvatarMenuBubbleControllerTest : public CocoaTest {
public:
AvatarMenuBubbleControllerTest()
- : manager_(static_cast<TestingBrowserProcess*>(g_browser_process)) {
+ : manager_(TestingBrowserProcess::GetGlobal()) {
}
virtual void SetUp() {
diff --git a/chrome/browser/ui/cocoa/cocoa_profile_test.mm b/chrome/browser/ui/cocoa/cocoa_profile_test.mm
index f236bcc..de09de8 100644
--- a/chrome/browser/ui/cocoa/cocoa_profile_test.mm
+++ b/chrome/browser/ui/cocoa/cocoa_profile_test.mm
@@ -17,7 +17,7 @@ using content::BrowserThread;
CocoaProfileTest::CocoaProfileTest()
: ui_thread_(BrowserThread::UI, &message_loop_),
- profile_manager_(static_cast<TestingBrowserProcess*>(g_browser_process)),
+ profile_manager_(TestingBrowserProcess::GetGlobal()),
profile_(NULL),
file_user_blocking_thread_(new content::TestBrowserThread(
BrowserThread::FILE_USER_BLOCKING, &message_loop_)),
@@ -37,7 +37,7 @@ CocoaProfileTest::~CocoaProfileTest() {
// thread. If the scoper in TestingBrowserProcess, owned by ChromeTestSuite,
// were to delete the ProfileManager, the UI thread would at that point no
// longer exist.
- static_cast<TestingBrowserProcess*>(g_browser_process)->SetProfileManager(
+ TestingBrowserProcess::GetGlobal()->SetProfileManager(
NULL);
// Make sure any pending tasks run before we destroy other threads.
diff --git a/chrome/browser/ui/sync/one_click_signin_helper_unittest.cc b/chrome/browser/ui/sync/one_click_signin_helper_unittest.cc
index 4311b5a..2894025 100644
--- a/chrome/browser/ui/sync/one_click_signin_helper_unittest.cc
+++ b/chrome/browser/ui/sync/one_click_signin_helper_unittest.cc
@@ -290,7 +290,7 @@ class OneClickSigninHelperIOTest : public OneClickSigninHelperTest {
OneClickSigninHelperIOTest::OneClickSigninHelperIOTest()
: testing_profile_manager_(
- static_cast<TestingBrowserProcess*>(g_browser_process)),
+ TestingBrowserProcess::GetGlobal()),
valid_gaia_url_("https://accounts.google.com/"),
db_thread_(content::BrowserThread::DB, &message_loop_),
fub_thread_(content::BrowserThread::FILE_USER_BLOCKING, &message_loop_),
diff --git a/chrome/browser/ui/tab_contents/tab_contents_iterator_unittest.cc b/chrome/browser/ui/tab_contents/tab_contents_iterator_unittest.cc
index 634bdbe..a0faa92 100644
--- a/chrome/browser/ui/tab_contents/tab_contents_iterator_unittest.cc
+++ b/chrome/browser/ui/tab_contents/tab_contents_iterator_unittest.cc
@@ -154,7 +154,7 @@ TEST_F(BrowserListTest, MAYBE_AttemptRestart) {
false);
TestingBrowserProcess* testing_browser_process =
- static_cast<TestingBrowserProcess*>(g_browser_process);
+ TestingBrowserProcess::GetGlobal();
testing_browser_process->SetLocalState(&testing_pref_service);
ASSERT_TRUE(g_browser_process->local_state());
ProfileManager* profile_manager = new ProfileManager(FilePath());
diff --git a/chrome/browser/web_resource/promo_resource_service_mobile_ntp_unittest.cc b/chrome/browser/web_resource/promo_resource_service_mobile_ntp_unittest.cc
index 0ed340b..44910d8 100644
--- a/chrome/browser/web_resource/promo_resource_service_mobile_ntp_unittest.cc
+++ b/chrome/browser/web_resource/promo_resource_service_mobile_ntp_unittest.cc
@@ -25,13 +25,10 @@
class PromoResourceServiceMobileNtpTest : public testing::Test {
public:
+ // |promo_resource_service_| must be created after |local_state_|.
PromoResourceServiceMobileNtpTest()
- : local_state_(static_cast<TestingBrowserProcess*>(g_browser_process)) {
- static_cast<TestingBrowserProcess*>(g_browser_process)->SetLocalState(
- local_state_.Get());
- // |promo_resource_service_| must be created after local state is set.
- promo_resource_service_ = new PromoResourceService;
- }
+ : local_state_(TestingBrowserProcess::GetGlobal()),
+ promo_resource_service_(new PromoResourceService) {}
protected:
ScopedTestingLocalState local_state_;
@@ -41,8 +38,7 @@ class PromoResourceServiceMobileNtpTest : public testing::Test {
class NotificationPromoMobileNtpTest {
public:
- NotificationPromoMobileNtpTest() : received_notification_(false) {
- }
+ NotificationPromoMobileNtpTest() : received_notification_(false) {}
void Init(const std::string& json,
const std::string& promo_text,
diff --git a/chrome/browser/web_resource/promo_resource_service_unittest.cc b/chrome/browser/web_resource/promo_resource_service_unittest.cc
index 71f5b28..98529d5 100644
--- a/chrome/browser/web_resource/promo_resource_service_unittest.cc
+++ b/chrome/browser/web_resource/promo_resource_service_unittest.cc
@@ -27,13 +27,10 @@
class PromoResourceServiceTest : public testing::Test {
public:
+ // |promo_resource_service_| must be created after |local_state_|.
PromoResourceServiceTest()
- : local_state_(static_cast<TestingBrowserProcess*>(g_browser_process)) {
- static_cast<TestingBrowserProcess*>(g_browser_process)->SetLocalState(
- local_state_.Get());
- // |promo_resource_service_| must be created after local state is set.
- promo_resource_service_ = new PromoResourceService;
- }
+ : local_state_(TestingBrowserProcess::GetGlobal()),
+ promo_resource_service_(new PromoResourceService) {}
protected:
ScopedTestingLocalState local_state_;
@@ -53,8 +50,7 @@ class NotificationPromoTest {
time_slice_(0),
max_group_(0),
max_views_(0),
- closed_(false) {
- }
+ closed_(false) {}
void Init(const std::string& json,
const std::string& promo_text,
diff --git a/chrome/test/base/testing_browser_process.cc b/chrome/test/base/testing_browser_process.cc
index c52dc37..c581437 100644
--- a/chrome/test/base/testing_browser_process.cc
+++ b/chrome/test/base/testing_browser_process.cc
@@ -30,6 +30,11 @@
#include "chrome/browser/policy/policy_service_stub.h"
#endif // defined(ENABLE_CONFIGURATION_POLICY)
+// static
+TestingBrowserProcess* TestingBrowserProcess::GetGlobal() {
+ return static_cast<TestingBrowserProcess*>(g_browser_process);
+}
+
TestingBrowserProcess::TestingBrowserProcess()
: notification_service_(content::NotificationService::Create()),
module_ref_count_(0),
diff --git a/chrome/test/base/testing_browser_process.h b/chrome/test/base/testing_browser_process.h
index 27c3601..40409d3 100644
--- a/chrome/test/base/testing_browser_process.h
+++ b/chrome/test/base/testing_browser_process.h
@@ -43,6 +43,9 @@ class TestingBrowserProcess : public BrowserProcess {
TestingBrowserProcess();
virtual ~TestingBrowserProcess();
+ // Convenience method to get g_browser_process as a TestingBrowserProcess*.
+ static TestingBrowserProcess* GetGlobal();
+
virtual void ResourceDispatcherHostCreated() OVERRIDE;
virtual void EndSession() OVERRIDE;
virtual MetricsService* metrics_service() OVERRIDE;