| Index: content/child/webcrypto/test/ecdh_unittest.cc
|
| diff --git a/content/child/webcrypto/test/ecdh_unittest.cc b/content/child/webcrypto/test/ecdh_unittest.cc
|
| index b49aaa8d2e2d54e3ae1f2e93809e3bcd81afe269..c44aa93376d1e4ce5c1138043e3f393e674d721f 100644
|
| --- a/content/child/webcrypto/test/ecdh_unittest.cc
|
| +++ b/content/child/webcrypto/test/ecdh_unittest.cc
|
| @@ -309,6 +309,36 @@ TEST(WebCryptoEcdhTest, DeriveKeyAes128) {
|
| EXPECT_EQ(16u, raw_key.size());
|
| }
|
|
|
| +TEST(WebCryptoEcdhTest, ImportKeyEmptyUsage) {
|
| + blink::WebCryptoKey key;
|
| +
|
| + scoped_ptr<base::ListValue> tests;
|
| + ASSERT_TRUE(ReadJsonTestFileToList("ecdh.json", &tests));
|
| +
|
| + const base::DictionaryValue* test;
|
| + ASSERT_TRUE(tests->GetDictionary(0, &test));
|
| +
|
| + // Import the public key.
|
| + const base::DictionaryValue* public_key_json = NULL;
|
| + EXPECT_TRUE(test->GetDictionary("public_key", &public_key_json));
|
| + blink::WebCryptoNamedCurve curve =
|
| + GetCurveNameFromDictionary(public_key_json, "crv");
|
| + ASSERT_EQ(Status::Success(),
|
| + ImportKey(blink::WebCryptoKeyFormatJwk,
|
| + CryptoData(MakeJsonVector(*public_key_json)),
|
| + CreateEcdhImportAlgorithm(curve), true, 0, &key));
|
| +
|
| + // Import the private key.
|
| + const base::DictionaryValue* private_key_json = NULL;
|
| + EXPECT_TRUE(test->GetDictionary("private_key", &private_key_json));
|
| + curve = GetCurveNameFromDictionary(private_key_json, "crv");
|
| + ASSERT_EQ(Status::ErrorKeyEmptyUsages(),
|
| + ImportKey(blink::WebCryptoKeyFormatJwk,
|
| + CryptoData(MakeJsonVector(*private_key_json)),
|
| + CreateEcdhImportAlgorithm(curve), true,
|
| + 0, &key));
|
| +}
|
| +
|
| } // namespace
|
|
|
| } // namespace webcrypto
|
|
|