OLD | NEW |
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 22 matching lines...) Expand all Loading... |
33 ::onc::ONCSource onc_source) { | 33 ::onc::ONCSource onc_source) { |
34 scoped_ptr<Validator> validator; | 34 scoped_ptr<Validator> validator; |
35 if (strict) { | 35 if (strict) { |
36 // Create a strict validator that complains about every error. | 36 // Create a strict validator that complains about every error. |
37 validator.reset(new Validator(true, true, true, managed_onc)); | 37 validator.reset(new Validator(true, true, true, managed_onc)); |
38 } else { | 38 } else { |
39 // Create a liberal validator that ignores or repairs non-critical errors. | 39 // Create a liberal validator that ignores or repairs non-critical errors. |
40 validator.reset(new Validator(false, false, false, managed_onc)); | 40 validator.reset(new Validator(false, false, false, managed_onc)); |
41 } | 41 } |
42 validator->SetOncSource(onc_source); | 42 validator->SetOncSource(onc_source); |
43 original_object_ = onc_object.Pass(); | 43 original_object_ = std::move(onc_object); |
44 repaired_object_ = validator->ValidateAndRepairObject(signature, | 44 repaired_object_ = validator->ValidateAndRepairObject(signature, |
45 *original_object_, | 45 *original_object_, |
46 &validation_result_); | 46 &validation_result_); |
47 } | 47 } |
48 | 48 |
49 void ExpectValid() { | 49 void ExpectValid() { |
50 EXPECT_EQ(Validator::VALID, validation_result_); | 50 EXPECT_EQ(Validator::VALID, validation_result_); |
51 EXPECT_TRUE(test_utils::Equals(original_object_.get(), | 51 EXPECT_TRUE(test_utils::Equals(original_object_.get(), |
52 repaired_object_.get())); | 52 repaired_object_.get())); |
53 } | 53 } |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 true, | 547 true, |
548 ::onc::ONC_SOURCE_DEVICE_POLICY), | 548 ::onc::ONC_SOURCE_DEVICE_POLICY), |
549 ExpectBothNotValid("", "")), | 549 ExpectBothNotValid("", "")), |
550 std::make_pair(OncParams("openvpn-invalid-verify-x509-type", | 550 std::make_pair(OncParams("openvpn-invalid-verify-x509-type", |
551 &kNetworkConfigurationSignature, | 551 &kNetworkConfigurationSignature, |
552 false), | 552 false), |
553 ExpectBothNotValid("", "")))); | 553 ExpectBothNotValid("", "")))); |
554 | 554 |
555 } // namespace onc | 555 } // namespace onc |
556 } // namespace chromeos | 556 } // namespace chromeos |
OLD | NEW |