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 "chromeos/network/onc/onc_merger.h" | 5 #include "chromeos/network/onc/onc_merger.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 namespace merger { | 47 namespace merger { |
48 | 48 |
49 class ONCMergerTest : public testing::Test { | 49 class ONCMergerTest : public testing::Test { |
50 public: | 50 public: |
51 scoped_ptr<const base::DictionaryValue> user_; | 51 scoped_ptr<const base::DictionaryValue> user_; |
52 scoped_ptr<const base::DictionaryValue> policy_; | 52 scoped_ptr<const base::DictionaryValue> policy_; |
53 scoped_ptr<const base::DictionaryValue> policy_without_recommended_; | 53 scoped_ptr<const base::DictionaryValue> policy_without_recommended_; |
54 scoped_ptr<const base::DictionaryValue> device_policy_; | 54 scoped_ptr<const base::DictionaryValue> device_policy_; |
55 | 55 |
56 virtual void SetUp() { | 56 virtual void SetUp() { |
57 policy_ = test_utils::ReadTestDictionary("policy.onc"); | 57 policy_ = test_utils::ReadTestDictionary("managed_vpn.onc"); |
58 policy_without_recommended_ = | 58 policy_without_recommended_ = |
59 test_utils::ReadTestDictionary("policy_without_recommended.onc"); | 59 test_utils::ReadTestDictionary("managed_vpn_without_recommended.onc"); |
60 user_ = test_utils::ReadTestDictionary("user.onc"); | 60 user_ = test_utils::ReadTestDictionary("user.onc"); |
61 device_policy_ = test_utils::ReadTestDictionary("device_policy.onc"); | 61 device_policy_ = test_utils::ReadTestDictionary("device_policy.onc"); |
62 } | 62 } |
63 }; | 63 }; |
64 | 64 |
65 TEST_F(ONCMergerTest, MandatoryValueOverwritesUserValue) { | 65 TEST_F(ONCMergerTest, MandatoryValueOverwritesUserValue) { |
66 scoped_ptr<base::DictionaryValue> merged( | 66 scoped_ptr<base::DictionaryValue> merged( |
67 MergeSettingsWithPolicies(policy_.get(), NULL, user_.get(), NULL)); | 67 MergeSettingsWithPolicies(policy_.get(), NULL, user_.get(), NULL)); |
68 EXPECT_TRUE(HaveSameValueAt(*merged, *policy_, "Type")); | 68 EXPECT_TRUE(HaveSameValueAt(*merged, *policy_, "Type")); |
69 EXPECT_TRUE(HaveSameValueAt(*merged, *policy_, "IPConfigs")); | 69 EXPECT_TRUE(HaveSameValueAt(*merged, *policy_, "IPConfigs")); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 TEST_F(ONCMergerTest, MandatoryDevicePolicyOverwritesRecommendedUserPolicy) { | 137 TEST_F(ONCMergerTest, MandatoryDevicePolicyOverwritesRecommendedUserPolicy) { |
138 scoped_ptr<base::DictionaryValue> merged(MergeSettingsWithPolicies( | 138 scoped_ptr<base::DictionaryValue> merged(MergeSettingsWithPolicies( |
139 policy_.get(), device_policy_.get(), user_.get(), NULL)); | 139 policy_.get(), device_policy_.get(), user_.get(), NULL)); |
140 EXPECT_TRUE(HaveSameValueAt(*merged, *device_policy_, | 140 EXPECT_TRUE(HaveSameValueAt(*merged, *device_policy_, |
141 "VPN.OpenVPN.Username")); | 141 "VPN.OpenVPN.Username")); |
142 } | 142 } |
143 | 143 |
144 } // namespace merger | 144 } // namespace merger |
145 } // namespace onc | 145 } // namespace onc |
146 } // namespace chromeos | 146 } // namespace chromeos |
OLD | NEW |