| 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_translator.h" | 5 #include "chromeos/network/onc/onc_translator.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_constants.h" | 9 #include "chromeos/network/onc/onc_constants.h" |
| 10 #include "chromeos/network/onc/onc_signature.h" | 10 #include "chromeos/network/onc/onc_signature.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 EXPECT_TRUE(test_utils::Equals(shill_network.get(), translation.get())); | 35 EXPECT_TRUE(test_utils::Equals(shill_network.get(), translation.get())); |
| 36 } | 36 } |
| 37 | 37 |
| 38 // Test different network types, such that each ONC object type is tested at | 38 // Test different network types, such that each ONC object type is tested at |
| 39 // least once. | 39 // least once. |
| 40 INSTANTIATE_TEST_CASE_P( | 40 INSTANTIATE_TEST_CASE_P( |
| 41 ONCTranslatorOncToShillTest, | 41 ONCTranslatorOncToShillTest, |
| 42 ONCTranslatorOncToShillTest, | 42 ONCTranslatorOncToShillTest, |
| 43 ::testing::Values( | 43 ::testing::Values( |
| 44 std::make_pair("managed_ethernet.onc", "shill_ethernet.json"), | 44 std::make_pair("managed_ethernet.onc", "shill_ethernet.json"), |
| 45 std::make_pair("valid_wifi_psk.onc", "shill_wifi_psk.json"), |
| 46 std::make_pair("valid_wifi_clientcert.onc", |
| 47 "shill_wifi_clientcert.json"), |
| 48 std::make_pair("valid_wifi_clientref.onc", |
| 49 "shill_wifi_clientref.json"), |
| 45 std::make_pair("valid_l2tpipsec.onc", "shill_l2tpipsec.json"), | 50 std::make_pair("valid_l2tpipsec.onc", "shill_l2tpipsec.json"), |
| 46 std::make_pair("valid_openvpn.onc", "shill_openvpn.json"))); | 51 std::make_pair("valid_l2tpipsec_clientcert.onc", |
| 52 "shill_l2tpipsec_clientcert.json"), |
| 53 std::make_pair("valid_openvpn.onc", "shill_openvpn.json"), |
| 54 std::make_pair("valid_openvpn_clientcert.onc", |
| 55 "shill_openvpn_clientcert.json"))); |
| 47 | 56 |
| 48 // Test the translation from Shill json to ONC. | 57 // Test the translation from Shill json to ONC. |
| 49 // | 58 // |
| 50 // Note: This translation direction doesn't have to reconstruct all of the ONC | 59 // Note: This translation direction doesn't have to reconstruct all of the ONC |
| 51 // fields, as Chrome doesn't need all of a Service's properties. | 60 // fields, as Chrome doesn't need all of a Service's properties. |
| 52 TEST(ONCTranslatorShillToOncTest, L2TPIPsec) { | 61 TEST(ONCTranslatorShillToOncTest, L2TPIPsec) { |
| 53 scoped_ptr<base::DictionaryValue> onc_network( | 62 scoped_ptr<base::DictionaryValue> onc_network( |
| 54 test_utils::ReadTestDictionary("valid_l2tpipsec.onc")); | 63 test_utils::ReadTestDictionary("valid_l2tpipsec.onc")); |
| 55 | 64 |
| 56 // These two fields are part of the ONC (and are required). However, they | 65 // These two fields are part of the ONC (and are required). However, they |
| (...skipping 20 matching lines...) Expand all Loading... |
| 77 test_utils::ReadTestDictionary("shill_openvpn.json")); | 86 test_utils::ReadTestDictionary("shill_openvpn.json")); |
| 78 | 87 |
| 79 scoped_ptr<base::DictionaryValue> translation(TranslateShillServiceToONCPart( | 88 scoped_ptr<base::DictionaryValue> translation(TranslateShillServiceToONCPart( |
| 80 *shill_network, &kNetworkConfigurationSignature)); | 89 *shill_network, &kNetworkConfigurationSignature)); |
| 81 | 90 |
| 82 EXPECT_TRUE(test_utils::Equals(onc_network.get(), translation.get())); | 91 EXPECT_TRUE(test_utils::Equals(onc_network.get(), translation.get())); |
| 83 } | 92 } |
| 84 | 93 |
| 85 } // namespace onc | 94 } // namespace onc |
| 86 } // namespace chromeos | 95 } // namespace chromeos |
| OLD | NEW |