Chromium Code Reviews| Index: chromeos/network/onc/onc_utils_unittest.cc |
| diff --git a/chromeos/network/onc/onc_utils_unittest.cc b/chromeos/network/onc/onc_utils_unittest.cc |
| index f5acd5d04bd9449172a2f493e5076b6965547f59..67894b3a2c002ff379602d1d2ef13501fbc50d6c 100644 |
| --- a/chromeos/network/onc/onc_utils_unittest.cc |
| +++ b/chromeos/network/onc/onc_utils_unittest.cc |
| @@ -6,9 +6,12 @@ |
| #include <string> |
| +#include "base/strings/string_number_conversions.h" |
| #include "base/values.h" |
| +#include "chromeos/network/network_ui_data.h" |
| #include "chromeos/network/onc/onc_signature.h" |
| #include "chromeos/network/onc/onc_test_utils.h" |
| +#include "google_apis/drive/test_util.h" |
| #include "testing/gtest/include/gtest/gtest.h" |
| namespace chromeos { |
| @@ -136,5 +139,61 @@ TEST(ONCResolveServerCertRefs, ResolveServerCertRefs) { |
| } |
| } |
| +TEST(ONCUtils, ProxySettingsToProxyConfig) { |
| + scoped_ptr<base::Value> test_data = |
| + google_apis::test_util::LoadJSONFile("chromeos/net/proxy_config.json"); |
| + |
| + base::ListValue* list_of_tests; |
| + test_data->GetAsList(&list_of_tests); |
| + |
| + int index = 0; |
| + for (base::ListValue::iterator it = list_of_tests->begin(); |
| + it != list_of_tests->end(); ++it, ++index) { |
| + SCOPED_TRACE("Test case #" + base::IntToString(index)); |
| + |
| + base::DictionaryValue* test_case; |
| + (*it)->GetAsDictionary(&test_case); |
| + |
| + base::DictionaryValue* onc_proxy_settings; |
| + test_case->GetDictionary("ONC_ProxySettings", &onc_proxy_settings); |
| + |
| + base::DictionaryValue* expected_proxy_config; |
| + test_case->GetDictionary("ProxyConfig", &expected_proxy_config); |
| + |
| + scoped_ptr<base::DictionaryValue> actual_proxy_config = |
| + ConvertOncProxySettingsToProxyConfig(*onc_proxy_settings); |
| + EXPECT_TRUE( |
| + test_utils::Equals(expected_proxy_config, actual_proxy_config.get())); |
| + } |
| +} |
| + |
| +TEST(ONCUtils, ProxyConfigToOncProxySettings) { |
| + scoped_ptr<base::Value> test_data = |
| + google_apis::test_util::LoadJSONFile("chromeos/net/proxy_config.json"); |
| + |
| + base::ListValue* list_of_tests; |
| + test_data->GetAsList(&list_of_tests); |
| + |
| + int index = 0; |
| + for (base::ListValue::iterator it = list_of_tests->begin(); |
| + it != list_of_tests->end(); ++it, ++index) { |
| + SCOPED_TRACE("Test case #" + base::IntToString(index)); |
| + |
| + base::DictionaryValue* test_case; |
| + (*it)->GetAsDictionary(&test_case); |
| + |
| + base::DictionaryValue* shill_proxy_config; |
| + test_case->GetDictionary("ProxyConfig", &shill_proxy_config); |
| + |
| + base::DictionaryValue* onc_proxy_settings; |
| + test_case->GetDictionary("ONC_ProxySettings", &onc_proxy_settings); |
| + |
| + scoped_ptr<base::DictionaryValue> actual_proxy_settings = |
| + ConvertProxyConfigToOncProxySettings(*shill_proxy_config); |
| + EXPECT_TRUE( |
| + test_utils::Equals(onc_proxy_settings, actual_proxy_settings.get())); |
|
pneubeck (no reviews)
2015/07/07 10:18:48
you could also just do that in the the previous te
stevenjb
2015/07/07 18:30:36
Sure, but this makes identifying any failure easie
|
| + } |
| +} |
| + |
| } // namespace onc |
| } // namespace chromeos |