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 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 } | 670 } |
671 #endif | 671 #endif |
672 | 672 |
673 // This retry loop reduces flakiness due to the fact that this ultimately | 673 // This retry loop reduces flakiness due to the fact that this ultimately |
674 // tests whether or not a code path hits a timed wait. | 674 // tests whether or not a code path hits a timed wait. |
675 bool succeeded = false; | 675 bool succeeded = false; |
676 for (size_t retries = 0; !succeeded && retries < 3; ++retries) { | 676 for (size_t retries = 0; !succeeded && retries < 3; ++retries) { |
677 // Flush the profile data to disk for all loaded profiles. | 677 // Flush the profile data to disk for all loaded profiles. |
678 profile->SetExitType(Profile::EXIT_CRASHED); | 678 profile->SetExitType(Profile::EXIT_CRASHED); |
679 profile->GetPrefs()->CommitPendingWrite(); | 679 profile->GetPrefs()->CommitPendingWrite(); |
| 680 FlushTaskRunner(content::BrowserThread::GetTaskRunnerForThread( |
| 681 content::BrowserThread::IO) |
| 682 .get()); |
680 FlushTaskRunner(profile->GetIOTaskRunner().get()); | 683 FlushTaskRunner(profile->GetIOTaskRunner().get()); |
681 | 684 |
682 // Make sure that the prefs file was written with the expected key/value. | 685 // Make sure that the prefs file was written with the expected key/value. |
683 ASSERT_EQ(GetExitTypePreferenceFromDisk(profile), "Crashed"); | 686 ASSERT_EQ(GetExitTypePreferenceFromDisk(profile), "Crashed"); |
684 | 687 |
685 // The blocking wait in EndSession has a timeout. | 688 // The blocking wait in EndSession has a timeout. |
686 base::Time start = base::Time::Now(); | 689 base::Time start = base::Time::Now(); |
687 | 690 |
688 // This must not return until the profile data has been written to disk. | 691 // This must not return until the profile data has been written to disk. |
689 // If this test flakes, then logoff on Windows has broken again. | 692 // If this test flakes, then logoff on Windows has broken again. |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
846 base::Bind(&SendReportHttpResponse, embedded_test_server()->base_url())); | 849 base::Bind(&SendReportHttpResponse, embedded_test_server()->base_url())); |
847 ASSERT_TRUE(hpkp_test_server.Start()); | 850 ASSERT_TRUE(hpkp_test_server.Start()); |
848 | 851 |
849 // To send a report, must use a non-numeric host name for the original | 852 // To send a report, must use a non-numeric host name for the original |
850 // request. This must not match the host name of the server that reports are | 853 // request. This must not match the host name of the server that reports are |
851 // sent to. | 854 // sent to. |
852 ui_test_utils::NavigateToURL(browser(), | 855 ui_test_utils::NavigateToURL(browser(), |
853 hpkp_test_server.GetURL("localhost", "/")); | 856 hpkp_test_server.GetURL("localhost", "/")); |
854 wait_for_report_loop.Run(); | 857 wait_for_report_loop.Run(); |
855 } | 858 } |
OLD | NEW |