Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(271)

Side by Side Diff: chrome/browser/sessions/session_restore_browsertest.cc

Issue 325443002: Move about://-related constants from //content to //url (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Android ifx Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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(),
203 GURL(url::kAboutBlankURL),
204 NEW_FOREGROUND_TAB,
203 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); 205 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
204 ui_test_utils::NavigateToURLWithDisposition( 206 ui_test_utils::NavigateToURLWithDisposition(
205 browser(), GURL(content::kAboutBlankURL), NEW_BACKGROUND_TAB, 207 browser(),
208 GURL(url::kAboutBlankURL),
209 NEW_BACKGROUND_TAB,
206 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); 210 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
207 211
208 // Restart and session restore the tabs. 212 // Restart and session restore the tabs.
209 Browser* restored = QuitBrowserAndRestore(browser(), 3); 213 Browser* restored = QuitBrowserAndRestore(browser(), 3);
210 TabStripModel* tab_strip_model = restored->tab_strip_model(); 214 TabStripModel* tab_strip_model = restored->tab_strip_model();
211 const int tabs = tab_strip_model->count(); 215 const int tabs = tab_strip_model->count();
212 ASSERT_EQ(3, tabs); 216 ASSERT_EQ(3, tabs);
213 217
214 // Check the restored tabs have a root window. 218 // Check the restored tabs have a root window.
215 for (int i = 0; i < tabs; ++i) { 219 for (int i = 0; i < tabs; ++i) {
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after
943 } 947 }
944 948
945 #endif // !defined(OS_CHROMEOS) && !defined(OS_MACOSX) 949 #endif // !defined(OS_CHROMEOS) && !defined(OS_MACOSX)
946 950
947 // Creates two windows, closes one, restores, make sure only one window open. 951 // Creates two windows, closes one, restores, make sure only one window open.
948 IN_PROC_BROWSER_TEST_F(SessionRestoreTest, TwoWindowsCloseOneRestoreOnlyOne) { 952 IN_PROC_BROWSER_TEST_F(SessionRestoreTest, TwoWindowsCloseOneRestoreOnlyOne) {
949 ui_test_utils::NavigateToURL(browser(), url1_); 953 ui_test_utils::NavigateToURL(browser(), url1_);
950 954
951 // Open a second window. 955 // Open a second window.
952 ui_test_utils::NavigateToURLWithDisposition( 956 ui_test_utils::NavigateToURLWithDisposition(
953 browser(), GURL(content::kAboutBlankURL), NEW_WINDOW, 957 browser(),
958 GURL(url::kAboutBlankURL),
959 NEW_WINDOW,
954 ui_test_utils::BROWSER_TEST_WAIT_FOR_BROWSER); 960 ui_test_utils::BROWSER_TEST_WAIT_FOR_BROWSER);
955 961
956 ASSERT_EQ(2u, active_browser_list_->size()); 962 ASSERT_EQ(2u, active_browser_list_->size());
957 963
958 // Close it. 964 // Close it.
959 Browser* new_window = active_browser_list_->get(1); 965 Browser* new_window = active_browser_list_->get(1);
960 CloseBrowserSynchronously(new_window); 966 CloseBrowserSynchronously(new_window);
961 967
962 // Restart and make sure we have only one window with one tab and the url 968 // Restart and make sure we have only one window with one tab and the url
963 // is url1_. 969 // is url1_.
(...skipping 12 matching lines...) Expand all
976 // as a special case in process-per-site-instance so that it only ever uses one 982 // as a special case in process-per-site-instance so that it only ever uses one
977 // process.) 983 // process.)
978 // 984 //
979 // Flaky: http://code.google.com/p/chromium/issues/detail?id=52022 985 // Flaky: http://code.google.com/p/chromium/issues/detail?id=52022
980 // Unfortunately, the fix at http://codereview.chromium.org/6546078 986 // Unfortunately, the fix at http://codereview.chromium.org/6546078
981 // breaks NTP background image refreshing, so ThemeSource had to revert to 987 // breaks NTP background image refreshing, so ThemeSource had to revert to
982 // replacing the existing data source. 988 // replacing the existing data source.
983 IN_PROC_BROWSER_TEST_F(SessionRestoreTest, ShareProcessesOnRestore) { 989 IN_PROC_BROWSER_TEST_F(SessionRestoreTest, ShareProcessesOnRestore) {
984 // Create two new tabs. 990 // Create two new tabs.
985 ui_test_utils::NavigateToURLWithDisposition( 991 ui_test_utils::NavigateToURLWithDisposition(
986 browser(), GURL(content::kAboutBlankURL), NEW_FOREGROUND_TAB, 992 browser(),
993 GURL(url::kAboutBlankURL),
994 NEW_FOREGROUND_TAB,
987 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); 995 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
988 ui_test_utils::NavigateToURLWithDisposition( 996 ui_test_utils::NavigateToURLWithDisposition(
989 browser(), GURL(content::kAboutBlankURL), NEW_FOREGROUND_TAB, 997 browser(),
998 GURL(url::kAboutBlankURL),
999 NEW_FOREGROUND_TAB,
990 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); 1000 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
991 1001
992 int expected_process_count = RenderProcessHostCount(); 1002 int expected_process_count = RenderProcessHostCount();
993 1003
994 // Restart. 1004 // Restart.
995 Browser* new_browser = QuitBrowserAndRestore(browser(), 3); 1005 Browser* new_browser = QuitBrowserAndRestore(browser(), 3);
996 1006
997 ASSERT_EQ(3, new_browser->tab_strip_model()->count()); 1007 ASSERT_EQ(3, new_browser->tab_strip_model()->count());
998 1008
999 ASSERT_EQ(expected_process_count, RenderProcessHostCount()); 1009 ASSERT_EQ(expected_process_count, RenderProcessHostCount());
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
1184 content::NavigationController* controller = 1194 content::NavigationController* controller =
1185 &browser()->tab_strip_model()->GetActiveWebContents()->GetController(); 1195 &browser()->tab_strip_model()->GetActiveWebContents()->GetController();
1186 EXPECT_TRUE( 1196 EXPECT_TRUE(
1187 controller->GetDefaultSessionStorageNamespace()->should_persist()); 1197 controller->GetDefaultSessionStorageNamespace()->should_persist());
1188 1198
1189 // Quit and restore. Check that no extra tabs were created. 1199 // Quit and restore. Check that no extra tabs were created.
1190 Browser* new_browser = QuitBrowserAndRestore(browser(), 1); 1200 Browser* new_browser = QuitBrowserAndRestore(browser(), 1);
1191 ASSERT_EQ(1u, active_browser_list_->size()); 1201 ASSERT_EQ(1u, active_browser_list_->size());
1192 EXPECT_EQ(1, new_browser->tab_strip_model()->count()); 1202 EXPECT_EQ(1, new_browser->tab_strip_model()->count());
1193 } 1203 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698