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

Side by Side Diff: chromeos/network/client_cert_resolver_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: aa Created 6 years, 11 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 #include "chromeos/network/client_cert_resolver.h" 4 #include "chromeos/network/client_cert_resolver.h"
5 5
6 #include <cert.h> 6 #include <cert.h>
7 #include <pk11pub.h> 7 #include <pk11pub.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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 user_.FinishInit(); 58 user_.FinishInit();
59 slot_ = crypto::GetPrivateSlotForChromeOSUser( 59 slot_ = crypto::GetPrivateSlotForChromeOSUser(
60 user_.username_hash(), 60 user_.username_hash(),
61 base::Callback<void(crypto::ScopedPK11Slot)>()); 61 base::Callback<void(crypto::ScopedPK11Slot)>());
62 ASSERT_TRUE(slot_.get()); 62 ASSERT_TRUE(slot_.get());
63 test_nssdb_.reset(new net::NSSCertDatabaseChromeOS( 63 test_nssdb_.reset(new net::NSSCertDatabaseChromeOS(
64 crypto::GetPublicSlotForChromeOSUser(user_.username_hash()), 64 crypto::GetPublicSlotForChromeOSUser(user_.username_hash()),
65 crypto::GetPrivateSlotForChromeOSUser( 65 crypto::GetPrivateSlotForChromeOSUser(
66 user_.username_hash(), 66 user_.username_hash(),
67 base::Callback<void(crypto::ScopedPK11Slot)>()))); 67 base::Callback<void(crypto::ScopedPK11Slot)>())));
68 test_nssdb_->SetSlowTaskRunnerForTest(message_loop_.message_loop_proxy());
68 69
69 DBusThreadManager::InitializeWithStub(); 70 DBusThreadManager::InitializeWithStub();
70 service_test_ = 71 service_test_ =
71 DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface(); 72 DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface();
72 profile_test_ = 73 profile_test_ =
73 DBusThreadManager::Get()->GetShillProfileClient()->GetTestInterface(); 74 DBusThreadManager::Get()->GetShillProfileClient()->GetTestInterface();
74 base::RunLoop().RunUntilIdle(); 75 base::RunLoop().RunUntilIdle();
75 service_test_->ClearServices(); 76 service_test_->ClearServices();
76 base::RunLoop().RunUntilIdle(); 77 base::RunLoop().RunUntilIdle();
77 78
78 TPMTokenLoader::InitializeForTest(); 79 TPMTokenLoader::InitializeForTest();
79 80
80 CertLoader::Initialize(); 81 CertLoader::Initialize();
81 CertLoader* cert_loader_ = CertLoader::Get(); 82 CertLoader* cert_loader_ = CertLoader::Get();
82 cert_loader_->SetSlowTaskRunnerForTest(message_loop_.message_loop_proxy());
83 cert_loader_->set_hardware_backed_for_test(); 83 cert_loader_->set_hardware_backed_for_test();
84 cert_loader_->StartWithNSSDB(test_nssdb_.get()); 84 cert_loader_->StartWithNSSDB(test_nssdb_.get());
85 } 85 }
86 86
87 virtual void TearDown() OVERRIDE { 87 virtual void TearDown() OVERRIDE {
88 client_cert_resolver_.reset(); 88 client_cert_resolver_.reset();
89 managed_config_handler_.reset(); 89 managed_config_handler_.reset();
90 network_config_handler_.reset(); 90 network_config_handler_.reset();
91 network_profile_handler_.reset(); 91 network_profile_handler_.reset();
92 network_state_handler_.reset(); 92 network_state_handler_.reset();
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 base::RunLoop().RunUntilIdle(); 292 base::RunLoop().RunUntilIdle();
293 293
294 // Verify that the resolver positively matched the pattern in the policy with 294 // Verify that the resolver positively matched the pattern in the policy with
295 // the test client cert and configured the network. 295 // the test client cert and configured the network.
296 std::string pkcs11_id; 296 std::string pkcs11_id;
297 GetClientCertProperties(&pkcs11_id); 297 GetClientCertProperties(&pkcs11_id);
298 EXPECT_EQ(test_pkcs11_id_, pkcs11_id); 298 EXPECT_EQ(test_pkcs11_id_, pkcs11_id);
299 } 299 }
300 300
301 } // namespace chromeos 301 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698