| Index: chrome/browser/policy/policy_loader_mac_unittest.cc
|
| diff --git a/chrome/browser/policy/configuration_policy_provider_mac_unittest.cc b/chrome/browser/policy/policy_loader_mac_unittest.cc
|
| similarity index 92%
|
| rename from chrome/browser/policy/configuration_policy_provider_mac_unittest.cc
|
| rename to chrome/browser/policy/policy_loader_mac_unittest.cc
|
| index 9414f22f0d2a1c786eb83c2089eb705583b7e099..51a31c8ff507826d712431a46e6e89169bf36d1e 100644
|
| --- a/chrome/browser/policy/configuration_policy_provider_mac_unittest.cc
|
| +++ b/chrome/browser/policy/policy_loader_mac_unittest.cc
|
| @@ -8,10 +8,10 @@
|
| #include "base/mac/scoped_cftyperef.h"
|
| #include "base/sys_string_conversions.h"
|
| #include "base/values.h"
|
| -#include "chrome/browser/policy/asynchronous_policy_test_base.h"
|
| -#include "chrome/browser/policy/configuration_policy_provider_mac.h"
|
| +#include "chrome/browser/policy/async_policy_provider.h"
|
| #include "chrome/browser/policy/configuration_policy_provider_test.h"
|
| #include "chrome/browser/policy/policy_bundle.h"
|
| +#include "chrome/browser/policy/policy_loader_mac.h"
|
| #include "chrome/browser/policy/policy_map.h"
|
| #include "chrome/browser/preferences_mock_mac.h"
|
| #include "policy/policy_constants.h"
|
| @@ -158,7 +158,9 @@ void TestHarness::SetUp() {}
|
| ConfigurationPolicyProvider* TestHarness::CreateProvider(
|
| const PolicyDefinitionList* policy_definition_list) {
|
| prefs_ = new MockPreferences();
|
| - return new ConfigurationPolicyProviderMac(policy_definition_list, prefs_);
|
| + scoped_ptr<AsyncPolicyLoader> loader(
|
| + new PolicyLoaderMac(policy_definition_list, prefs_));
|
| + return new AsyncPolicyProvider(policy_definition_list, loader.Pass());
|
| }
|
|
|
| void TestHarness::InstallEmptyPolicy() {}
|
| @@ -214,23 +216,26 @@ PolicyProviderTestHarness* TestHarness::Create() {
|
|
|
| // Instantiate abstract test case for basic policy reading tests.
|
| INSTANTIATE_TEST_CASE_P(
|
| - ConfigurationPolicyProviderMacTest,
|
| + PolicyProviderMacTest,
|
| ConfigurationPolicyProviderTest,
|
| testing::Values(TestHarness::Create));
|
|
|
| // Special test cases for some mac preferences details.
|
| -class ConfigurationPolicyProviderMacTest : public AsynchronousPolicyTestBase {
|
| +class PolicyLoaderMacTest : public PolicyTestBase {
|
| protected:
|
| - ConfigurationPolicyProviderMacTest()
|
| + PolicyLoaderMacTest()
|
| : prefs_(new MockPreferences()),
|
| - provider_(&test_policy_definitions::kList, prefs_) {}
|
| - virtual ~ConfigurationPolicyProviderMacTest() {}
|
| + loader_(new PolicyLoaderMac(&test_policy_definitions::kList, prefs_)),
|
| + provider_(&test_policy_definitions::kList,
|
| + scoped_ptr<AsyncPolicyLoader>(loader_)) {}
|
| + virtual ~PolicyLoaderMacTest() {}
|
|
|
| MockPreferences* prefs_;
|
| - ConfigurationPolicyProviderMac provider_;
|
| + PolicyLoaderMac* loader_;
|
| + AsyncPolicyProvider provider_;
|
| };
|
|
|
| -TEST_F(ConfigurationPolicyProviderMacTest, Invalid) {
|
| +TEST_F(PolicyLoaderMacTest, Invalid) {
|
| ScopedCFTypeRef<CFStringRef> name(
|
| base::SysUTF8ToCFStringRef(test_policy_definitions::kKeyString));
|
| const char buffer[] = "binary \xde\xad\xbe\xef data";
|
| @@ -249,7 +254,7 @@ TEST_F(ConfigurationPolicyProviderMacTest, Invalid) {
|
| EXPECT_TRUE(provider_.policies().Equals(kEmptyBundle));
|
| }
|
|
|
| -TEST_F(ConfigurationPolicyProviderMacTest, TestNonForcedValue) {
|
| +TEST_F(PolicyLoaderMacTest, TestNonForcedValue) {
|
| ScopedCFTypeRef<CFStringRef> name(
|
| base::SysUTF8ToCFStringRef(test_policy_definitions::kKeyString));
|
| ScopedCFTypeRef<CFPropertyListRef> test_value(
|
| @@ -267,7 +272,7 @@ TEST_F(ConfigurationPolicyProviderMacTest, TestNonForcedValue) {
|
| EXPECT_TRUE(provider_.policies().Equals(expected_bundle));
|
| }
|
|
|
| -TEST_F(ConfigurationPolicyProviderMacTest, TestConversions) {
|
| +TEST_F(PolicyLoaderMacTest, TestConversions) {
|
| base::DictionaryValue root;
|
|
|
| // base::Value::TYPE_NULL
|
| @@ -307,7 +312,7 @@ TEST_F(ConfigurationPolicyProviderMacTest, TestConversions) {
|
| ScopedCFTypeRef<CFPropertyListRef> property(CreatePropertyFromValue(&root));
|
| ASSERT_TRUE(property);
|
| scoped_ptr<base::Value> value(
|
| - MacPreferencesPolicyProviderDelegate::CreateValueFromProperty(property));
|
| + PolicyLoaderMac::CreateValueFromProperty(property));
|
| ASSERT_TRUE(value.get());
|
|
|
| EXPECT_TRUE(root.Equals(value.get()));
|
|
|