| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 user_ = test_utils::ReadTestDictionary("user.onc"); | 62 user_ = test_utils::ReadTestDictionary("user.onc"); |
| 63 device_policy_ = test_utils::ReadTestDictionary("device_policy.onc"); | 63 device_policy_ = test_utils::ReadTestDictionary("device_policy.onc"); |
| 64 active_ = test_utils::ReadTestDictionary("vpn_active_settings.onc"); | 64 active_ = test_utils::ReadTestDictionary("vpn_active_settings.onc"); |
| 65 } | 65 } |
| 66 }; | 66 }; |
| 67 | 67 |
| 68 TEST_F(ONCMergerTest, MandatoryValueOverwritesUserValue) { | 68 TEST_F(ONCMergerTest, MandatoryValueOverwritesUserValue) { |
| 69 scoped_ptr<base::DictionaryValue> merged(MergeSettingsAndPoliciesToEffective( | 69 scoped_ptr<base::DictionaryValue> merged(MergeSettingsAndPoliciesToEffective( |
| 70 policy_.get(), NULL, user_.get(), NULL)); | 70 policy_.get(), NULL, user_.get(), NULL)); |
| 71 EXPECT_TRUE(HaveSameValueAt(*merged, *policy_, "Type")); | 71 EXPECT_TRUE(HaveSameValueAt(*merged, *policy_, "Type")); |
| 72 EXPECT_TRUE(HaveSameValueAt(*merged, *policy_, "IPConfigs")); | 72 EXPECT_TRUE(HaveSameValueAt(*merged, *policy_, "StaticIPConfig")); |
| 73 } | 73 } |
| 74 | 74 |
| 75 TEST_F(ONCMergerTest, MandatoryValueAndNoUserValue) { | 75 TEST_F(ONCMergerTest, MandatoryValueAndNoUserValue) { |
| 76 scoped_ptr<base::DictionaryValue> merged(MergeSettingsAndPoliciesToEffective( | 76 scoped_ptr<base::DictionaryValue> merged(MergeSettingsAndPoliciesToEffective( |
| 77 policy_.get(), NULL, user_.get(), NULL)); | 77 policy_.get(), NULL, user_.get(), NULL)); |
| 78 EXPECT_TRUE(HaveSameValueAt(*merged, *policy_, "GUID")); | 78 EXPECT_TRUE(HaveSameValueAt(*merged, *policy_, "GUID")); |
| 79 EXPECT_TRUE(HaveSameValueAt(*merged, *policy_, "VPN.OpenVPN.Username")); | 79 EXPECT_TRUE(HaveSameValueAt(*merged, *policy_, "VPN.OpenVPN.Username")); |
| 80 } | 80 } |
| 81 | 81 |
| 82 TEST_F(ONCMergerTest, MandatoryDictionaryAndNoUserValue) { | 82 TEST_F(ONCMergerTest, MandatoryDictionaryAndNoUserValue) { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 test_utils::ReadTestDictionary("augmented_merge.json"); | 150 test_utils::ReadTestDictionary("augmented_merge.json"); |
| 151 scoped_ptr<base::DictionaryValue> merged(MergeSettingsAndPoliciesToAugmented( | 151 scoped_ptr<base::DictionaryValue> merged(MergeSettingsAndPoliciesToAugmented( |
| 152 kNetworkConfigurationSignature, policy_.get(), device_policy_.get(), | 152 kNetworkConfigurationSignature, policy_.get(), device_policy_.get(), |
| 153 user_.get(), NULL, active_.get())); | 153 user_.get(), NULL, active_.get())); |
| 154 EXPECT_TRUE(test_utils::Equals(expected_augmented.get(), merged.get())); | 154 EXPECT_TRUE(test_utils::Equals(expected_augmented.get(), merged.get())); |
| 155 } | 155 } |
| 156 | 156 |
| 157 } // namespace merger | 157 } // namespace merger |
| 158 } // namespace onc | 158 } // namespace onc |
| 159 } // namespace chromeos | 159 } // namespace chromeos |
| OLD | NEW |