#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"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/host_desktop.h"
#include "chrome/common/chrome_paths.h"
-#include "chrome/common/pref_names.h"
+#include "chrome/common/chrome_switches.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "components/sessions/serialized_navigation_entry_test_helper.h"
#include "content/public/browser/notification_service.h"
virtual ~SessionRestoreTestChromeOS() {}
protected:
- virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE {
+ virtual void SetUpCommandLine(base::CommandLine* command_line) override {
InProcessBrowserTest::SetUpCommandLine(command_line);
}
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(); }
// 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) {
// 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) {
EXPECT_FALSE(app_browser1->window()->IsMaximized());
EXPECT_TRUE(app_browser2->window()->IsMaximized());
- SetRestart();
+ TurnOnSessionRestore();
}
IN_PROC_BROWSER_TEST_F(SessionRestoreTestChromeOS, RestoreMaximized) {