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_path.h" | 6 #include "base/file_path.h" |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
9 #include "chrome/browser/defaults.h" | 9 #include "chrome/browser/defaults.h" |
10 #include "chrome/browser/first_run/first_run.h" | 10 #include "chrome/browser/first_run/first_run.h" |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 FilePath(kTitle1File))); | 220 FilePath(kTitle1File))); |
221 ui_test_utils::NavigateToURL(browser(), url); | 221 ui_test_utils::NavigateToURL(browser(), url); |
222 | 222 |
223 // Turn on session restore. | 223 // Turn on session restore. |
224 SessionStartupPref::SetStartupPref( | 224 SessionStartupPref::SetStartupPref( |
225 browser()->profile(), | 225 browser()->profile(), |
226 SessionStartupPref(SessionStartupPref::LAST)); | 226 SessionStartupPref(SessionStartupPref::LAST)); |
227 | 227 |
228 // Create a new popup. | 228 // Create a new popup. |
229 Profile* profile = browser()->profile(); | 229 Profile* profile = browser()->profile(); |
230 Browser* popup = Browser::CreateWithParams( | 230 Browser* popup = |
231 Browser::CreateParams(Browser::TYPE_POPUP, profile)); | 231 new Browser(Browser::CreateParams(Browser::TYPE_POPUP, profile)); |
232 popup->window()->Show(); | 232 popup->window()->Show(); |
233 | 233 |
234 // Close the browser. | 234 // Close the browser. |
235 CloseBrowserSynchronously(browser()); | 235 CloseBrowserSynchronously(browser()); |
236 | 236 |
237 // Create a new window, which should trigger session restore. | 237 // Create a new window, which should trigger session restore. |
238 ui_test_utils::BrowserAddedObserver observer; | 238 ui_test_utils::BrowserAddedObserver observer; |
239 chrome::NewWindow(popup); | 239 chrome::NewWindow(popup); |
240 Browser* new_browser = observer.WaitForSingleNewBrowser(); | 240 Browser* new_browser = observer.WaitForSingleNewBrowser(); |
241 | 241 |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 IN_PROC_BROWSER_TEST_F(SessionRestoreTest, NormalAndPopup) { | 594 IN_PROC_BROWSER_TEST_F(SessionRestoreTest, NormalAndPopup) { |
595 if (!browser_defaults::kRestorePopups) | 595 if (!browser_defaults::kRestorePopups) |
596 return; // Test only applicable if restoring popups. | 596 return; // Test only applicable if restoring popups. |
597 | 597 |
598 ui_test_utils::NavigateToURL(browser(), url1_); | 598 ui_test_utils::NavigateToURL(browser(), url1_); |
599 | 599 |
600 // Make sure we have one window. | 600 // Make sure we have one window. |
601 AssertOneWindowWithOneTab(browser()); | 601 AssertOneWindowWithOneTab(browser()); |
602 | 602 |
603 // Open a popup. | 603 // Open a popup. |
604 Browser* popup = Browser::CreateWithParams( | 604 Browser* popup = new Browser( |
605 Browser::CreateParams(Browser::TYPE_POPUP, browser()->profile())); | 605 Browser::CreateParams(Browser::TYPE_POPUP, browser()->profile())); |
606 popup->window()->Show(); | 606 popup->window()->Show(); |
607 ASSERT_EQ(2u, BrowserList::size()); | 607 ASSERT_EQ(2u, BrowserList::size()); |
608 | 608 |
609 ui_test_utils::NavigateToURL(popup, url1_); | 609 ui_test_utils::NavigateToURL(popup, url1_); |
610 | 610 |
611 // Simulate an exit by shuting down the session service. If we don't do this | 611 // Simulate an exit by shuting down the session service. If we don't do this |
612 // the first window close is treated as though the user closed the window | 612 // the first window close is treated as though the user closed the window |
613 // and won't be restored. | 613 // and won't be restored. |
614 SessionServiceFactory::ShutdownForProfile(browser()->profile()); | 614 SessionServiceFactory::ShutdownForProfile(browser()->profile()); |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
780 ASSERT_EQ(1u, BrowserList::size()); | 780 ASSERT_EQ(1u, BrowserList::size()); |
781 ASSERT_EQ(url1_, chrome::GetActiveWebContents(new_browser)->GetURL()); | 781 ASSERT_EQ(url1_, chrome::GetActiveWebContents(new_browser)->GetURL()); |
782 const content::NavigationController& new_controller = | 782 const content::NavigationController& new_controller = |
783 chrome::GetActiveWebContents(new_browser)->GetController(); | 783 chrome::GetActiveWebContents(new_browser)->GetController(); |
784 ASSERT_TRUE(new_controller.GetSessionStorageNamespace()); | 784 ASSERT_TRUE(new_controller.GetSessionStorageNamespace()); |
785 std::string restored_session_storage_persistent_id = | 785 std::string restored_session_storage_persistent_id = |
786 new_controller.GetSessionStorageNamespace()->persistent_id(); | 786 new_controller.GetSessionStorageNamespace()->persistent_id(); |
787 EXPECT_EQ(session_storage_persistent_id, | 787 EXPECT_EQ(session_storage_persistent_id, |
788 restored_session_storage_persistent_id); | 788 restored_session_storage_persistent_id); |
789 } | 789 } |
OLD | NEW |