| 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 087878b267d6f5308b33dfe9331a89a2f9391e9a..24312f2b5d20425a2a190f5f125865eb3054185a 100644
|
| --- a/chrome/browser/policy/config_dir_policy_provider_unittest.cc
|
| +++ b/chrome/browser/policy/config_dir_policy_provider_unittest.cc
|
| @@ -18,6 +18,10 @@ namespace policy {
|
|
|
| namespace {
|
|
|
| +// Subdirectory of the ConfigDirPolicyProvider config dir that contains
|
| +// mandatory policies.
|
| +const char kManagedPath[] = "managed";
|
| +
|
| class TestHarness : public PolicyProviderTestHarness {
|
| public:
|
| TestHarness();
|
| @@ -68,7 +72,6 @@ void TestHarness::SetUp() {
|
| AsynchronousPolicyProvider* TestHarness::CreateProvider(
|
| const PolicyDefinitionList* policy_definition_list) {
|
| return new ConfigDirPolicyProvider(policy_definition_list,
|
| - POLICY_LEVEL_MANDATORY,
|
| POLICY_SCOPE_MACHINE,
|
| test_dir());
|
| }
|
| @@ -119,8 +122,11 @@ void TestHarness::WriteConfigFile(const base::DictionaryValue& dict,
|
| std::string data;
|
| JSONStringValueSerializer serializer(&data);
|
| serializer.Serialize(dict);
|
| - const FilePath file_path(test_dir().AppendASCII(file_name));
|
| - ASSERT_TRUE(file_util::WriteFile(file_path, data.c_str(), data.size()));
|
| + const FilePath dir_path(test_dir().AppendASCII(kManagedPath));
|
| + ASSERT_TRUE(file_util::CreateDirectory(dir_path));
|
| + const FilePath file_path(dir_path.AppendASCII(file_name));
|
| + ASSERT_EQ((int) data.size(),
|
| + file_util::WriteFile(file_path, data.c_str(), data.size()));
|
| }
|
|
|
| // static
|
| @@ -150,7 +156,6 @@ class ConfigDirPolicyLoaderTest : public testing::Test {
|
| // load.
|
| TEST_F(ConfigDirPolicyLoaderTest, ReadPrefsEmpty) {
|
| ConfigDirPolicyProviderDelegate loader(harness_.test_dir(),
|
| - POLICY_LEVEL_MANDATORY,
|
| POLICY_SCOPE_MACHINE);
|
| scoped_ptr<PolicyBundle> bundle(loader.Load());
|
| ASSERT_TRUE(bundle.get());
|
| @@ -164,7 +169,6 @@ TEST_F(ConfigDirPolicyLoaderTest, ReadPrefsNonExistentDirectory) {
|
| FilePath non_existent_dir(
|
| harness_.test_dir().Append(FILE_PATH_LITERAL("not_there")));
|
| ConfigDirPolicyProviderDelegate loader(non_existent_dir,
|
| - POLICY_LEVEL_MANDATORY,
|
| POLICY_SCOPE_MACHINE);
|
| scoped_ptr<PolicyBundle> bundle(loader.Load());
|
| ASSERT_TRUE(bundle.get());
|
| @@ -189,7 +193,6 @@ TEST_F(ConfigDirPolicyLoaderTest, ReadPrefsMergePrefs) {
|
| harness_.WriteConfigFile(test_dict_bar, base::IntToString(i));
|
|
|
| ConfigDirPolicyProviderDelegate loader(harness_.test_dir(),
|
| - POLICY_LEVEL_MANDATORY,
|
| POLICY_SCOPE_USER);
|
| scoped_ptr<PolicyBundle> bundle(loader.Load());
|
| ASSERT_TRUE(bundle.get());
|
| @@ -226,7 +229,6 @@ TEST_F(ConfigDirPolicyLoaderTest, Load3rdParty) {
|
|
|
| harness_.WriteConfigFile(json_dict, "policy.json");
|
| ConfigDirPolicyProviderDelegate loader(harness_.test_dir(),
|
| - POLICY_LEVEL_MANDATORY,
|
| POLICY_SCOPE_USER);
|
| scoped_ptr<PolicyBundle> bundle(loader.Load());
|
| ASSERT_TRUE(bundle.get());
|
|
|