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

Side by Side Diff: net/cert/nss_cert_database_unittest.cc

Issue 669813003: Update from chromium https://crrev.com/301725/ (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « net/cert/nss_cert_database.cc ('k') | net/cert/signed_certificate_timestamp_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <cert.h> 5 #include <cert.h>
6 #include <certdb.h> 6 #include <certdb.h>
7 #include <pk11pub.h> 7 #include <pk11pub.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 void SwapCertList(CertificateList* destination, 48 void SwapCertList(CertificateList* destination,
49 scoped_ptr<CertificateList> source) { 49 scoped_ptr<CertificateList> source) {
50 ASSERT_TRUE(destination); 50 ASSERT_TRUE(destination);
51 destination->swap(*source); 51 destination->swap(*source);
52 } 52 }
53 53
54 } // namespace 54 } // namespace
55 55
56 class CertDatabaseNSSTest : public testing::Test { 56 class CertDatabaseNSSTest : public testing::Test {
57 public: 57 public:
58 virtual void SetUp() { 58 void SetUp() override {
59 ASSERT_TRUE(test_nssdb_.is_open()); 59 ASSERT_TRUE(test_nssdb_.is_open());
60 cert_db_.reset(new NSSCertDatabase( 60 cert_db_.reset(new NSSCertDatabase(
61 crypto::ScopedPK11Slot( 61 crypto::ScopedPK11Slot(
62 PK11_ReferenceSlot(test_nssdb_.slot())) /* public slot */, 62 PK11_ReferenceSlot(test_nssdb_.slot())) /* public slot */,
63 crypto::ScopedPK11Slot( 63 crypto::ScopedPK11Slot(
64 PK11_ReferenceSlot(test_nssdb_.slot())) /* private slot */)); 64 PK11_ReferenceSlot(test_nssdb_.slot())) /* private slot */));
65 public_module_ = cert_db_->GetPublicModule(); 65 public_module_ = cert_db_->GetPublicModule();
66 66
67 // Test db should be empty at start of test. 67 // Test db should be empty at start of test.
68 EXPECT_EQ(0U, ListCerts().size()); 68 EXPECT_EQ(0U, ListCerts().size());
69 } 69 }
70 70
71 virtual void TearDown() { 71 void TearDown() override {
72 // Run the message loop to process any observer callbacks (e.g. for the 72 // Run the message loop to process any observer callbacks (e.g. for the
73 // ClientSocketFactory singleton) so that the scoped ref ptrs created in 73 // ClientSocketFactory singleton) so that the scoped ref ptrs created in
74 // NSSCertDatabase::NotifyObservers* get released. 74 // NSSCertDatabase::NotifyObservers* get released.
75 base::MessageLoop::current()->RunUntilIdle(); 75 base::MessageLoop::current()->RunUntilIdle();
76 } 76 }
77 77
78 protected: 78 protected:
79 net::CryptoModule* GetPublicModule() { 79 net::CryptoModule* GetPublicModule() {
80 return public_module_.get(); 80 return public_module_.get();
81 } 81 }
(...skipping 936 matching lines...) Expand 10 before | Expand all | Expand 10 after
1018 EXPECT_EQ(NSSCertDatabase::TRUST_DEFAULT, 1018 EXPECT_EQ(NSSCertDatabase::TRUST_DEFAULT,
1019 cert_db_->GetCertTrust(certs2[0].get(), SERVER_CERT)); 1019 cert_db_->GetCertTrust(certs2[0].get(), SERVER_CERT));
1020 1020
1021 new_certs = ListCerts(); 1021 new_certs = ListCerts();
1022 ASSERT_EQ(2U, new_certs.size()); 1022 ASSERT_EQ(2U, new_certs.size());
1023 EXPECT_STRNE(new_certs[0]->os_cert_handle()->nickname, 1023 EXPECT_STRNE(new_certs[0]->os_cert_handle()->nickname,
1024 new_certs[1]->os_cert_handle()->nickname); 1024 new_certs[1]->os_cert_handle()->nickname);
1025 } 1025 }
1026 1026
1027 } // namespace net 1027 } // namespace net
OLDNEW
« no previous file with comments | « net/cert/nss_cert_database.cc ('k') | net/cert/signed_certificate_timestamp_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698