cygprofile: increase timeouts to allow showing web contents
[chromium-blink-merge.git] / chromeos / network / onc / onc_normalizer_unittest.cc
blobd7e8b85e44f40ce296618642c5bdc2b50b63e59c
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
3 // found in the LICENSE file.
5 #include "chromeos/network/onc/onc_normalizer.h"
7 #include "base/memory/scoped_ptr.h"
8 #include "base/values.h"
9 #include "chromeos/network/onc/onc_signature.h"
10 #include "chromeos/network/onc/onc_test_utils.h"
11 #include "testing/gtest/include/gtest/gtest.h"
13 namespace chromeos {
14 namespace onc {
16 // Validate that an irrelevant StaticIPConfig dictionary will be removed.
17 TEST(ONCNormalizerTest, RemoveStaticIPConfig) {
18 Normalizer normalizer(true);
19 scoped_ptr<const base::DictionaryValue> data(
20 test_utils::ReadTestDictionary("settings_with_normalization.json"));
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);
28 scoped_ptr<base::DictionaryValue> actual_normalized =
29 normalizer.NormalizeObject(&kNetworkConfigurationSignature, *original);
30 EXPECT_TRUE(test_utils::Equals(expected_normalized, actual_normalized.get()));
33 // This test case is about validating valid ONC objects.
34 TEST(ONCNormalizerTest, NormalizeNetworkConfigurationEthernetAndVPN) {
35 Normalizer normalizer(true);
36 scoped_ptr<const base::DictionaryValue> data(
37 test_utils::ReadTestDictionary("settings_with_normalization.json"));
39 const base::DictionaryValue* original = NULL;
40 const base::DictionaryValue* expected_normalized = NULL;
41 data->GetDictionary("ethernet-and-vpn", &original);
42 data->GetDictionary("ethernet-and-vpn-normalized", &expected_normalized);
44 scoped_ptr<base::DictionaryValue> actual_normalized =
45 normalizer.NormalizeObject(&kNetworkConfigurationSignature, *original);
46 EXPECT_TRUE(test_utils::Equals(expected_normalized, actual_normalized.get()));
49 // This test case is about validating valid ONC objects.
50 TEST(ONCNormalizerTest, NormalizeNetworkConfigurationWifi) {
51 Normalizer normalizer(true);
52 scoped_ptr<const base::DictionaryValue> data(
53 test_utils::ReadTestDictionary("settings_with_normalization.json"));
55 const base::DictionaryValue* original = NULL;
56 const base::DictionaryValue* expected_normalized = NULL;
57 data->GetDictionary("wifi", &original);
58 data->GetDictionary("wifi-normalized", &expected_normalized);
60 scoped_ptr<base::DictionaryValue> actual_normalized =
61 normalizer.NormalizeObject(&kNetworkConfigurationSignature, *original);
62 EXPECT_TRUE(test_utils::Equals(expected_normalized, actual_normalized.get()));
65 } // namespace onc
66 } // namespace chromeos