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

Side by Side Diff: chrome/browser/metrics/metrics_service_uitest.cc

Issue 2823037: Add an ExtensionPrefStore, layered between the user prefs nad the managed pre... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 5 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 // Tests the MetricsService stat recording to make sure that the numbers are 5 // Tests the MetricsService stat recording to make sure that the numbers are
6 // what we expect. 6 // what we expect.
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 ASSERT_TRUE(window->AppendTab(net::FilePathToFileURL(page2_path))); 47 ASSERT_TRUE(window->AppendTab(net::FilePathToFileURL(page2_path)));
48 } 48 }
49 49
50 // Get a PrefService whose contents correspond to the Local State file 50 // Get a PrefService whose contents correspond to the Local State file
51 // that was saved by the app as it closed. The caller takes ownership of the 51 // that was saved by the app as it closed. The caller takes ownership of the
52 // returned PrefService object. 52 // returned PrefService object.
53 PrefService* GetLocalState() { 53 PrefService* GetLocalState() {
54 FilePath local_state_path = user_data_dir() 54 FilePath local_state_path = user_data_dir()
55 .Append(chrome::kLocalStateFilename); 55 .Append(chrome::kLocalStateFilename);
56 56
57 return new PrefService(new PrefValueStore( 57 return PrefService::CreateUserPrefService(local_state_path);
58 NULL, /* no managed preferences */
59 new JsonPrefStore( /* local user preferences */
60 local_state_path,
61 ChromeThread::GetMessageLoopProxyForThread(ChromeThread::FILE)),
62 NULL /* no recommended preferences */));
63 } 58 }
64 }; 59 };
65 60
66 TEST_F(MetricsServiceTest, CloseRenderersNormally) { 61 TEST_F(MetricsServiceTest, CloseRenderersNormally) {
67 OpenTabs(); 62 OpenTabs();
68 QuitBrowser(); 63 QuitBrowser();
69 64
70 scoped_ptr<PrefService> local_state(GetLocalState()); 65 scoped_ptr<PrefService> local_state(GetLocalState());
71 local_state->RegisterBooleanPref(prefs::kStabilityExitedCleanly, true); 66 local_state->RegisterBooleanPref(prefs::kStabilityExitedCleanly, true);
72 local_state->RegisterIntegerPref(prefs::kStabilityLaunchCount, 0); 67 local_state->RegisterIntegerPref(prefs::kStabilityLaunchCount, 0);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 scoped_ptr<PrefService> local_state(GetLocalState()); 111 scoped_ptr<PrefService> local_state(GetLocalState());
117 local_state->RegisterBooleanPref(prefs::kStabilityExitedCleanly, true); 112 local_state->RegisterBooleanPref(prefs::kStabilityExitedCleanly, true);
118 local_state->RegisterIntegerPref(prefs::kStabilityLaunchCount, 0); 113 local_state->RegisterIntegerPref(prefs::kStabilityLaunchCount, 0);
119 local_state->RegisterIntegerPref(prefs::kStabilityPageLoadCount, 0); 114 local_state->RegisterIntegerPref(prefs::kStabilityPageLoadCount, 0);
120 local_state->RegisterIntegerPref(prefs::kStabilityRendererCrashCount, 0); 115 local_state->RegisterIntegerPref(prefs::kStabilityRendererCrashCount, 0);
121 EXPECT_TRUE(local_state->GetBoolean(prefs::kStabilityExitedCleanly)); 116 EXPECT_TRUE(local_state->GetBoolean(prefs::kStabilityExitedCleanly));
122 EXPECT_EQ(1, local_state->GetInteger(prefs::kStabilityLaunchCount)); 117 EXPECT_EQ(1, local_state->GetInteger(prefs::kStabilityLaunchCount));
123 EXPECT_EQ(4, local_state->GetInteger(prefs::kStabilityPageLoadCount)); 118 EXPECT_EQ(4, local_state->GetInteger(prefs::kStabilityPageLoadCount));
124 EXPECT_EQ(1, local_state->GetInteger(prefs::kStabilityRendererCrashCount)); 119 EXPECT_EQ(1, local_state->GetInteger(prefs::kStabilityRendererCrashCount));
125 } 120 }
OLDNEW
« no previous file with comments | « chrome/browser/managed_prefs_banner_base_unittest.cc ('k') | chrome/browser/net/chrome_url_request_context_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698