summaryrefslogtreecommitdiffstats
path: root/chrome/browser/preferences_mock_mac.cc
diff options
context:
space:
mode:
authoravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-14 20:05:21 +0000
committeravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-14 20:05:21 +0000
commit4cd7adb2f69afcebd5690b10d24cd13f5c05f095 (patch)
treeb563fafc38aed7c76795ff568d035dc7b011e361 /chrome/browser/preferences_mock_mac.cc
parente63783695ea1efc9789883c132b7cfb56c26454c (diff)
downloadchromium_src-4cd7adb2f69afcebd5690b10d24cd13f5c05f095.zip
chromium_src-4cd7adb2f69afcebd5690b10d24cd13f5c05f095.tar.gz
chromium_src-4cd7adb2f69afcebd5690b10d24cd13f5c05f095.tar.bz2
Policy provider for the Mac.
BUG=http://crbug.com/7147 TEST=unit tested; not integrated yet Review URL: http://codereview.chromium.org/2605002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49715 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/preferences_mock_mac.cc')
-rw-r--r--chrome/browser/preferences_mock_mac.cc45
1 files changed, 45 insertions, 0 deletions
diff --git a/chrome/browser/preferences_mock_mac.cc b/chrome/browser/preferences_mock_mac.cc
new file mode 100644
index 0000000..aa32a93
--- /dev/null
+++ b/chrome/browser/preferences_mock_mac.cc
@@ -0,0 +1,45 @@
+// Copyright (c) 2010 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.
+
+#include "chrome/browser/preferences_mock_mac.h"
+
+MockPreferences::MockPreferences() {
+ values_.reset(CFDictionaryCreateMutable(kCFAllocatorDefault,
+ 0,
+ &kCFTypeDictionaryKeyCallBacks,
+ &kCFTypeDictionaryValueCallBacks));
+ forced_.reset(CFSetCreateMutable(kCFAllocatorDefault,
+ 0,
+ &kCFTypeSetCallBacks));
+}
+
+MockPreferences::~MockPreferences() {
+}
+
+
+CFPropertyListRef MockPreferences::CopyAppValue(CFStringRef key,
+ CFStringRef applicationID) {
+ CFPropertyListRef value;
+ Boolean found = CFDictionaryGetValueIfPresent(values_,
+ key,
+ &value);
+ if (!found || !value)
+ return NULL;
+ CFRetain(value);
+ return value;
+}
+
+Boolean MockPreferences::AppValueIsForced(CFStringRef key,
+ CFStringRef applicationID) {
+ return CFSetContainsValue(forced_, key);
+}
+
+void MockPreferences::AddTestItem(CFStringRef key,
+ CFPropertyListRef value,
+ bool is_forced) {
+ CFDictionarySetValue(values_, key, value);
+ if (is_forced)
+ CFSetAddValue(forced_, key);
+}
+