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 <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" |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "chrome/browser/lifetime/application_lifetime.h" | 23 #include "chrome/browser/lifetime/application_lifetime.h" |
24 #include "chrome/browser/prefs/session_startup_pref.h" | 24 #include "chrome/browser/prefs/session_startup_pref.h" |
25 #include "chrome/browser/profiles/profile.h" | 25 #include "chrome/browser/profiles/profile.h" |
26 #include "chrome/browser/profiles/profile_impl.h" | 26 #include "chrome/browser/profiles/profile_impl.h" |
27 #include "chrome/browser/profiles/profile_manager.h" | 27 #include "chrome/browser/profiles/profile_manager.h" |
28 #include "chrome/browser/sessions/session_restore_test_helper.h" | 28 #include "chrome/browser/sessions/session_restore_test_helper.h" |
29 #include "chrome/browser/sessions/session_service_factory.h" | 29 #include "chrome/browser/sessions/session_service_factory.h" |
30 #include "chrome/browser/sessions/session_service_test_helper.h" | 30 #include "chrome/browser/sessions/session_service_test_helper.h" |
31 #include "chrome/browser/ui/browser.h" | 31 #include "chrome/browser/ui/browser.h" |
32 #include "chrome/browser/ui/browser_commands.h" | 32 #include "chrome/browser/ui/browser_commands.h" |
33 #include "chrome/browser/ui/browser_iterator.h" | 33 #include "chrome/browser/ui/browser_list.h" |
34 #include "chrome/browser/ui/browser_window.h" | 34 #include "chrome/browser/ui/browser_window.h" |
35 #include "chrome/browser/ui/startup/startup_browser_creator.h" | 35 #include "chrome/browser/ui/startup/startup_browser_creator.h" |
36 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 36 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
37 #include "chrome/common/chrome_switches.h" | 37 #include "chrome/common/chrome_switches.h" |
38 #include "chrome/common/pref_names.h" | 38 #include "chrome/common/pref_names.h" |
39 #include "chrome/common/url_constants.h" | 39 #include "chrome/common/url_constants.h" |
40 #include "chrome/test/base/in_process_browser_test.h" | 40 #include "chrome/test/base/in_process_browser_test.h" |
41 #include "chrome/test/base/ui_test_utils.h" | 41 #include "chrome/test/base/ui_test_utils.h" |
42 #include "components/content_settings/core/browser/cookie_settings.h" | 42 #include "components/content_settings/core/browser/cookie_settings.h" |
43 #include "components/content_settings/core/common/content_settings.h" | 43 #include "components/content_settings/core/common/content_settings.h" |
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 // system restart. | 588 // system restart. |
589 #if !defined(OS_CHROMEOS) | 589 #if !defined(OS_CHROMEOS) |
590 class RestartTest : public BetterSessionRestoreTest { | 590 class RestartTest : public BetterSessionRestoreTest { |
591 public: | 591 public: |
592 RestartTest() { } | 592 RestartTest() { } |
593 ~RestartTest() override {} | 593 ~RestartTest() override {} |
594 | 594 |
595 protected: | 595 protected: |
596 void Restart() { | 596 void Restart() { |
597 // Simulate restarting the browser, but let the test exit peacefully. | 597 // Simulate restarting the browser, but let the test exit peacefully. |
598 for (chrome::BrowserIterator it; !it.done(); it.Next()) | 598 for (auto* browser : *BrowserList::GetInstance()) |
599 content::BrowserContext::SaveSessionState(it->profile()); | 599 content::BrowserContext::SaveSessionState(browser->profile()); |
600 PrefService* pref_service = g_browser_process->local_state(); | 600 PrefService* pref_service = g_browser_process->local_state(); |
601 pref_service->SetBoolean(prefs::kWasRestarted, true); | 601 pref_service->SetBoolean(prefs::kWasRestarted, true); |
602 #if defined(OS_WIN) | 602 #if defined(OS_WIN) |
603 if (pref_service->HasPrefPath(prefs::kRelaunchMode)) | 603 if (pref_service->HasPrefPath(prefs::kRelaunchMode)) |
604 pref_service->ClearPref(prefs::kRelaunchMode); | 604 pref_service->ClearPref(prefs::kRelaunchMode); |
605 #endif | 605 #endif |
606 } | 606 } |
607 | 607 |
608 private: | 608 private: |
609 DISALLOW_COPY_AND_ASSIGN(RestartTest); | 609 DISALLOW_COPY_AND_ASSIGN(RestartTest); |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
844 CookieSettingsFactory::GetForProfile(new_browser->profile()) | 844 CookieSettingsFactory::GetForProfile(new_browser->profile()) |
845 ->SetDefaultCookieSetting(CONTENT_SETTING_SESSION_ONLY); | 845 ->SetDefaultCookieSetting(CONTENT_SETTING_SESSION_ONLY); |
846 // ... even if background mode is active. | 846 // ... even if background mode is active. |
847 EnableBackgroundMode(); | 847 EnableBackgroundMode(); |
848 new_browser = QuitBrowserAndRestore(new_browser, true); | 848 new_browser = QuitBrowserAndRestore(new_browser, true); |
849 StoreDataWithPage(new_browser, "cookies.html"); | 849 StoreDataWithPage(new_browser, "cookies.html"); |
850 DisableBackgroundMode(); | 850 DisableBackgroundMode(); |
851 new_browser = QuitBrowserAndRestore(new_browser, true); | 851 new_browser = QuitBrowserAndRestore(new_browser, true); |
852 StoreDataWithPage(new_browser, "cookies.html"); | 852 StoreDataWithPage(new_browser, "cookies.html"); |
853 } | 853 } |
OLD | NEW |