diff options
Diffstat (limited to 'chromium/chrome/browser/extensions/api/platform_keys/platform_keys_apitest_nss.cc')
-rw-r--r-- | chromium/chrome/browser/extensions/api/platform_keys/platform_keys_apitest_nss.cc | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/chromium/chrome/browser/extensions/api/platform_keys/platform_keys_apitest_nss.cc b/chromium/chrome/browser/extensions/api/platform_keys/platform_keys_apitest_nss.cc index 2b6386c993b..2ae65f5c0f0 100644 --- a/chromium/chrome/browser/extensions/api/platform_keys/platform_keys_apitest_nss.cc +++ b/chromium/chrome/browser/extensions/api/platform_keys/platform_keys_apitest_nss.cc @@ -9,7 +9,6 @@ #include <utility> #include "base/bind.h" -#include "base/json/json_writer.h" #include "base/macros.h" #include "base/run_loop.h" #include "base/strings/stringprintf.h" @@ -28,8 +27,8 @@ #include "crypto/scoped_test_system_nss_key_slot.h" #include "net/cert/nss_cert_database.h" #include "net/cert/test_root_certs.h" +#include "net/cert/x509_certificate.h" #include "net/test/cert_test_util.h" -#include "net/test/test_data_directory.h" namespace { @@ -160,6 +159,10 @@ class PlatformKeysTest : public PlatformKeysTestBase { const extensions::Extension* extension_; private: + base::FilePath extension_path() const { + return test_data_dir_.AppendASCII("platform_keys"); + } + void SetPrivateSoftwareSlotOnIO(crypto::ScopedPK11Slot slot) { crypto::SetPrivateSoftwareSlotForChromeOSUserForTesting(std::move(slot)); } @@ -193,25 +196,23 @@ class PlatformKeysTest : public PlatformKeysTestBase { ? cert_db->GetPrivateSlot() : cert_db->GetPublicSlot(); client_cert1_ = net::ImportClientCertAndKeyFromFile( - net::GetTestCertsDirectory(), "client_1.pem", "client_1.pk8", - slot.get()); + extension_path(), "client_1.pem", "client_1.pk8", slot.get()); ASSERT_TRUE(client_cert1_.get()); // Import a second client cert signed by another CA than client_1 into the // system wide key slot. client_cert2_ = net::ImportClientCertAndKeyFromFile( - net::GetTestCertsDirectory(), "client_2.pem", "client_2.pk8", + extension_path(), "client_2.pem", "client_2.pk8", test_system_slot()->slot()); ASSERT_TRUE(client_cert2_.get()); } void SetupTestCACerts() { net::TestRootCerts* root_certs = net::TestRootCerts::GetInstance(); - // "root_ca_cert.pem" is the issuer of "ok_cert.pem" which is loaded on the - // JS side. Generated by create_test_certs.sh . - base::FilePath extension_path = test_data_dir_.AppendASCII("platform_keys"); - root_certs->AddFromFile( - test_data_dir_.AppendASCII("platform_keys").AppendASCII("root.pem")); + // "root.pem" is the issuer of the "l1_leaf.pem" and (transitively) + // "l1_leaf.pem" certs which are loaded on the JS side. Generated by + // create_test_certs.sh . + root_certs->AddFromFile(extension_path().AppendASCII("root.pem")); } const bool key_permission_policy_; |