Home | History | Annotate | Download | only in browser
      1 // Copyright (c) 2010 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.
      4 
      5 #ifndef CHROME_BROWSER_PREFERENCES_MOCK_MAC_H_
      6 #define CHROME_BROWSER_PREFERENCES_MOCK_MAC_H_
      7 #pragma once
      8 
      9 #include "base/mac/scoped_cftyperef.h"
     10 #include "chrome/browser/preferences_mac.h"
     11 
     12 // Mock preferences wrapper for testing code that interacts with CFPreferences.
     13 class MockPreferences : public MacPreferences {
     14  public:
     15   MockPreferences();
     16   virtual ~MockPreferences();
     17 
     18   virtual Boolean AppSynchronize(CFStringRef applicationID);
     19 
     20   virtual CFPropertyListRef CopyAppValue(CFStringRef key,
     21                                          CFStringRef applicationID);
     22 
     23   virtual Boolean AppValueIsForced(CFStringRef key, CFStringRef applicationID);
     24 
     25   // Adds a preference item with the given info to the test set.
     26   void AddTestItem(CFStringRef key, CFPropertyListRef value, bool is_forced);
     27 
     28  private:
     29   base::mac::ScopedCFTypeRef<CFMutableDictionaryRef> values_;
     30   base::mac::ScopedCFTypeRef<CFMutableSetRef> forced_;
     31 };
     32 
     33 #endif  // CHROME_BROWSER_PREFERENCES_MOCK_MAC_H_
     34