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/file_util.h" | 6 #include "base/file_util.h" |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.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 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 DISALLOW_COPY_AND_ASSIGN(NoSessionRestoreTest); | 673 DISALLOW_COPY_AND_ASSIGN(NoSessionRestoreTest); |
674 }; | 674 }; |
675 | 675 |
676 IN_PROC_BROWSER_TEST_F(NoSessionRestoreTest, PRE_SessionCookies) { | 676 IN_PROC_BROWSER_TEST_F(NoSessionRestoreTest, PRE_SessionCookies) { |
677 StoreDataWithPage("session_cookies.html"); | 677 StoreDataWithPage("session_cookies.html"); |
678 } | 678 } |
679 | 679 |
680 IN_PROC_BROWSER_TEST_F(NoSessionRestoreTest, SessionCookies) { | 680 IN_PROC_BROWSER_TEST_F(NoSessionRestoreTest, SessionCookies) { |
681 content::WebContents* web_contents = | 681 content::WebContents* web_contents = |
682 browser()->tab_strip_model()->GetActiveWebContents(); | 682 browser()->tab_strip_model()->GetActiveWebContents(); |
683 EXPECT_EQ(std::string(content::kAboutBlankURL), | 683 EXPECT_EQ(std::string(url::kAboutBlankURL), web_contents->GetURL().spec()); |
684 web_contents->GetURL().spec()); | |
685 // When we navigate to the page again, it doens't see the data previously | 684 // When we navigate to the page again, it doens't see the data previously |
686 // stored. | 685 // stored. |
687 StoreDataWithPage("session_cookies.html"); | 686 StoreDataWithPage("session_cookies.html"); |
688 } | 687 } |
689 | 688 |
690 IN_PROC_BROWSER_TEST_F(NoSessionRestoreTest, PRE_SessionStorage) { | 689 IN_PROC_BROWSER_TEST_F(NoSessionRestoreTest, PRE_SessionStorage) { |
691 StoreDataWithPage("session_storage.html"); | 690 StoreDataWithPage("session_storage.html"); |
692 } | 691 } |
693 | 692 |
694 IN_PROC_BROWSER_TEST_F(NoSessionRestoreTest, SessionStorage) { | 693 IN_PROC_BROWSER_TEST_F(NoSessionRestoreTest, SessionStorage) { |
695 content::WebContents* web_contents = | 694 content::WebContents* web_contents = |
696 browser()->tab_strip_model()->GetActiveWebContents(); | 695 browser()->tab_strip_model()->GetActiveWebContents(); |
697 EXPECT_EQ(std::string(content::kAboutBlankURL), | 696 EXPECT_EQ(std::string(url::kAboutBlankURL), web_contents->GetURL().spec()); |
698 web_contents->GetURL().spec()); | |
699 StoreDataWithPage("session_storage.html"); | 697 StoreDataWithPage("session_storage.html"); |
700 } | 698 } |
701 | 699 |
702 IN_PROC_BROWSER_TEST_F(NoSessionRestoreTest, | 700 IN_PROC_BROWSER_TEST_F(NoSessionRestoreTest, |
703 PRE_PRE_LocalStorageClearedOnExit) { | 701 PRE_PRE_LocalStorageClearedOnExit) { |
704 StoreDataWithPage("local_storage.html"); | 702 StoreDataWithPage("local_storage.html"); |
705 } | 703 } |
706 | 704 |
707 IN_PROC_BROWSER_TEST_F(NoSessionRestoreTest, PRE_LocalStorageClearedOnExit) { | 705 IN_PROC_BROWSER_TEST_F(NoSessionRestoreTest, PRE_LocalStorageClearedOnExit) { |
708 // Normally localStorage is persisted. | 706 // Normally localStorage is persisted. |
709 content::WebContents* web_contents = | 707 content::WebContents* web_contents = |
710 browser()->tab_strip_model()->GetActiveWebContents(); | 708 browser()->tab_strip_model()->GetActiveWebContents(); |
711 EXPECT_EQ(std::string(content::kAboutBlankURL), | 709 EXPECT_EQ(std::string(url::kAboutBlankURL), web_contents->GetURL().spec()); |
712 web_contents->GetURL().spec()); | |
713 NavigateAndCheckStoredData("local_storage.html"); | 710 NavigateAndCheckStoredData("local_storage.html"); |
714 // ... but not if it's set to clear on exit. | 711 // ... but not if it's set to clear on exit. |
715 CookieSettings::Factory::GetForProfile(browser()->profile())-> | 712 CookieSettings::Factory::GetForProfile(browser()->profile())-> |
716 SetDefaultCookieSetting(CONTENT_SETTING_SESSION_ONLY); | 713 SetDefaultCookieSetting(CONTENT_SETTING_SESSION_ONLY); |
717 } | 714 } |
718 | 715 |
719 IN_PROC_BROWSER_TEST_F(NoSessionRestoreTest, LocalStorageClearedOnExit) { | 716 IN_PROC_BROWSER_TEST_F(NoSessionRestoreTest, LocalStorageClearedOnExit) { |
720 content::WebContents* web_contents = | 717 content::WebContents* web_contents = |
721 browser()->tab_strip_model()->GetActiveWebContents(); | 718 browser()->tab_strip_model()->GetActiveWebContents(); |
722 EXPECT_EQ(std::string(content::kAboutBlankURL), | 719 EXPECT_EQ(std::string(url::kAboutBlankURL), web_contents->GetURL().spec()); |
723 web_contents->GetURL().spec()); | |
724 StoreDataWithPage("local_storage.html"); | 720 StoreDataWithPage("local_storage.html"); |
725 } | 721 } |
726 | 722 |
727 IN_PROC_BROWSER_TEST_F(NoSessionRestoreTest, PRE_PRE_CookiesClearedOnExit) { | 723 IN_PROC_BROWSER_TEST_F(NoSessionRestoreTest, PRE_PRE_CookiesClearedOnExit) { |
728 StoreDataWithPage("cookies.html"); | 724 StoreDataWithPage("cookies.html"); |
729 } | 725 } |
730 | 726 |
731 IN_PROC_BROWSER_TEST_F(NoSessionRestoreTest, PRE_CookiesClearedOnExit) { | 727 IN_PROC_BROWSER_TEST_F(NoSessionRestoreTest, PRE_CookiesClearedOnExit) { |
732 // Normally cookies are restored. | 728 // Normally cookies are restored. |
733 content::WebContents* web_contents = | 729 content::WebContents* web_contents = |
734 browser()->tab_strip_model()->GetActiveWebContents(); | 730 browser()->tab_strip_model()->GetActiveWebContents(); |
735 EXPECT_EQ(std::string(content::kAboutBlankURL), | 731 EXPECT_EQ(std::string(url::kAboutBlankURL), web_contents->GetURL().spec()); |
736 web_contents->GetURL().spec()); | |
737 NavigateAndCheckStoredData("cookies.html"); | 732 NavigateAndCheckStoredData("cookies.html"); |
738 // ... but not if the content setting is set to clear on exit. | 733 // ... but not if the content setting is set to clear on exit. |
739 CookieSettings::Factory::GetForProfile(browser()->profile())-> | 734 CookieSettings::Factory::GetForProfile(browser()->profile())-> |
740 SetDefaultCookieSetting(CONTENT_SETTING_SESSION_ONLY); | 735 SetDefaultCookieSetting(CONTENT_SETTING_SESSION_ONLY); |
741 } | 736 } |
742 | 737 |
743 IN_PROC_BROWSER_TEST_F(NoSessionRestoreTest, CookiesClearedOnExit) { | 738 IN_PROC_BROWSER_TEST_F(NoSessionRestoreTest, CookiesClearedOnExit) { |
744 content::WebContents* web_contents = | 739 content::WebContents* web_contents = |
745 browser()->tab_strip_model()->GetActiveWebContents(); | 740 browser()->tab_strip_model()->GetActiveWebContents(); |
746 EXPECT_EQ(std::string(content::kAboutBlankURL), | 741 EXPECT_EQ(std::string(url::kAboutBlankURL), web_contents->GetURL().spec()); |
747 web_contents->GetURL().spec()); | |
748 StoreDataWithPage("local_storage.html"); | 742 StoreDataWithPage("local_storage.html"); |
749 } | 743 } |
750 | 744 |
751 IN_PROC_BROWSER_TEST_F(NoSessionRestoreTest, SessionCookiesBrowserClose) { | 745 IN_PROC_BROWSER_TEST_F(NoSessionRestoreTest, SessionCookiesBrowserClose) { |
752 StoreDataWithPage("session_cookies.html"); | 746 StoreDataWithPage("session_cookies.html"); |
753 EnableBackgroundMode(); | 747 EnableBackgroundMode(); |
754 Browser* new_browser = QuitBrowserAndRestore(browser(), false); | 748 Browser* new_browser = QuitBrowserAndRestore(browser(), false); |
755 NavigateAndCheckStoredData(new_browser, "session_cookies.html"); | 749 NavigateAndCheckStoredData(new_browser, "session_cookies.html"); |
756 DisableBackgroundMode(); | 750 DisableBackgroundMode(); |
757 new_browser = QuitBrowserAndRestore(new_browser, false); | 751 new_browser = QuitBrowserAndRestore(new_browser, false); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
838 CookieSettings::Factory::GetForProfile(new_browser->profile())-> | 832 CookieSettings::Factory::GetForProfile(new_browser->profile())-> |
839 SetDefaultCookieSetting(CONTENT_SETTING_SESSION_ONLY); | 833 SetDefaultCookieSetting(CONTENT_SETTING_SESSION_ONLY); |
840 // ... even if background mode is active. | 834 // ... even if background mode is active. |
841 EnableBackgroundMode(); | 835 EnableBackgroundMode(); |
842 new_browser = QuitBrowserAndRestore(new_browser, true); | 836 new_browser = QuitBrowserAndRestore(new_browser, true); |
843 StoreDataWithPage(new_browser, "cookies.html"); | 837 StoreDataWithPage(new_browser, "cookies.html"); |
844 DisableBackgroundMode(); | 838 DisableBackgroundMode(); |
845 new_browser = QuitBrowserAndRestore(new_browser, true); | 839 new_browser = QuitBrowserAndRestore(new_browser, true); |
846 StoreDataWithPage(new_browser, "cookies.html"); | 840 StoreDataWithPage(new_browser, "cookies.html"); |
847 } | 841 } |
OLD | NEW |