Chromium Code Reviews| Index: media/filters/ffmpeg_demuxer_unittest.cc |
| diff --git a/media/filters/ffmpeg_demuxer_unittest.cc b/media/filters/ffmpeg_demuxer_unittest.cc |
| index af2cd92528527c8175c1192a5619717908838ebc..5b914dd89f42fe7bbef10c1f0b598b88551925fc 100644 |
| --- a/media/filters/ffmpeg_demuxer_unittest.cc |
| +++ b/media/filters/ffmpeg_demuxer_unittest.cc |
| @@ -11,17 +11,21 @@ |
| #include "base/files/file_path.h" |
| #include "base/path_service.h" |
| #include "base/threading/thread.h" |
| +#include "media/base/decrypt_config.h" |
| #include "media/base/mock_demuxer_host.h" |
| #include "media/base/test_helpers.h" |
| #include "media/ffmpeg/ffmpeg_common.h" |
| #include "media/filters/ffmpeg_demuxer.h" |
| #include "media/filters/file_data_source.h" |
| +#include "media/webm/webm_crypto_helpers.h" |
| #include "testing/gtest/include/gtest/gtest.h" |
| using ::testing::AnyNumber; |
| using ::testing::DoAll; |
| +using ::testing::Exactly; |
| using ::testing::InSequence; |
| using ::testing::Invoke; |
| +using ::testing::NotNull; |
| using ::testing::Return; |
| using ::testing::SaveArg; |
| using ::testing::SetArgPointee; |
| @@ -77,8 +81,12 @@ class FFmpegDemuxerTest : public testing::Test { |
| EXPECT_CALL(host_, AddBufferedTimeRange(_, _)).Times(AnyNumber()); |
| CreateDataSource(name); |
| + |
| + media::FFmpegNeedKeyCB need_key_cb = |
| + base::Bind(&FFmpegDemuxerTest::NeedKeyCB, base::Unretained(this)); |
| demuxer_ = new FFmpegDemuxer(message_loop_.message_loop_proxy(), |
| - data_source_); |
| + data_source_, |
| + need_key_cb); |
| } |
| MOCK_METHOD1(CheckPoint, void(int v)); |
| @@ -121,6 +129,13 @@ class FFmpegDemuxerTest : public testing::Test { |
| location, size, timestampInMicroseconds); |
| } |
| + MOCK_METHOD3(NeedKeyCBMock, void(const std::string& type, |
| + const uint8* init_data, int init_data_size)); |
| + void NeedKeyCB(const std::string& type, |
|
ddorwin
2013/03/13 19:16:09
Why can't we use the mock method directly? For the
fgalligan1
2013/03/13 19:36:52
I added xhwang's todo and comment on why we can't
xhwang
2013/03/13 20:15:20
Yeah, it's unfortunate that mock method doesn't wo
|
| + scoped_array<uint8> init_data, int init_data_size) { |
| + NeedKeyCBMock(type, init_data.get(), init_data_size); |
| + } |
| + |
| // Accessor to demuxer internals. |
| void set_duration_known(bool duration_known) { |
| demuxer_->duration_known_ = duration_known; |
| @@ -281,6 +296,17 @@ TEST_F(FFmpegDemuxerTest, Initialize_Multitrack) { |
| EXPECT_FALSE(demuxer_->GetStream(DemuxerStream::UNKNOWN)); |
| } |
| +// TODO(fgalligan): Enable test when code to parse encrypted WebM files lands |
| +// in Chromium's FFmpeg. crbug.com/189221 |
| +TEST_F(FFmpegDemuxerTest, DISABLED_Initialize_Encrypted) { |
| + EXPECT_CALL(*this, NeedKeyCBMock(kWebMEncryptInitDataType, NotNull(), |
| + DecryptConfig::kDecryptionKeySize)) |
| + .Times(Exactly(2)); |
| + |
| + CreateDemuxer("bear-320x240-av_enc-av.webm"); |
| + InitializeDemuxer(); |
| +} |
| + |
| TEST_F(FFmpegDemuxerTest, Read_Audio) { |
| // We test that on a successful audio packet read. |
| CreateDemuxer("bear-320x240.webm"); |