| 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 "components/policy/core/common/mac_util.h" | 5 #include "components/policy/core/common/mac_util.h" |
| 6 | 6 |
| 7 #include <CoreFoundation/CoreFoundation.h> | 7 #include <CoreFoundation/CoreFoundation.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| 11 #include "base/mac/scoped_cftyperef.h" | 11 #include "base/mac/scoped_cftyperef.h" |
| 12 #include "base/memory/ptr_util.h" |
| 12 #include "base/values.h" | 13 #include "base/values.h" |
| 13 #include "components/policy/core/common/policy_test_utils.h" | 14 #include "components/policy/core/common/policy_test_utils.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 15 | 16 |
| 16 namespace policy { | 17 namespace policy { |
| 17 | 18 |
| 18 TEST(PolicyMacUtilTest, PropertyToValue) { | 19 TEST(PolicyMacUtilTest, PropertyToValue) { |
| 19 base::DictionaryValue root; | 20 base::DictionaryValue root; |
| 20 | 21 |
| 21 // base::Value::Type::NONE | 22 // base::Value::Type::NONE |
| 22 root.Set("null", base::Value::CreateNullValue()); | 23 root.Set("null", base::MakeUnique<base::Value>()); |
| 23 | 24 |
| 24 // base::Value::Type::BOOLEAN | 25 // base::Value::Type::BOOLEAN |
| 25 root.SetBoolean("false", false); | 26 root.SetBoolean("false", false); |
| 26 root.SetBoolean("true", true); | 27 root.SetBoolean("true", true); |
| 27 | 28 |
| 28 // base::Value::Type::INTEGER | 29 // base::Value::Type::INTEGER |
| 29 root.SetInteger("int", 123); | 30 root.SetInteger("int", 123); |
| 30 root.SetInteger("zero", 0); | 31 root.SetInteger("zero", 0); |
| 31 | 32 |
| 32 // base::Value::Type::DOUBLE | 33 // base::Value::Type::DOUBLE |
| (...skipping 20 matching lines...) Expand all Loading... |
| 53 root.Set("dict", root.DeepCopy()); | 54 root.Set("dict", root.DeepCopy()); |
| 54 | 55 |
| 55 base::ScopedCFTypeRef<CFPropertyListRef> property(ValueToProperty(root)); | 56 base::ScopedCFTypeRef<CFPropertyListRef> property(ValueToProperty(root)); |
| 56 ASSERT_TRUE(property); | 57 ASSERT_TRUE(property); |
| 57 std::unique_ptr<base::Value> value = PropertyToValue(property); | 58 std::unique_ptr<base::Value> value = PropertyToValue(property); |
| 58 ASSERT_TRUE(value); | 59 ASSERT_TRUE(value); |
| 59 EXPECT_TRUE(root.Equals(value.get())); | 60 EXPECT_TRUE(root.Equals(value.get())); |
| 60 } | 61 } |
| 61 | 62 |
| 62 } // namespace policy | 63 } // namespace policy |
| OLD | NEW |