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

Unified Diff: media/filters/ffmpeg_video_decoder_unittest.cc

Issue 10651006: Add Common Encryption support to BMFF, including subsample decryption. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Convert key_id to string Created 8 years, 5 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/filters/ffmpeg_video_decoder_unittest.cc
diff --git a/media/filters/ffmpeg_video_decoder_unittest.cc b/media/filters/ffmpeg_video_decoder_unittest.cc
index a21c3c84a6d63a92302e6f7b43be7c1f3073a01e..16f061b89c7a8bc9c6d0865a5b95de74756520b9 100644
--- a/media/filters/ffmpeg_video_decoder_unittest.cc
+++ b/media/filters/ffmpeg_video_decoder_unittest.cc
@@ -213,9 +213,9 @@ class FFmpegVideoDecoderTest : public testing::Test {
// Generates a 16 byte CTR counter block. The CTR counter block format is a
// CTR IV appended with a CTR block counter. |iv| is an 8 byte CTR IV.
- static scoped_array<uint8> GenerateCounterBlock(uint64 iv) {
- scoped_array<uint8> counter_block_data(
- new uint8[DecryptConfig::kDecryptionKeySize]);
+ static std::string GenerateCounterBlock(uint64 iv) {
+ scoped_array<char> counter_block_data(
ddorwin 2012/07/24 01:00:10 Can we allocate the string here (instead of 228) a
strobe_ 2012/07/25 01:05:13 string.data() seems to be const.
+ new char[DecryptConfig::kDecryptionKeySize]);
// Set the IV.
memcpy(counter_block_data.get(), &iv, sizeof(iv));
@@ -225,7 +225,8 @@ class FFmpegVideoDecoderTest : public testing::Test {
0,
DecryptConfig::kDecryptionKeySize - sizeof(iv));
- return counter_block_data.Pass();
+ return std::string(counter_block_data.get(),
+ DecryptConfig::kDecryptionKeySize);
}
@@ -415,13 +416,14 @@ TEST_F(FFmpegVideoDecoderTest, DISABLED_DecodeEncryptedFrame_Normal) {
Initialize();
// Simulate decoding a single encrypted frame.
- scoped_array<uint8> counter_block(GenerateCounterBlock(kIv));
+ std::string counter_block(GenerateCounterBlock(kIv));
encrypted_i_frame_buffer_->SetDecryptConfig(scoped_ptr<DecryptConfig>(
new DecryptConfig(
- kKeyId, arraysize(kKeyId),
- counter_block.get(), DecryptConfig::kDecryptionKeySize,
- kHmac, arraysize(kHmac),
- sizeof(kIv))));
+ std::string(kKeyId, kKeyId + arraysize(kKeyId)),
+ counter_block,
+ std::string(kHmac, kHmac + arraysize(kHmac)),
+ sizeof(kIv),
+ std::vector<SubsampleEntry>())));
EXPECT_CALL(*decryptor_, Decrypt(encrypted_i_frame_buffer_, _))
.WillRepeatedly(RunDecryptCB(Decryptor::kSuccess, i_frame_buffer_));
@@ -440,13 +442,14 @@ TEST_F(FFmpegVideoDecoderTest, DecodeEncryptedFrame_DecryptError) {
Initialize();
// Simulate decoding a single encrypted frame.
- scoped_array<uint8> counter_block(GenerateCounterBlock(kIv));
+ std::string counter_block(GenerateCounterBlock(kIv));
encrypted_i_frame_buffer_->SetDecryptConfig(scoped_ptr<DecryptConfig>(
new DecryptConfig(
- kKeyId, arraysize(kKeyId),
- counter_block.get(), DecryptConfig::kDecryptionKeySize,
- kHmac, arraysize(kHmac),
- sizeof(kIv))));
+ std::string(kKeyId, kKeyId + arraysize(kKeyId)),
+ counter_block,
+ std::string(kHmac, kHmac + arraysize(kHmac)),
+ sizeof(kIv),
+ std::vector<SubsampleEntry>())));
EXPECT_CALL(*demuxer_, Read(_))
.WillRepeatedly(ReturnBuffer(encrypted_i_frame_buffer_));
@@ -471,13 +474,14 @@ TEST_F(FFmpegVideoDecoderTest, DecodeEncryptedFrame_CorruptedBufferReturned) {
Initialize();
// Simulate decoding a single encrypted frame.
- scoped_array<uint8> counter_block(GenerateCounterBlock(kIv));
+ std::string counter_block(GenerateCounterBlock(kIv));
encrypted_i_frame_buffer_->SetDecryptConfig(scoped_ptr<DecryptConfig>(
new DecryptConfig(
- kKeyId, arraysize(kKeyId),
- counter_block.get(), DecryptConfig::kDecryptionKeySize,
- kHmac, arraysize(kHmac),
- sizeof(kIv))));
+ std::string(kKeyId, kKeyId + arraysize(kKeyId)),
+ counter_block,
+ std::string(kHmac, kHmac + arraysize(kHmac)),
+ sizeof(kIv),
+ std::vector<SubsampleEntry>())));
EXPECT_CALL(*demuxer_, Read(_))
.WillRepeatedly(ReturnBuffer(encrypted_i_frame_buffer_));

Powered by Google App Engine
This is Rietveld 408576698