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

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

Issue 11488008: Adding more ONC validation tests. (Closed) Base URL: http://git.chromium.org/chromium/src.git@reject_network_independently
Patch Set: Rebased. Created 8 years 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
« no previous file with comments | « no previous file | chromeos/test/data/network/invalid_settings_with_repairs.json » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 ExpectValid(); 120 ExpectValid();
121 } 121 }
122 122
123 // The parameters are: 123 // The parameters are:
124 // OncParams(string: Filename of a ONC file that is to be validated, 124 // OncParams(string: Filename of a ONC file that is to be validated,
125 // OncValueSignature: signature of that ONC, 125 // OncValueSignature: signature of that ONC,
126 // bool: true if the ONC is managed). 126 // bool: true if the ONC is managed).
127 INSTANTIATE_TEST_CASE_P( 127 INSTANTIATE_TEST_CASE_P(
128 ONCValidatorValidTest, 128 ONCValidatorValidTest,
129 ONCValidatorValidTest, 129 ONCValidatorValidTest,
130 ::testing::Values(OncParams("managed_toplevel.onc", 130 ::testing::Values(OncParams("managed_toplevel1.onc",
131 &kToplevelConfigurationSignature,
132 true),
133 OncParams("managed_toplevel2.onc",
134 &kToplevelConfigurationSignature,
135 true),
136 // Test a configuration generated by CPanel.
137 OncParams("managed_toplevel_cpanel.onc",
131 &kToplevelConfigurationSignature, 138 &kToplevelConfigurationSignature,
132 true), 139 true),
133 OncParams("encrypted.onc", 140 OncParams("encrypted.onc",
134 &kToplevelConfigurationSignature, 141 &kToplevelConfigurationSignature,
135 true), 142 true),
136 OncParams("managed_vpn.onc", 143 OncParams("managed_vpn.onc",
137 &kNetworkConfigurationSignature, 144 &kNetworkConfigurationSignature,
138 true), 145 true),
139 OncParams("managed_ethernet.onc", 146 OncParams("managed_ethernet.onc",
140 &kNetworkConfigurationSignature, 147 &kNetworkConfigurationSignature,
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 &kToplevelConfigurationSignature, 276 &kToplevelConfigurationSignature,
270 true), 277 true),
271 RepairParams("toplevel-repaired", 278 RepairParams("toplevel-repaired",
272 "toplevel-repaired")), 279 "toplevel-repaired")),
273 // Ignore recommended arrays in unmanaged ONC. 280 // Ignore recommended arrays in unmanaged ONC.
274 std::make_pair(OncParams("network-with-illegal-recommended", 281 std::make_pair(OncParams("network-with-illegal-recommended",
275 &kNetworkConfigurationSignature, 282 &kNetworkConfigurationSignature,
276 false), 283 false),
277 RepairParams("network-repaired", "network-repaired")))); 284 RepairParams("network-repaired", "network-repaired"))));
278 285
286 // Strict and liberal validator both repair, but with different results.
287 INSTANTIATE_TEST_CASE_P(
288 StrictAndLiberalRepairDifferently,
289 ONCValidatorTestRepairable,
290 ::testing::Values(
291 std::make_pair(OncParams("toplevel-with-nested-warning",
292 &kToplevelConfigurationSignature,
293 false),
294 RepairParams("toplevel-empty", "toplevel-repaired"))));
295
279 // Strict and liberal validator return both INVALID. 296 // Strict and liberal validator return both INVALID.
280 INSTANTIATE_TEST_CASE_P( 297 INSTANTIATE_TEST_CASE_P(
281 StrictAndLiberalInvalid, 298 StrictAndLiberalInvalid,
282 ONCValidatorTestRepairable, 299 ONCValidatorTestRepairable,
283 ::testing::Values( 300 ::testing::Values(
284 std::make_pair(OncParams("network-unknown-value", 301 std::make_pair(OncParams("network-unknown-value",
285 &kNetworkConfigurationSignature, false), 302 &kNetworkConfigurationSignature, false),
286 RepairParams("", "")), 303 RepairParams("", "")),
287 std::make_pair(OncParams("managed-network-unknown-value", 304 std::make_pair(OncParams("managed-network-unknown-value",
288 &kNetworkConfigurationSignature, true), 305 &kNetworkConfigurationSignature, true),
289 RepairParams("", "")), 306 RepairParams("", "")),
290 std::make_pair(OncParams("network-value-out-of-range", 307 std::make_pair(OncParams("network-value-out-of-range",
291 &kNetworkConfigurationSignature, false), 308 &kNetworkConfigurationSignature, false),
292 RepairParams("", "")), 309 RepairParams("", "")),
293 std::make_pair(OncParams("managed-network-value-out-of-range", 310 std::make_pair(OncParams("managed-network-value-out-of-range",
294 &kNetworkConfigurationSignature, true), 311 &kNetworkConfigurationSignature, true),
295 RepairParams("", "")), 312 RepairParams("", "")),
296 std::make_pair(OncParams("network-wrong-type", 313 std::make_pair(OncParams("network-wrong-type",
297 &kNetworkConfigurationSignature, false), 314 &kNetworkConfigurationSignature, false),
298 RepairParams("", "")), 315 RepairParams("", "")),
299 std::make_pair(OncParams("managed-network-wrong-type", 316 std::make_pair(OncParams("managed-network-wrong-type",
300 &kNetworkConfigurationSignature, true), 317 &kNetworkConfigurationSignature, true),
301 RepairParams("", "")))); 318 RepairParams("", ""))));
302 319
303 } // namespace onc 320 } // namespace onc
304 } // namespace chromeos 321 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chromeos/test/data/network/invalid_settings_with_repairs.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698