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

Unified Diff: components/gcm_driver/crypto/gcm_encryption_provider_unittest.cc

Issue 1446163002: Rename Encryption-Key to Crypto-Key, "key" parameter to "aesgcm128". (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: one more rename Created 5 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 | « components/gcm_driver/crypto/gcm_encryption_provider.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/gcm_driver/crypto/gcm_encryption_provider_unittest.cc
diff --git a/components/gcm_driver/crypto/gcm_encryption_provider_unittest.cc b/components/gcm_driver/crypto/gcm_encryption_provider_unittest.cc
index ba3ca605f5e42baf26b3832f98c8701182d5dbca..2e6d60a2597da55b8ca1d1c63eb6b7079f1458ae 100644
--- a/components/gcm_driver/crypto/gcm_encryption_provider_unittest.cc
+++ b/components/gcm_driver/crypto/gcm_encryption_provider_unittest.cc
@@ -32,10 +32,10 @@ const char kValidEncryptionHeader[] =
"keyid=foo;salt=MTIzNDU2Nzg5MDEyMzQ1Ng;rs=1024";
const char kInvalidEncryptionHeader[] = "keyid";
-const char kValidEncryptionKeyHeader[] =
+const char kValidCryptoKeyHeader[] =
"keyid=foo;dh=BL_UGhfudEkXMUd4U4-D4nP5KHxKjQHsW6j88ybbehXM7fqi1OMFefDUEi0eJ"
"vsKfyVBWYkQjH-lSPJKxjAyslg";
-const char kInvalidEncryptionKeyHeader[] = "keyid";
+const char kInvalidCryptoKeyHeader[] = "keyid";
// TODO(peter): Unify the Base64Url implementations. https://crbug.com/536745.
void Base64UrlEncode(const std::string& decoded_input,
@@ -150,13 +150,13 @@ TEST_F(GCMEncryptionProviderTest, IsEncryptedMessage) {
IncomingMessage double_header_message;
double_header_message.data["encryption"] = "";
- double_header_message.data["encryption_key"] = "";
+ double_header_message.data["crypto_key"] = "";
EXPECT_FALSE(encryption_provider()->IsEncryptedMessage(
double_header_message));
IncomingMessage double_header_with_data_message;
double_header_with_data_message.data["encryption"] = "";
- double_header_with_data_message.data["encryption_key"] = "";
+ double_header_with_data_message.data["crypto_key"] = "";
double_header_with_data_message.raw_data = "foo";
EXPECT_TRUE(encryption_provider()->IsEncryptedMessage(
double_header_with_data_message));
@@ -168,7 +168,7 @@ TEST_F(GCMEncryptionProviderTest, VerifiesEncryptionHeaderParsing) {
IncomingMessage invalid_message;
invalid_message.data["encryption"] = kInvalidEncryptionHeader;
- invalid_message.data["encryption_key"] = kValidEncryptionKeyHeader;
+ invalid_message.data["crypto_key"] = kValidCryptoKeyHeader;
ASSERT_NO_FATAL_FAILURE(Decrypt(invalid_message));
ASSERT_EQ(DECRYPTION_FAILED, decryption_result());
@@ -177,7 +177,7 @@ TEST_F(GCMEncryptionProviderTest, VerifiesEncryptionHeaderParsing) {
IncomingMessage valid_message;
valid_message.data["encryption"] = kValidEncryptionHeader;
- valid_message.data["encryption_key"] = kInvalidEncryptionKeyHeader;
+ valid_message.data["crypto_key"] = kInvalidCryptoKeyHeader;
ASSERT_NO_FATAL_FAILURE(Decrypt(valid_message));
ASSERT_EQ(DECRYPTION_FAILED, decryption_result());
@@ -185,29 +185,27 @@ TEST_F(GCMEncryptionProviderTest, VerifiesEncryptionHeaderParsing) {
failure_reason());
}
-TEST_F(GCMEncryptionProviderTest, VerifiesEncryptionKeyHeaderParsing) {
+TEST_F(GCMEncryptionProviderTest, VerifiesCryptoKeyHeaderParsing) {
// The Encryption-Key header must be parsable and contain valid values.
// Note that this is more extensively tested in EncryptionHeaderParsersTest.
IncomingMessage invalid_message;
invalid_message.data["encryption"] = kValidEncryptionHeader;
- invalid_message.data["encryption_key"] = kInvalidEncryptionKeyHeader;
+ invalid_message.data["crypto_key"] = kInvalidCryptoKeyHeader;
ASSERT_NO_FATAL_FAILURE(Decrypt(invalid_message));
ASSERT_EQ(DECRYPTION_FAILED, decryption_result());
- EXPECT_EQ(
- GCMEncryptionProvider::DECRYPTION_FAILURE_INVALID_ENCRYPTION_KEY_HEADER,
- failure_reason());
+ EXPECT_EQ(GCMEncryptionProvider::DECRYPTION_FAILURE_INVALID_CRYPTO_KEY_HEADER,
+ failure_reason());
IncomingMessage valid_message;
valid_message.data["encryption"] = kInvalidEncryptionHeader;
- valid_message.data["encryption_key"] = kValidEncryptionKeyHeader;
+ valid_message.data["crypto_key"] = kValidCryptoKeyHeader;
ASSERT_NO_FATAL_FAILURE(Decrypt(valid_message));
ASSERT_EQ(DECRYPTION_FAILED, decryption_result());
- EXPECT_NE(
- GCMEncryptionProvider::DECRYPTION_FAILURE_INVALID_ENCRYPTION_KEY_HEADER,
- failure_reason());
+ EXPECT_NE(GCMEncryptionProvider::DECRYPTION_FAILURE_INVALID_CRYPTO_KEY_HEADER,
+ failure_reason());
}
TEST_F(GCMEncryptionProviderTest, VerifiesExistingKeys) {
@@ -216,7 +214,7 @@ TEST_F(GCMEncryptionProviderTest, VerifiesExistingKeys) {
IncomingMessage message;
message.data["encryption"] = kValidEncryptionHeader;
- message.data["encryption_key"] = kValidEncryptionKeyHeader;
+ message.data["crypto_key"] = kValidCryptoKeyHeader;
ASSERT_NO_FATAL_FAILURE(Decrypt(message));
ASSERT_EQ(DECRYPTION_FAILED, decryption_result());
@@ -301,7 +299,7 @@ TEST_F(GCMEncryptionProviderTest, EncryptionRoundTrip) {
encryption_header << "salt=" << encoded_salt;
message.data["encryption"] = encryption_header.str();
- message.data["encryption_key"] = "dh=" + encoded_key;
+ message.data["crypto_key"] = "dh=" + encoded_key;
ASSERT_TRUE(encryption_provider()->IsEncryptedMessage(message));
« no previous file with comments | « components/gcm_driver/crypto/gcm_encryption_provider.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698