Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1777)

Unified Diff: content/renderer/webcrypto/webcrypto_impl_unittest.cc

Issue 57373004: [webcrypto] Fix compiler errors in WebCryptoImplTest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update commit log Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/webcrypto/webcrypto_impl_unittest.cc
diff --git a/content/renderer/webcrypto/webcrypto_impl_unittest.cc b/content/renderer/webcrypto/webcrypto_impl_unittest.cc
index 503bdb8c9ffaf327bab4413ecc43091a06872360..1efeca0578249ddb27ded2eb283c9c908d7617f4 100644
--- a/content/renderer/webcrypto/webcrypto_impl_unittest.cc
+++ b/content/renderer/webcrypto/webcrypto_impl_unittest.cc
@@ -2,7 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "webcrypto_impl.h"
+#include "content/renderer/webcrypto/webcrypto_impl.h"
+
+#include <string>
+#include <vector>
#include "base/basictypes.h"
#include "base/logging.h"
@@ -10,7 +13,6 @@
#include "base/strings/string_number_conversions.h"
#include "content/public/renderer/content_renderer_client.h"
#include "content/renderer/renderer_webkitplatformsupport_impl.h"
-#include "content/renderer/webcrypto/webcrypto_impl.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/WebKit/public/platform/WebArrayBuffer.h"
#include "third_party/WebKit/public/platform/WebCryptoAlgorithm.h"
@@ -72,7 +74,7 @@ WebKit::WebCryptoAlgorithm CreateAesCbcAlgorithm(
}
WebKit::WebCryptoAlgorithm CreateAesCbcAlgorithm(
- unsigned short key_length_bits) {
+ unsigned short key_length_bits) { // NOLINT
return WebKit::WebCryptoAlgorithm::adoptParamsAndCreate(
WebKit::WebCryptoAlgorithmIdAesCbc,
new WebKit::WebCryptoAesKeyGenParams(key_length_bits));
@@ -637,8 +639,7 @@ TEST_F(WebCryptoImplTest, AesCbcSampleSets) {
}
}
-// TODO (padolph): Add test to verify generated symmetric keys appear random.
-
+// TODO(padolph): Add test to verify generated symmetric keys appear random.
TEST_F(WebCryptoImplTest, GenerateKeyAes) {
WebKit::WebCryptoKey key = WebKit::WebCryptoKey::createNull();
@@ -686,7 +687,6 @@ TEST_F(WebCryptoImplTest, ImportSecretKeyNoAlgorithm) {
#if !defined(USE_OPENSSL)
TEST_F(WebCryptoImplTest, GenerateKeyPairRsa) {
-
// Note: using unrealistic short key lengths here to avoid bogging down tests.
// Successful WebCryptoAlgorithmIdRsaEsPkcs1v1_5 key generation.
@@ -706,8 +706,8 @@ TEST_F(WebCryptoImplTest, GenerateKeyPairRsa) {
EXPECT_FALSE(private_key.isNull());
EXPECT_EQ(WebKit::WebCryptoKeyTypePublic, public_key.type());
EXPECT_EQ(WebKit::WebCryptoKeyTypePrivate, private_key.type());
- EXPECT_EQ(extractable, public_key.extractable());
- EXPECT_EQ(extractable, private_key.extractable());
+ EXPECT_FALSE(public_key.extractable());
eroman 2013/11/04 17:35:06 Can you explain why this is necessary? both "extra
padolph 2013/11/04 18:37:56 The reason I used EXPECT_EQ here was so we could c
+ EXPECT_FALSE(private_key.extractable());
EXPECT_EQ(usage_mask, public_key.usages());
EXPECT_EQ(usage_mask, private_key.usages());
@@ -718,7 +718,7 @@ TEST_F(WebCryptoImplTest, GenerateKeyPairRsa) {
algorithm, extractable, usage_mask, &public_key, &private_key));
// Fail with bad exponent: larger than unsigned long.
- unsigned exponent_length = sizeof(unsigned long) + 1;
+ unsigned exponent_length = sizeof(unsigned long) + 1; // NOLINT
const std::vector<uint8> long_exponent(exponent_length, 0x01);
algorithm = CreateRsaAlgorithm(WebKit::WebCryptoAlgorithmIdRsaEsPkcs1v1_5,
modulus_length,
@@ -755,8 +755,8 @@ TEST_F(WebCryptoImplTest, GenerateKeyPairRsa) {
EXPECT_FALSE(private_key.isNull());
EXPECT_EQ(WebKit::WebCryptoKeyTypePublic, public_key.type());
EXPECT_EQ(WebKit::WebCryptoKeyTypePrivate, private_key.type());
- EXPECT_EQ(extractable, public_key.extractable());
- EXPECT_EQ(extractable, private_key.extractable());
+ EXPECT_FALSE(public_key.extractable());
+ EXPECT_FALSE(private_key.extractable());
EXPECT_EQ(usage_mask, public_key.usages());
EXPECT_EQ(usage_mask, private_key.usages());
@@ -769,8 +769,8 @@ TEST_F(WebCryptoImplTest, GenerateKeyPairRsa) {
EXPECT_FALSE(private_key.isNull());
EXPECT_EQ(WebKit::WebCryptoKeyTypePublic, public_key.type());
EXPECT_EQ(WebKit::WebCryptoKeyTypePrivate, private_key.type());
- EXPECT_EQ(extractable, public_key.extractable());
- EXPECT_EQ(extractable, private_key.extractable());
+ EXPECT_FALSE(public_key.extractable());
+ EXPECT_FALSE(private_key.extractable());
EXPECT_EQ(usage_mask, public_key.usages());
EXPECT_EQ(usage_mask, private_key.usages());
@@ -784,8 +784,8 @@ TEST_F(WebCryptoImplTest, GenerateKeyPairRsa) {
EXPECT_FALSE(private_key.isNull());
EXPECT_EQ(WebKit::WebCryptoKeyTypePublic, public_key.type());
EXPECT_EQ(WebKit::WebCryptoKeyTypePrivate, private_key.type());
- EXPECT_EQ(extractable, public_key.extractable());
- EXPECT_EQ(extractable, private_key.extractable());
+ EXPECT_FALSE(public_key.extractable());
+ EXPECT_FALSE(private_key.extractable());
EXPECT_EQ(usage_mask, public_key.usages());
EXPECT_EQ(usage_mask, private_key.usages());
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698