| 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  142 #if defined(OS_CHROMEOS) |  142 #if defined(OS_CHROMEOS) | 
|  143 // Calling AttemptRestart on ChromeOS will exit the test. |  143 // Calling AttemptRestart on ChromeOS will exit the test. | 
|  144 #define MAYBE_AttemptRestart DISABLED_AttemptRestart |  144 #define MAYBE_AttemptRestart DISABLED_AttemptRestart | 
|  145 #else |  145 #else | 
|  146 #define MAYBE_AttemptRestart AttemptRestart |  146 #define MAYBE_AttemptRestart AttemptRestart | 
|  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.registrar()->RegisterBooleanPref( | 
|  153   testing_pref_service.RegisterBooleanPref(prefs::kRestartLastSessionOnShutdown, |  153       prefs::kWasRestarted, false); | 
|  154                                            false); |  154   testing_pref_service.registrar()->RegisterBooleanPref( | 
 |  155       prefs::kRestartLastSessionOnShutdown, | 
 |  156       false); | 
|  155  |  157  | 
|  156   TestingBrowserProcess* testing_browser_process = |  158   TestingBrowserProcess* testing_browser_process = | 
|  157       static_cast<TestingBrowserProcess*>(g_browser_process); |  159       static_cast<TestingBrowserProcess*>(g_browser_process); | 
|  158   testing_browser_process->SetLocalState(&testing_pref_service); |  160   testing_browser_process->SetLocalState(&testing_pref_service); | 
|  159   ASSERT_TRUE(g_browser_process->local_state()); |  161   ASSERT_TRUE(g_browser_process->local_state()); | 
|  160   ProfileManager* profile_manager = new ProfileManager(FilePath()); |  162   ProfileManager* profile_manager = new ProfileManager(FilePath()); | 
|  161   testing_browser_process->SetProfileManager(profile_manager); |  163   testing_browser_process->SetProfileManager(profile_manager); | 
|  162  |  164  | 
|  163   browser::AttemptRestart(); |  165   browser::AttemptRestart(); | 
|  164   // Cancel the effects of us calling browser::AttemptRestart. Otherwise tests |  166   // Cancel the effects of us calling browser::AttemptRestart. Otherwise tests | 
|  165   // ran after this one will fail. |  167   // ran after this one will fail. | 
|  166   browser_shutdown::SetTryingToQuit(false); |  168   browser_shutdown::SetTryingToQuit(false); | 
|  167  |  169  | 
|  168   EXPECT_TRUE(testing_pref_service.GetBoolean(prefs::kWasRestarted)); |  170   EXPECT_TRUE(testing_pref_service.GetBoolean(prefs::kWasRestarted)); | 
|  169   testing_browser_process->SetLocalState(NULL); |  171   testing_browser_process->SetLocalState(NULL); | 
|  170 } |  172 } | 
| OLD | NEW |