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