Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(202)

Side by Side Diff: chromeos/network/onc/onc_normalizer_unittest.cc

Issue 750313003: ONC: Add IPConfigType. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ipconfig_object
Patch Set: Fixed default value documentation. Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_normalizer.h" 5 #include "chromeos/network/onc/onc_normalizer.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chromeos/network/onc/onc_signature.h" 9 #include "chromeos/network/onc/onc_signature.h"
10 #include "chromeos/network/onc/onc_test_utils.h" 10 #include "chromeos/network/onc/onc_test_utils.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 12
13 namespace chromeos { 13 namespace chromeos {
14 namespace onc { 14 namespace onc {
15 15
16 // This test case is about validating valid ONC objects. 16 // Validate that an irrelevant StaticIPConfig dictionary will be removed.
17 TEST(ONCNormalizerTest, NormalizeNetworkConfiguration) { 17 TEST(ONCNormalizerTest, RemoveStaticIPConfig) {
18 Normalizer normalizer(true); 18 Normalizer normalizer(true);
19 scoped_ptr<const base::DictionaryValue> data( 19 scoped_ptr<const base::DictionaryValue> data(
20 test_utils::ReadTestDictionary("settings_with_normalization.json")); 20 test_utils::ReadTestDictionary("settings_with_normalization.json"));
21
22 const base::DictionaryValue* original = NULL;
23 const base::DictionaryValue* expected_normalized = NULL;
24 data->GetDictionary("irrelevant-staticipconfig", &original);
25 data->GetDictionary("irrelevant-staticipconfig-normalized",
26 &expected_normalized);
27
28 scoped_ptr<base::DictionaryValue> actual_normalized =
29 normalizer.NormalizeObject(&kNetworkConfigurationSignature, *original);
30 EXPECT_TRUE(test_utils::Equals(expected_normalized, actual_normalized.get()));
31 }
32
33 // Validate that an irrelevant VPN dictionary will be removed.
34 TEST(ONCNormalizerTest, RemoveVPN) {
35 Normalizer normalizer(true);
36 scoped_ptr<const base::DictionaryValue> data(
37 test_utils::ReadTestDictionary("settings_with_normalization.json"));
21 38
22 const base::DictionaryValue* original = NULL; 39 const base::DictionaryValue* original = NULL;
23 const base::DictionaryValue* expected_normalized = NULL; 40 const base::DictionaryValue* expected_normalized = NULL;
24 data->GetDictionary("ethernet-and-vpn", &original); 41 data->GetDictionary("ethernet-and-vpn", &original);
25 data->GetDictionary("ethernet-and-vpn-normalized", &expected_normalized); 42 data->GetDictionary("ethernet-and-vpn-normalized", &expected_normalized);
26 43
27 scoped_ptr<base::DictionaryValue> actual_normalized = 44 scoped_ptr<base::DictionaryValue> actual_normalized =
28 normalizer.NormalizeObject(&kNetworkConfigurationSignature, *original); 45 normalizer.NormalizeObject(&kNetworkConfigurationSignature, *original);
29 EXPECT_TRUE(test_utils::Equals(expected_normalized, actual_normalized.get())); 46 EXPECT_TRUE(test_utils::Equals(expected_normalized, actual_normalized.get()));
30 } 47 }
31 48
32 } // namespace onc 49 } // namespace onc
33 } // namespace chromeos 50 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698