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/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 #include "content/public/common/ssl_status.h" | 40 #include "content/public/common/ssl_status.h" |
41 #include "content/public/test/browser_test_utils.h" | 41 #include "content/public/test/browser_test_utils.h" |
42 #include "content/public/test/download_test_observer.h" | 42 #include "content/public/test/download_test_observer.h" |
43 #include "content/public/test/test_renderer_host.h" | 43 #include "content/public/test/test_renderer_host.h" |
44 #include "net/base/net_errors.h" | 44 #include "net/base/net_errors.h" |
45 #include "net/base/test_data_directory.h" | 45 #include "net/base/test_data_directory.h" |
46 #include "net/cert/cert_status_flags.h" | 46 #include "net/cert/cert_status_flags.h" |
47 #include "net/test/spawned_test_server/spawned_test_server.h" | 47 #include "net/test/spawned_test_server/spawned_test_server.h" |
48 | 48 |
49 #if defined(USE_NSS) | 49 #if defined(USE_NSS) |
50 #include "chrome/browser/net/nss_context.h" | 50 #include "chrome/browser/net/cert_database_service_factory.h" |
| 51 #include "components/cert_database/cert_database_service.h" |
51 #include "net/base/crypto_module.h" | 52 #include "net/base/crypto_module.h" |
52 #include "net/cert/nss_cert_database.h" | 53 #include "net/cert/nss_cert_database.h" |
53 #endif // defined(USE_NSS) | 54 #endif // defined(USE_NSS) |
54 | 55 |
55 using base::ASCIIToUTF16; | 56 using base::ASCIIToUTF16; |
56 using content::InterstitialPage; | 57 using content::InterstitialPage; |
57 using content::NavigationController; | 58 using content::NavigationController; |
58 using content::NavigationEntry; | 59 using content::NavigationEntry; |
59 using content::SSLStatus; | 60 using content::SSLStatus; |
60 using content::WebContents; | 61 using content::WebContents; |
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 | 736 |
736 #if defined(USE_NSS) | 737 #if defined(USE_NSS) |
737 class SSLUITestWithClientCert : public SSLUITest { | 738 class SSLUITestWithClientCert : public SSLUITest { |
738 public: | 739 public: |
739 SSLUITestWithClientCert() : cert_db_(NULL) {} | 740 SSLUITestWithClientCert() : cert_db_(NULL) {} |
740 | 741 |
741 void SetUpOnMainThread() override { | 742 void SetUpOnMainThread() override { |
742 SSLUITest::SetUpOnMainThread(); | 743 SSLUITest::SetUpOnMainThread(); |
743 | 744 |
744 base::RunLoop loop; | 745 base::RunLoop loop; |
745 GetNSSCertDatabaseForProfile( | 746 cert_database::CertDatabaseService* cert_service = |
746 browser()->profile(), | 747 cert_database::CertDatabaseServiceFactory::GetForBrowserContext( |
| 748 browser()->profile()); |
| 749 EXPECT_TRUE(cert_service); |
| 750 |
| 751 cert_service->GetNSSCertDatabase( |
747 base::Bind(&SSLUITestWithClientCert::DidGetCertDatabase, | 752 base::Bind(&SSLUITestWithClientCert::DidGetCertDatabase, |
748 base::Unretained(this), | 753 base::Unretained(this), loop.QuitClosure())); |
749 &loop)); | |
750 loop.Run(); | 754 loop.Run(); |
751 } | 755 } |
752 | 756 |
753 protected: | 757 protected: |
754 void DidGetCertDatabase(base::RunLoop* loop, net::NSSCertDatabase* cert_db) { | 758 void DidGetCertDatabase(const base::Closure& done_callback, |
| 759 net::NSSCertDatabase* cert_db) { |
755 cert_db_ = cert_db; | 760 cert_db_ = cert_db; |
756 loop->Quit(); | 761 done_callback.Run(); |
757 } | 762 } |
758 | 763 |
759 net::NSSCertDatabase* cert_db_; | 764 net::NSSCertDatabase* cert_db_; |
760 }; | 765 }; |
761 | 766 |
762 // SSL client certificate tests are only enabled when using NSS for private key | 767 // SSL client certificate tests are only enabled when using NSS for private key |
763 // storage, as only NSS can avoid modifying global machine state when testing. | 768 // storage, as only NSS can avoid modifying global machine state when testing. |
764 // See http://crbug.com/51132 | 769 // See http://crbug.com/51132 |
765 | 770 |
766 // Visit a HTTPS page which requires client cert authentication. The client | 771 // Visit a HTTPS page which requires client cert authentication. The client |
(...skipping 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1880 | 1885 |
1881 // Visit a page over https that contains a frame with a redirect. | 1886 // Visit a page over https that contains a frame with a redirect. |
1882 | 1887 |
1883 // XMLHttpRequest insecure content in synchronous mode. | 1888 // XMLHttpRequest insecure content in synchronous mode. |
1884 | 1889 |
1885 // XMLHttpRequest insecure content in asynchronous mode. | 1890 // XMLHttpRequest insecure content in asynchronous mode. |
1886 | 1891 |
1887 // XMLHttpRequest over bad ssl in synchronous mode. | 1892 // XMLHttpRequest over bad ssl in synchronous mode. |
1888 | 1893 |
1889 // XMLHttpRequest over OK ssl in synchronous mode. | 1894 // XMLHttpRequest over OK ssl in synchronous mode. |
OLD | NEW |