Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(829)

Side by Side Diff: chrome/browser/ssl/ssl_browser_tests.cc

Issue 419013003: Replace c/b/nss_context by a KeyedService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added cert_database namespace. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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/public/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 672 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 734
734 #if defined(USE_NSS) 735 #if defined(USE_NSS)
735 class SSLUITestWithClientCert : public SSLUITest { 736 class SSLUITestWithClientCert : public SSLUITest {
736 public: 737 public:
737 SSLUITestWithClientCert() : cert_db_(NULL) {} 738 SSLUITestWithClientCert() : cert_db_(NULL) {}
738 739
739 virtual void SetUpOnMainThread() override { 740 virtual void SetUpOnMainThread() override {
740 SSLUITest::SetUpOnMainThread(); 741 SSLUITest::SetUpOnMainThread();
741 742
742 base::RunLoop loop; 743 base::RunLoop loop;
743 GetNSSCertDatabaseForProfile( 744 CertDatabaseServiceFactory::GetForBrowserContext(browser()->profile())
744 browser()->profile(), 745 ->GetNSSCertDatabase(
745 base::Bind(&SSLUITestWithClientCert::DidGetCertDatabase, 746 base::Bind(&SSLUITestWithClientCert::DidGetCertDatabase,
746 base::Unretained(this), 747 base::Unretained(this),
747 &loop)); 748 loop.QuitClosure()));
748 loop.Run(); 749 loop.Run();
749 } 750 }
750 751
751 protected: 752 protected:
752 void DidGetCertDatabase(base::RunLoop* loop, net::NSSCertDatabase* cert_db) { 753 void DidGetCertDatabase(const base::Closure& done_callback,
754 net::NSSCertDatabase* cert_db) {
753 cert_db_ = cert_db; 755 cert_db_ = cert_db;
754 loop->Quit(); 756 done_callback.Run();
755 } 757 }
756 758
757 net::NSSCertDatabase* cert_db_; 759 net::NSSCertDatabase* cert_db_;
758 }; 760 };
759 761
760 // SSL client certificate tests are only enabled when using NSS for private key 762 // SSL client certificate tests are only enabled when using NSS for private key
761 // storage, as only NSS can avoid modifying global machine state when testing. 763 // storage, as only NSS can avoid modifying global machine state when testing.
762 // See http://crbug.com/51132 764 // See http://crbug.com/51132
763 765
764 // Visit a HTTPS page which requires client cert authentication. The client 766 // Visit a HTTPS page which requires client cert authentication. The client
(...skipping 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1878 1880
1879 // Visit a page over https that contains a frame with a redirect. 1881 // Visit a page over https that contains a frame with a redirect.
1880 1882
1881 // XMLHttpRequest insecure content in synchronous mode. 1883 // XMLHttpRequest insecure content in synchronous mode.
1882 1884
1883 // XMLHttpRequest insecure content in asynchronous mode. 1885 // XMLHttpRequest insecure content in asynchronous mode.
1884 1886
1885 // XMLHttpRequest over bad ssl in synchronous mode. 1887 // XMLHttpRequest over bad ssl in synchronous mode.
1886 1888
1887 // XMLHttpRequest over OK ssl in synchronous mode. 1889 // XMLHttpRequest over OK ssl in synchronous mode.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698