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

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: . 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
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 649f4dc1f51d38b396f48d6d6f04a330cf147b54..780ea42e0539bc378bb16488917ca9b0ec354c02 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"
@@ -304,4 +307,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)

Powered by Google App Engine
This is Rietveld 408576698