| 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 "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/files/scoped_temp_dir.h" |
| 7 #include "base/json/json_string_value_serializer.h" | 8 #include "base/json/json_string_value_serializer.h" |
| 8 #include "base/message_loop.h" | 9 #include "base/message_loop.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" |
| 12 #include "chrome/browser/policy/async_policy_provider.h" | 12 #include "chrome/browser/policy/async_policy_provider.h" |
| 13 #include "chrome/browser/policy/config_dir_policy_loader.h" | 13 #include "chrome/browser/policy/config_dir_policy_loader.h" |
| 14 #include "chrome/browser/policy/configuration_policy_provider_test.h" | 14 #include "chrome/browser/policy/configuration_policy_provider_test.h" |
| 15 #include "chrome/browser/policy/policy_bundle.h" | 15 #include "chrome/browser/policy/policy_bundle.h" |
| 16 #include "chrome/browser/policy/policy_map.h" | 16 #include "chrome/browser/policy/policy_map.h" |
| 17 | 17 |
| 18 namespace policy { | 18 namespace policy { |
| 19 | 19 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 void WriteConfigFile(const base::DictionaryValue& dict, | 54 void WriteConfigFile(const base::DictionaryValue& dict, |
| 55 const std::string& file_name); | 55 const std::string& file_name); |
| 56 | 56 |
| 57 // Returns a unique name for a policy file. Each subsequent call returns a new | 57 // Returns a unique name for a policy file. Each subsequent call returns a new |
| 58 // name that comes lexicographically after the previous one. | 58 // name that comes lexicographically after the previous one. |
| 59 std::string NextConfigFileName(); | 59 std::string NextConfigFileName(); |
| 60 | 60 |
| 61 static PolicyProviderTestHarness* Create(); | 61 static PolicyProviderTestHarness* Create(); |
| 62 | 62 |
| 63 private: | 63 private: |
| 64 ScopedTempDir test_dir_; | 64 base::ScopedTempDir test_dir_; |
| 65 int next_policy_file_index_; | 65 int next_policy_file_index_; |
| 66 | 66 |
| 67 DISALLOW_COPY_AND_ASSIGN(TestHarness); | 67 DISALLOW_COPY_AND_ASSIGN(TestHarness); |
| 68 }; | 68 }; |
| 69 | 69 |
| 70 TestHarness::TestHarness() | 70 TestHarness::TestHarness() |
| 71 : PolicyProviderTestHarness(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE), | 71 : PolicyProviderTestHarness(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE), |
| 72 next_policy_file_index_(100) {} | 72 next_policy_file_index_(100) {} |
| 73 | 73 |
| 74 TestHarness::~TestHarness() {} | 74 TestHarness::~TestHarness() {} |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 ConfigDirPolicyLoader loader(harness_.test_dir(), POLICY_SCOPE_USER); | 219 ConfigDirPolicyLoader loader(harness_.test_dir(), POLICY_SCOPE_USER); |
| 220 scoped_ptr<PolicyBundle> bundle(loader.Load()); | 220 scoped_ptr<PolicyBundle> bundle(loader.Load()); |
| 221 ASSERT_TRUE(bundle.get()); | 221 ASSERT_TRUE(bundle.get()); |
| 222 PolicyBundle expected_bundle; | 222 PolicyBundle expected_bundle; |
| 223 expected_bundle.Get(POLICY_DOMAIN_CHROME, "") | 223 expected_bundle.Get(POLICY_DOMAIN_CHROME, "") |
| 224 .LoadFrom(&test_dict_foo, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER); | 224 .LoadFrom(&test_dict_foo, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER); |
| 225 EXPECT_TRUE(bundle->Equals(expected_bundle)); | 225 EXPECT_TRUE(bundle->Equals(expected_bundle)); |
| 226 } | 226 } |
| 227 | 227 |
| 228 } // namespace policy | 228 } // namespace policy |
| OLD | NEW |