| OLD | NEW |
| 1 // Copyright (c) 2011 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 "base/compiler_specific.h" | 5 #include "base/compiler_specific.h" |
| 6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
| 7 #include "base/json/json_value_serializer.h" | 7 #include "base/json/json_value_serializer.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/scoped_temp_dir.h" | 9 #include "base/scoped_temp_dir.h" |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 TestHarness::TestHarness() {} | 53 TestHarness::TestHarness() {} |
| 54 | 54 |
| 55 TestHarness::~TestHarness() {} | 55 TestHarness::~TestHarness() {} |
| 56 | 56 |
| 57 void TestHarness::SetUp() { | 57 void TestHarness::SetUp() { |
| 58 ASSERT_TRUE(test_dir_.CreateUniqueTempDir()); | 58 ASSERT_TRUE(test_dir_.CreateUniqueTempDir()); |
| 59 } | 59 } |
| 60 | 60 |
| 61 AsynchronousPolicyProvider* TestHarness::CreateProvider( | 61 AsynchronousPolicyProvider* TestHarness::CreateProvider( |
| 62 const PolicyDefinitionList* policy_definition_list) { | 62 const PolicyDefinitionList* policy_definition_list) { |
| 63 return new ConfigDirPolicyProvider(policy_definition_list, test_dir()); | 63 return new ConfigDirPolicyProvider(policy_definition_list, |
| 64 POLICY_LEVEL_MANDATORY, |
| 65 test_dir()); |
| 64 } | 66 } |
| 65 | 67 |
| 66 void TestHarness::InstallEmptyPolicy() { | 68 void TestHarness::InstallEmptyPolicy() { |
| 67 DictionaryValue dict; | 69 DictionaryValue dict; |
| 68 WriteConfigFile(dict, "policy"); | 70 WriteConfigFile(dict, "policy"); |
| 69 } | 71 } |
| 70 | 72 |
| 71 void TestHarness::InstallStringPolicy(const std::string& policy_name, | 73 void TestHarness::InstallStringPolicy(const std::string& policy_name, |
| 72 const std::string& policy_value) { | 74 const std::string& policy_value) { |
| 73 DictionaryValue dict; | 75 DictionaryValue dict; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 for (unsigned int i = 5; i <= 8; ++i) | 166 for (unsigned int i = 5; i <= 8; ++i) |
| 165 harness_.WriteConfigFile(test_dict_bar, base::IntToString(i)); | 167 harness_.WriteConfigFile(test_dict_bar, base::IntToString(i)); |
| 166 | 168 |
| 167 ConfigDirPolicyProviderDelegate loader(harness_.test_dir()); | 169 ConfigDirPolicyProviderDelegate loader(harness_.test_dir()); |
| 168 scoped_ptr<base::DictionaryValue> policy(loader.Load()); | 170 scoped_ptr<base::DictionaryValue> policy(loader.Load()); |
| 169 EXPECT_TRUE(policy.get()); | 171 EXPECT_TRUE(policy.get()); |
| 170 EXPECT_TRUE(policy->Equals(&test_dict_foo)); | 172 EXPECT_TRUE(policy->Equals(&test_dict_foo)); |
| 171 } | 173 } |
| 172 | 174 |
| 173 } // namespace policy | 175 } // namespace policy |
| OLD | NEW |