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 <CoreFoundation/CoreFoundation.h> | 5 #include <CoreFoundation/CoreFoundation.h> |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/mac/scoped_cftyperef.h" | 8 #include "base/mac/scoped_cftyperef.h" |
9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
11 #include "chrome/browser/policy/async_policy_provider.h" | 11 #include "chrome/browser/policy/async_policy_provider.h" |
12 #include "chrome/browser/policy/configuration_policy_provider_test.h" | 12 #include "chrome/browser/policy/configuration_policy_provider_test.h" |
13 #include "chrome/browser/policy/policy_bundle.h" | 13 #include "chrome/browser/policy/policy_bundle.h" |
14 #include "chrome/browser/policy/policy_loader_mac.h" | 14 #include "chrome/browser/policy/policy_loader_mac.h" |
15 #include "chrome/browser/policy/policy_map.h" | 15 #include "chrome/browser/policy/policy_map.h" |
16 #include "chrome/browser/policy/preferences_mock_mac.h" | 16 #include "chrome/browser/policy/preferences_mock_mac.h" |
17 #include "policy/policy_constants.h" | 17 #include "policy/policy_constants.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
19 | 19 |
20 using base::mac::ScopedCFTypeRef; | 20 using base::ScopedCFTypeRef; |
21 | 21 |
22 namespace policy { | 22 namespace policy { |
23 | 23 |
24 namespace { | 24 namespace { |
25 | 25 |
26 // Converts a base::Value to the equivalent CFPropertyListRef. | 26 // Converts a base::Value to the equivalent CFPropertyListRef. |
27 // The returned value is owned by the caller. | 27 // The returned value is owned by the caller. |
28 CFPropertyListRef CreatePropertyFromValue(const base::Value* value) { | 28 CFPropertyListRef CreatePropertyFromValue(const base::Value* value) { |
29 switch (value->GetType()) { | 29 switch (value->GetType()) { |
30 case base::Value::TYPE_NULL: | 30 case base::Value::TYPE_NULL: |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 ScopedCFTypeRef<CFPropertyListRef> property(CreatePropertyFromValue(&root)); | 326 ScopedCFTypeRef<CFPropertyListRef> property(CreatePropertyFromValue(&root)); |
327 ASSERT_TRUE(property); | 327 ASSERT_TRUE(property); |
328 scoped_ptr<base::Value> value( | 328 scoped_ptr<base::Value> value( |
329 PolicyLoaderMac::CreateValueFromProperty(property)); | 329 PolicyLoaderMac::CreateValueFromProperty(property)); |
330 ASSERT_TRUE(value.get()); | 330 ASSERT_TRUE(value.get()); |
331 | 331 |
332 EXPECT_TRUE(root.Equals(value.get())); | 332 EXPECT_TRUE(root.Equals(value.get())); |
333 } | 333 } |
334 | 334 |
335 } // namespace policy | 335 } // namespace policy |
OLD | NEW |