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 | 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 | 46 |
47 virtual void SetUp() OVERRIDE { | 47 virtual void SetUp() OVERRIDE { |
48 // Initialize NSS db for the user. | 48 // Initialize NSS db for the user. |
49 ASSERT_TRUE(user_.constructed_successfully()); | 49 ASSERT_TRUE(user_.constructed_successfully()); |
50 user_.FinishInit(); | 50 user_.FinishInit(); |
51 test_nssdb_.reset(new net::NSSCertDatabaseChromeOS( | 51 test_nssdb_.reset(new net::NSSCertDatabaseChromeOS( |
52 crypto::GetPublicSlotForChromeOSUser(user_.username_hash()), | 52 crypto::GetPublicSlotForChromeOSUser(user_.username_hash()), |
53 crypto::GetPrivateSlotForChromeOSUser( | 53 crypto::GetPrivateSlotForChromeOSUser( |
54 user_.username_hash(), | 54 user_.username_hash(), |
55 base::Callback<void(crypto::ScopedPK11Slot)>()))); | 55 base::Callback<void(crypto::ScopedPK11Slot)>()))); |
| 56 test_nssdb_->SetSlowTaskRunnerForTest(message_loop_.message_loop_proxy()); |
56 | 57 |
57 DBusThreadManager::InitializeWithStub(); | 58 DBusThreadManager::InitializeWithStub(); |
58 service_test_ = | 59 service_test_ = |
59 DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface(); | 60 DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface(); |
60 base::RunLoop().RunUntilIdle(); | 61 base::RunLoop().RunUntilIdle(); |
61 service_test_->ClearServices(); | 62 service_test_->ClearServices(); |
62 base::RunLoop().RunUntilIdle(); | 63 base::RunLoop().RunUntilIdle(); |
63 | 64 |
64 CertLoader::Initialize(); | 65 CertLoader::Initialize(); |
65 CertLoader* cert_loader_ = CertLoader::Get(); | 66 CertLoader* cert_loader_ = CertLoader::Get(); |
66 cert_loader_->SetSlowTaskRunnerForTest(message_loop_.message_loop_proxy()); | |
67 cert_loader_->set_hardware_backed_for_test(); | 67 cert_loader_->set_hardware_backed_for_test(); |
68 cert_loader_->StartWithNSSDB(test_nssdb_.get()); | 68 cert_loader_->StartWithNSSDB(test_nssdb_.get()); |
69 } | 69 } |
70 | 70 |
71 virtual void TearDown() OVERRIDE { | 71 virtual void TearDown() OVERRIDE { |
72 network_cert_migrator_.reset(); | 72 network_cert_migrator_.reset(); |
73 network_state_handler_.reset(); | 73 network_state_handler_.reset(); |
74 CertLoader::Shutdown(); | 74 CertLoader::Shutdown(); |
75 DBusThreadManager::Shutdown(); | 75 DBusThreadManager::Shutdown(); |
76 CleanupTestCert(); | 76 CleanupTestCert(); |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 SetupNetworkHandlers(); | 260 SetupNetworkHandlers(); |
261 | 261 |
262 base::RunLoop().RunUntilIdle(); | 262 base::RunLoop().RunUntilIdle(); |
263 std::string nss_nickname, ca_pem; | 263 std::string nss_nickname, ca_pem; |
264 GetVpnCACertProperties(false /* not OpenVPN */, &nss_nickname, &ca_pem); | 264 GetVpnCACertProperties(false /* not OpenVPN */, &nss_nickname, &ca_pem); |
265 EXPECT_TRUE(nss_nickname.empty()); | 265 EXPECT_TRUE(nss_nickname.empty()); |
266 EXPECT_EQ(test_ca_cert_pem_, ca_pem); | 266 EXPECT_EQ(test_ca_cert_pem_, ca_pem); |
267 } | 267 } |
268 | 268 |
269 } // namespace chromeos | 269 } // namespace chromeos |
OLD | NEW |