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

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

Powered by Google App Engine
This is Rietveld 408576698