| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
| 7 #include "base/synchronization/waitable_event.h" | 7 #include "base/synchronization/waitable_event.h" |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/ssl/ssl_client_auth_requestor_mock.h" | 10 #include "chrome/browser/ssl/ssl_client_auth_requestor_mock.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 using ::testing::StrictMock; | 36 using ::testing::StrictMock; |
| 37 using content::BrowserThread; | 37 using content::BrowserThread; |
| 38 | 38 |
| 39 // We don't have a way to do end-to-end SSL client auth testing, so this test | 39 // We don't have a way to do end-to-end SSL client auth testing, so this test |
| 40 // creates a certificate selector_ manually with a mocked | 40 // creates a certificate selector_ manually with a mocked |
| 41 // SSLClientAuthHandler. | 41 // SSLClientAuthHandler. |
| 42 | 42 |
| 43 class SSLClientCertificateSelectorTest : public InProcessBrowserTest { | 43 class SSLClientCertificateSelectorTest : public InProcessBrowserTest { |
| 44 public: | 44 public: |
| 45 SSLClientCertificateSelectorTest() | 45 SSLClientCertificateSelectorTest() |
| 46 : io_loop_finished_event_(false, false), | 46 : io_loop_finished_event_( |
| 47 base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| 48 base::WaitableEvent::InitialState::NOT_SIGNALED), |
| 47 url_request_(NULL), | 49 url_request_(NULL), |
| 48 selector_(NULL) { | 50 selector_(NULL) {} |
| 49 } | |
| 50 | 51 |
| 51 void SetUpInProcessBrowserTestFixture() override { | 52 void SetUpInProcessBrowserTestFixture() override { |
| 52 base::FilePath certs_dir = net::GetTestCertsDirectory(); | 53 base::FilePath certs_dir = net::GetTestCertsDirectory(); |
| 53 | 54 |
| 54 #if defined(USE_NSS_CERTS) | 55 #if defined(USE_NSS_CERTS) |
| 55 // If USE_NSS_CERTS, the selector tries to unlock the slot where the | 56 // If USE_NSS_CERTS, the selector tries to unlock the slot where the |
| 56 // private key of each certificate is stored. If no private key is found, | 57 // private key of each certificate is stored. If no private key is found, |
| 57 // the slot would be null and the unlock will crash. | 58 // the slot would be null and the unlock will crash. |
| 58 ASSERT_TRUE(test_nssdb_.is_open()); | 59 ASSERT_TRUE(test_nssdb_.is_open()); |
| 59 client_cert_1_ = net::ImportClientCertAndKeyFromFile( | 60 client_cert_1_ = net::ImportClientCertAndKeyFromFile( |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 EXPECT_TRUE(ui_test_utils::SendKeyPressSync( | 386 EXPECT_TRUE(ui_test_utils::SendKeyPressSync( |
| 386 browser_1_, ui::VKEY_RETURN, false, false, false, false)); | 387 browser_1_, ui::VKEY_RETURN, false, false, false, false)); |
| 387 | 388 |
| 388 Mock::VerifyAndClear(auth_requestor_.get()); | 389 Mock::VerifyAndClear(auth_requestor_.get()); |
| 389 Mock::VerifyAndClear(auth_requestor_1_.get()); | 390 Mock::VerifyAndClear(auth_requestor_1_.get()); |
| 390 | 391 |
| 391 // Now let the default selection for auth_requestor_ mock get checked on | 392 // Now let the default selection for auth_requestor_ mock get checked on |
| 392 // destruction. | 393 // destruction. |
| 393 EXPECT_CALL(*auth_requestor_.get(), CancelCertificateSelection()); | 394 EXPECT_CALL(*auth_requestor_.get(), CancelCertificateSelection()); |
| 394 } | 395 } |
| OLD | NEW |