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

Unified Diff: chrome/browser/sessions/session_restore_browsertest_chromeos.cc

Issue 653773003: Fixing problem where a session restore gets performed even though users don't want it (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months 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/sessions/session_restore_browsertest_chromeos.cc
diff --git a/chrome/browser/sessions/session_restore_browsertest_chromeos.cc b/chrome/browser/sessions/session_restore_browsertest_chromeos.cc
index 67c97ad76737c85d7d2c9c60298d521c21bf3397..b26f53ca0b535fecc97a54e98bfa1f29a685843f 100644
--- a/chrome/browser/sessions/session_restore_browsertest_chromeos.cc
+++ b/chrome/browser/sessions/session_restore_browsertest_chromeos.cc
@@ -5,6 +5,7 @@
#include <list>
#include <vector>
+#include "base/command_line.h"
#include "base/prefs/pref_service.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_notification_types.h"
@@ -14,6 +15,7 @@
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/host_desktop.h"
#include "chrome/common/chrome_paths.h"
+#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "components/sessions/serialized_navigation_entry_test_helper.h"
@@ -67,10 +69,10 @@ class SessionRestoreTestChromeOS : public InProcessBrowserTest {
name, trusted, gfx::Rect(), profile(), chrome::GetActiveDesktop());
}
- // Simluate restarting the browser
- void SetRestart() {
- PrefService* pref_service = g_browser_process->local_state();
- pref_service->SetBoolean(prefs::kWasRestarted, true);
+ // Turn on session restore before we restart.
+ void TurnOnSessionRestore() {
+ SessionStartupPref::SetStartupPref(
+ browser()->profile(), SessionStartupPref(SessionStartupPref::LAST));
}
Profile* profile() { return browser()->profile(); }
@@ -91,7 +93,7 @@ IN_PROC_BROWSER_TEST_F(SessionRestoreTestChromeOS, PRE_RestoreBrowserWindows) {
// Create a third incognito browser window which should not get restored.
CreateBrowserWithParams(Browser::CreateParams(
profile()->GetOffTheRecordProfile(), chrome::GetActiveDesktop()));
- SetRestart();
+ TurnOnSessionRestore();
}
IN_PROC_BROWSER_TEST_F(SessionRestoreTestChromeOS, RestoreBrowserWindows) {
@@ -115,7 +117,7 @@ IN_PROC_BROWSER_TEST_F(SessionRestoreTestChromeOS, PRE_RestoreAppsV1) {
// Create a third untrusted (child) app3 popup. This should not get restored.
CreateBrowserWithParams(CreateParamsForApp(test_app_popup_name2, false));
- SetRestart();
+ TurnOnSessionRestore();
}
IN_PROC_BROWSER_TEST_F(SessionRestoreTestChromeOS, RestoreAppsV1) {
@@ -154,7 +156,7 @@ IN_PROC_BROWSER_TEST_F(SessionRestoreTestChromeOS, PRE_RestoreMaximized) {
EXPECT_FALSE(app_browser1->window()->IsMaximized());
EXPECT_TRUE(app_browser2->window()->IsMaximized());
- SetRestart();
+ TurnOnSessionRestore();
}
IN_PROC_BROWSER_TEST_F(SessionRestoreTestChromeOS, RestoreMaximized) {

Powered by Google App Engine
This is Rietveld 408576698