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

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

Issue 2830983005: Remove old webui History page on desktop and mobile (Closed)
Patch Set: fix unused var Created 3 years, 8 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
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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/files/file_util.h" 11 #include "base/files/file_util.h"
12 #include "base/lazy_instance.h" 12 #include "base/lazy_instance.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/path_service.h" 14 #include "base/path_service.h"
15 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
16 #include "base/test/scoped_feature_list.h"
17 #include "build/build_config.h" 16 #include "build/build_config.h"
18 #include "chrome/browser/background/background_mode_manager.h" 17 #include "chrome/browser/background/background_mode_manager.h"
19 #include "chrome/browser/browser_process.h" 18 #include "chrome/browser/browser_process.h"
20 #include "chrome/browser/content_settings/cookie_settings_factory.h" 19 #include "chrome/browser/content_settings/cookie_settings_factory.h"
21 #include "chrome/browser/defaults.h" 20 #include "chrome/browser/defaults.h"
22 #include "chrome/browser/infobars/infobar_service.h" 21 #include "chrome/browser/infobars/infobar_service.h"
23 #include "chrome/browser/lifetime/keep_alive_types.h" 22 #include "chrome/browser/lifetime/keep_alive_types.h"
24 #include "chrome/browser/lifetime/scoped_keep_alive.h" 23 #include "chrome/browser/lifetime/scoped_keep_alive.h"
25 #include "chrome/browser/prefs/session_startup_pref.h" 24 #include "chrome/browser/prefs/session_startup_pref.h"
26 #include "chrome/browser/profiles/profile.h" 25 #include "chrome/browser/profiles/profile.h"
27 #include "chrome/browser/profiles/profile_impl.h" 26 #include "chrome/browser/profiles/profile_impl.h"
28 #include "chrome/browser/profiles/profile_manager.h" 27 #include "chrome/browser/profiles/profile_manager.h"
29 #include "chrome/browser/sessions/session_restore_test_helper.h" 28 #include "chrome/browser/sessions/session_restore_test_helper.h"
30 #include "chrome/browser/sessions/session_service_factory.h" 29 #include "chrome/browser/sessions/session_service_factory.h"
31 #include "chrome/browser/sessions/session_service_test_helper.h" 30 #include "chrome/browser/sessions/session_service_test_helper.h"
32 #include "chrome/browser/ui/browser.h" 31 #include "chrome/browser/ui/browser.h"
33 #include "chrome/browser/ui/browser_commands.h" 32 #include "chrome/browser/ui/browser_commands.h"
34 #include "chrome/browser/ui/browser_list.h" 33 #include "chrome/browser/ui/browser_list.h"
35 #include "chrome/browser/ui/browser_window.h" 34 #include "chrome/browser/ui/browser_window.h"
36 #include "chrome/browser/ui/startup/startup_browser_creator.h" 35 #include "chrome/browser/ui/startup/startup_browser_creator.h"
37 #include "chrome/browser/ui/tabs/tab_strip_model.h" 36 #include "chrome/browser/ui/tabs/tab_strip_model.h"
38 #include "chrome/browser/ui/webui/md_history_ui.h" 37 #include "chrome/browser/ui/webui/md_history_ui.h"
39 #include "chrome/common/chrome_features.h"
40 #include "chrome/common/chrome_switches.h"
41 #include "chrome/common/pref_names.h" 38 #include "chrome/common/pref_names.h"
42 #include "chrome/common/url_constants.h" 39 #include "chrome/common/url_constants.h"
43 #include "chrome/test/base/in_process_browser_test.h" 40 #include "chrome/test/base/in_process_browser_test.h"
44 #include "chrome/test/base/ui_test_utils.h" 41 #include "chrome/test/base/ui_test_utils.h"
45 #include "components/content_settings/core/browser/cookie_settings.h" 42 #include "components/content_settings/core/browser/cookie_settings.h"
46 #include "components/content_settings/core/common/content_settings.h" 43 #include "components/content_settings/core/common/content_settings.h"
47 #include "components/infobars/core/confirm_infobar_delegate.h" 44 #include "components/infobars/core/confirm_infobar_delegate.h"
48 #include "components/prefs/pref_service.h" 45 #include "components/prefs/pref_service.h"
49 #include "content/public/browser/web_contents.h" 46 #include "content/public/browser/web_contents.h"
50 #include "content/public/common/url_constants.h" 47 #include "content/public/common/url_constants.h"
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 IN_PROC_BROWSER_TEST_F(ContinueWhereILeftOffTest, SessionCookiesBrowserClose) { 490 IN_PROC_BROWSER_TEST_F(ContinueWhereILeftOffTest, SessionCookiesBrowserClose) {
494 // Set the startup preference to "continue where I left off" and visit a page 491 // Set the startup preference to "continue where I left off" and visit a page
495 // which stores a session cookie. 492 // which stores a session cookie.
496 StoreDataWithPage("session_cookies.html"); 493 StoreDataWithPage("session_cookies.html");
497 Browser* new_browser = QuitBrowserAndRestore(browser(), false); 494 Browser* new_browser = QuitBrowserAndRestore(browser(), false);
498 // The browsing session will be continued; just wait for the page to reload 495 // The browsing session will be continued; just wait for the page to reload
499 // and check the stored data. 496 // and check the stored data.
500 CheckReloadedPageRestored(new_browser); 497 CheckReloadedPageRestored(new_browser);
501 } 498 }
502 499
503 // Test that switching MD History on behaves correctly with session restore.
sky 2017/04/27 22:41:04 Is there already a test that ensures the old histo
Dan Beam 2017/04/28 03:17:45 I assume the main entry point to history is Chrome
sky 2017/04/28 17:43:54 I was specifically thinking of an old URL entering
Dan Beam 2017/04/29 02:39:43 it's possible in some cases, so i restored some le
504 IN_PROC_BROWSER_TEST_F(ContinueWhereILeftOffTest, MDHistoryUpgrade) {
505 MdHistoryUI::use_test_title_ = true;
506 Browser* current_browser = browser();
507 {
508 base::test::ScopedFeatureList feature_list;
509 feature_list.InitAndDisableFeature(features::kMaterialDesignHistory);
510 content::WebContents* web_contents =
511 current_browser->tab_strip_model()->GetActiveWebContents();
512 content::TitleWatcher title_watcher(web_contents,
513 base::ASCIIToUTF16("History"));
514 ui_test_utils::NavigateToURL(current_browser, GURL("chrome://history"));
515 base::string16 final_title = title_watcher.WaitAndGetTitle();
516 EXPECT_EQ(3u, current_browser->tab_strip_model()
517 ->GetActiveWebContents()
518 ->GetAllFrames()
519 .size());
520 }
521 {
522 base::test::ScopedFeatureList feature_list;
523 feature_list.InitAndEnableFeature(features::kMaterialDesignHistory);
524 current_browser = QuitBrowserAndRestore(browser(), false);
525 // The new history page should have loaded.
526 CheckTitle(current_browser, base::ASCIIToUTF16("MD History"));
527 EXPECT_EQ(1u, current_browser->tab_strip_model()
528 ->GetActiveWebContents()
529 ->GetAllFrames()
530 .size());
531 }
532 {
533 base::test::ScopedFeatureList feature_list;
534 feature_list.InitAndDisableFeature(features::kMaterialDesignHistory);
535 current_browser = QuitBrowserAndRestore(current_browser, false);
536 // The old history page should have loaded.
537 CheckTitle(current_browser, base::ASCIIToUTF16("History"));
538 EXPECT_EQ(3u, current_browser->tab_strip_model()
539 ->GetActiveWebContents()
540 ->GetAllFrames()
541 .size());
542 }
543 }
544
545 // Test that leaving a popup open will not prevent session restore. 500 // Test that leaving a popup open will not prevent session restore.
546 IN_PROC_BROWSER_TEST_F(ContinueWhereILeftOffTest, 501 IN_PROC_BROWSER_TEST_F(ContinueWhereILeftOffTest,
547 SessionCookiesBrowserCloseWithPopupOpen) { 502 SessionCookiesBrowserCloseWithPopupOpen) {
548 // Set the startup preference to "continue where I left off" and visit a page 503 // Set the startup preference to "continue where I left off" and visit a page
549 // which stores a session cookie. 504 // which stores a session cookie.
550 StoreDataWithPage("session_cookies.html"); 505 StoreDataWithPage("session_cookies.html");
551 Browser* popup = new Browser( 506 Browser* popup = new Browser(
552 Browser::CreateParams(Browser::TYPE_POPUP, browser()->profile(), true)); 507 Browser::CreateParams(Browser::TYPE_POPUP, browser()->profile(), true));
553 popup->window()->Show(); 508 popup->window()->Show();
554 509
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 CookieSettingsFactory::GetForProfile(new_browser->profile()) 858 CookieSettingsFactory::GetForProfile(new_browser->profile())
904 ->SetDefaultCookieSetting(CONTENT_SETTING_SESSION_ONLY); 859 ->SetDefaultCookieSetting(CONTENT_SETTING_SESSION_ONLY);
905 // ... even if background mode is active. 860 // ... even if background mode is active.
906 EnableBackgroundMode(); 861 EnableBackgroundMode();
907 new_browser = QuitBrowserAndRestore(new_browser, true); 862 new_browser = QuitBrowserAndRestore(new_browser, true);
908 StoreDataWithPage(new_browser, "cookies.html"); 863 StoreDataWithPage(new_browser, "cookies.html");
909 DisableBackgroundMode(); 864 DisableBackgroundMode();
910 new_browser = QuitBrowserAndRestore(new_browser, true); 865 new_browser = QuitBrowserAndRestore(new_browser, true);
911 StoreDataWithPage(new_browser, "cookies.html"); 866 StoreDataWithPage(new_browser, "cookies.html");
912 } 867 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698