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

Unified Diff: media/filters/decrypting_audio_decoder_unittest.cc

Issue 11189082: Update PluginInstance for audio support for content decryption. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix tests Created 8 years, 2 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
« no previous file with comments | « media/filters/decrypting_audio_decoder.cc ('k') | webkit/media/crypto/ppapi/cdm_wrapper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/decrypting_audio_decoder_unittest.cc
diff --git a/media/filters/decrypting_audio_decoder_unittest.cc b/media/filters/decrypting_audio_decoder_unittest.cc
index 46265d09ea2752abf77f041c69dc4f50e62ec2fc..a77438a810be5e47b121bae8a27859cf828bd78a 100644
--- a/media/filters/decrypting_audio_decoder_unittest.cc
+++ b/media/filters/decrypting_audio_decoder_unittest.cc
@@ -96,9 +96,14 @@ class DecryptingAudioDecoderTest : public testing::Test {
decryptor_(new StrictMock<MockDecryptor>()),
demuxer_(new StrictMock<MockDemuxerStream>()),
encrypted_buffer_(CreateFakeEncryptedBuffer()),
- decoded_frame_(new DataBuffer(kFakeAudioFrameSize)),
+ decoded_frame_(NULL),
end_of_stream_frame_(new DataBuffer(0)),
- decoded_frame_list_(1, decoded_frame_) {
+ decoded_frame_list_() {
+ // TODO(xhwang): Fix this after DataBuffer(data, size) is public.
+ scoped_refptr<DataBuffer> buffer = new DataBuffer(kFakeAudioFrameSize);
+ buffer->SetDataSize(kFakeAudioFrameSize);
+ decoded_frame_ = buffer;
+ decoded_frame_list_.push_back(decoded_frame_);
}
void InitializeAndExpectStatus(const AudioDecoderConfig& config,
@@ -325,10 +330,12 @@ TEST_F(DecryptingAudioDecoderTest, DecryptAndDecode_NeedMoreData) {
TEST_F(DecryptingAudioDecoderTest, DecryptAndDecode_MultipleFrames) {
Initialize();
- scoped_refptr<Buffer> decoded_frame_a(new DataBuffer(kFakeAudioFrameSize));
- scoped_refptr<Buffer> decoded_frame_b(new DataBuffer(kFakeAudioFrameSize));
- decoded_frame_list_.push_back(decoded_frame_a);
- decoded_frame_list_.push_back(decoded_frame_b);
+ scoped_refptr<DataBuffer> frame_a = new DataBuffer(kFakeAudioFrameSize);
+ frame_a->SetDataSize(kFakeAudioFrameSize);
+ scoped_refptr<DataBuffer> frame_b = new DataBuffer(kFakeAudioFrameSize);
+ frame_b->SetDataSize(kFakeAudioFrameSize);
+ decoded_frame_list_.push_back(frame_a);
+ decoded_frame_list_.push_back(frame_b);
EXPECT_CALL(*demuxer_, Read(_))
.WillOnce(ReturnBuffer(encrypted_buffer_));
@@ -337,8 +344,8 @@ TEST_F(DecryptingAudioDecoderTest, DecryptAndDecode_MultipleFrames) {
EXPECT_CALL(statistics_cb_, OnStatistics(_));
ReadAndExpectFrameReadyWith(AudioDecoder::kOk, decoded_frame_);
- ReadAndExpectFrameReadyWith(AudioDecoder::kOk, decoded_frame_a);
- ReadAndExpectFrameReadyWith(AudioDecoder::kOk, decoded_frame_b);
+ ReadAndExpectFrameReadyWith(AudioDecoder::kOk, frame_a);
+ ReadAndExpectFrameReadyWith(AudioDecoder::kOk, frame_b);
}
// Test the case where the decryptor receives end-of-stream buffer.
@@ -348,34 +355,6 @@ TEST_F(DecryptingAudioDecoderTest, DecryptAndDecode_EndOfStream) {
EnterEndOfStreamState();
}
-// Test the case where the decryptor returns multiple decoded frames, the last
-// of which is end-of-stream frame.
-TEST_F(DecryptingAudioDecoderTest, DecryptAndDecode_MultipleFramesWithEos) {
- Initialize();
-
- scoped_refptr<Buffer> decoded_frame_a(new DataBuffer(kFakeAudioFrameSize));
- scoped_refptr<Buffer> decoded_frame_b(new DataBuffer(kFakeAudioFrameSize));
- Decryptor::AudioBuffers second_decoded_frame_list;
- second_decoded_frame_list.push_back(decoded_frame_a);
- second_decoded_frame_list.push_back(decoded_frame_b);
- second_decoded_frame_list.push_back(end_of_stream_frame_);
-
- EXPECT_CALL(*demuxer_, Read(_))
- .WillOnce(ReturnBuffer(encrypted_buffer_))
- .WillOnce(ReturnBuffer(DecoderBuffer::CreateEOSBuffer()));
- EXPECT_CALL(*decryptor_, DecryptAndDecodeAudio(_, _))
- .WillOnce(RunCallback2(Decryptor::kSuccess, decoded_frame_list_))
- .WillOnce(RunCallback2(Decryptor::kSuccess, second_decoded_frame_list));
- // Expect only one OnStatistics() here because EOS input buffer doesn't
- // trigger statistics reporting.
- EXPECT_CALL(statistics_cb_, OnStatistics(_));
-
- ReadAndExpectFrameReadyWith(AudioDecoder::kOk, decoded_frame_);
- ReadAndExpectFrameReadyWith(AudioDecoder::kOk, decoded_frame_a);
- ReadAndExpectFrameReadyWith(AudioDecoder::kOk, decoded_frame_b);
- ReadAndExpectFrameReadyWith(AudioDecoder::kOk, end_of_stream_frame_);
-}
-
// Test the case where the a key is added when the decryptor is in
// kWaitingForKey state.
TEST_F(DecryptingAudioDecoderTest, KeyAdded_DuringWaitingForKey) {
« no previous file with comments | « media/filters/decrypting_audio_decoder.cc ('k') | webkit/media/crypto/ppapi/cdm_wrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698