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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 } | 540 } |
541 } | 541 } |
542 | 542 |
543 // Test that leaving a popup open will not prevent session restore. | 543 // Test that leaving a popup open will not prevent session restore. |
544 IN_PROC_BROWSER_TEST_F(ContinueWhereILeftOffTest, | 544 IN_PROC_BROWSER_TEST_F(ContinueWhereILeftOffTest, |
545 SessionCookiesBrowserCloseWithPopupOpen) { | 545 SessionCookiesBrowserCloseWithPopupOpen) { |
546 // Set the startup preference to "continue where I left off" and visit a page | 546 // Set the startup preference to "continue where I left off" and visit a page |
547 // which stores a session cookie. | 547 // which stores a session cookie. |
548 StoreDataWithPage("session_cookies.html"); | 548 StoreDataWithPage("session_cookies.html"); |
549 Browser* popup = new Browser( | 549 Browser* popup = new Browser( |
550 Browser::CreateParams(Browser::TYPE_POPUP, browser()->profile())); | 550 Browser::CreateParams(Browser::TYPE_POPUP, browser()->profile(), true)); |
551 popup->window()->Show(); | 551 popup->window()->Show(); |
552 | 552 |
553 Browser* new_browser = QuitBrowserAndRestore(browser(), false); | 553 Browser* new_browser = QuitBrowserAndRestore(browser(), false); |
554 // The browsing session will be continued; just wait for the page to reload | 554 // The browsing session will be continued; just wait for the page to reload |
555 // and check the stored data. | 555 // and check the stored data. |
556 CheckReloadedPageRestored(new_browser); | 556 CheckReloadedPageRestored(new_browser); |
557 } | 557 } |
558 IN_PROC_BROWSER_TEST_F(ContinueWhereILeftOffTest, | 558 IN_PROC_BROWSER_TEST_F(ContinueWhereILeftOffTest, |
559 CookiesClearedOnBrowserClose) { | 559 CookiesClearedOnBrowserClose) { |
560 StoreDataWithPage("cookies.html"); | 560 StoreDataWithPage("cookies.html"); |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
819 NavigateAndCheckStoredData(new_browser, "session_cookies.html"); | 819 NavigateAndCheckStoredData(new_browser, "session_cookies.html"); |
820 else | 820 else |
821 StoreDataWithPage(new_browser, "session_cookies.html"); | 821 StoreDataWithPage(new_browser, "session_cookies.html"); |
822 } | 822 } |
823 | 823 |
824 // Tests that session cookies are not cleared when only a popup window is open. | 824 // Tests that session cookies are not cleared when only a popup window is open. |
825 IN_PROC_BROWSER_TEST_F(NoSessionRestoreTest, | 825 IN_PROC_BROWSER_TEST_F(NoSessionRestoreTest, |
826 SessionCookiesBrowserCloseWithPopupOpen) { | 826 SessionCookiesBrowserCloseWithPopupOpen) { |
827 StoreDataWithPage("session_cookies.html"); | 827 StoreDataWithPage("session_cookies.html"); |
828 Browser* popup = new Browser( | 828 Browser* popup = new Browser( |
829 Browser::CreateParams(Browser::TYPE_POPUP, browser()->profile())); | 829 Browser::CreateParams(Browser::TYPE_POPUP, browser()->profile(), true)); |
830 popup->window()->Show(); | 830 popup->window()->Show(); |
831 Browser* new_browser = QuitBrowserAndRestore(browser(), false); | 831 Browser* new_browser = QuitBrowserAndRestore(browser(), false); |
832 NavigateAndCheckStoredData(new_browser, "session_cookies.html"); | 832 NavigateAndCheckStoredData(new_browser, "session_cookies.html"); |
833 } | 833 } |
834 | 834 |
835 // Tests that session cookies are cleared if the last window to close is a | 835 // Tests that session cookies are cleared if the last window to close is a |
836 // popup. | 836 // popup. |
837 IN_PROC_BROWSER_TEST_F(NoSessionRestoreTest, | 837 IN_PROC_BROWSER_TEST_F(NoSessionRestoreTest, |
838 SessionCookiesBrowserClosePopupLast) { | 838 SessionCookiesBrowserClosePopupLast) { |
839 StoreDataWithPage("session_cookies.html"); | 839 StoreDataWithPage("session_cookies.html"); |
840 Browser* popup = new Browser( | 840 Browser* popup = new Browser( |
841 Browser::CreateParams(Browser::TYPE_POPUP, browser()->profile())); | 841 Browser::CreateParams(Browser::TYPE_POPUP, browser()->profile(), true)); |
842 popup->window()->Show(); | 842 popup->window()->Show(); |
843 CloseBrowserSynchronously(browser()); | 843 CloseBrowserSynchronously(browser()); |
844 Browser* new_browser = QuitBrowserAndRestore(popup, false); | 844 Browser* new_browser = QuitBrowserAndRestore(popup, false); |
845 if (browser_defaults::kBrowserAliveWithNoWindows) | 845 if (browser_defaults::kBrowserAliveWithNoWindows) |
846 NavigateAndCheckStoredData(new_browser, "session_cookies.html"); | 846 NavigateAndCheckStoredData(new_browser, "session_cookies.html"); |
847 else | 847 else |
848 StoreDataWithPage(new_browser, "session_cookies.html"); | 848 StoreDataWithPage(new_browser, "session_cookies.html"); |
849 } | 849 } |
850 | 850 |
851 IN_PROC_BROWSER_TEST_F(NoSessionRestoreTest, CookiesClearedOnBrowserClose) { | 851 IN_PROC_BROWSER_TEST_F(NoSessionRestoreTest, CookiesClearedOnBrowserClose) { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
894 CookieSettingsFactory::GetForProfile(new_browser->profile()) | 894 CookieSettingsFactory::GetForProfile(new_browser->profile()) |
895 ->SetDefaultCookieSetting(CONTENT_SETTING_SESSION_ONLY); | 895 ->SetDefaultCookieSetting(CONTENT_SETTING_SESSION_ONLY); |
896 // ... even if background mode is active. | 896 // ... even if background mode is active. |
897 EnableBackgroundMode(); | 897 EnableBackgroundMode(); |
898 new_browser = QuitBrowserAndRestore(new_browser, true); | 898 new_browser = QuitBrowserAndRestore(new_browser, true); |
899 StoreDataWithPage(new_browser, "cookies.html"); | 899 StoreDataWithPage(new_browser, "cookies.html"); |
900 DisableBackgroundMode(); | 900 DisableBackgroundMode(); |
901 new_browser = QuitBrowserAndRestore(new_browser, true); | 901 new_browser = QuitBrowserAndRestore(new_browser, true); |
902 StoreDataWithPage(new_browser, "cookies.html"); | 902 StoreDataWithPage(new_browser, "cookies.html"); |
903 } | 903 } |
OLD | NEW |