| Index: chrome/browser/ui/browser_list_unittest.cc
|
| diff --git a/chrome/browser/ui/browser_list_unittest.cc b/chrome/browser/ui/browser_list_unittest.cc
|
| index ca5d26c74c4346517db1fdf2fdd3cbdb88a990eb..3f11a7217c5709e0bb8d18b01d0f43964787cfbf 100644
|
| --- a/chrome/browser/ui/browser_list_unittest.cc
|
| +++ b/chrome/browser/ui/browser_list_unittest.cc
|
| @@ -2,12 +2,18 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| +#include "chrome/browser/browser_process.h"
|
| +#include "chrome/browser/prefs/pref_service.h"
|
| #include "chrome/browser/printing/background_printing_manager.h"
|
| +#include "chrome/browser/profiles/profile_manager.h"
|
| #include "chrome/browser/ui/browser_list.h"
|
| #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
|
| +#include "chrome/common/pref_names.h"
|
| #include "chrome/common/url_constants.h"
|
| #include "chrome/test/base/browser_with_test_window_test.h"
|
| #include "chrome/test/base/testing_browser_process.h"
|
| +#include "chrome/test/base/testing_pref_service.h"
|
| +#include "chrome/test/base/testing_profile_manager.h"
|
| #include "content/browser/tab_contents/tab_contents.h"
|
|
|
| typedef BrowserWithTestWindowTest BrowserListTest;
|
| @@ -232,3 +238,22 @@ TEST_F(BrowserListTest, TabContentsIteratorBackgroundPrinting) {
|
| EXPECT_EQ(0U, CountAllTabs());
|
| }
|
| #endif
|
| +
|
| +TEST_F(BrowserListTest, AttemptRestart) {
|
| + ASSERT_TRUE(g_browser_process);
|
| + TestingPrefService testing_pref_service;
|
| + testing_pref_service.RegisterBooleanPref(prefs::kWasRestarted, false);
|
| + testing_pref_service.RegisterBooleanPref(prefs::kRestartLastSessionOnShutdown,
|
| + false);
|
| +
|
| + TestingBrowserProcess* testing_browser_process =
|
| + static_cast<TestingBrowserProcess*>(g_browser_process);
|
| + testing_browser_process->SetLocalState(&testing_pref_service);
|
| + ASSERT_TRUE(g_browser_process->local_state());
|
| + ProfileManager* profile_manager = new ProfileManager(FilePath());
|
| + testing_browser_process->SetProfileManager(profile_manager);
|
| +
|
| + BrowserList::AttemptRestart();
|
| + EXPECT_TRUE(testing_pref_service.GetBoolean(prefs::kWasRestarted));
|
| + testing_browser_process->SetLocalState(NULL);
|
| +}
|
|
|