| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/net/client_cert_store_chromeos.h" | 5 #include "chrome/browser/chromeos/net/client_cert_store_chromeos.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/location.h" |
| 12 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
| 13 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 14 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
| 15 #include "base/run_loop.h" | 16 #include "base/run_loop.h" |
| 17 #include "base/single_thread_task_runner.h" |
| 18 #include "base/threading/thread_task_runner_handle.h" |
| 16 #include "chrome/browser/chromeos/certificate_provider/certificate_provider.h" | 19 #include "chrome/browser/chromeos/certificate_provider/certificate_provider.h" |
| 17 #include "crypto/scoped_test_nss_db.h" | 20 #include "crypto/scoped_test_nss_db.h" |
| 18 #include "net/base/test_data_directory.h" | 21 #include "net/base/test_data_directory.h" |
| 19 #include "net/cert/x509_certificate.h" | 22 #include "net/cert/x509_certificate.h" |
| 20 #include "net/ssl/ssl_cert_request_info.h" | 23 #include "net/ssl/ssl_cert_request_info.h" |
| 21 #include "net/test/cert_test_util.h" | 24 #include "net/test/cert_test_util.h" |
| 22 #include "testing/gtest/include/gtest/gtest.h" | 25 #include "testing/gtest/include/gtest/gtest.h" |
| 23 | 26 |
| 24 namespace chromeos { | 27 namespace chromeos { |
| 25 | 28 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 49 const scoped_refptr<net::X509Certificate>& cert) const override { | 52 const scoped_refptr<net::X509Certificate>& cert) const override { |
| 50 if (not_allowed_cert_.get() && cert->Equals(not_allowed_cert_.get())) | 53 if (not_allowed_cert_.get() && cert->Equals(not_allowed_cert_.get())) |
| 51 return false; | 54 return false; |
| 52 return true; | 55 return true; |
| 53 } | 56 } |
| 54 | 57 |
| 55 bool init_called() { return init_called_; } | 58 bool init_called() { return init_called_; } |
| 56 | 59 |
| 57 void FinishInit() { | 60 void FinishInit() { |
| 58 init_finished_ = true; | 61 init_finished_ = true; |
| 59 base::MessageLoop::current()->PostTask(FROM_HERE, pending_callback_); | 62 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, pending_callback_); |
| 60 pending_callback_.Reset(); | 63 pending_callback_.Reset(); |
| 61 } | 64 } |
| 62 | 65 |
| 63 void SetNotAllowedCert(scoped_refptr<net::X509Certificate> cert) { | 66 void SetNotAllowedCert(scoped_refptr<net::X509Certificate> cert) { |
| 64 not_allowed_cert_ = cert; | 67 not_allowed_cert_ = cert; |
| 65 } | 68 } |
| 66 | 69 |
| 67 private: | 70 private: |
| 68 bool init_finished_; | 71 bool init_finished_; |
| 69 bool init_called_ = false; | 72 bool init_called_ = false; |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 base::RunLoop run_loop; | 228 base::RunLoop run_loop; |
| 226 net::CertificateList selected_certs; | 229 net::CertificateList selected_certs; |
| 227 store.GetClientCerts(*request, &selected_certs, run_loop.QuitClosure()); | 230 store.GetClientCerts(*request, &selected_certs, run_loop.QuitClosure()); |
| 228 run_loop.Run(); | 231 run_loop.Run(); |
| 229 | 232 |
| 230 ASSERT_EQ(1u, selected_certs.size()); | 233 ASSERT_EQ(1u, selected_certs.size()); |
| 231 EXPECT_TRUE(cert_1->Equals(selected_certs[0].get())); | 234 EXPECT_TRUE(cert_1->Equals(selected_certs[0].get())); |
| 232 } | 235 } |
| 233 | 236 |
| 234 } // namespace chromeos | 237 } // namespace chromeos |
| OLD | NEW |