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 "chrome/browser/profiles/profile.h" | 5 #include "chrome/browser/profiles/profile.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "build/build_config.h" | 24 #include "build/build_config.h" |
25 #include "chrome/browser/browser_process.h" | 25 #include "chrome/browser/browser_process.h" |
26 #include "chrome/browser/chrome_notification_types.h" | 26 #include "chrome/browser/chrome_notification_types.h" |
27 #include "chrome/browser/net/url_request_mock_util.h" | 27 #include "chrome/browser/net/url_request_mock_util.h" |
28 #include "chrome/browser/profiles/chrome_version_service.h" | 28 #include "chrome/browser/profiles/chrome_version_service.h" |
29 #include "chrome/browser/profiles/profile_impl.h" | 29 #include "chrome/browser/profiles/profile_impl.h" |
30 #include "chrome/browser/profiles/profile_manager.h" | 30 #include "chrome/browser/profiles/profile_manager.h" |
31 #include "chrome/browser/ui/browser.h" | 31 #include "chrome/browser/ui/browser.h" |
32 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 32 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
33 #include "chrome/common/chrome_constants.h" | 33 #include "chrome/common/chrome_constants.h" |
| 34 #include "chrome/common/chrome_features.h" |
34 #include "chrome/common/pref_names.h" | 35 #include "chrome/common/pref_names.h" |
35 #include "chrome/test/base/in_process_browser_test.h" | 36 #include "chrome/test/base/in_process_browser_test.h" |
36 #include "chrome/test/base/ui_test_utils.h" | 37 #include "chrome/test/base/ui_test_utils.h" |
37 #include "components/bookmarks/browser/startup_task_runner_service.h" | 38 #include "components/bookmarks/browser/startup_task_runner_service.h" |
38 #include "components/prefs/pref_service.h" | 39 #include "components/prefs/pref_service.h" |
39 #include "components/version_info/version_info.h" | 40 #include "components/version_info/version_info.h" |
40 #include "content/public/browser/browser_thread.h" | 41 #include "content/public/browser/browser_thread.h" |
41 #include "content/public/browser/storage_partition.h" | 42 #include "content/public/browser/storage_partition.h" |
42 #include "content/public/test/test_utils.h" | 43 #include "content/public/test/test_utils.h" |
43 #include "extensions/browser/extension_registry.h" | 44 #include "extensions/browser/extension_registry.h" |
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 } | 684 } |
684 #endif | 685 #endif |
685 | 686 |
686 // This retry loop reduces flakiness due to the fact that this ultimately | 687 // This retry loop reduces flakiness due to the fact that this ultimately |
687 // tests whether or not a code path hits a timed wait. | 688 // tests whether or not a code path hits a timed wait. |
688 bool succeeded = false; | 689 bool succeeded = false; |
689 for (size_t retries = 0; !succeeded && retries < 3; ++retries) { | 690 for (size_t retries = 0; !succeeded && retries < 3; ++retries) { |
690 // Flush the profile data to disk for all loaded profiles. | 691 // Flush the profile data to disk for all loaded profiles. |
691 profile->SetExitType(Profile::EXIT_CRASHED); | 692 profile->SetExitType(Profile::EXIT_CRASHED); |
692 profile->GetPrefs()->CommitPendingWrite(); | 693 profile->GetPrefs()->CommitPendingWrite(); |
| 694 if (base::FeatureList::IsEnabled(features::kPrefService)) { |
| 695 FlushTaskRunner(content::BrowserThread::GetTaskRunnerForThread( |
| 696 content::BrowserThread::IO) |
| 697 .get()); |
| 698 } |
693 FlushTaskRunner(profile->GetIOTaskRunner().get()); | 699 FlushTaskRunner(profile->GetIOTaskRunner().get()); |
694 | 700 |
695 // Make sure that the prefs file was written with the expected key/value. | 701 // Make sure that the prefs file was written with the expected key/value. |
696 ASSERT_EQ(GetExitTypePreferenceFromDisk(profile), "Crashed"); | 702 ASSERT_EQ(GetExitTypePreferenceFromDisk(profile), "Crashed"); |
697 | 703 |
698 // The blocking wait in EndSession has a timeout. | 704 // The blocking wait in EndSession has a timeout. |
699 base::Time start = base::Time::Now(); | 705 base::Time start = base::Time::Now(); |
700 | 706 |
701 // This must not return until the profile data has been written to disk. | 707 // This must not return until the profile data has been written to disk. |
702 // If this test flakes, then logoff on Windows has broken again. | 708 // If this test flakes, then logoff on Windows has broken again. |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
859 base::Bind(&SendReportHttpResponse, embedded_test_server()->base_url())); | 865 base::Bind(&SendReportHttpResponse, embedded_test_server()->base_url())); |
860 ASSERT_TRUE(hpkp_test_server.Start()); | 866 ASSERT_TRUE(hpkp_test_server.Start()); |
861 | 867 |
862 // To send a report, must use a non-numeric host name for the original | 868 // To send a report, must use a non-numeric host name for the original |
863 // request. This must not match the host name of the server that reports are | 869 // request. This must not match the host name of the server that reports are |
864 // sent to. | 870 // sent to. |
865 ui_test_utils::NavigateToURL(browser(), | 871 ui_test_utils::NavigateToURL(browser(), |
866 hpkp_test_server.GetURL("localhost", "/")); | 872 hpkp_test_server.GetURL("localhost", "/")); |
867 wait_for_report_loop.Run(); | 873 wait_for_report_loop.Run(); |
868 } | 874 } |
OLD | NEW |