OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 void TearDown() override { | 60 void TearDown() override { |
61 // Destroy |cert_verifier_| before destroying the ThreadBundle, otherwise | 61 // Destroy |cert_verifier_| before destroying the ThreadBundle, otherwise |
62 // BrowserThread::CurrentlyOn checks fail. | 62 // BrowserThread::CurrentlyOn checks fail. |
63 cert_verifier_.reset(); | 63 cert_verifier_.reset(); |
64 } | 64 } |
65 | 65 |
66 protected: | 66 protected: |
67 int VerifyTestServerCert(const net::TestCompletionCallback& test_callback, | 67 int VerifyTestServerCert(const net::TestCompletionCallback& test_callback, |
68 net::CertVerifyResult* verify_result, | 68 net::CertVerifyResult* verify_result, |
69 net::CertVerifier::RequestHandle* request_handle) { | 69 net::CertVerifier::RequestHandle* request_handle) { |
70 return cert_verifier_->Verify(test_server_cert_.get(), | 70 return cert_verifier_->Verify(test_server_cert_.get(), "127.0.0.1", |
71 "127.0.0.1", | 71 std::string(), 0, NULL, verify_result, |
72 0, | 72 test_callback.callback(), request_handle, |
73 NULL, | |
74 verify_result, | |
75 test_callback.callback(), | |
76 request_handle, | |
77 net::BoundNetLog()); | 73 net::BoundNetLog()); |
78 } | 74 } |
79 | 75 |
80 bool SupportsAdditionalTrustAnchors() { | 76 bool SupportsAdditionalTrustAnchors() { |
81 scoped_refptr<net::CertVerifyProc> proc = | 77 scoped_refptr<net::CertVerifyProc> proc = |
82 net::CertVerifyProc::CreateDefault(); | 78 net::CertVerifyProc::CreateDefault(); |
83 return proc->SupportsAdditionalTrustAnchors(); | 79 return proc->SupportsAdditionalTrustAnchors(); |
84 } | 80 } |
85 | 81 |
86 // Returns whether |cert_verifier| signalled usage of one of the additional | 82 // Returns whether |cert_verifier| signalled usage of one of the additional |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 int error = VerifyTestServerCert(callback, &verify_result, &request_handle); | 222 int error = VerifyTestServerCert(callback, &verify_result, &request_handle); |
227 // Note: this hits the cached result from the first Verify() in this test. | 223 // Note: this hits the cached result from the first Verify() in this test. |
228 EXPECT_EQ(net::ERR_CERT_AUTHORITY_INVALID, error); | 224 EXPECT_EQ(net::ERR_CERT_AUTHORITY_INVALID, error); |
229 } | 225 } |
230 // The additional trust anchors were reset, thus |cert_verifier_| should not | 226 // The additional trust anchors were reset, thus |cert_verifier_| should not |
231 // signal it's usage anymore. | 227 // signal it's usage anymore. |
232 EXPECT_FALSE(WasTrustAnchorUsedAndReset()); | 228 EXPECT_FALSE(WasTrustAnchorUsedAndReset()); |
233 } | 229 } |
234 | 230 |
235 } // namespace policy | 231 } // namespace policy |
OLD | NEW |