Chromium Code Reviews| 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_)); |