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" |
11 #include "chromeos/network/onc/onc_constants.h" | 11 #include "chromeos/network/onc/onc_constants.h" |
| 12 #include "chromeos/network/onc/onc_signature.h" |
12 #include "chromeos/network/onc/onc_test_utils.h" | 13 #include "chromeos/network/onc/onc_test_utils.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
14 | 15 |
15 namespace chromeos { | 16 namespace chromeos { |
16 namespace onc { | 17 namespace onc { |
17 namespace { | 18 namespace { |
18 | 19 |
19 // Checks that both dictionaries contain an entry at |path| with the same value. | 20 // Checks that both dictionaries contain an entry at |path| with the same value. |
20 ::testing::AssertionResult HaveSameValueAt(const base::DictionaryValue& a, | 21 ::testing::AssertionResult HaveSameValueAt(const base::DictionaryValue& a, |
21 const base::DictionaryValue& b, | 22 const base::DictionaryValue& b, |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 scoped_ptr<base::DictionaryValue> merged(MergeSettingsAndPoliciesToEffective( | 140 scoped_ptr<base::DictionaryValue> merged(MergeSettingsAndPoliciesToEffective( |
140 policy_.get(), device_policy_.get(), user_.get(), NULL)); | 141 policy_.get(), device_policy_.get(), user_.get(), NULL)); |
141 EXPECT_TRUE(HaveSameValueAt(*merged, *device_policy_, | 142 EXPECT_TRUE(HaveSameValueAt(*merged, *device_policy_, |
142 "VPN.OpenVPN.Username")); | 143 "VPN.OpenVPN.Username")); |
143 } | 144 } |
144 | 145 |
145 TEST_F(ONCMergerTest, MergeToAugmented) { | 146 TEST_F(ONCMergerTest, MergeToAugmented) { |
146 scoped_ptr<base::DictionaryValue> expected_augmented = | 147 scoped_ptr<base::DictionaryValue> expected_augmented = |
147 test_utils::ReadTestDictionary("augmented_merge.json"); | 148 test_utils::ReadTestDictionary("augmented_merge.json"); |
148 scoped_ptr<base::DictionaryValue> merged(MergeSettingsAndPoliciesToAugmented( | 149 scoped_ptr<base::DictionaryValue> merged(MergeSettingsAndPoliciesToAugmented( |
149 policy_.get(), device_policy_.get(), user_.get(), NULL)); | 150 kNetworkConfigurationSignature, policy_.get(), device_policy_.get(), |
| 151 user_.get(), NULL, NULL)); |
150 EXPECT_TRUE(test_utils::Equals(expected_augmented.get(), merged.get())); | 152 EXPECT_TRUE(test_utils::Equals(expected_augmented.get(), merged.get())); |
151 } | 153 } |
152 | 154 |
153 } // namespace merger | 155 } // namespace merger |
154 } // namespace onc | 156 } // namespace onc |
155 } // namespace chromeos | 157 } // namespace chromeos |
OLD | NEW |