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

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

Issue 12390017: Separating ONC<->Shill translation from the ONC signature. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed browser tests. Created 7 years, 9 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 | Annotate | Revision Log
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_validator.h" 5 #include "chromeos/network/onc/onc_validator.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 &kToplevelConfigurationSignature, 149 &kToplevelConfigurationSignature,
150 false), 150 false),
151 OncParams("encrypted.onc", 151 OncParams("encrypted.onc",
152 &kToplevelConfigurationSignature, 152 &kToplevelConfigurationSignature,
153 true), 153 true),
154 OncParams("managed_vpn.onc", 154 OncParams("managed_vpn.onc",
155 &kNetworkConfigurationSignature, 155 &kNetworkConfigurationSignature,
156 true), 156 true),
157 OncParams("managed_ethernet.onc", 157 OncParams("managed_ethernet.onc",
158 &kNetworkConfigurationSignature, 158 &kNetworkConfigurationSignature,
159 true))); 159 true),
160 OncParams("translation_of_shill_wifi_with_state.onc",
161 &kNetworkWithStateSignature,
162 false)));
160 163
161 namespace { 164 namespace {
162 165
163 struct RepairParams { 166 struct RepairParams {
164 // Both arguments are strings to identify the object that is expected as the 167 // Both arguments are strings to identify the object that is expected as the
165 // validation result. They may either be used as filenames or as dictionary 168 // validation result. They may either be used as filenames or as dictionary
166 // keys. 169 // keys.
167 RepairParams(std::string strict_repaired, 170 RepairParams(std::string strict_repaired,
168 std::string liberal_repaired) 171 std::string liberal_repaired)
169 : location_of_strict_repaired(strict_repaired), 172 : location_of_strict_repaired(strict_repaired),
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 &kNetworkConfigurationSignature, 267 &kNetworkConfigurationSignature,
265 true), 268 true),
266 RepairParams("", "managed-network-repaired")), 269 RepairParams("", "managed-network-repaired")),
267 std::make_pair(OncParams("network-missing-required", 270 std::make_pair(OncParams("network-missing-required",
268 &kNetworkConfigurationSignature, 271 &kNetworkConfigurationSignature,
269 false), 272 false),
270 RepairParams("", "network-missing-required")), 273 RepairParams("", "network-missing-required")),
271 std::make_pair(OncParams("managed-network-missing-required", 274 std::make_pair(OncParams("managed-network-missing-required",
272 &kNetworkConfigurationSignature, 275 &kNetworkConfigurationSignature,
273 true), 276 true),
274 RepairParams("", "managed-network-missing-required")))); 277 RepairParams("", "managed-network-missing-required")),
278 // Ensure that state values from Shill aren't accepted as
279 // configuration.
280 std::make_pair(OncParams("network-state-field",
281 &kNetworkConfigurationSignature,
282 false),
283 RepairParams("", "network-repaired")),
284 std::make_pair(OncParams("network-nested-state-field",
285 &kNetworkConfigurationSignature,
286 false),
287 RepairParams("",
288 "network-nested-state-field-repaired"))));
275 289
276 // Strict and liberal validator repair identically. 290 // Strict and liberal validator repair identically.
277 INSTANTIATE_TEST_CASE_P( 291 INSTANTIATE_TEST_CASE_P(
278 StrictAndLiberalRepairIdentically, 292 StrictAndLiberalRepairIdentically,
279 ONCValidatorTestRepairable, 293 ONCValidatorTestRepairable,
280 ::testing::Values( 294 ::testing::Values(
281 std::make_pair(OncParams("toplevel-invalid-network", 295 std::make_pair(OncParams("toplevel-invalid-network",
282 &kToplevelConfigurationSignature, 296 &kToplevelConfigurationSignature,
283 false), 297 false),
284 RepairParams("toplevel-repaired", 298 RepairParams("toplevel-repaired",
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 std::make_pair(OncParams("managed-network-wrong-type", 352 std::make_pair(OncParams("managed-network-wrong-type",
339 &kNetworkConfigurationSignature, true), 353 &kNetworkConfigurationSignature, true),
340 RepairParams("", "")), 354 RepairParams("", "")),
341 std::make_pair(OncParams("network-with-client-cert-pattern", 355 std::make_pair(OncParams("network-with-client-cert-pattern",
342 &kNetworkConfigurationSignature, true, 356 &kNetworkConfigurationSignature, true,
343 ONC_SOURCE_DEVICE_POLICY), 357 ONC_SOURCE_DEVICE_POLICY),
344 RepairParams("", "")))); 358 RepairParams("", ""))));
345 359
346 } // namespace onc 360 } // namespace onc
347 } // namespace chromeos 361 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/onc/onc_validator.cc ('k') | chromeos/test/data/network/invalid_settings_with_repairs.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698