| OLD | NEW |
| 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/browser/ui/tab_contents/tab_contents_iterator.h" | 5 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" |
| 6 | 6 |
| 7 #include "chrome/browser/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
| 8 #include "chrome/browser/browser_shutdown.h" | 8 #include "chrome/browser/browser_shutdown.h" |
| 9 #include "chrome/browser/profiles/profile_manager.h" | 9 #include "chrome/browser/profiles/profile_manager.h" |
| 10 #include "chrome/browser/ui/browser_commands.h" | 10 #include "chrome/browser/ui/browser_commands.h" |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 #endif | 147 #endif |
| 148 | 148 |
| 149 TEST_F(BrowserListTest, MAYBE_AttemptRestart) { | 149 TEST_F(BrowserListTest, MAYBE_AttemptRestart) { |
| 150 ASSERT_TRUE(g_browser_process); | 150 ASSERT_TRUE(g_browser_process); |
| 151 TestingPrefServiceSimple testing_pref_service; | 151 TestingPrefServiceSimple testing_pref_service; |
| 152 testing_pref_service.RegisterBooleanPref(prefs::kWasRestarted, false); | 152 testing_pref_service.RegisterBooleanPref(prefs::kWasRestarted, false); |
| 153 testing_pref_service.RegisterBooleanPref(prefs::kRestartLastSessionOnShutdown, | 153 testing_pref_service.RegisterBooleanPref(prefs::kRestartLastSessionOnShutdown, |
| 154 false); | 154 false); |
| 155 | 155 |
| 156 TestingBrowserProcess* testing_browser_process = | 156 TestingBrowserProcess* testing_browser_process = |
| 157 static_cast<TestingBrowserProcess*>(g_browser_process); | 157 TestingBrowserProcess::GetGlobal(); |
| 158 testing_browser_process->SetLocalState(&testing_pref_service); | 158 testing_browser_process->SetLocalState(&testing_pref_service); |
| 159 ASSERT_TRUE(g_browser_process->local_state()); | 159 ASSERT_TRUE(g_browser_process->local_state()); |
| 160 ProfileManager* profile_manager = new ProfileManager(FilePath()); | 160 ProfileManager* profile_manager = new ProfileManager(FilePath()); |
| 161 testing_browser_process->SetProfileManager(profile_manager); | 161 testing_browser_process->SetProfileManager(profile_manager); |
| 162 | 162 |
| 163 browser::AttemptRestart(); | 163 browser::AttemptRestart(); |
| 164 // Cancel the effects of us calling browser::AttemptRestart. Otherwise tests | 164 // Cancel the effects of us calling browser::AttemptRestart. Otherwise tests |
| 165 // ran after this one will fail. | 165 // ran after this one will fail. |
| 166 browser_shutdown::SetTryingToQuit(false); | 166 browser_shutdown::SetTryingToQuit(false); |
| 167 | 167 |
| 168 EXPECT_TRUE(testing_pref_service.GetBoolean(prefs::kWasRestarted)); | 168 EXPECT_TRUE(testing_pref_service.GetBoolean(prefs::kWasRestarted)); |
| 169 testing_browser_process->SetLocalState(NULL); | 169 testing_browser_process->SetLocalState(NULL); |
| 170 } | 170 } |
| OLD | NEW |