| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "chrome/browser/extensions/api/messaging/native_messaging_policy_handle
r.h" | 5 #include "chrome/browser/extensions/api/messaging/native_messaging_policy_handle
r.h" |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/policy_handlers.h" | 7 #include "chrome/browser/extensions/policy_handlers.h" |
| 8 #include "components/policy/core/browser/policy_error_map.h" | 8 #include "components/policy/core/browser/policy_error_map.h" |
| 9 #include "components/policy/core/common/policy_map.h" | 9 #include "components/policy/core/common/policy_map.h" |
| 10 #include "components/policy/core/common/policy_types.h" | 10 #include "components/policy/core/common/policy_types.h" |
| 11 #include "components/policy/policy_constants.h" |
| 11 #include "components/prefs/pref_value_map.h" | 12 #include "components/prefs/pref_value_map.h" |
| 12 #include "policy/policy_constants.h" | |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | 14 |
| 15 namespace extensions { | 15 namespace extensions { |
| 16 | 16 |
| 17 const char kTestPref[] = "unit_test.test_pref"; | 17 const char kTestPref[] = "unit_test.test_pref"; |
| 18 | 18 |
| 19 TEST(NativeMessagingHostListPolicyHandlerTest, CheckPolicySettings) { | 19 TEST(NativeMessagingHostListPolicyHandlerTest, CheckPolicySettings) { |
| 20 base::ListValue list; | 20 base::ListValue list; |
| 21 policy::PolicyMap policy_map; | 21 policy::PolicyMap policy_map; |
| 22 NativeMessagingHostListPolicyHandler handler( | 22 NativeMessagingHostListPolicyHandler handler( |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 policy.AppendString("invalid Name"); | 96 policy.AppendString("invalid Name"); |
| 97 policy_map.Set(policy::key::kNativeMessagingBlacklist, | 97 policy_map.Set(policy::key::kNativeMessagingBlacklist, |
| 98 policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, | 98 policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, |
| 99 policy::POLICY_SOURCE_CLOUD, policy.CreateDeepCopy(), nullptr); | 99 policy::POLICY_SOURCE_CLOUD, policy.CreateDeepCopy(), nullptr); |
| 100 handler.ApplyPolicySettings(policy_map, &prefs); | 100 handler.ApplyPolicySettings(policy_map, &prefs); |
| 101 EXPECT_TRUE(prefs.GetValue(kTestPref, &value)); | 101 EXPECT_TRUE(prefs.GetValue(kTestPref, &value)); |
| 102 EXPECT_TRUE(base::Value::Equals(&expected, value)); | 102 EXPECT_TRUE(base::Value::Equals(&expected, value)); |
| 103 } | 103 } |
| 104 | 104 |
| 105 } // namespace extensions | 105 } // namespace extensions |
| OLD | NEW |