summaryrefslogtreecommitdiffstats
path: root/chrome/test/testing_pref_service.cc
diff options
context:
space:
mode:
authordanno@chromium.org <danno@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-15 08:40:58 +0000
committerdanno@chromium.org <danno@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-15 08:40:58 +0000
commitce1850e90e8472a05fd9efdb8379c0d399d0be78 (patch)
tree4d1c28169195a01381d23fac5b07187f0ef7ab25 /chrome/test/testing_pref_service.cc
parent817b6121b50d77b2eacc5ce594cc20fe4fddef6d (diff)
downloadchromium_src-ce1850e90e8472a05fd9efdb8379c0d399d0be78.zip
chromium_src-ce1850e90e8472a05fd9efdb8379c0d399d0be78.tar.gz
chromium_src-ce1850e90e8472a05fd9efdb8379c0d399d0be78.tar.bz2
When a proxy command line switches are specified, policy admin warning shouldn't be shown
Removed the logic from the ConfigurationPolicyPrefStore that sets managed preferences, it's now completely handled by CommandLinePrefStore. Moved the detection of conflicting proxy settings between the managed and other stores into the PrefValueStore. Implemented a sentinel value that can be used by stores to signal that they are returning the default value. Changed managed store to use this sentinel to hide non-managed proxy settings proxy settings when proxy policy is specified. BUG=54792 TEST=manual Review URL: http://codereview.chromium.org/3367021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62716 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/testing_pref_service.cc')
-rw-r--r--chrome/test/testing_pref_service.cc40
1 files changed, 34 insertions, 6 deletions
diff --git a/chrome/test/testing_pref_service.cc b/chrome/test/testing_pref_service.cc
index b9f9927..5a4fde4 100644
--- a/chrome/test/testing_pref_service.cc
+++ b/chrome/test/testing_pref_service.cc
@@ -4,8 +4,10 @@
#include "chrome/test/testing_pref_service.h"
+#include "chrome/browser/prefs/command_line_pref_store.h"
#include "chrome/browser/prefs/dummy_pref_store.h"
#include "chrome/browser/prefs/pref_value_store.h"
+#include "chrome/browser/policy/configuration_policy_pref_store.h"
TestingPrefService::TestingPrefValueStore::TestingPrefValueStore(
PrefStore* managed_prefs,
@@ -22,12 +24,38 @@ TestingPrefService::TestingPrefValueStore::TestingPrefValueStore(
// which they want, and expand usage of this class to more unit tests.
TestingPrefService::TestingPrefService()
: PrefService(new TestingPrefValueStore(
- managed_prefs_ = new DummyPrefStore(),
- NULL,
- NULL,
- user_prefs_ = new DummyPrefStore(),
- NULL,
- default_prefs_ = new DummyPrefStore())) {
+ managed_prefs_ = new DummyPrefStore(),
+ NULL,
+ NULL,
+ user_prefs_ = new DummyPrefStore(),
+ NULL,
+ default_prefs_ = new DummyPrefStore())) {
+}
+
+TestingPrefService::TestingPrefService(
+ policy::ConfigurationPolicyProvider* provider,
+ CommandLine* command_line)
+ : PrefService(new TestingPrefValueStore(
+ managed_prefs_ = CreateManagedPrefStore(provider),
+ NULL,
+ CreateCommandLinePrefStore(command_line),
+ user_prefs_ = new DummyPrefStore(),
+ NULL,
+ default_prefs_ = new DummyPrefStore())) {
+}
+
+PrefStore* TestingPrefService::CreateManagedPrefStore(
+ policy::ConfigurationPolicyProvider* provider) {
+ if (provider)
+ return new policy::ConfigurationPolicyPrefStore(provider);
+ return new DummyPrefStore();
+}
+
+PrefStore* TestingPrefService::CreateCommandLinePrefStore(
+ CommandLine* command_line) {
+ if (command_line)
+ return new CommandLinePrefStore(command_line);
+ return new DummyPrefStore();
}
const Value* TestingPrefService::GetManagedPref(const char* path) {