OLD | NEW |
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/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 | 50 |
51 class ClientCertResolverTest : public testing::Test { | 51 class ClientCertResolverTest : public testing::Test { |
52 public: | 52 public: |
53 ClientCertResolverTest() : service_test_(NULL), | 53 ClientCertResolverTest() : service_test_(NULL), |
54 profile_test_(NULL), | 54 profile_test_(NULL), |
55 cert_loader_(NULL), | 55 cert_loader_(NULL), |
56 user_(kUserHash) { | 56 user_(kUserHash) { |
57 } | 57 } |
58 virtual ~ClientCertResolverTest() {} | 58 virtual ~ClientCertResolverTest() {} |
59 | 59 |
60 virtual void SetUp() OVERRIDE { | 60 virtual void SetUp() override { |
61 // Initialize NSS db for the user. | 61 // Initialize NSS db for the user. |
62 ASSERT_TRUE(user_.constructed_successfully()); | 62 ASSERT_TRUE(user_.constructed_successfully()); |
63 user_.FinishInit(); | 63 user_.FinishInit(); |
64 private_slot_ = crypto::GetPrivateSlotForChromeOSUser( | 64 private_slot_ = crypto::GetPrivateSlotForChromeOSUser( |
65 user_.username_hash(), | 65 user_.username_hash(), |
66 base::Callback<void(crypto::ScopedPK11Slot)>()); | 66 base::Callback<void(crypto::ScopedPK11Slot)>()); |
67 ASSERT_TRUE(private_slot_.get()); | 67 ASSERT_TRUE(private_slot_.get()); |
68 test_nssdb_.reset(new net::NSSCertDatabaseChromeOS( | 68 test_nssdb_.reset(new net::NSSCertDatabaseChromeOS( |
69 crypto::GetPublicSlotForChromeOSUser(user_.username_hash()), | 69 crypto::GetPublicSlotForChromeOSUser(user_.username_hash()), |
70 crypto::GetPrivateSlotForChromeOSUser( | 70 crypto::GetPrivateSlotForChromeOSUser( |
(...skipping 10 matching lines...) Expand all Loading... |
81 service_test_->ClearServices(); | 81 service_test_->ClearServices(); |
82 base::RunLoop().RunUntilIdle(); | 82 base::RunLoop().RunUntilIdle(); |
83 | 83 |
84 TPMTokenLoader::InitializeForTest(); | 84 TPMTokenLoader::InitializeForTest(); |
85 | 85 |
86 CertLoader::Initialize(); | 86 CertLoader::Initialize(); |
87 cert_loader_ = CertLoader::Get(); | 87 cert_loader_ = CertLoader::Get(); |
88 cert_loader_->force_hardware_backed_for_test(); | 88 cert_loader_->force_hardware_backed_for_test(); |
89 } | 89 } |
90 | 90 |
91 virtual void TearDown() OVERRIDE { | 91 virtual void TearDown() override { |
92 client_cert_resolver_.reset(); | 92 client_cert_resolver_.reset(); |
93 managed_config_handler_.reset(); | 93 managed_config_handler_.reset(); |
94 network_config_handler_.reset(); | 94 network_config_handler_.reset(); |
95 network_profile_handler_.reset(); | 95 network_profile_handler_.reset(); |
96 network_state_handler_.reset(); | 96 network_state_handler_.reset(); |
97 CertLoader::Shutdown(); | 97 CertLoader::Shutdown(); |
98 TPMTokenLoader::Shutdown(); | 98 TPMTokenLoader::Shutdown(); |
99 DBusThreadManager::Shutdown(); | 99 DBusThreadManager::Shutdown(); |
100 CleanupSlotContents(); | 100 CleanupSlotContents(); |
101 } | 101 } |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 // Verify that the resolver positively matched the pattern in the policy with | 316 // Verify that the resolver positively matched the pattern in the policy with |
317 // the test client cert and configured the network. | 317 // the test client cert and configured the network. |
318 std::string pkcs11_id; | 318 std::string pkcs11_id; |
319 GetClientCertProperties(&pkcs11_id); | 319 GetClientCertProperties(&pkcs11_id); |
320 EXPECT_EQ(test_cert_id_, pkcs11_id); | 320 EXPECT_EQ(test_cert_id_, pkcs11_id); |
321 } | 321 } |
322 | 322 |
323 } // namespace chromeos | 323 } // namespace chromeos |
324 | 324 |
325 #endif | 325 #endif |
OLD | NEW |