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..d2f02ae01705ff4f79dbf52c2fdf4f821d1b2b99 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,17 @@ class FFmpegDemuxerTest : public testing::Test { |
location, size, timestampInMicroseconds); |
} |
+ // TODO(xhwang): This is a workaround of the issue that move-only parameters |
+ // are not supported in mocked methods. Remove this when the issue is fixed |
+ // (http://code.google.com/p/googletest/issues/detail?id=395) or when we use |
+ // std::string instead of scoped_array<uint8> (http://crbug.com/130689). |
+ MOCK_METHOD3(NeedKeyCBMock, void(const std::string& type, |
+ const uint8* init_data, int init_data_size)); |
+ void NeedKeyCB(const std::string& type, |
+ 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 +300,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"); |