Index: components/webcrypto/test/rsa_ssa_unittest.cc |
diff --git a/content/child/webcrypto/test/rsa_ssa_unittest.cc b/components/webcrypto/test/rsa_ssa_unittest.cc |
similarity index 96% |
rename from content/child/webcrypto/test/rsa_ssa_unittest.cc |
rename to components/webcrypto/test/rsa_ssa_unittest.cc |
index 1a01a60400c9e3407e8e979cc91cb8dc23b1521a..55a1a1c281d3b5a337314e41452b1985a4c44e8c 100644 |
--- a/content/child/webcrypto/test/rsa_ssa_unittest.cc |
+++ b/components/webcrypto/test/rsa_ssa_unittest.cc |
@@ -4,18 +4,16 @@ |
#include "base/logging.h" |
#include "base/stl_util.h" |
-#include "content/child/webcrypto/algorithm_dispatch.h" |
-#include "content/child/webcrypto/crypto_data.h" |
-#include "content/child/webcrypto/status.h" |
-#include "content/child/webcrypto/test/test_helpers.h" |
-#include "content/child/webcrypto/webcrypto_util.h" |
+#include "components/webcrypto/algorithm_dispatch.h" |
+#include "components/webcrypto/crypto_data.h" |
+#include "components/webcrypto/status.h" |
+#include "components/webcrypto/test/test_helpers.h" |
+#include "components/webcrypto/webcrypto_util.h" |
#include "testing/gtest/include/gtest/gtest.h" |
#include "third_party/WebKit/public/platform/WebCryptoAlgorithmParams.h" |
#include "third_party/WebKit/public/platform/WebCryptoKey.h" |
#include "third_party/WebKit/public/platform/WebCryptoKeyAlgorithm.h" |
-namespace content { |
- |
namespace webcrypto { |
namespace { |
@@ -419,11 +417,10 @@ TEST(WebCryptoRsaSsaTest, GenerateKeyPairRsa) { |
exponent_with_leading_zeros.insert(exponent_with_leading_zeros.end(), |
public_exponent.begin(), |
public_exponent.end()); |
- algorithm = |
- CreateRsaHashedKeyGenAlgorithm(blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5, |
- blink::WebCryptoAlgorithmIdSha256, |
- modulus_length, |
- exponent_with_leading_zeros); |
+ algorithm = CreateRsaHashedKeyGenAlgorithm( |
+ blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5, |
+ blink::WebCryptoAlgorithmIdSha256, modulus_length, |
+ exponent_with_leading_zeros); |
EXPECT_EQ(Status::Success(), GenerateKeyPair(algorithm, extractable, usages, |
&public_key, &private_key)); |
EXPECT_FALSE(public_key.isNull()); |
@@ -436,14 +433,11 @@ TEST(WebCryptoRsaSsaTest, GenerateKeyPairRsa) { |
EXPECT_EQ(private_usages, private_key.usages()); |
// Successful WebCryptoAlgorithmIdRsaSsaPkcs1v1_5 key generation (sha1) |
- algorithm = |
- CreateRsaHashedKeyGenAlgorithm(blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5, |
- blink::WebCryptoAlgorithmIdSha1, |
- modulus_length, |
- public_exponent); |
- EXPECT_EQ( |
- Status::Success(), |
- GenerateKeyPair(algorithm, false, usages, &public_key, &private_key)); |
+ algorithm = CreateRsaHashedKeyGenAlgorithm( |
+ blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5, |
+ blink::WebCryptoAlgorithmIdSha1, modulus_length, public_exponent); |
+ EXPECT_EQ(Status::Success(), GenerateKeyPair(algorithm, false, usages, |
+ &public_key, &private_key)); |
EXPECT_FALSE(public_key.isNull()); |
EXPECT_FALSE(private_key.isNull()); |
EXPECT_EQ(blink::WebCryptoKeyTypePublic, public_key.type()); |
@@ -854,8 +848,7 @@ TEST(WebCryptoRsaSsaTest, ImportKeyEmptyUsages) { |
ExportKey(blink::WebCryptoKeyFormatJwk, public_key, &public_jwk)); |
ASSERT_EQ(Status::Success(), |
- ImportKey(blink::WebCryptoKeyFormatJwk, |
- CryptoData(public_jwk), |
+ ImportKey(blink::WebCryptoKeyFormatJwk, CryptoData(public_jwk), |
CreateRsaHashedImportAlgorithm( |
blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5, |
blink::WebCryptoAlgorithmIdSha256), |
@@ -864,23 +857,22 @@ TEST(WebCryptoRsaSsaTest, ImportKeyEmptyUsages) { |
// With correct usage to get correct imported private_key |
std::vector<uint8_t> private_jwk; |
- ImportKey(blink::WebCryptoKeyFormatPkcs8, |
- CryptoData(HexStringToBytes(kPrivateKeyPkcs8DerHex)), |
- CreateRsaHashedImportAlgorithm( |
- blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5, |
- blink::WebCryptoAlgorithmIdSha1), |
- true, blink::WebCryptoKeyUsageSign, &private_key); |
+ ImportKey( |
+ blink::WebCryptoKeyFormatPkcs8, |
+ CryptoData(HexStringToBytes(kPrivateKeyPkcs8DerHex)), |
+ CreateRsaHashedImportAlgorithm(blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5, |
+ blink::WebCryptoAlgorithmIdSha1), |
+ true, blink::WebCryptoKeyUsageSign, &private_key); |
ASSERT_EQ(Status::Success(), |
ExportKey(blink::WebCryptoKeyFormatJwk, private_key, &private_jwk)); |
ASSERT_EQ(Status::ErrorCreateKeyEmptyUsages(), |
- ImportKey(blink::WebCryptoKeyFormatJwk, |
- CryptoData(private_jwk), |
- CreateRsaHashedImportAlgorithm( |
- blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5, |
- blink::WebCryptoAlgorithmIdSha1), |
- true, 0, &private_key)); |
+ ImportKey(blink::WebCryptoKeyFormatJwk, CryptoData(private_jwk), |
+ CreateRsaHashedImportAlgorithm( |
+ blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5, |
+ blink::WebCryptoAlgorithmIdSha1), |
+ true, 0, &private_key)); |
} |
TEST(WebCryptoRsaSsaTest, ImportExportJwkRsaPublicKey) { |
@@ -1049,5 +1041,3 @@ TEST(WebCryptoRsaSsaTest, ImportInvalidKeyData) { |
} // namespace |
} // namespace webcrypto |
- |
-} // namespace content |