Index: media/filters/pipeline_integration_test.cc |
diff --git a/media/filters/pipeline_integration_test.cc b/media/filters/pipeline_integration_test.cc |
index dddc0652473c23e6adb0af94de4d8786a8ea6f47..56204ce472337630a6cbf88503e8ccbe21a6f97a 100644 |
--- a/media/filters/pipeline_integration_test.cc |
+++ b/media/filters/pipeline_integration_test.cc |
@@ -32,6 +32,13 @@ static const uint8 kSecretKey[] = { |
static const int kAppendWholeFile = -1; |
+static const int AppendTimeSec = 2; |
ddorwin
2013/01/07 22:19:29
acolwell: Any problems dropping this to 1 to speed
acolwell GONE FROM CHROMIUM
2013/01/07 22:21:57
No. I have no problems w/ that.
ddorwin
2013/01/07 23:34:53
Done.
|
+static const int AppendTimeMs = AppendTimeSec * 1000; |
+static const int k320WebMFileDurationMs = 2737; |
+static const int k640WebMFileDurationMs = 2763; |
+ |
+// Note: Tests using this class only exercise the DecryptingDemuxerStream path. |
+// They do not exercise the Decrypting{Audio|Video}Decoder path. |
class FakeEncryptedMedia { |
public: |
FakeEncryptedMedia() |
@@ -309,11 +316,11 @@ TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource) { |
MockMediaSource source("bear-320x240.webm", kWebM, 219229); |
StartPipelineWithMediaSource(&source); |
source.EndOfStream(); |
- ASSERT_EQ(pipeline_status_, PIPELINE_OK); |
- EXPECT_EQ(pipeline_->GetBufferedTimeRanges().size(), 1u); |
- EXPECT_EQ(pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds(), 0); |
- EXPECT_EQ(pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds(), 2737); |
+ EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
+ EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
+ EXPECT_EQ(k320WebMFileDurationMs, |
+ pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
Play(); |
@@ -330,23 +337,108 @@ TEST_F(PipelineIntegrationTest, MediaSource_ConfigChange_WebM) { |
scoped_refptr<DecoderBuffer> second_file = |
ReadTestDataFile("bear-640x360.webm"); |
- source.AppendAtTime(base::TimeDelta::FromSeconds(2), |
+ source.AppendAtTime(base::TimeDelta::FromSeconds(AppendTimeSec), |
second_file->GetData(), second_file->GetDataSize()); |
source.EndOfStream(); |
- ASSERT_EQ(pipeline_status_, PIPELINE_OK); |
- EXPECT_EQ(pipeline_->GetBufferedTimeRanges().size(), 1u); |
- EXPECT_EQ(pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds(), 0); |
- EXPECT_EQ(pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds(), 4763); |
+ EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
+ EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
+ EXPECT_EQ(AppendTimeMs + k640WebMFileDurationMs, |
+ pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
Play(); |
- ASSERT_TRUE(WaitUntilOnEnded()); |
+ EXPECT_TRUE(WaitUntilOnEnded()); |
+ source.Abort(); |
+ Stop(); |
+} |
+ |
+TEST_F(PipelineIntegrationTest, MediaSource_ConfigChange_Encrypted_WebM) { |
+ MockMediaSource source("bear-320x240-16x9-aspect-av-enc_av.webm", kWebM, |
+ kAppendWholeFile); |
+ FakeEncryptedMedia encrypted_media; |
+ StartPipelineWithEncryptedMedia(&source, &encrypted_media); |
+ |
+ scoped_refptr<DecoderBuffer> second_file = |
+ ReadTestDataFile("bear-640x360-av-enc_av.webm"); |
+ |
+ source.AppendAtTime(base::TimeDelta::FromSeconds(AppendTimeSec), |
+ second_file->GetData(), second_file->GetDataSize()); |
+ |
+ source.EndOfStream(); |
+ |
+ EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
+ EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
+ EXPECT_EQ(AppendTimeMs + k640WebMFileDurationMs, |
+ pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
+ |
+ Play(); |
+ |
+ EXPECT_TRUE(WaitUntilOnEnded()); |
source.Abort(); |
Stop(); |
} |
+// Config changes from encrypted to clear are not currently supported. |
+TEST_F(PipelineIntegrationTest, |
+ MediaSource_ConfigChange_ClearThenEncrypted_WebM) { |
+ MockMediaSource source("bear-320x240-16x9-aspect.webm", kWebM, |
+ kAppendWholeFile); |
+ FakeEncryptedMedia encrypted_media; |
+ StartPipelineWithEncryptedMedia(&source, &encrypted_media); |
+ |
+ scoped_refptr<DecoderBuffer> second_file = |
+ ReadTestDataFile("bear-640x360-av-enc_av.webm"); |
+ |
+ source.AppendAtTime(base::TimeDelta::FromSeconds(AppendTimeSec), |
+ second_file->GetData(), second_file->GetDataSize()); |
+ |
+ source.EndOfStream(); |
+ |
+ message_loop_.Run(); |
+ EXPECT_EQ(PIPELINE_ERROR_DECODE, pipeline_status_); |
+ |
+ EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
+ EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
+ // The second video was not added, so its time has not been added. |
+ EXPECT_EQ(k320WebMFileDurationMs, |
+ pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
+ |
+ Play(); |
+ |
+ EXPECT_EQ(PIPELINE_ERROR_DECODE, WaitUntilEndedOrError()); |
+ source.Abort(); |
+} |
+ |
+// Config changes from clear to encrypted are not currently supported. |
+TEST_F(PipelineIntegrationTest, |
+ MediaSource_ConfigChange_EncryptedThenClear_WebM) { |
+ MockMediaSource source("bear-320x240-16x9-aspect-av-enc_av.webm", kWebM, |
+ kAppendWholeFile); |
+ FakeEncryptedMedia encrypted_media; |
+ StartPipelineWithEncryptedMedia(&source, &encrypted_media); |
+ |
+ scoped_refptr<DecoderBuffer> second_file = |
+ ReadTestDataFile("bear-640x360.webm"); |
+ |
+ source.AppendAtTime(base::TimeDelta::FromSeconds(AppendTimeSec), |
+ second_file->GetData(), second_file->GetDataSize()); |
+ |
+ source.EndOfStream(); |
+ |
+ EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
+ EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
+ // The second video was not added, so its time has not been added. |
+ EXPECT_EQ(k320WebMFileDurationMs, |
+ pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
+ |
+ Play(); |
+ |
+ EXPECT_EQ(PIPELINE_ERROR_DECODE, WaitUntilEndedOrError()); |
+ source.Abort(); |
+} |
+ |
#if defined(GOOGLE_CHROME_BUILD) || defined(USE_PROPRIETARY_CODECS) |
TEST_F(PipelineIntegrationTest, MediaSource_ConfigChange_MP4) { |
MockMediaSource source("bear.640x360_dash.mp4", kMP4, kAppendWholeFile); |
@@ -355,19 +447,18 @@ TEST_F(PipelineIntegrationTest, MediaSource_ConfigChange_MP4) { |
scoped_refptr<DecoderBuffer> second_file = |
ReadTestDataFile("bear.1280x720_dash.mp4"); |
- source.AppendAtTime(base::TimeDelta::FromSeconds(2), |
+ source.AppendAtTime(base::TimeDelta::FromSeconds(AppendTimeSec), |
second_file->GetData(), second_file->GetDataSize()); |
source.EndOfStream(); |
- ASSERT_EQ(pipeline_status_, PIPELINE_OK); |
- EXPECT_EQ(pipeline_->GetBufferedTimeRanges().size(), 1u); |
- EXPECT_EQ(pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds(), 0); |
- EXPECT_EQ(pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds(), 4736); |
+ EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
+ EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
+ EXPECT_EQ(4736, pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
Play(); |
- ASSERT_TRUE(WaitUntilOnEnded()); |
+ EXPECT_TRUE(WaitUntilOnEnded()); |
source.Abort(); |
Stop(); |
} |