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

Unified Diff: chrome/browser/ui/browser_list_unittest.cc

Issue 8929027: Follow-up changes to http://codereview.chromium.org/8937001 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Disabling the AttemptRestart test on ChromiumOS. Created 9 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/browser_init_browsertest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..7cff8a5626085e8857be36e8df2406c54448dca8 100644
--- a/chrome/browser/ui/browser_list_unittest.cc
+++ b/chrome/browser/ui/browser_list_unittest.cc
@@ -2,12 +2,19 @@
// 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/browser_shutdown.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 +239,33 @@ TEST_F(BrowserListTest, TabContentsIteratorBackgroundPrinting) {
EXPECT_EQ(0U, CountAllTabs());
}
#endif
+
+#if defined(OS_CHROMEOS)
+// Calling AttemptRestart on ChromeOS will exit the test.
+#define MAYBE_AttemptRestart DISABLED_AttemptRestart
+#else
+#define MAYBE_AttemptRestart AttemptRestart
+#endif
+
+TEST_F(BrowserListTest, MAYBE_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();
+ // Cancel the effects of us calling BrowserList::AttemptRestart. Otherwise
+ // tests ran after this one will fail.
+ browser_shutdown::SetTryingToQuit(false);
+
+ EXPECT_TRUE(testing_pref_service.GetBoolean(prefs::kWasRestarted));
+ testing_browser_process->SetLocalState(NULL);
+}
« no previous file with comments | « chrome/browser/ui/browser_init_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698