summaryrefslogtreecommitdiffstats
path: root/chrome/browser/policy
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/policy')
-rw-r--r--chrome/browser/policy/browser_policy_connector.cc2
-rw-r--r--chrome/browser/policy/policy_loader_mac.cc2
-rw-r--r--chrome/browser/policy/policy_loader_mac_unittest.cc2
-rw-r--r--chrome/browser/policy/preferences_mac.cc19
-rw-r--r--chrome/browser/policy/preferences_mac.h34
-rw-r--r--chrome/browser/policy/preferences_mock_mac.cc47
-rw-r--r--chrome/browser/policy/preferences_mock_mac.h33
7 files changed, 3 insertions, 136 deletions
diff --git a/chrome/browser/policy/browser_policy_connector.cc b/chrome/browser/policy/browser_policy_connector.cc
index 5c452ac..bccc637 100644
--- a/chrome/browser/policy/browser_policy_connector.cc
+++ b/chrome/browser/policy/browser_policy_connector.cc
@@ -56,7 +56,7 @@
#elif defined(OS_MACOSX) && !defined(OS_IOS)
#include <CoreFoundation/CoreFoundation.h>
#include "chrome/browser/policy/policy_loader_mac.h"
-#include "chrome/browser/policy/preferences_mac.h"
+#include "components/policy/core/common/preferences_mac.h"
#elif defined(OS_POSIX) && !defined(OS_ANDROID)
#include "chrome/browser/policy/config_dir_policy_loader.h"
#endif
diff --git a/chrome/browser/policy/policy_loader_mac.cc b/chrome/browser/policy/policy_loader_mac.cc
index 04a5e6f..1ee42ee 100644
--- a/chrome/browser/policy/policy_loader_mac.cc
+++ b/chrome/browser/policy/policy_loader_mac.cc
@@ -16,10 +16,10 @@
#include "base/strings/sys_string_conversions.h"
#include "base/values.h"
#include "chrome/browser/policy/policy_load_status.h"
-#include "chrome/browser/policy/preferences_mac.h"
#include "components/policy/core/common/external_data_fetcher.h"
#include "components/policy/core/common/policy_bundle.h"
#include "components/policy/core/common/policy_map.h"
+#include "components/policy/core/common/preferences_mac.h"
#include "components/policy/core/common/schema.h"
#include "components/policy/core/common/schema_map.h"
diff --git a/chrome/browser/policy/policy_loader_mac_unittest.cc b/chrome/browser/policy/policy_loader_mac_unittest.cc
index 00a8cd5..5445447 100644
--- a/chrome/browser/policy/policy_loader_mac_unittest.cc
+++ b/chrome/browser/policy/policy_loader_mac_unittest.cc
@@ -11,12 +11,12 @@
#include "base/strings/sys_string_conversions.h"
#include "base/values.h"
#include "chrome/browser/policy/policy_loader_mac.h"
-#include "chrome/browser/policy/preferences_mock_mac.h"
#include "components/policy/core/common/async_policy_provider.h"
#include "components/policy/core/common/configuration_policy_provider_test.h"
#include "components/policy/core/common/external_data_fetcher.h"
#include "components/policy/core/common/policy_bundle.h"
#include "components/policy/core/common/policy_map.h"
+#include "components/policy/core/common/preferences_mock_mac.h"
#include "testing/gtest/include/gtest/gtest.h"
using base::ScopedCFTypeRef;
diff --git a/chrome/browser/policy/preferences_mac.cc b/chrome/browser/policy/preferences_mac.cc
deleted file mode 100644
index cfc041f..0000000
--- a/chrome/browser/policy/preferences_mac.cc
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2013 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/policy/preferences_mac.h"
-
-Boolean MacPreferences::AppSynchronize(CFStringRef applicationID) {
- return CFPreferencesAppSynchronize(applicationID);
-}
-
-CFPropertyListRef MacPreferences::CopyAppValue(CFStringRef key,
- CFStringRef applicationID) {
- return CFPreferencesCopyAppValue(key, applicationID);
-}
-
-Boolean MacPreferences::AppValueIsForced(CFStringRef key,
- CFStringRef applicationID) {
- return CFPreferencesAppValueIsForced(key, applicationID);
-}
diff --git a/chrome/browser/policy/preferences_mac.h b/chrome/browser/policy/preferences_mac.h
deleted file mode 100644
index 31a46d8..0000000
--- a/chrome/browser/policy/preferences_mac.h
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright 2013 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_POLICY_PREFERENCES_MAC_H_
-#define CHROME_BROWSER_POLICY_PREFERENCES_MAC_H_
-
-#include <CoreFoundation/CoreFoundation.h>
-
-#include "base/basictypes.h"
-
-// Wraps a small part of the CFPreferences API surface in a very thin layer, to
-// allow it to be mocked out for testing.
-
-// See CFPreferences documentation for function documentation, as these call
-// through directly to their CFPreferences equivalents (Foo ->
-// CFPreferencesFoo).
-class MacPreferences {
- public:
- MacPreferences() {}
- virtual ~MacPreferences() {}
-
- virtual Boolean AppSynchronize(CFStringRef applicationID);
-
- virtual CFPropertyListRef CopyAppValue(CFStringRef key,
- CFStringRef applicationID);
-
- virtual Boolean AppValueIsForced(CFStringRef key, CFStringRef applicationID);
-
- private:
- DISALLOW_COPY_AND_ASSIGN(MacPreferences);
-};
-
-#endif // CHROME_BROWSER_POLICY_PREFERENCES_MAC_H_
diff --git a/chrome/browser/policy/preferences_mock_mac.cc b/chrome/browser/policy/preferences_mock_mac.cc
deleted file mode 100644
index 9d11df6..0000000
--- a/chrome/browser/policy/preferences_mock_mac.cc
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright 2013 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/policy/preferences_mock_mac.h"
-
-MockPreferences::MockPreferences() {
- values_.reset(CFDictionaryCreateMutable(kCFAllocatorDefault,
- 0,
- &kCFTypeDictionaryKeyCallBacks,
- &kCFTypeDictionaryValueCallBacks));
- forced_.reset(CFSetCreateMutable(kCFAllocatorDefault,
- 0,
- &kCFTypeSetCallBacks));
-}
-
-MockPreferences::~MockPreferences() {
-}
-
-Boolean MockPreferences::AppSynchronize(CFStringRef applicationID) {
- return true;
-}
-
-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);
-}
diff --git a/chrome/browser/policy/preferences_mock_mac.h b/chrome/browser/policy/preferences_mock_mac.h
deleted file mode 100644
index 3a28816..0000000
--- a/chrome/browser/policy/preferences_mock_mac.h
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright 2013 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_POLICY_PREFERENCES_MOCK_MAC_H_
-#define CHROME_BROWSER_POLICY_PREFERENCES_MOCK_MAC_H_
-
-#include "base/mac/scoped_cftyperef.h"
-#include "chrome/browser/policy/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) OVERRIDE;
-
- virtual CFPropertyListRef CopyAppValue(CFStringRef key,
- CFStringRef applicationID) OVERRIDE;
-
- virtual Boolean AppValueIsForced(CFStringRef key,
- CFStringRef applicationID) OVERRIDE;
-
- // Adds a preference item with the given info to the test set.
- void AddTestItem(CFStringRef key, CFPropertyListRef value, bool is_forced);
-
- private:
- base::ScopedCFTypeRef<CFMutableDictionaryRef> values_;
- base::ScopedCFTypeRef<CFMutableSetRef> forced_;
-};
-
-#endif // CHROME_BROWSER_POLICY_PREFERENCES_MOCK_MAC_H_