Commit 20ddac71 authored by marja@chromium.org's avatar marja@chromium.org

Better session restore: Remove a pointless test.

The test wasn't testing what it was supposed to; it didn't destroy the storage
systems of a Profile and recreate them. We can't test crash recovery like this.

BUG=172770
R=jochen


Review URL: https://chromiumcodereview.appspot.com/12208131

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@182213 0039d316-1c4b-4281-b951-d872f2087c98
parent 9b80dbb1
...@@ -525,80 +525,3 @@ IN_PROC_BROWSER_TEST_F(NoSessionRestoreTest, CookiesClearedOnExit) { ...@@ -525,80 +525,3 @@ IN_PROC_BROWSER_TEST_F(NoSessionRestoreTest, CookiesClearedOnExit) {
EXPECT_EQ(std::string(chrome::kAboutBlankURL), web_contents->GetURL().spec()); EXPECT_EQ(std::string(chrome::kAboutBlankURL), web_contents->GetURL().spec());
StoreDataWithPage("local_storage.html"); StoreDataWithPage("local_storage.html");
} }
class BetterSessionRestoreCrashTest : public BetterSessionRestoreTest {
public:
BetterSessionRestoreCrashTest() { }
virtual void SetUpOnMainThread() OVERRIDE {
BetterSessionRestoreTest::SetUpOnMainThread();
SessionStartupPref::SetStartupPref(
browser()->profile(), SessionStartupPref(SessionStartupPref::DEFAULT));
}
protected:
void CrashTestWithPage(const std::string& filename) {
Profile* profile = browser()->profile();
Browser* browser_before_restore = browser();
ASSERT_TRUE(browser_before_restore);
StoreDataWithPage(browser_before_restore, filename);
// Session restore data is written lazily but we cannot restore data that
// was not saved. Be less lazy for the test.
SessionServiceFactory::GetForProfile(profile)->Save();
// Simulate a crash and a restart.
browser_before_restore->window()->Close();
SessionServiceFactory::GetForProfile(profile)->backend()->
MoveCurrentSessionToLastSession();
ProfileImpl* profile_impl = static_cast<ProfileImpl*>(profile);
profile_impl->last_session_exit_type_ = Profile::EXIT_CRASHED;
#if defined(OS_CHROMEOS)
profile_impl->chromeos_enterprise_extension_observer_.reset(NULL);
#endif
StartupBrowserCreator::ClearLaunchedProfilesForTesting();
CommandLine dummy(CommandLine::NO_PROGRAM);
dummy.AppendSwitchASCII(switches::kTestType, "browser");
int return_code;
StartupBrowserCreator browser_creator;
std::vector<Profile*> last_opened_profiles(1, profile);
browser_creator.Start(dummy,
g_browser_process->profile_manager()->user_data_dir(),
profile, last_opened_profiles, &return_code);
// The browser displays an info bar, use it to restore the session.
Browser* browser_after_restore =
FindOneOtherBrowserForProfile(profile, browser_before_restore);
ASSERT_TRUE(browser_after_restore);
content::WebContents* web_contents =
browser_after_restore->tab_strip_model()->GetActiveWebContents();
ASSERT_TRUE(web_contents);
EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), web_contents->GetURL());
InfoBarService* infobar_service =
InfoBarService::FromWebContents(web_contents);
EXPECT_EQ(1U, infobar_service->GetInfoBarCount());
infobar_service->GetInfoBarDelegateAt(0)->AsConfirmInfoBarDelegate()->
Accept();
// Session restore is done ascynhronously.
base::RunLoop loop;
loop.RunUntilIdle();
// Check the restored page.
web_contents =
browser_after_restore->tab_strip_model()->GetWebContentsAt(0);
ASSERT_TRUE(web_contents);
EXPECT_EQ(GURL(fake_server_address() + test_path() + filename),
web_contents->GetURL());
CheckReloadedPageRestored(browser_after_restore);
}
private:
DISALLOW_COPY_AND_ASSIGN(BetterSessionRestoreCrashTest);
};
// http://crbug.com/172770
IN_PROC_BROWSER_TEST_F(BetterSessionRestoreCrashTest, DISABLED_SessionCookies) {
CrashTestWithPage("session_cookies.html");
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment