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

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

Issue 2493573002: Make sure that the browser will always restore settings page instead of sign out page after user si… (Closed)
Patch Set: Created 4 years, 1 month 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 <vector> 7 #include <vector>
8 8
9 #include "base/base_switches.h" 9 #include "base/base_switches.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 1394 matching lines...) Expand 10 before | Expand all | Expand 10 after
1405 &browser()->tab_strip_model()->GetActiveWebContents()->GetController(); 1405 &browser()->tab_strip_model()->GetActiveWebContents()->GetController();
1406 EXPECT_TRUE( 1406 EXPECT_TRUE(
1407 controller->GetDefaultSessionStorageNamespace()->should_persist()); 1407 controller->GetDefaultSessionStorageNamespace()->should_persist());
1408 1408
1409 // Quit and restore. Check that no extra tabs were created. 1409 // Quit and restore. Check that no extra tabs were created.
1410 Browser* new_browser = QuitBrowserAndRestore(browser(), 1); 1410 Browser* new_browser = QuitBrowserAndRestore(browser(), 1);
1411 ASSERT_EQ(1u, active_browser_list_->size()); 1411 ASSERT_EQ(1u, active_browser_list_->size());
1412 EXPECT_EQ(1, new_browser->tab_strip_model()->count()); 1412 EXPECT_EQ(1, new_browser->tab_strip_model()->count());
1413 } 1413 }
1414 1414
1415 IN_PROC_BROWSER_TEST_F(SessionRestoreTest, RestoresSignOutPage) {
sky 2016/11/09 22:24:04 Writing a browser test for this is very heavy. How
zmin 2016/11/10 22:36:07 I moved this function to session_common_utils.cc a
1416 const GURL settings_page("chrome://settings");
1417 const GURL sign_out_page("chrome://settings/signOut");
1418 ui_test_utils::NavigateToURL(browser(), settings_page);
1419 ui_test_utils::NavigateToURL(browser(), sign_out_page);
1420 Browser* new_browser = QuitBrowserAndRestore(browser(), 1);
1421 ASSERT_EQ(1u, active_browser_list_->size());
1422 ASSERT_EQ(settings_page,
1423 new_browser->tab_strip_model()->GetActiveWebContents()->GetURL());
1424 }
1425
1415 IN_PROC_BROWSER_TEST_F(SmartSessionRestoreTest, PRE_CorrectLoadingOrder) { 1426 IN_PROC_BROWSER_TEST_F(SmartSessionRestoreTest, PRE_CorrectLoadingOrder) {
1416 Profile* profile = browser()->profile(); 1427 Profile* profile = browser()->profile();
1417 1428
1418 const int activation_order[] = {4, 2, 1, 5, 0, 3}; 1429 const int activation_order[] = {4, 2, 1, 5, 0, 3};
1419 1430
1420 // Replace the first tab and add the other tabs. 1431 // Replace the first tab and add the other tabs.
1421 ui_test_utils::NavigateToURL(browser(), GURL(kUrls[0])); 1432 ui_test_utils::NavigateToURL(browser(), GURL(kUrls[0]));
1422 for (size_t i = 1; i < kExpectedNumTabs; i++) { 1433 for (size_t i = 1; i < kExpectedNumTabs; i++) {
1423 ui_test_utils::NavigateToURLWithDisposition( 1434 ui_test_utils::NavigateToURLWithDisposition(
1424 browser(), GURL(kUrls[i]), WindowOpenDisposition::NEW_FOREGROUND_TAB, 1435 browser(), GURL(kUrls[i]), WindowOpenDisposition::NEW_FOREGROUND_TAB,
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
1503 // automatically at the start of the test. 1514 // automatically at the start of the test.
1504 for (size_t i = 1; i < web_contents().size(); i++) { 1515 for (size_t i = 1; i < web_contents().size(); i++) {
1505 GURL expected_url = GURL(kUrls[activation_order[kExpectedNumTabs - i]]); 1516 GURL expected_url = GURL(kUrls[activation_order[kExpectedNumTabs - i]]);
1506 ASSERT_EQ(expected_url, web_contents()[i]->GetLastCommittedURL()); 1517 ASSERT_EQ(expected_url, web_contents()[i]->GetLastCommittedURL());
1507 if (i > 0) { 1518 if (i > 0) {
1508 ASSERT_GT(web_contents()[i - 1]->GetLastActiveTime(), 1519 ASSERT_GT(web_contents()[i - 1]->GetLastActiveTime(),
1509 web_contents()[i]->GetLastActiveTime()); 1520 web_contents()[i]->GetLastActiveTime());
1510 } 1521 }
1511 } 1522 }
1512 } 1523 }
OLDNEW
« chrome/browser/sessions/session_restore.cc ('K') | « chrome/browser/sessions/session_restore.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698