Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <CoreFoundation/CoreFoundation.h> | 5 #include <CoreFoundation/CoreFoundation.h> |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/mac/scoped_cftyperef.h" | 10 #include "base/mac/scoped_cftyperef.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 52 | 52 |
| 53 static PolicyProviderTestHarness* Create(); | 53 static PolicyProviderTestHarness* Create(); |
| 54 | 54 |
| 55 private: | 55 private: |
| 56 MockPreferences* prefs_; | 56 MockPreferences* prefs_; |
| 57 | 57 |
| 58 DISALLOW_COPY_AND_ASSIGN(TestHarness); | 58 DISALLOW_COPY_AND_ASSIGN(TestHarness); |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 TestHarness::TestHarness() | 61 TestHarness::TestHarness() |
| 62 : PolicyProviderTestHarness(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER) {} | 62 : PolicyProviderTestHarness(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, |
| 63 POLICY_SOURCE_PLATFORM) {} | |
|
bartfab (slow)
2015/09/14 14:42:27
Nit: #include "components/policy/core/common/polic
fhorschig
2015/09/16 13:52:05
Done.
| |
| 63 | 64 |
| 64 TestHarness::~TestHarness() {} | 65 TestHarness::~TestHarness() {} |
| 65 | 66 |
| 66 void TestHarness::SetUp() {} | 67 void TestHarness::SetUp() {} |
| 67 | 68 |
| 68 ConfigurationPolicyProvider* TestHarness::CreateProvider( | 69 ConfigurationPolicyProvider* TestHarness::CreateProvider( |
| 69 SchemaRegistry* registry, | 70 SchemaRegistry* registry, |
| 70 scoped_refptr<base::SequencedTaskRunner> task_runner) { | 71 scoped_refptr<base::SequencedTaskRunner> task_runner) { |
| 71 prefs_ = new MockPreferences(); | 72 prefs_ = new MockPreferences(); |
| 72 scoped_ptr<AsyncPolicyLoader> loader( | 73 scoped_ptr<AsyncPolicyLoader> loader( |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 180 ScopedCFTypeRef<CFPropertyListRef> test_value( | 181 ScopedCFTypeRef<CFPropertyListRef> test_value( |
| 181 base::SysUTF8ToCFStringRef("string value")); | 182 base::SysUTF8ToCFStringRef("string value")); |
| 182 ASSERT_TRUE(test_value.get()); | 183 ASSERT_TRUE(test_value.get()); |
| 183 prefs_->AddTestItem(name, test_value.get(), false); | 184 prefs_->AddTestItem(name, test_value.get(), false); |
| 184 | 185 |
| 185 // Make the provider read the updated |prefs_|. | 186 // Make the provider read the updated |prefs_|. |
| 186 provider_->RefreshPolicies(); | 187 provider_->RefreshPolicies(); |
| 187 loop_.RunUntilIdle(); | 188 loop_.RunUntilIdle(); |
| 188 PolicyBundle expected_bundle; | 189 PolicyBundle expected_bundle; |
| 189 expected_bundle.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())) | 190 expected_bundle.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())) |
| 190 .Set(test_keys::kKeyString, | 191 .SetWithSource(test_keys::kKeyString, |
| 191 POLICY_LEVEL_RECOMMENDED, | 192 POLICY_LEVEL_RECOMMENDED, |
| 192 POLICY_SCOPE_USER, | 193 POLICY_SCOPE_USER, |
| 193 new base::StringValue("string value"), | 194 new base::StringValue("string value"), |
| 194 NULL); | 195 NULL, |
|
bartfab (slow)
2015/09/14 14:42:27
Nit: s/NULL/nullptr/
fhorschig
2015/09/16 13:52:05
Done.
| |
| 196 POLICY_SOURCE_PLATFORM); | |
| 195 EXPECT_TRUE(provider_->policies().Equals(expected_bundle)); | 197 EXPECT_TRUE(provider_->policies().Equals(expected_bundle)); |
| 196 } | 198 } |
| 197 | 199 |
| 198 } // namespace policy | 200 } // namespace policy |
| OLD | NEW |