| 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/process/launch.h" | 9 #include "base/process/launch.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 const BrowserList* active_browser_list_; | 192 const BrowserList* active_browser_list_; |
| 193 }; | 193 }; |
| 194 | 194 |
| 195 #if defined(USE_AURA) | 195 #if defined(USE_AURA) |
| 196 // Verifies that restored tabs have a root window. This is important | 196 // Verifies that restored tabs have a root window. This is important |
| 197 // otherwise the wrong information is communicated to the renderer. | 197 // otherwise the wrong information is communicated to the renderer. |
| 198 // (http://crbug.com/342672). | 198 // (http://crbug.com/342672). |
| 199 IN_PROC_BROWSER_TEST_F(SessionRestoreTest, RestoredTabsShouldHaveRootWindow) { | 199 IN_PROC_BROWSER_TEST_F(SessionRestoreTest, RestoredTabsShouldHaveRootWindow) { |
| 200 // Create tabs. | 200 // Create tabs. |
| 201 ui_test_utils::NavigateToURLWithDisposition( | 201 ui_test_utils::NavigateToURLWithDisposition( |
| 202 browser(), GURL(content::kAboutBlankURL), NEW_FOREGROUND_TAB, | 202 browser(), GURL(url::kAboutBlankURL), NEW_FOREGROUND_TAB, |
| 203 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 203 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
| 204 ui_test_utils::NavigateToURLWithDisposition( | 204 ui_test_utils::NavigateToURLWithDisposition( |
| 205 browser(), GURL(content::kAboutBlankURL), NEW_BACKGROUND_TAB, | 205 browser(), GURL(url::kAboutBlankURL), NEW_BACKGROUND_TAB, |
| 206 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 206 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
| 207 | 207 |
| 208 // Restart and session restore the tabs. | 208 // Restart and session restore the tabs. |
| 209 Browser* restored = QuitBrowserAndRestore(browser(), 3); | 209 Browser* restored = QuitBrowserAndRestore(browser(), 3); |
| 210 TabStripModel* tab_strip_model = restored->tab_strip_model(); | 210 TabStripModel* tab_strip_model = restored->tab_strip_model(); |
| 211 const int tabs = tab_strip_model->count(); | 211 const int tabs = tab_strip_model->count(); |
| 212 ASSERT_EQ(3, tabs); | 212 ASSERT_EQ(3, tabs); |
| 213 | 213 |
| 214 // Check the restored tabs have a root window. | 214 // Check the restored tabs have a root window. |
| 215 for (int i = 0; i < tabs; ++i) { | 215 for (int i = 0; i < tabs; ++i) { |
| (...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 943 } | 943 } |
| 944 | 944 |
| 945 #endif // !defined(OS_CHROMEOS) && !defined(OS_MACOSX) | 945 #endif // !defined(OS_CHROMEOS) && !defined(OS_MACOSX) |
| 946 | 946 |
| 947 // Creates two windows, closes one, restores, make sure only one window open. | 947 // Creates two windows, closes one, restores, make sure only one window open. |
| 948 IN_PROC_BROWSER_TEST_F(SessionRestoreTest, TwoWindowsCloseOneRestoreOnlyOne) { | 948 IN_PROC_BROWSER_TEST_F(SessionRestoreTest, TwoWindowsCloseOneRestoreOnlyOne) { |
| 949 ui_test_utils::NavigateToURL(browser(), url1_); | 949 ui_test_utils::NavigateToURL(browser(), url1_); |
| 950 | 950 |
| 951 // Open a second window. | 951 // Open a second window. |
| 952 ui_test_utils::NavigateToURLWithDisposition( | 952 ui_test_utils::NavigateToURLWithDisposition( |
| 953 browser(), GURL(content::kAboutBlankURL), NEW_WINDOW, | 953 browser(), GURL(url::kAboutBlankURL), NEW_WINDOW, |
| 954 ui_test_utils::BROWSER_TEST_WAIT_FOR_BROWSER); | 954 ui_test_utils::BROWSER_TEST_WAIT_FOR_BROWSER); |
| 955 | 955 |
| 956 ASSERT_EQ(2u, active_browser_list_->size()); | 956 ASSERT_EQ(2u, active_browser_list_->size()); |
| 957 | 957 |
| 958 // Close it. | 958 // Close it. |
| 959 Browser* new_window = active_browser_list_->get(1); | 959 Browser* new_window = active_browser_list_->get(1); |
| 960 CloseBrowserSynchronously(new_window); | 960 CloseBrowserSynchronously(new_window); |
| 961 | 961 |
| 962 // Restart and make sure we have only one window with one tab and the url | 962 // Restart and make sure we have only one window with one tab and the url |
| 963 // is url1_. | 963 // is url1_. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 976 // as a special case in process-per-site-instance so that it only ever uses one | 976 // as a special case in process-per-site-instance so that it only ever uses one |
| 977 // process.) | 977 // process.) |
| 978 // | 978 // |
| 979 // Flaky: http://code.google.com/p/chromium/issues/detail?id=52022 | 979 // Flaky: http://code.google.com/p/chromium/issues/detail?id=52022 |
| 980 // Unfortunately, the fix at http://codereview.chromium.org/6546078 | 980 // Unfortunately, the fix at http://codereview.chromium.org/6546078 |
| 981 // breaks NTP background image refreshing, so ThemeSource had to revert to | 981 // breaks NTP background image refreshing, so ThemeSource had to revert to |
| 982 // replacing the existing data source. | 982 // replacing the existing data source. |
| 983 IN_PROC_BROWSER_TEST_F(SessionRestoreTest, ShareProcessesOnRestore) { | 983 IN_PROC_BROWSER_TEST_F(SessionRestoreTest, ShareProcessesOnRestore) { |
| 984 // Create two new tabs. | 984 // Create two new tabs. |
| 985 ui_test_utils::NavigateToURLWithDisposition( | 985 ui_test_utils::NavigateToURLWithDisposition( |
| 986 browser(), GURL(content::kAboutBlankURL), NEW_FOREGROUND_TAB, | 986 browser(), GURL(url::kAboutBlankURL), NEW_FOREGROUND_TAB, |
| 987 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 987 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
| 988 ui_test_utils::NavigateToURLWithDisposition( | 988 ui_test_utils::NavigateToURLWithDisposition( |
| 989 browser(), GURL(content::kAboutBlankURL), NEW_FOREGROUND_TAB, | 989 browser(), GURL(url::kAboutBlankURL), NEW_FOREGROUND_TAB, |
| 990 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 990 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
| 991 | 991 |
| 992 int expected_process_count = RenderProcessHostCount(); | 992 int expected_process_count = RenderProcessHostCount(); |
| 993 | 993 |
| 994 // Restart. | 994 // Restart. |
| 995 Browser* new_browser = QuitBrowserAndRestore(browser(), 3); | 995 Browser* new_browser = QuitBrowserAndRestore(browser(), 3); |
| 996 | 996 |
| 997 ASSERT_EQ(3, new_browser->tab_strip_model()->count()); | 997 ASSERT_EQ(3, new_browser->tab_strip_model()->count()); |
| 998 | 998 |
| 999 ASSERT_EQ(expected_process_count, RenderProcessHostCount()); | 999 ASSERT_EQ(expected_process_count, RenderProcessHostCount()); |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1184 content::NavigationController* controller = | 1184 content::NavigationController* controller = |
| 1185 &browser()->tab_strip_model()->GetActiveWebContents()->GetController(); | 1185 &browser()->tab_strip_model()->GetActiveWebContents()->GetController(); |
| 1186 EXPECT_TRUE( | 1186 EXPECT_TRUE( |
| 1187 controller->GetDefaultSessionStorageNamespace()->should_persist()); | 1187 controller->GetDefaultSessionStorageNamespace()->should_persist()); |
| 1188 | 1188 |
| 1189 // Quit and restore. Check that no extra tabs were created. | 1189 // Quit and restore. Check that no extra tabs were created. |
| 1190 Browser* new_browser = QuitBrowserAndRestore(browser(), 1); | 1190 Browser* new_browser = QuitBrowserAndRestore(browser(), 1); |
| 1191 ASSERT_EQ(1u, active_browser_list_->size()); | 1191 ASSERT_EQ(1u, active_browser_list_->size()); |
| 1192 EXPECT_EQ(1, new_browser->tab_strip_model()->count()); | 1192 EXPECT_EQ(1, new_browser->tab_strip_model()->count()); |
| 1193 } | 1193 } |
| OLD | NEW |