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 // This file provides reliablity test which runs under UI test framework. The | 5 // This file provides reliablity test which runs under UI test framework. The |
6 // test is intended to run within QEMU environment. | 6 // test is intended to run within QEMU environment. |
7 // | 7 // |
8 // Usage 1: reliability_test | 8 // Usage 1: reliability_test |
9 // Upon invocation, it visits a hard coded list of sample URLs. This is mainly | 9 // Upon invocation, it visits a hard coded list of sample URLs. This is mainly |
10 // used by buildbot, to verify reliability_test itself runs ok. | 10 // used by buildbot, to verify reliability_test itself runs ok. |
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
747 num_dumps++; | 747 num_dumps++; |
748 } | 748 } |
749 } | 749 } |
750 if (metrics) | 750 if (metrics) |
751 metrics->crash_dump_count = num_dumps; | 751 metrics->crash_dump_count = num_dumps; |
752 } | 752 } |
753 | 753 |
754 // Get a PrefService whose contents correspond to the Local State file | 754 // Get a PrefService whose contents correspond to the Local State file |
755 // that was saved by the app as it closed. The caller takes ownership of the | 755 // that was saved by the app as it closed. The caller takes ownership of the |
756 // returned PrefService object. | 756 // returned PrefService object. |
757 PrefService* GetLocalState() { | 757 PrefServiceSimple* GetLocalState() { |
758 FilePath path = user_data_dir().Append(chrome::kLocalStateFilename); | 758 FilePath path = user_data_dir().Append(chrome::kLocalStateFilename); |
759 return PrefServiceMockBuilder().WithUserFilePrefs( | 759 PrefServiceMockBuilder builder; |
760 path, MessageLoop::current()->message_loop_proxy()).Create(); | 760 builder.WithUserFilePrefs(path, |
| 761 MessageLoop::current()->message_loop_proxy()); |
| 762 return builder.CreateSimple(); |
761 } | 763 } |
762 | 764 |
763 void GetStabilityMetrics(NavigationMetrics* metrics) { | 765 void GetStabilityMetrics(NavigationMetrics* metrics) { |
764 if (!metrics) | 766 if (!metrics) |
765 return; | 767 return; |
766 scoped_ptr<PrefService> local_state(GetLocalState()); | 768 scoped_ptr<PrefServiceSimple> local_state(GetLocalState()); |
767 if (!local_state.get()) | 769 if (!local_state.get()) |
768 return; | 770 return; |
769 local_state->RegisterBooleanPref(prefs::kStabilityExitedCleanly, false); | 771 local_state->RegisterBooleanPref(prefs::kStabilityExitedCleanly, false); |
770 local_state->RegisterIntegerPref(prefs::kStabilityLaunchCount, -1); | 772 local_state->RegisterIntegerPref(prefs::kStabilityLaunchCount, -1); |
771 local_state->RegisterIntegerPref(prefs::kStabilityPageLoadCount, -1); | 773 local_state->RegisterIntegerPref(prefs::kStabilityPageLoadCount, -1); |
772 local_state->RegisterIntegerPref(prefs::kStabilityCrashCount, 0); | 774 local_state->RegisterIntegerPref(prefs::kStabilityCrashCount, 0); |
773 local_state->RegisterIntegerPref(prefs::kStabilityRendererCrashCount, 0); | 775 local_state->RegisterIntegerPref(prefs::kStabilityRendererCrashCount, 0); |
774 | 776 |
775 metrics->browser_clean_exit = | 777 metrics->browser_clean_exit = |
776 local_state->GetBoolean(prefs::kStabilityExitedCleanly); | 778 local_state->GetBoolean(prefs::kStabilityExitedCleanly); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
833 if (!g_end_url.empty()) { | 835 if (!g_end_url.empty()) { |
834 NavigateToURLLogResult( | 836 NavigateToURLLogResult( |
835 g_end_url, log_file, NULL, g_continuous_load, false); | 837 g_end_url, log_file, NULL, g_continuous_load, false); |
836 } | 838 } |
837 | 839 |
838 log_file.close(); | 840 log_file.close(); |
839 } | 841 } |
840 | 842 |
841 } // namespace | 843 } // namespace |
842 | 844 |
OLD | NEW |