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

Side by Side Diff: chrome/test/reliability/page_load_test.cc

Issue 11741003: Remove PrefServiceSimple, replacing it with PrefService and PrefRegistrySimple. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix double registration in Chrome Frame test. Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « chrome/test/base/testing_pref_service.cc ('k') | chrome_frame/test/net/fake_external_tab.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 #include "base/i18n/time_formatting.h" 45 #include "base/i18n/time_formatting.h"
46 #include "base/memory/scoped_ptr.h" 46 #include "base/memory/scoped_ptr.h"
47 #include "base/path_service.h" 47 #include "base/path_service.h"
48 #include "base/prefs/json_pref_store.h" 48 #include "base/prefs/json_pref_store.h"
49 #include "base/string_number_conversions.h" 49 #include "base/string_number_conversions.h"
50 #include "base/string_util.h" 50 #include "base/string_util.h"
51 #include "base/test/test_file_util.h" 51 #include "base/test/test_file_util.h"
52 #include "base/threading/platform_thread.h" 52 #include "base/threading/platform_thread.h"
53 #include "base/time.h" 53 #include "base/time.h"
54 #include "chrome/browser/net/url_fixer_upper.h" 54 #include "chrome/browser/net/url_fixer_upper.h"
55 #include "chrome/browser/prefs/pref_registry_simple.h"
55 #include "chrome/browser/prefs/pref_service.h" 56 #include "chrome/browser/prefs/pref_service.h"
56 #include "chrome/browser/prefs/pref_service_mock_builder.h" 57 #include "chrome/browser/prefs/pref_service_mock_builder.h"
57 #include "chrome/common/automation_messages.h" 58 #include "chrome/common/automation_messages.h"
58 #include "chrome/common/chrome_constants.h" 59 #include "chrome/common/chrome_constants.h"
59 #include "chrome/common/chrome_paths.h" 60 #include "chrome/common/chrome_paths.h"
60 #include "chrome/common/chrome_switches.h" 61 #include "chrome/common/chrome_switches.h"
61 #include "chrome/common/chrome_version_info.h" 62 #include "chrome/common/chrome_version_info.h"
62 #include "chrome/common/logging_chrome.h" 63 #include "chrome/common/logging_chrome.h"
63 #include "chrome/common/pref_names.h" 64 #include "chrome/common/pref_names.h"
64 #include "chrome/common/render_messages.h" 65 #include "chrome/common/render_messages.h"
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 num_dumps++; 739 num_dumps++;
739 } 740 }
740 } 741 }
741 if (metrics) 742 if (metrics)
742 metrics->crash_dump_count = num_dumps; 743 metrics->crash_dump_count = num_dumps;
743 } 744 }
744 745
745 // Get a PrefService whose contents correspond to the Local State file 746 // Get a PrefService whose contents correspond to the Local State file
746 // that was saved by the app as it closed. The caller takes ownership of the 747 // that was saved by the app as it closed. The caller takes ownership of the
747 // returned PrefService object. 748 // returned PrefService object.
748 PrefServiceSimple* GetLocalState() { 749 PrefService* GetLocalState(PrefRegistry* registry) {
749 FilePath path = user_data_dir().Append(chrome::kLocalStateFilename); 750 FilePath path = user_data_dir().Append(chrome::kLocalStateFilename);
750 PrefServiceMockBuilder builder; 751 PrefServiceMockBuilder builder;
751 builder.WithUserFilePrefs(path, 752 builder.WithUserFilePrefs(path,
752 MessageLoop::current()->message_loop_proxy()); 753 MessageLoop::current()->message_loop_proxy());
753 return builder.CreateSimple(); 754 return builder.Create(registry);
754 } 755 }
755 756
756 void GetStabilityMetrics(NavigationMetrics* metrics) { 757 void GetStabilityMetrics(NavigationMetrics* metrics) {
757 if (!metrics) 758 if (!metrics)
758 return; 759 return;
759 scoped_ptr<PrefServiceSimple> local_state(GetLocalState()); 760 scoped_refptr<PrefRegistrySimple> registry = new PrefRegistrySimple();
761 registry->RegisterBooleanPref(prefs::kStabilityExitedCleanly, false);
762 registry->RegisterIntegerPref(prefs::kStabilityLaunchCount, -1);
763 registry->RegisterIntegerPref(prefs::kStabilityPageLoadCount, -1);
764 registry->RegisterIntegerPref(prefs::kStabilityCrashCount, 0);
765 registry->RegisterIntegerPref(prefs::kStabilityRendererCrashCount, 0);
766
767 scoped_ptr<PrefService> local_state(GetLocalState(registry));
760 if (!local_state.get()) 768 if (!local_state.get())
761 return; 769 return;
762 local_state->RegisterBooleanPref(prefs::kStabilityExitedCleanly, false);
763 local_state->RegisterIntegerPref(prefs::kStabilityLaunchCount, -1);
764 local_state->RegisterIntegerPref(prefs::kStabilityPageLoadCount, -1);
765 local_state->RegisterIntegerPref(prefs::kStabilityCrashCount, 0);
766 local_state->RegisterIntegerPref(prefs::kStabilityRendererCrashCount, 0);
767 770
768 metrics->browser_clean_exit = 771 metrics->browser_clean_exit =
769 local_state->GetBoolean(prefs::kStabilityExitedCleanly); 772 local_state->GetBoolean(prefs::kStabilityExitedCleanly);
770 metrics->browser_launch_count = 773 metrics->browser_launch_count =
771 local_state->GetInteger(prefs::kStabilityLaunchCount); 774 local_state->GetInteger(prefs::kStabilityLaunchCount);
772 metrics->page_load_count = 775 metrics->page_load_count =
773 local_state->GetInteger(prefs::kStabilityPageLoadCount); 776 local_state->GetInteger(prefs::kStabilityPageLoadCount);
774 metrics->browser_crash_count = 777 metrics->browser_crash_count =
775 local_state->GetInteger(prefs::kStabilityCrashCount); 778 local_state->GetInteger(prefs::kStabilityCrashCount);
776 metrics->renderer_crash_count = 779 metrics->renderer_crash_count =
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 if (!g_end_url.empty()) { 829 if (!g_end_url.empty()) {
827 NavigateToURLLogResult( 830 NavigateToURLLogResult(
828 g_end_url, log_file, NULL, g_continuous_load, false); 831 g_end_url, log_file, NULL, g_continuous_load, false);
829 } 832 }
830 833
831 log_file.close(); 834 log_file.close();
832 } 835 }
833 836
834 } // namespace 837 } // namespace
835 838
OLDNEW
« no previous file with comments | « chrome/test/base/testing_pref_service.cc ('k') | chrome_frame/test/net/fake_external_tab.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698