| 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 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 // Test that leaving a popup open will not prevent session restore. | 474 // Test that leaving a popup open will not prevent session restore. |
| 475 IN_PROC_BROWSER_TEST_F(ContinueWhereILeftOffTest, | 475 IN_PROC_BROWSER_TEST_F(ContinueWhereILeftOffTest, |
| 476 SessionCookiesBrowserCloseWithPopupOpen) { | 476 SessionCookiesBrowserCloseWithPopupOpen) { |
| 477 // Set the startup preference to "continue where I left off" and visit a page | 477 // Set the startup preference to "continue where I left off" and visit a page |
| 478 // which stores a session cookie. | 478 // which stores a session cookie. |
| 479 StoreDataWithPage("session_cookies.html"); | 479 StoreDataWithPage("session_cookies.html"); |
| 480 Browser* popup = new Browser(Browser::CreateParams( | 480 Browser* popup = new Browser(Browser::CreateParams( |
| 481 Browser::TYPE_POPUP, | 481 Browser::TYPE_POPUP, |
| 482 browser()->profile(), | 482 browser()->profile(), |
| 483 chrome::HOST_DESKTOP_TYPE_NATIVE)); | 483 chrome::HOST_DESKTOP_TYPE_NATIVE)); |
| 484 popup->window()->Show(); | 484 popup->window()->Show(false /* user_gesture */); |
| 485 | 485 |
| 486 Browser* new_browser = QuitBrowserAndRestore(browser(), false); | 486 Browser* new_browser = QuitBrowserAndRestore(browser(), false); |
| 487 // The browsing session will be continued; just wait for the page to reload | 487 // The browsing session will be continued; just wait for the page to reload |
| 488 // and check the stored data. | 488 // and check the stored data. |
| 489 CheckReloadedPageRestored(new_browser); | 489 CheckReloadedPageRestored(new_browser); |
| 490 } | 490 } |
| 491 IN_PROC_BROWSER_TEST_F(ContinueWhereILeftOffTest, | 491 IN_PROC_BROWSER_TEST_F(ContinueWhereILeftOffTest, |
| 492 CookiesClearedOnBrowserClose) { | 492 CookiesClearedOnBrowserClose) { |
| 493 StoreDataWithPage("cookies.html"); | 493 StoreDataWithPage("cookies.html"); |
| 494 // Normally cookies are restored. | 494 // Normally cookies are restored. |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 759 } | 759 } |
| 760 | 760 |
| 761 // Tests that session cookies are not cleared when only a popup window is open. | 761 // Tests that session cookies are not cleared when only a popup window is open. |
| 762 IN_PROC_BROWSER_TEST_F(NoSessionRestoreTest, | 762 IN_PROC_BROWSER_TEST_F(NoSessionRestoreTest, |
| 763 SessionCookiesBrowserCloseWithPopupOpen) { | 763 SessionCookiesBrowserCloseWithPopupOpen) { |
| 764 StoreDataWithPage("session_cookies.html"); | 764 StoreDataWithPage("session_cookies.html"); |
| 765 Browser* popup = new Browser(Browser::CreateParams( | 765 Browser* popup = new Browser(Browser::CreateParams( |
| 766 Browser::TYPE_POPUP, | 766 Browser::TYPE_POPUP, |
| 767 browser()->profile(), | 767 browser()->profile(), |
| 768 chrome::HOST_DESKTOP_TYPE_NATIVE)); | 768 chrome::HOST_DESKTOP_TYPE_NATIVE)); |
| 769 popup->window()->Show(); | 769 popup->window()->Show(false /* user_gesture */); |
| 770 Browser* new_browser = QuitBrowserAndRestore(browser(), false); | 770 Browser* new_browser = QuitBrowserAndRestore(browser(), false); |
| 771 NavigateAndCheckStoredData(new_browser, "session_cookies.html"); | 771 NavigateAndCheckStoredData(new_browser, "session_cookies.html"); |
| 772 } | 772 } |
| 773 | 773 |
| 774 // Tests that session cookies are cleared if the last window to close is a | 774 // Tests that session cookies are cleared if the last window to close is a |
| 775 // popup. | 775 // popup. |
| 776 IN_PROC_BROWSER_TEST_F(NoSessionRestoreTest, | 776 IN_PROC_BROWSER_TEST_F(NoSessionRestoreTest, |
| 777 SessionCookiesBrowserClosePopupLast) { | 777 SessionCookiesBrowserClosePopupLast) { |
| 778 StoreDataWithPage("session_cookies.html"); | 778 StoreDataWithPage("session_cookies.html"); |
| 779 Browser* popup = new Browser(Browser::CreateParams( | 779 Browser* popup = new Browser(Browser::CreateParams( |
| 780 Browser::TYPE_POPUP, | 780 Browser::TYPE_POPUP, |
| 781 browser()->profile(), | 781 browser()->profile(), |
| 782 chrome::HOST_DESKTOP_TYPE_NATIVE)); | 782 chrome::HOST_DESKTOP_TYPE_NATIVE)); |
| 783 popup->window()->Show(); | 783 popup->window()->Show(false /* user_gesture */); |
| 784 CloseBrowserSynchronously(browser(), false); | 784 CloseBrowserSynchronously(browser(), false); |
| 785 Browser* new_browser = QuitBrowserAndRestore(popup, false); | 785 Browser* new_browser = QuitBrowserAndRestore(popup, false); |
| 786 if (browser_defaults::kBrowserAliveWithNoWindows) | 786 if (browser_defaults::kBrowserAliveWithNoWindows) |
| 787 NavigateAndCheckStoredData(new_browser, "session_cookies.html"); | 787 NavigateAndCheckStoredData(new_browser, "session_cookies.html"); |
| 788 else | 788 else |
| 789 StoreDataWithPage(new_browser, "session_cookies.html"); | 789 StoreDataWithPage(new_browser, "session_cookies.html"); |
| 790 } | 790 } |
| 791 | 791 |
| 792 IN_PROC_BROWSER_TEST_F(NoSessionRestoreTest, CookiesClearedOnBrowserClose) { | 792 IN_PROC_BROWSER_TEST_F(NoSessionRestoreTest, CookiesClearedOnBrowserClose) { |
| 793 StoreDataWithPage("cookies.html"); | 793 StoreDataWithPage("cookies.html"); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 835 CookieSettings::Factory::GetForProfile(new_browser->profile())-> | 835 CookieSettings::Factory::GetForProfile(new_browser->profile())-> |
| 836 SetDefaultCookieSetting(CONTENT_SETTING_SESSION_ONLY); | 836 SetDefaultCookieSetting(CONTENT_SETTING_SESSION_ONLY); |
| 837 // ... even if background mode is active. | 837 // ... even if background mode is active. |
| 838 EnableBackgroundMode(); | 838 EnableBackgroundMode(); |
| 839 new_browser = QuitBrowserAndRestore(new_browser, true); | 839 new_browser = QuitBrowserAndRestore(new_browser, true); |
| 840 StoreDataWithPage(new_browser, "cookies.html"); | 840 StoreDataWithPage(new_browser, "cookies.html"); |
| 841 DisableBackgroundMode(); | 841 DisableBackgroundMode(); |
| 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 } | 844 } |
| OLD | NEW |