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

Side by Side Diff: chromeos/network/onc/onc_utils_unittest.cc

Issue 2619803003: Revert of ONC: Fix handling of invalid proxy scheme. (Closed)
Patch Set: Created 3 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
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_utils.h" 5 #include "chromeos/network/onc/onc_utils.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/json/json_file_value_serializer.h" 9 #include "base/json/json_file_value_serializer.h"
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 } 164 }
165 } 165 }
166 166
167 TEST(ONCUtils, ProxySettingsToProxyConfig) { 167 TEST(ONCUtils, ProxySettingsToProxyConfig) {
168 std::unique_ptr<base::Value> test_data(ReadTestJson("proxy_config.json")); 168 std::unique_ptr<base::Value> test_data(ReadTestJson("proxy_config.json"));
169 169
170 base::ListValue* list_of_tests; 170 base::ListValue* list_of_tests;
171 test_data->GetAsList(&list_of_tests); 171 test_data->GetAsList(&list_of_tests);
172 ASSERT_TRUE(list_of_tests); 172 ASSERT_TRUE(list_of_tests);
173 173
174 // Additional ONC -> ProxyConfig test cases to test fixup.
175 test_data = ReadTestJson("proxy_config_from_onc.json");
176 base::ListValue* list_of_tests2;
177 test_data->GetAsList(&list_of_tests2);
178 ASSERT_TRUE(list_of_tests2);
179 list_of_tests->Append(list_of_tests2->CreateDeepCopy());
180
181 int index = 0; 174 int index = 0;
182 for (base::ListValue::iterator it = list_of_tests->begin(); 175 for (base::ListValue::iterator it = list_of_tests->begin();
183 it != list_of_tests->end(); ++it, ++index) { 176 it != list_of_tests->end(); ++it, ++index) {
184 SCOPED_TRACE("Test case #" + base::IntToString(index)); 177 SCOPED_TRACE("Test case #" + base::IntToString(index));
185 178
186 base::DictionaryValue* test_case; 179 base::DictionaryValue* test_case;
187 (*it)->GetAsDictionary(&test_case); 180 (*it)->GetAsDictionary(&test_case);
188 181
189 base::DictionaryValue* onc_proxy_settings; 182 base::DictionaryValue* onc_proxy_settings;
190 test_case->GetDictionary("ONC_ProxySettings", &onc_proxy_settings); 183 test_case->GetDictionary("ONC_ProxySettings", &onc_proxy_settings);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 215
223 std::unique_ptr<base::DictionaryValue> actual_proxy_settings = 216 std::unique_ptr<base::DictionaryValue> actual_proxy_settings =
224 ConvertProxyConfigToOncProxySettings(*shill_proxy_config); 217 ConvertProxyConfigToOncProxySettings(*shill_proxy_config);
225 EXPECT_TRUE( 218 EXPECT_TRUE(
226 test_utils::Equals(onc_proxy_settings, actual_proxy_settings.get())); 219 test_utils::Equals(onc_proxy_settings, actual_proxy_settings.get()));
227 } 220 }
228 } 221 }
229 222
230 } // namespace onc 223 } // namespace onc
231 } // namespace chromeos 224 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/onc/onc_utils.cc ('k') | chromeos/test/data/network/proxy_config_from_onc.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698