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

Side by Side Diff: chrome/browser/chromeos/net/onc_utils_unittest.cc

Issue 11664005: Extending the translation from ONC to Shill. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebased. Created 7 years, 11 months 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
(Empty)
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.
4
5 #include "chrome/browser/chromeos/net/onc_utils.h"
6
7 #include <string>
8
9 #include "base/memory/scoped_ptr.h"
10 #include "base/string_number_conversions.h"
11 #include "base/values.h"
12 #include "chrome/browser/chromeos/cros/network_ui_data.h"
13 #include "chrome/browser/google_apis/test_util.h"
14 #include "chromeos/network/onc/onc_test_utils.h"
15 #include "testing/gtest/include/gtest/gtest.h"
16
17 namespace chromeos {
18 namespace onc {
19
20 TEST(ONCUtils, ProxySettingsToProxyConfig) {
21 scoped_ptr<base::Value> test_data =
22 google_apis::test_util::LoadJSONFile("net/proxy_config.json");
23
24 base::ListValue* list_of_tests;
25 test_data->GetAsList(&list_of_tests);
26
27 int index = 0;
28 for (base::ListValue::iterator it = list_of_tests->begin();
29 it != list_of_tests->end(); ++it, ++index) {
30 SCOPED_TRACE("Test case #" + base::IntToString(index));
31
32 base::DictionaryValue* test_case;
33 (*it)->GetAsDictionary(&test_case);
34
35 base::DictionaryValue* onc_proxy_settings;
36 test_case->GetDictionary("ONC_ProxySettings", &onc_proxy_settings);
37
38 base::DictionaryValue* expected_proxy_config;
39 test_case->GetDictionary("ProxyConfig", &expected_proxy_config);
40
41 scoped_ptr<base::DictionaryValue> actual_proxy_config =
42 ConvertOncProxySettingsToProxyConfig(*onc_proxy_settings);
43 EXPECT_TRUE(test_utils::Equals(expected_proxy_config,
44 actual_proxy_config.get()));
45 }
46 }
47
48 class ONCCreateUIDataTest
49 : public ::testing::TestWithParam<std::pair<std::string, std::string> > {
50 };
51
52 TEST_P(ONCCreateUIDataTest, CreateUIData) {
53 scoped_ptr<base::DictionaryValue> onc_network =
54 test_utils::ReadTestDictionary(GetParam().first);
55
56 scoped_ptr<base::Value> expected_uidata =
57 google_apis::test_util::LoadJSONFile(GetParam().second);
58 const base::DictionaryValue* expected_uidata_dict;
59 expected_uidata->GetAsDictionary(&expected_uidata_dict);
60
61 scoped_ptr<NetworkUIData> actual_uidata =
62 CreateUIData(ONC_SOURCE_USER_POLICY, *onc_network);
63 EXPECT_TRUE(actual_uidata != NULL);
64
65 base::DictionaryValue actual_uidata_dict;
66 actual_uidata->FillDictionary(&actual_uidata_dict);
67 EXPECT_TRUE(test_utils::Equals(&actual_uidata_dict, expected_uidata_dict));
68 }
69
70 INSTANTIATE_TEST_CASE_P(
71 ONCCreateUIDataTest,
72 ONCCreateUIDataTest,
73 ::testing::Values(
74 std::make_pair("valid_wifi_clientcert.onc",
75 "net/uidata_for_wifi_clientcert.json"),
76 std::make_pair("valid_wifi_clientref.onc",
77 "net/uidata_for_wifi_clientref.json"),
78 std::make_pair("valid_wifi_psk.onc", "net/uidata_for_wifi_psk.json"),
79 std::make_pair("valid_openvpn_clientcert.onc",
80 "net/uidata_for_openvpn_clientcert.json"),
81 std::make_pair("valid_l2tpipsec_clientcert.onc",
82 "net/uidata_for_l2tpipsec_clientcert.json")));
83
84 } // namespace onc
85 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/net/onc_utils.cc ('k') | chrome/browser/chromeos/proxy_config_service_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698