1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "components/policy/core/common/preferences_mock_mac.h"
7 MockPreferences::MockPreferences() {
8 values_
.reset(CFDictionaryCreateMutable(kCFAllocatorDefault
,
10 &kCFTypeDictionaryKeyCallBacks
,
11 &kCFTypeDictionaryValueCallBacks
));
12 forced_
.reset(CFSetCreateMutable(kCFAllocatorDefault
,
14 &kCFTypeSetCallBacks
));
17 MockPreferences::~MockPreferences() {
20 Boolean
MockPreferences::AppSynchronize(CFStringRef applicationID
) {
24 CFPropertyListRef
MockPreferences::CopyAppValue(CFStringRef key
,
25 CFStringRef applicationID
) {
26 CFPropertyListRef value
;
27 Boolean found
= CFDictionaryGetValueIfPresent(values_
,
36 Boolean
MockPreferences::AppValueIsForced(CFStringRef key
,
37 CFStringRef applicationID
) {
38 return CFSetContainsValue(forced_
, key
);
41 void MockPreferences::AddTestItem(CFStringRef key
,
42 CFPropertyListRef value
,
44 CFDictionarySetValue(values_
, key
, value
);
46 CFSetAddValue(forced_
, key
);