Index: chrome/test/testing_pref_service.h |
diff --git a/chrome/test/testing_pref_service.h b/chrome/test/testing_pref_service.h |
index 25349b63251b810dbd43f2a34fe010fc4dd96f31..742914528393c7a4372d3073020514b0647243bf 100644 |
--- a/chrome/test/testing_pref_service.h |
+++ b/chrome/test/testing_pref_service.h |
@@ -1,4 +1,4 @@ |
-// Copyright (c) 2010 The Chromium Authors. All rights reserved. |
+// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
@@ -6,6 +6,7 @@ |
#define CHROME_TEST_TESTING_PREF_SERVICE_H_ |
#pragma once |
+#include "base/ref_counted.h" |
#include "chrome/browser/prefs/pref_service.h" |
class TestingPrefStore; |
@@ -13,11 +14,9 @@ class TestingPrefStore; |
// A PrefService subclass for testing. It operates totally in memory and |
// provides additional API for manipulating preferences at the different levels |
// (managed, extension, user) conveniently. |
-class TestingPrefService : public PrefService { |
+class TestingPrefServiceBase : public PrefService { |
public: |
- // Create an empty instance. |
- TestingPrefService(); |
- virtual ~TestingPrefService() {} |
+ virtual ~TestingPrefServiceBase(); |
// Read the value of a preference from the managed layer. Returns NULL if the |
// preference is not defined at the managed layer. |
@@ -36,6 +35,12 @@ class TestingPrefService : public PrefService { |
void SetUserPref(const char* path, Value* value); |
void RemoveUserPref(const char* path); |
+ protected: |
+ TestingPrefServiceBase( |
+ TestingPrefStore* managed_platform_prefs, |
+ TestingPrefStore* device_management_prefs, |
+ TestingPrefStore* user_prefs); |
+ |
private: |
// Reads the value of the preference indicated by |path| from |pref_store|. |
// Returns NULL if the preference was not found. |
@@ -48,10 +53,20 @@ class TestingPrefService : public PrefService { |
void RemovePref(TestingPrefStore* pref_store, const char* path); |
// Pointers to the pref stores our value store uses. |
- TestingPrefStore* managed_platform_prefs_; // weak |
- TestingPrefStore* device_management_prefs_; // weak |
- TestingPrefStore* user_prefs_; // weak |
+ scoped_refptr<TestingPrefStore> managed_platform_prefs_; |
+ scoped_refptr<TestingPrefStore> device_management_prefs_; |
+ scoped_refptr<TestingPrefStore> user_prefs_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(TestingPrefServiceBase); |
+}; |
+// Class for simplified construction of TestPrefServiceBase objects. |
+class TestingPrefService : public TestingPrefServiceBase { |
+ public: |
+ TestingPrefService(); |
+ virtual ~TestingPrefService(); |
+ |
+ private: |
DISALLOW_COPY_AND_ASSIGN(TestingPrefService); |
}; |