summaryrefslogtreecommitdiffstats
path: root/chrome/browser/preferences_mock_mac.h
blob: 85e0e30ddffea35f8bae1f54d49d85bcf4d0dde4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// 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.

#ifndef CHROME_BROWSER_PREFERENCES_MOCK_MAC_H_
#define CHROME_BROWSER_PREFERENCES_MOCK_MAC_H_
#pragma once

#include "base/mac/scoped_cftyperef.h"
#include "chrome/browser/preferences_mac.h"

// Mock preferences wrapper for testing code that interacts with CFPreferences.
class MockPreferences : public MacPreferences {
 public:
  MockPreferences();
  virtual ~MockPreferences();

  virtual Boolean AppSynchronize(CFStringRef applicationID);

  virtual CFPropertyListRef CopyAppValue(CFStringRef key,
                                         CFStringRef applicationID);

  virtual Boolean AppValueIsForced(CFStringRef key, CFStringRef applicationID);

  // Adds a preference item with the given info to the test set.
  void AddTestItem(CFStringRef key, CFPropertyListRef value, bool is_forced);

 private:
  base::mac::ScopedCFTypeRef<CFMutableDictionaryRef> values_;
  base::mac::ScopedCFTypeRef<CFMutableSetRef> forced_;
};

#endif  // CHROME_BROWSER_PREFERENCES_MOCK_MAC_H_