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

Unified Diff: chrome/browser/ui/browser_init_browsertest.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.cc ('k') | chrome/browser/ui/browser_list_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/browser_init_browsertest.cc
diff --git a/chrome/browser/ui/browser_init_browsertest.cc b/chrome/browser/ui/browser_init_browsertest.cc
index f04fc8bf63aa6e1a2538a59f99d9af72ca232b7c..4f16d2dd82af94858d6857626d0756fd77b6a890 100644
--- a/chrome/browser/ui/browser_init_browsertest.cc
+++ b/chrome/browser/ui/browser_init_browsertest.cc
@@ -5,9 +5,11 @@
#include "base/command_line.h"
#include "base/file_path.h"
#include "base/utf_string_conversions.h"
+#include "chrome/browser/browser_process.h"
#include "chrome/browser/extensions/extension_browsertest.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/first_run/first_run.h"
+#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/prefs/session_startup_pref.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
@@ -15,6 +17,7 @@
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/common/chrome_switches.h"
+#include "chrome/common/pref_names.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/browser/tab_contents/tab_contents.h"
@@ -309,4 +312,24 @@ IN_PROC_BROWSER_TEST_F(BrowserInitTest, OpenAppShortcutPanel) {
std::string::npos) << new_browser->app_name_;
}
+IN_PROC_BROWSER_TEST_F(BrowserInitTest, ReadingWasRestartedAfterRestart) {
+ // Tests that BrowserInit::WasRestarted reads and resets the preference
+ // kWasRestarted correctly.
+ PrefService* pref_service = g_browser_process->local_state();
+ pref_service->SetBoolean(prefs::kWasRestarted, true);
+ EXPECT_TRUE(BrowserInit::WasRestarted());
+ EXPECT_FALSE(pref_service->GetBoolean(prefs::kWasRestarted));
+ EXPECT_TRUE(BrowserInit::WasRestarted());
+}
+
+IN_PROC_BROWSER_TEST_F(BrowserInitTest, ReadingWasRestartedAfterNormalStart) {
+ // Tests that BrowserInit::WasRestarted reads and resets the preference
+ // kWasRestarted correctly.
+ PrefService* pref_service = g_browser_process->local_state();
+ pref_service->SetBoolean(prefs::kWasRestarted, false);
+ EXPECT_FALSE(BrowserInit::WasRestarted());
+ EXPECT_FALSE(pref_service->GetBoolean(prefs::kWasRestarted));
+ EXPECT_FALSE(BrowserInit::WasRestarted());
+}
+
#endif // !defined(OS_MACOSX)
« no previous file with comments | « chrome/browser/ui/browser_init.cc ('k') | chrome/browser/ui/browser_list_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698