OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 // Check that form data with a password field is cleared after wrench menu quit. | 572 // Check that form data with a password field is cleared after wrench menu quit. |
573 IN_PROC_BROWSER_TEST_F(ContinueWhereILeftOffTest, | 573 IN_PROC_BROWSER_TEST_F(ContinueWhereILeftOffTest, |
574 PostWithPasswordCloseAllBrowsers) { | 574 PostWithPasswordCloseAllBrowsers) { |
575 PostFormWithPage("post_with_password.html", true); | 575 PostFormWithPage("post_with_password.html", true); |
576 Browser* new_browser = QuitBrowserAndRestore(browser(), true); | 576 Browser* new_browser = QuitBrowserAndRestore(browser(), true); |
577 CheckReloadedPageRestored(new_browser); | 577 CheckReloadedPageRestored(new_browser); |
578 // The form data contained passwords, so it's removed completely. | 578 // The form data contained passwords, so it's removed completely. |
579 CheckFormRestored(new_browser, false, false); | 579 CheckFormRestored(new_browser, false, false); |
580 } | 580 } |
581 | 581 |
| 582 // ChromeOS does not override the SessionStartupPreference upon controlled |
| 583 // system restart. |
| 584 #if !defined(OS_CHROMEOS) |
582 class RestartTest : public BetterSessionRestoreTest { | 585 class RestartTest : public BetterSessionRestoreTest { |
583 public: | 586 public: |
584 RestartTest() { } | 587 RestartTest() { } |
585 virtual ~RestartTest() { } | 588 virtual ~RestartTest() { } |
586 protected: | 589 protected: |
587 void Restart() { | 590 void Restart() { |
588 // Simluate restarting the browser, but let the test exit peacefully. | 591 // Simulate restarting the browser, but let the test exit peacefully. |
589 for (chrome::BrowserIterator it; !it.done(); it.Next()) | 592 for (chrome::BrowserIterator it; !it.done(); it.Next()) |
590 content::BrowserContext::SaveSessionState(it->profile()); | 593 content::BrowserContext::SaveSessionState(it->profile()); |
591 PrefService* pref_service = g_browser_process->local_state(); | 594 PrefService* pref_service = g_browser_process->local_state(); |
592 pref_service->SetBoolean(prefs::kWasRestarted, true); | 595 pref_service->SetBoolean(prefs::kWasRestarted, true); |
593 #if defined(OS_WIN) | 596 #if defined(OS_WIN) |
594 if (pref_service->HasPrefPath(prefs::kRelaunchMode)) | 597 if (pref_service->HasPrefPath(prefs::kRelaunchMode)) |
595 pref_service->ClearPref(prefs::kRelaunchMode); | 598 pref_service->ClearPref(prefs::kRelaunchMode); |
596 #endif | 599 #endif |
597 } | 600 } |
598 | 601 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 | 654 |
652 IN_PROC_BROWSER_TEST_F(RestartTest, PRE_PostWithPassword) { | 655 IN_PROC_BROWSER_TEST_F(RestartTest, PRE_PostWithPassword) { |
653 PostFormWithPage("post_with_password.html", true); | 656 PostFormWithPage("post_with_password.html", true); |
654 Restart(); | 657 Restart(); |
655 } | 658 } |
656 | 659 |
657 IN_PROC_BROWSER_TEST_F(RestartTest, PostWithPassword) { | 660 IN_PROC_BROWSER_TEST_F(RestartTest, PostWithPassword) { |
658 // The form data contained passwords, so it's removed completely. | 661 // The form data contained passwords, so it's removed completely. |
659 CheckFormRestored(false, false); | 662 CheckFormRestored(false, false); |
660 } | 663 } |
| 664 #endif |
661 | 665 |
662 // These tests ensure that the Better Session Restore features are not triggered | 666 // These tests ensure that the Better Session Restore features are not triggered |
663 // when they shouldn't be. | 667 // when they shouldn't be. |
664 class NoSessionRestoreTest : public BetterSessionRestoreTest { | 668 class NoSessionRestoreTest : public BetterSessionRestoreTest { |
665 public: | 669 public: |
666 NoSessionRestoreTest() { } | 670 NoSessionRestoreTest() { } |
667 | 671 |
668 virtual void SetUpOnMainThread() override { | 672 virtual void SetUpOnMainThread() override { |
669 BetterSessionRestoreTest::SetUpOnMainThread(); | 673 BetterSessionRestoreTest::SetUpOnMainThread(); |
670 SessionStartupPref::SetStartupPref( | 674 SessionStartupPref::SetStartupPref( |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
834 CookieSettings::Factory::GetForProfile(new_browser->profile())-> | 838 CookieSettings::Factory::GetForProfile(new_browser->profile())-> |
835 SetDefaultCookieSetting(CONTENT_SETTING_SESSION_ONLY); | 839 SetDefaultCookieSetting(CONTENT_SETTING_SESSION_ONLY); |
836 // ... even if background mode is active. | 840 // ... even if background mode is active. |
837 EnableBackgroundMode(); | 841 EnableBackgroundMode(); |
838 new_browser = QuitBrowserAndRestore(new_browser, true); | 842 new_browser = QuitBrowserAndRestore(new_browser, true); |
839 StoreDataWithPage(new_browser, "cookies.html"); | 843 StoreDataWithPage(new_browser, "cookies.html"); |
840 DisableBackgroundMode(); | 844 DisableBackgroundMode(); |
841 new_browser = QuitBrowserAndRestore(new_browser, true); | 845 new_browser = QuitBrowserAndRestore(new_browser, true); |
842 StoreDataWithPage(new_browser, "cookies.html"); | 846 StoreDataWithPage(new_browser, "cookies.html"); |
843 } | 847 } |
OLD | NEW |