| 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" |
| 6 |
| 5 #include <CoreFoundation/CoreFoundation.h> | 7 #include <CoreFoundation/CoreFoundation.h> |
| 6 | 8 |
| 9 #include <memory> |
| 10 |
| 7 #include "base/mac/scoped_cftyperef.h" | 11 #include "base/mac/scoped_cftyperef.h" |
| 8 #include "base/memory/scoped_ptr.h" | |
| 9 #include "base/values.h" | 12 #include "base/values.h" |
| 10 #include "components/policy/core/common/mac_util.h" | |
| 11 #include "components/policy/core/common/policy_test_utils.h" | 13 #include "components/policy/core/common/policy_test_utils.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 13 | 15 |
| 14 namespace policy { | 16 namespace policy { |
| 15 | 17 |
| 16 TEST(PolicyMacUtilTest, PropertyToValue) { | 18 TEST(PolicyMacUtilTest, PropertyToValue) { |
| 17 base::DictionaryValue root; | 19 base::DictionaryValue root; |
| 18 | 20 |
| 19 // base::Value::TYPE_NULL | 21 // base::Value::TYPE_NULL |
| 20 root.Set("null", base::Value::CreateNullValue()); | 22 root.Set("null", base::Value::CreateNullValue()); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 45 root.Set("list", list.DeepCopy()); | 47 root.Set("list", list.DeepCopy()); |
| 46 | 48 |
| 47 // base::Value::TYPE_DICTIONARY | 49 // base::Value::TYPE_DICTIONARY |
| 48 base::DictionaryValue dict; | 50 base::DictionaryValue dict; |
| 49 root.Set("emptyd", dict.DeepCopy()); | 51 root.Set("emptyd", dict.DeepCopy()); |
| 50 // Very meta. | 52 // Very meta. |
| 51 root.Set("dict", root.DeepCopy()); | 53 root.Set("dict", root.DeepCopy()); |
| 52 | 54 |
| 53 base::ScopedCFTypeRef<CFPropertyListRef> property(ValueToProperty(&root)); | 55 base::ScopedCFTypeRef<CFPropertyListRef> property(ValueToProperty(&root)); |
| 54 ASSERT_TRUE(property); | 56 ASSERT_TRUE(property); |
| 55 scoped_ptr<base::Value> value = PropertyToValue(property); | 57 std::unique_ptr<base::Value> value = PropertyToValue(property); |
| 56 ASSERT_TRUE(value); | 58 ASSERT_TRUE(value); |
| 57 EXPECT_TRUE(root.Equals(value.get())); | 59 EXPECT_TRUE(root.Equals(value.get())); |
| 58 } | 60 } |
| 59 | 61 |
| 60 } // namespace policy | 62 } // namespace policy |
| OLD | NEW |