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

Side by Side Diff: chromeos/cert_loader_unittest.cc

Issue 421113002: Use correct slot id for client certs in network config. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chromeos/cert_loader.h" 5 #include "chromeos/cert_loader.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 EXPECT_FALSE(cert_loader_->certificates_loaded()); 182 EXPECT_FALSE(cert_loader_->certificates_loaded());
183 EXPECT_TRUE(cert_loader_->CertificatesLoading()); 183 EXPECT_TRUE(cert_loader_->CertificatesLoading());
184 EXPECT_TRUE(cert_loader_->cert_list().empty()); 184 EXPECT_TRUE(cert_loader_->cert_list().empty());
185 185
186 ASSERT_EQ(0U, GetAndResetCertificatesLoadedEventsCount()); 186 ASSERT_EQ(0U, GetAndResetCertificatesLoadedEventsCount());
187 base::RunLoop().RunUntilIdle(); 187 base::RunLoop().RunUntilIdle();
188 EXPECT_EQ(1U, GetAndResetCertificatesLoadedEventsCount()); 188 EXPECT_EQ(1U, GetAndResetCertificatesLoadedEventsCount());
189 189
190 EXPECT_TRUE(cert_loader_->certificates_loaded()); 190 EXPECT_TRUE(cert_loader_->certificates_loaded());
191 EXPECT_FALSE(cert_loader_->CertificatesLoading()); 191 EXPECT_FALSE(cert_loader_->CertificatesLoading());
192 EXPECT_EQ(GetDbPrivateSlotId(primary_db_.get()),
193 cert_loader_->TPMTokenSlotID());
194 192
195 // Default CA cert roots should get loaded. 193 // Default CA cert roots should get loaded.
196 EXPECT_FALSE(cert_loader_->cert_list().empty()); 194 EXPECT_FALSE(cert_loader_->cert_list().empty());
197 } 195 }
198 196
199 TEST_F(CertLoaderTest, CertLoaderUpdatesCertListOnNewCert) { 197 TEST_F(CertLoaderTest, CertLoaderUpdatesCertListOnNewCert) {
200 StartCertLoaderWithPrimaryUser(); 198 StartCertLoaderWithPrimaryUser();
201 199
202 net::CertificateList certs; 200 net::CertificateList certs;
203 ImportCACert("root_ca_cert.pem", primary_db_.get(), &certs); 201 ImportCACert("root_ca_cert.pem", primary_db_.get(), &certs);
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 certs[0], net::CA_CERT, net::NSSCertDatabase::TRUSTED_SSL)); 298 certs[0], net::CA_CERT, net::NSSCertDatabase::TRUSTED_SSL));
301 299
302 // Cert trust change should trigger certificate reload in cert_loader_. 300 // Cert trust change should trigger certificate reload in cert_loader_.
303 ASSERT_EQ(0U, GetAndResetCertificatesLoadedEventsCount()); 301 ASSERT_EQ(0U, GetAndResetCertificatesLoadedEventsCount());
304 base::RunLoop().RunUntilIdle(); 302 base::RunLoop().RunUntilIdle();
305 EXPECT_EQ(1U, GetAndResetCertificatesLoadedEventsCount()); 303 EXPECT_EQ(1U, GetAndResetCertificatesLoadedEventsCount());
306 } 304 }
307 305
308 } // namespace 306 } // namespace
309 } // namespace chromeos 307 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698