OLD | NEW |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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/bind.h" | 5 #include "base/bind.h" |
6 #include "base/callback.h" | 6 #include "base/callback.h" |
7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/prefs/pref_value_map.h" | 9 #include "base/prefs/pref_value_map.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 } | 27 } |
28 | 28 |
29 const char kTestPolicy[] = "unit_test.test_policy"; | 29 const char kTestPolicy[] = "unit_test.test_policy"; |
30 const char kTestPref[] = "unit_test.test_pref"; | 30 const char kTestPref[] = "unit_test.test_pref"; |
31 | 31 |
32 class TestSchemaValidatingPolicyHandler : public SchemaValidatingPolicyHandler { | 32 class TestSchemaValidatingPolicyHandler : public SchemaValidatingPolicyHandler { |
33 public: | 33 public: |
34 TestSchemaValidatingPolicyHandler(const Schema& schema, | 34 TestSchemaValidatingPolicyHandler(const Schema& schema, |
35 SchemaOnErrorStrategy strategy) | 35 SchemaOnErrorStrategy strategy) |
36 : SchemaValidatingPolicyHandler("PolicyForTesting", schema, strategy) {} | 36 : SchemaValidatingPolicyHandler("PolicyForTesting", schema, strategy) {} |
37 virtual ~TestSchemaValidatingPolicyHandler() {} | 37 ~TestSchemaValidatingPolicyHandler() override {} |
38 | 38 |
39 virtual void ApplyPolicySettings(const policy::PolicyMap&, | 39 void ApplyPolicySettings(const policy::PolicyMap&, PrefValueMap*) override {} |
40 PrefValueMap*) override { | |
41 } | |
42 | 40 |
43 bool CheckAndGetValueForTest(const PolicyMap& policies, | 41 bool CheckAndGetValueForTest(const PolicyMap& policies, |
44 scoped_ptr<base::Value>* value) { | 42 scoped_ptr<base::Value>* value) { |
45 return SchemaValidatingPolicyHandler::CheckAndGetValue( | 43 return SchemaValidatingPolicyHandler::CheckAndGetValue( |
46 policies, NULL, value); | 44 policies, NULL, value); |
47 } | 45 } |
48 }; | 46 }; |
49 | 47 |
50 } // namespace | 48 } // namespace |
51 | 49 |
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 handler_recommended.ApplyPolicySettings(policy_map_mandatory, &prefs); | 808 handler_recommended.ApplyPolicySettings(policy_map_mandatory, &prefs); |
811 EXPECT_TRUE(prefs.GetValue(kTestPref, &value_set_in_pref)); | 809 EXPECT_TRUE(prefs.GetValue(kTestPref, &value_set_in_pref)); |
812 EXPECT_TRUE(value_expected_in_pref->Equals(value_set_in_pref)); | 810 EXPECT_TRUE(value_expected_in_pref->Equals(value_set_in_pref)); |
813 | 811 |
814 EXPECT_FALSE( | 812 EXPECT_FALSE( |
815 handler_none.CheckPolicySettings(policy_map_recommended, &errors)); | 813 handler_none.CheckPolicySettings(policy_map_recommended, &errors)); |
816 EXPECT_FALSE(errors.empty()); | 814 EXPECT_FALSE(errors.empty()); |
817 } | 815 } |
818 | 816 |
819 } // namespace policy | 817 } // namespace policy |
OLD | NEW |