| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 test_nss_user_.username_hash(), | 44 test_nss_user_.username_hash(), |
| 45 base::Callback<void(crypto::ScopedPK11Slot)>()))); | 45 base::Callback<void(crypto::ScopedPK11Slot)>()))); |
| 46 test_cert_db_->SetSlowTaskRunnerForTest(base::MessageLoopProxy::current()); | 46 test_cert_db_->SetSlowTaskRunnerForTest(base::MessageLoopProxy::current()); |
| 47 | 47 |
| 48 cert_verifier_.reset(new PolicyCertVerifier(base::Bind( | 48 cert_verifier_.reset(new PolicyCertVerifier(base::Bind( |
| 49 &PolicyCertVerifierTest::OnTrustAnchorUsed, base::Unretained(this)))); | 49 &PolicyCertVerifierTest::OnTrustAnchorUsed, base::Unretained(this)))); |
| 50 cert_verifier_->InitializeOnIOThread(new chromeos::CertVerifyProcChromeOS( | 50 cert_verifier_->InitializeOnIOThread(new chromeos::CertVerifyProcChromeOS( |
| 51 crypto::GetPublicSlotForChromeOSUser(test_nss_user_.username_hash()))); | 51 crypto::GetPublicSlotForChromeOSUser(test_nss_user_.username_hash()))); |
| 52 | 52 |
| 53 test_ca_cert_ = LoadCertificate("root_ca_cert.pem", net::CA_CERT); | 53 test_ca_cert_ = LoadCertificate("root_ca_cert.pem", net::CA_CERT); |
| 54 ASSERT_TRUE(test_ca_cert_); | 54 ASSERT_TRUE(test_ca_cert_.get()); |
| 55 test_server_cert_ = LoadCertificate("ok_cert.pem", net::SERVER_CERT); | 55 test_server_cert_ = LoadCertificate("ok_cert.pem", net::SERVER_CERT); |
| 56 ASSERT_TRUE(test_server_cert_); | 56 ASSERT_TRUE(test_server_cert_.get()); |
| 57 test_ca_cert_list_.push_back(test_ca_cert_); | 57 test_ca_cert_list_.push_back(test_ca_cert_); |
| 58 } | 58 } |
| 59 | 59 |
| 60 virtual void TearDown() OVERRIDE { | 60 virtual 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: |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 int error = VerifyTestServerCert(callback, &verify_result, &request_handle); | 226 int error = VerifyTestServerCert(callback, &verify_result, &request_handle); |
| 227 // 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. |
| 228 EXPECT_EQ(net::ERR_CERT_AUTHORITY_INVALID, error); | 228 EXPECT_EQ(net::ERR_CERT_AUTHORITY_INVALID, error); |
| 229 } | 229 } |
| 230 // The additional trust anchors were reset, thus |cert_verifier_| should not | 230 // The additional trust anchors were reset, thus |cert_verifier_| should not |
| 231 // signal it's usage anymore. | 231 // signal it's usage anymore. |
| 232 EXPECT_FALSE(WasTrustAnchorUsedAndReset()); | 232 EXPECT_FALSE(WasTrustAnchorUsedAndReset()); |
| 233 } | 233 } |
| 234 | 234 |
| 235 } // namespace policy | 235 } // namespace policy |
| OLD | NEW |