| Index: content/browser/loader/resource_loader_unittest.cc
|
| diff --git a/content/browser/loader/resource_loader_unittest.cc b/content/browser/loader/resource_loader_unittest.cc
|
| index ff068e7a74036bb4bc3a7f589818649156062b22..9ea8a2609f4521866a36f833d494ddd8bbee4f84 100644
|
| --- a/content/browser/loader/resource_loader_unittest.cc
|
| +++ b/content/browser/loader/resource_loader_unittest.cc
|
| @@ -42,6 +42,7 @@
|
| #include "net/cert/x509_certificate.h"
|
| #include "net/nqe/effective_connection_type.h"
|
| #include "net/nqe/network_quality_estimator_test_util.h"
|
| +#include "net/ssl/client_cert_identity_test_util.h"
|
| #include "net/ssl/client_cert_store.h"
|
| #include "net/ssl/ssl_cert_request_info.h"
|
| #include "net/ssl/ssl_private_key.h"
|
| @@ -79,7 +80,7 @@ class ClientCertStoreStub : public net::ClientCertStore {
|
| ClientCertStoreStub(const net::CertificateList& response,
|
| int* request_count,
|
| std::vector<std::string>* requested_authorities)
|
| - : response_(response),
|
| + : response_(std::move(response)),
|
| requested_authorities_(requested_authorities),
|
| request_count_(request_count) {
|
| requested_authorities_->clear();
|
| @@ -94,7 +95,7 @@ class ClientCertStoreStub : public net::ClientCertStore {
|
| *requested_authorities_ = cert_request_info.cert_authorities;
|
| ++(*request_count_);
|
|
|
| - callback.Run(response_);
|
| + callback.Run(net::FakeClientCertIdentityListFromCertificateList(response_));
|
| }
|
|
|
| private:
|
| @@ -134,7 +135,7 @@ class LoaderDestroyingCertStore : public net::ClientCertStore {
|
| const ClientCertListCallback& cert_selected_callback,
|
| const base::Closure& on_loader_deleted_callback) {
|
| loader->reset();
|
| - cert_selected_callback.Run(net::CertificateList());
|
| + cert_selected_callback.Run(net::ClientCertIdentityList());
|
| on_loader_deleted_callback.Run();
|
| }
|
|
|
| @@ -168,8 +169,9 @@ class MockClientCertURLRequestJob : public net::URLRequestTestJob {
|
| base::RetainedRef(cert_request_info)));
|
| }
|
|
|
| - void ContinueWithCertificate(net::X509Certificate* cert,
|
| - net::SSLPrivateKey* private_key) override {
|
| + void ContinueWithCertificate(
|
| + scoped_refptr<net::X509Certificate> cert,
|
| + scoped_refptr<net::SSLPrivateKey> private_key) override {
|
| net::URLRequestTestJob::Start();
|
| }
|
|
|
| @@ -277,28 +279,31 @@ class SelectCertificateBrowserClient : public TestContentBrowserClient {
|
| void SelectClientCertificate(
|
| WebContents* web_contents,
|
| net::SSLCertRequestInfo* cert_request_info,
|
| - net::CertificateList client_certs,
|
| + net::ClientCertIdentityList client_certs,
|
| std::unique_ptr<ClientCertificateDelegate> delegate) override {
|
| EXPECT_FALSE(delegate_.get());
|
|
|
| ++call_count_;
|
| - passed_certs_ = std::move(client_certs);
|
| + passed_identities_ = std::move(client_certs);
|
| delegate_ = std::move(delegate);
|
| select_certificate_run_loop_.Quit();
|
| }
|
|
|
| int call_count() { return call_count_; }
|
| - net::CertificateList passed_certs() { return passed_certs_; }
|
| + const net::ClientCertIdentityList& passed_identities() {
|
| + return passed_identities_;
|
| + }
|
|
|
| - void ContinueWithCertificate(net::X509Certificate* cert) {
|
| - delegate_->ContinueWithCertificate(cert);
|
| + void ContinueWithCertificate(scoped_refptr<net::X509Certificate> cert,
|
| + scoped_refptr<net::SSLPrivateKey> private_key) {
|
| + delegate_->ContinueWithCertificate(std::move(cert), std::move(private_key));
|
| delegate_.reset();
|
| }
|
|
|
| void CancelCertificateSelection() { delegate_.reset(); }
|
|
|
| private:
|
| - net::CertificateList passed_certs_;
|
| + net::ClientCertIdentityList passed_identities_;
|
| int call_count_;
|
| std::unique_ptr<ClientCertificateDelegate> delegate_;
|
|
|
| @@ -599,7 +604,8 @@ TEST_F(ClientCertResourceLoaderTest, WithStoreLookup) {
|
| // Set up the test client cert store.
|
| int store_request_count;
|
| std::vector<std::string> store_requested_authorities;
|
| - net::CertificateList dummy_certs(1, GetTestCert());
|
| + scoped_refptr<net::X509Certificate> test_cert = GetTestCert();
|
| + net::CertificateList dummy_certs(1, test_cert);
|
| std::unique_ptr<ClientCertStoreStub> test_store(new ClientCertStoreStub(
|
| dummy_certs, &store_request_count, &store_requested_authorities));
|
| SetClientCertStore(std::move(test_store));
|
| @@ -622,10 +628,11 @@ TEST_F(ClientCertResourceLoaderTest, WithStoreLookup) {
|
| // Check if the retrieved certificates were passed to the content browser
|
| // client.
|
| EXPECT_EQ(1, test_client.call_count());
|
| - EXPECT_EQ(dummy_certs, test_client.passed_certs());
|
| + EXPECT_EQ(1U, test_client.passed_identities().size());
|
| + EXPECT_EQ(test_cert.get(), test_client.passed_identities()[0]->certificate());
|
|
|
| // Continue the request.
|
| - test_client.ContinueWithCertificate(nullptr);
|
| + test_client.ContinueWithCertificate(nullptr, nullptr);
|
| raw_ptr_resource_handler_->WaitUntilResponseComplete();
|
| EXPECT_EQ(net::OK, raw_ptr_resource_handler_->final_status().error());
|
|
|
| @@ -647,10 +654,10 @@ TEST_F(ClientCertResourceLoaderTest, WithNullStore) {
|
| // Check if the SelectClientCertificate was called on the content browser
|
| // client.
|
| EXPECT_EQ(1, test_client.call_count());
|
| - EXPECT_EQ(net::CertificateList(), test_client.passed_certs());
|
| + EXPECT_EQ(net::ClientCertIdentityList(), test_client.passed_identities());
|
|
|
| // Continue the request.
|
| - test_client.ContinueWithCertificate(nullptr);
|
| + test_client.ContinueWithCertificate(nullptr, nullptr);
|
| raw_ptr_resource_handler_->WaitUntilResponseComplete();
|
| EXPECT_EQ(net::OK, raw_ptr_resource_handler_->final_status().error());
|
|
|
| @@ -671,7 +678,7 @@ TEST_F(ClientCertResourceLoaderTest, CancelSelection) {
|
| // Check if the SelectClientCertificate was called on the content browser
|
| // client.
|
| EXPECT_EQ(1, test_client.call_count());
|
| - EXPECT_EQ(net::CertificateList(), test_client.passed_certs());
|
| + EXPECT_EQ(net::ClientCertIdentityList(), test_client.passed_identities());
|
|
|
| // Cancel the request.
|
| test_client.CancelCertificateSelection();
|
|
|