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

Unified Diff: media/crypto/aes_decryptor_unittest.cc

Issue 10535029: Add support for encrypted WebM files as defined in the RFC. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Updated encrypted WebM test data. Created 8 years, 6 months 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
Index: media/crypto/aes_decryptor_unittest.cc
diff --git a/media/crypto/aes_decryptor_unittest.cc b/media/crypto/aes_decryptor_unittest.cc
index 0b33f61f043ed147e8a527512bffbebe36c2b541..4a4b3bd5aa156e3b115cbcda56bec41251c837c9 100644
--- a/media/crypto/aes_decryptor_unittest.cc
+++ b/media/crypto/aes_decryptor_unittest.cc
@@ -15,15 +15,18 @@ namespace media {
// length is |kKeySize|. Modifying any of these independently would fail the
// test.
static const char kOriginalData[] = "Original data.";
-static const int kEncryptedDataSize = 16;
+static const int kEncryptedDataSize = 14;
static const unsigned char kEncryptedData[] =
- "\x82\x3A\x76\x92\xEC\x7F\xF8\x85\xEC\x23\x52\xFB\x19\xB1\xB9\x09";
+ "\x0\x93\x3d\xf6\xd6\x53\xfc\xcd\x9c\x53\x46\xed\x8c\x60";
static const int kKeySize = 16;
static const unsigned char kRightKey[] = "A wonderful key!";
static const unsigned char kWrongKey[] = "I'm a wrong key.";
static const int kKeyIdSize = 9;
static const unsigned char kKeyId1[] = "Key ID 1.";
static const unsigned char kKeyId2[] = "Key ID 2.";
+static const uint64 kIv = 0;
+static const int kDummyHmacDataSize = 12;
+static const unsigned char kDummyHmacData[] = "Unused HMAC.";
class AesDecryptorTest : public testing::Test {
public:
@@ -35,7 +38,10 @@ class AesDecryptorTest : public testing::Test {
protected:
void SetKeyIdForEncryptedData(const uint8* key_id, int key_id_size) {
encrypted_data_->SetDecryptConfig(
- scoped_ptr<DecryptConfig>(new DecryptConfig(key_id, key_id_size)));
+ scoped_ptr<DecryptConfig>(new DecryptConfig(kDummyHmacData,
+ kDummyHmacDataSize,
+ kIv,
+ key_id, key_id_size)));
}
void DecryptAndExpectToSucceed() {
@@ -50,7 +56,10 @@ class AesDecryptorTest : public testing::Test {
void DecryptAndExpectToFail() {
scoped_refptr<DecoderBuffer> decrypted =
decryptor_.Decrypt(encrypted_data_);
- EXPECT_FALSE(decrypted);
+ EXPECT_TRUE(decrypted);
+ EXPECT_NE(0, memcmp(kOriginalData,
+ decrypted->GetData(),
+ decrypted->GetDataSize()));
}
scoped_refptr<DecoderBuffer> encrypted_data_;

Powered by Google App Engine
This is Rietveld 408576698