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

Side by Side Diff: chromeos/network/network_cert_migrator_unittest.cc

Issue 144423007: Make NSSCertDatabase::ListCerts work async on a worker thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 10 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/network/network_cert_migrator.h" 5 #include "chromeos/network/network_cert_migrator.h"
6 6
7 #include <cert.h> 7 #include <cert.h>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 virtual void SetUp() OVERRIDE { 46 virtual void SetUp() OVERRIDE {
47 // Initialize NSS db for the user. 47 // Initialize NSS db for the user.
48 ASSERT_TRUE(user_.constructed_successfully()); 48 ASSERT_TRUE(user_.constructed_successfully());
49 user_.FinishInit(); 49 user_.FinishInit();
50 test_nssdb_.reset(new net::NSSCertDatabaseChromeOS( 50 test_nssdb_.reset(new net::NSSCertDatabaseChromeOS(
51 crypto::GetPublicSlotForChromeOSUser(user_.username_hash()), 51 crypto::GetPublicSlotForChromeOSUser(user_.username_hash()),
52 crypto::GetPrivateSlotForChromeOSUser( 52 crypto::GetPrivateSlotForChromeOSUser(
53 user_.username_hash(), 53 user_.username_hash(),
54 base::Callback<void(crypto::ScopedPK11Slot)>()))); 54 base::Callback<void(crypto::ScopedPK11Slot)>())));
55 test_nssdb_->SetSlowTaskRunnerForTest(message_loop_.message_loop_proxy());
55 56
56 DBusThreadManager::InitializeWithStub(); 57 DBusThreadManager::InitializeWithStub();
57 service_test_ = 58 service_test_ =
58 DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface(); 59 DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface();
59 base::RunLoop().RunUntilIdle(); 60 base::RunLoop().RunUntilIdle();
60 service_test_->ClearServices(); 61 service_test_->ClearServices();
61 base::RunLoop().RunUntilIdle(); 62 base::RunLoop().RunUntilIdle();
62 63
63 CertLoader::Initialize(); 64 CertLoader::Initialize();
64 CertLoader* cert_loader_ = CertLoader::Get(); 65 CertLoader* cert_loader_ = CertLoader::Get();
65 cert_loader_->SetSlowTaskRunnerForTest(message_loop_.message_loop_proxy());
66 cert_loader_->StartWithNSSDB(test_nssdb_.get()); 66 cert_loader_->StartWithNSSDB(test_nssdb_.get());
67 } 67 }
68 68
69 virtual void TearDown() OVERRIDE { 69 virtual void TearDown() OVERRIDE {
70 network_cert_migrator_.reset(); 70 network_cert_migrator_.reset();
71 network_state_handler_.reset(); 71 network_state_handler_.reset();
72 CertLoader::Shutdown(); 72 CertLoader::Shutdown();
73 DBusThreadManager::Shutdown(); 73 DBusThreadManager::Shutdown();
74 CleanupTestCert(); 74 CleanupTestCert();
75 } 75 }
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 SetupNetworkHandlers(); 258 SetupNetworkHandlers();
259 259
260 base::RunLoop().RunUntilIdle(); 260 base::RunLoop().RunUntilIdle();
261 std::string nss_nickname, ca_pem; 261 std::string nss_nickname, ca_pem;
262 GetVpnCACertProperties(false /* not OpenVPN */, &nss_nickname, &ca_pem); 262 GetVpnCACertProperties(false /* not OpenVPN */, &nss_nickname, &ca_pem);
263 EXPECT_TRUE(nss_nickname.empty()); 263 EXPECT_TRUE(nss_nickname.empty());
264 EXPECT_EQ(test_ca_cert_pem_, ca_pem); 264 EXPECT_EQ(test_ca_cert_pem_, ca_pem);
265 } 265 }
266 266
267 } // namespace chromeos 267 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/client_cert_resolver_unittest.cc ('k') | chromeos/network/network_connection_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698