Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2603)

Unified Diff: chrome/browser/policy/config_dir_policy_provider_unittest.cc

Issue 10384145: Removed ConfigurationPolicyProvider::Provide(). (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebased Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/policy/config_dir_policy_provider_unittest.cc
diff --git a/chrome/browser/policy/config_dir_policy_provider_unittest.cc b/chrome/browser/policy/config_dir_policy_provider_unittest.cc
index 0f3bbe621eab20bc8eb50504f461e35cf66c531c..c4ee1ae67c91f39b0200adea462f1d2bb0c02c1e 100644
--- a/chrome/browser/policy/config_dir_policy_provider_unittest.cc
+++ b/chrome/browser/policy/config_dir_policy_provider_unittest.cc
@@ -11,6 +11,8 @@
#include "base/values.h"
#include "chrome/browser/policy/config_dir_policy_provider.h"
#include "chrome/browser/policy/configuration_policy_provider_test.h"
+#include "chrome/browser/policy/policy_bundle.h"
+#include "chrome/browser/policy/policy_map.h"
namespace policy {
@@ -26,6 +28,9 @@ class TestHarness : public PolicyProviderTestHarness {
virtual AsynchronousPolicyProvider* CreateProvider(
const PolicyDefinitionList* policy_definition_list) OVERRIDE;
+ virtual PolicyLevel GetPolicyLevel() const OVERRIDE;
+ virtual PolicyScope GetPolicyScope() const OVERRIDE;
+
virtual void InstallEmptyPolicy() OVERRIDE;
virtual void InstallStringPolicy(const std::string& policy_name,
const std::string& policy_value) OVERRIDE;
@@ -70,6 +75,14 @@ AsynchronousPolicyProvider* TestHarness::CreateProvider(
test_dir());
}
+PolicyLevel TestHarness::GetPolicyLevel() const {
+ return POLICY_LEVEL_MANDATORY;
+}
+
+PolicyScope TestHarness::GetPolicyScope() const {
+ return POLICY_SCOPE_MACHINE;
+}
+
void TestHarness::InstallEmptyPolicy() {
base::DictionaryValue dict;
WriteConfigFile(dict, "policy");
@@ -149,9 +162,10 @@ TEST_F(ConfigDirPolicyLoaderTest, ReadPrefsEmpty) {
ConfigDirPolicyProviderDelegate loader(harness_.test_dir(),
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE);
- scoped_ptr<PolicyMap> policy(loader.Load());
- EXPECT_TRUE(policy.get());
- EXPECT_TRUE(policy->empty());
+ scoped_ptr<PolicyBundle> bundle(loader.Load());
+ ASSERT_TRUE(bundle.get());
+ const PolicyBundle kEmptyBundle;
+ EXPECT_TRUE(bundle->Equals(kEmptyBundle));
}
// Reading from a non-existent directory should result in an empty preferences
@@ -162,9 +176,10 @@ TEST_F(ConfigDirPolicyLoaderTest, ReadPrefsNonExistentDirectory) {
ConfigDirPolicyProviderDelegate loader(non_existent_dir,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE);
- scoped_ptr<PolicyMap> policy(loader.Load());
- EXPECT_TRUE(policy.get());
- EXPECT_TRUE(policy->empty());
+ scoped_ptr<PolicyBundle> bundle(loader.Load());
+ ASSERT_TRUE(bundle.get());
+ const PolicyBundle kEmptyBundle;
+ EXPECT_TRUE(bundle->Equals(kEmptyBundle));
}
// Test merging values from different files.
@@ -186,11 +201,12 @@ TEST_F(ConfigDirPolicyLoaderTest, ReadPrefsMergePrefs) {
ConfigDirPolicyProviderDelegate loader(harness_.test_dir(),
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER);
- scoped_ptr<PolicyMap> policy(loader.Load());
- EXPECT_TRUE(policy.get());
- PolicyMap expected;
- expected.LoadFrom(&test_dict_foo, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER);
- EXPECT_TRUE(policy->Equals(expected));
+ scoped_ptr<PolicyBundle> bundle(loader.Load());
+ ASSERT_TRUE(bundle.get());
+ PolicyBundle expected_bundle;
+ expected_bundle.Get(POLICY_DOMAIN_CHROME, "")
+ .LoadFrom(&test_dict_foo, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER);
+ EXPECT_TRUE(bundle->Equals(expected_bundle));
}
} // namespace policy

Powered by Google App Engine
This is Rietveld 408576698