OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "chrome/browser/chromeos/policy/policy_cert_verifier.h" | 5 #include "chrome/browser/chromeos/policy/policy_cert_verifier.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 test_ca_cert_ = LoadCertificate("root_ca_cert.pem", net::CA_CERT); | 49 test_ca_cert_ = LoadCertificate("root_ca_cert.pem", net::CA_CERT); |
50 ASSERT_TRUE(test_ca_cert_); | 50 ASSERT_TRUE(test_ca_cert_); |
51 test_server_cert_ = LoadCertificate("ok_cert.pem", net::SERVER_CERT); | 51 test_server_cert_ = LoadCertificate("ok_cert.pem", net::SERVER_CERT); |
52 ASSERT_TRUE(test_server_cert_); | 52 ASSERT_TRUE(test_server_cert_); |
53 test_ca_cert_list_.push_back(test_ca_cert_); | 53 test_ca_cert_list_.push_back(test_ca_cert_); |
54 } | 54 } |
55 | 55 |
56 virtual void TearDown() OVERRIDE { | 56 virtual void TearDown() OVERRIDE { |
57 // Destroy |cert_verifier_| before destroying the ThreadBundle, otherwise | 57 // Destroy |cert_verifier_| before destroying the ThreadBundle, otherwise |
58 // BrowserThread::CurrentlyOn checks fail. | 58 // BrowserThread::CurrentlyOn checks fail. |
| 59 cert_verifier_->UnsetTrustAnchorUsedCallback(); |
59 cert_verifier_.reset(); | 60 cert_verifier_.reset(); |
60 } | 61 } |
61 | 62 |
62 protected: | 63 protected: |
63 int VerifyTestServerCert(const net::TestCompletionCallback& test_callback, | 64 int VerifyTestServerCert(const net::TestCompletionCallback& test_callback, |
64 net::CertVerifyResult* verify_result, | 65 net::CertVerifyResult* verify_result, |
65 net::CertVerifier::RequestHandle* request_handle) { | 66 net::CertVerifier::RequestHandle* request_handle) { |
66 return cert_verifier_->Verify(test_server_cert_.get(), | 67 return cert_verifier_->Verify(test_server_cert_.get(), |
67 "127.0.0.1", | 68 "127.0.0.1", |
68 0, | 69 0, |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 int error = VerifyTestServerCert(callback, &verify_result, &request_handle); | 226 int error = VerifyTestServerCert(callback, &verify_result, &request_handle); |
226 // Note: this hits the cached result from the first Verify() in this test. | 227 // Note: this hits the cached result from the first Verify() in this test. |
227 EXPECT_EQ(net::ERR_CERT_AUTHORITY_INVALID, error); | 228 EXPECT_EQ(net::ERR_CERT_AUTHORITY_INVALID, error); |
228 } | 229 } |
229 // The additional trust anchors were reset, thus |cert_verifier_| should not | 230 // The additional trust anchors were reset, thus |cert_verifier_| should not |
230 // signal it's usage anymore. | 231 // signal it's usage anymore. |
231 EXPECT_FALSE(WasTrustAnchorUsedAndReset()); | 232 EXPECT_FALSE(WasTrustAnchorUsedAndReset()); |
232 } | 233 } |
233 | 234 |
234 } // namespace policy | 235 } // namespace policy |
OLD | NEW |