Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / chromeos / net / onc_utils_unittest.cc
blob514a3fac5027f60b9d20486e82915b112f2f517f
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 "chrome/browser/chromeos/net/onc_utils.h"
7 #include <string>
9 #include "base/strings/string_number_conversions.h"
10 #include "base/values.h"
11 #include "chromeos/network/network_ui_data.h"
12 #include "chromeos/network/onc/onc_test_utils.h"
13 #include "google_apis/drive/test_util.h"
14 #include "testing/gtest/include/gtest/gtest.h"
16 namespace chromeos {
17 namespace onc {
19 TEST(ONCUtils, ProxySettingsToProxyConfig) {
20 scoped_ptr<base::Value> test_data =
21 google_apis::test_util::LoadJSONFile("chromeos/net/proxy_config.json");
23 base::ListValue* list_of_tests;
24 test_data->GetAsList(&list_of_tests);
26 int index = 0;
27 for (base::ListValue::iterator it = list_of_tests->begin();
28 it != list_of_tests->end(); ++it, ++index) {
29 SCOPED_TRACE("Test case #" + base::IntToString(index));
31 base::DictionaryValue* test_case;
32 (*it)->GetAsDictionary(&test_case);
34 base::DictionaryValue* onc_proxy_settings;
35 test_case->GetDictionary("ONC_ProxySettings", &onc_proxy_settings);
37 base::DictionaryValue* expected_proxy_config;
38 test_case->GetDictionary("ProxyConfig", &expected_proxy_config);
40 scoped_ptr<base::DictionaryValue> actual_proxy_config =
41 ConvertOncProxySettingsToProxyConfig(*onc_proxy_settings);
42 EXPECT_TRUE(test_utils::Equals(expected_proxy_config,
43 actual_proxy_config.get()));
47 } // namespace onc
48 } // namespace chromeos