| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "media/filters/pipeline_integration_test_base.h" | 5 #include "media/filters/pipeline_integration_test_base.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 // Constants for the Media Source config change tests. | 48 // Constants for the Media Source config change tests. |
| 49 static const int kAppendTimeSec = 1; | 49 static const int kAppendTimeSec = 1; |
| 50 static const int kAppendTimeMs = kAppendTimeSec * 1000; | 50 static const int kAppendTimeMs = kAppendTimeSec * 1000; |
| 51 static const int k320WebMFileDurationMs = 2737; | 51 static const int k320WebMFileDurationMs = 2737; |
| 52 static const int k640WebMFileDurationMs = 2763; | 52 static const int k640WebMFileDurationMs = 2763; |
| 53 static const int k640IsoFileDurationMs = 2737; | 53 static const int k640IsoFileDurationMs = 2737; |
| 54 static const int k640IsoCencFileDurationMs = 2736; | 54 static const int k640IsoCencFileDurationMs = 2736; |
| 55 static const int k1280IsoFileDurationMs = 2736; | 55 static const int k1280IsoFileDurationMs = 2736; |
| 56 static const int kVP9WebMFileDurationMs = 2736; | 56 static const int kVP9WebMFileDurationMs = 2736; |
| 57 static const int kVP8AWebMFileDurationMs = 2700; |
| 57 | 58 |
| 58 // Note: Tests using this class only exercise the DecryptingDemuxerStream path. | 59 // Note: Tests using this class only exercise the DecryptingDemuxerStream path. |
| 59 // They do not exercise the Decrypting{Audio|Video}Decoder path. | 60 // They do not exercise the Decrypting{Audio|Video}Decoder path. |
| 60 class FakeEncryptedMedia { | 61 class FakeEncryptedMedia { |
| 61 public: | 62 public: |
| 62 // Defines the behavior of the "app" that responds to EME events. | 63 // Defines the behavior of the "app" that responds to EME events. |
| 63 class AppBase { | 64 class AppBase { |
| 64 public: | 65 public: |
| 65 virtual ~AppBase() {} | 66 virtual ~AppBase() {} |
| 66 | 67 |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 EXPECT_EQ(kVP9WebMFileDurationMs, | 475 EXPECT_EQ(kVP9WebMFileDurationMs, |
| 475 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); | 476 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
| 476 | 477 |
| 477 Play(); | 478 Play(); |
| 478 | 479 |
| 479 ASSERT_TRUE(WaitUntilOnEnded()); | 480 ASSERT_TRUE(WaitUntilOnEnded()); |
| 480 source.Abort(); | 481 source.Abort(); |
| 481 Stop(); | 482 Stop(); |
| 482 } | 483 } |
| 483 | 484 |
| 485 TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_VP8A_WebM) { |
| 486 MockMediaSource source("bear-vp8a.webm", kVideoOnlyWebM, kAppendWholeFile); |
| 487 StartPipelineWithMediaSource(&source); |
| 488 source.EndOfStream(); |
| 489 |
| 490 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
| 491 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
| 492 EXPECT_EQ(kVP8AWebMFileDurationMs, |
| 493 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
| 494 |
| 495 Play(); |
| 496 |
| 497 ASSERT_TRUE(WaitUntilOnEnded()); |
| 498 source.Abort(); |
| 499 Stop(); |
| 500 } |
| 501 |
| 484 TEST_F(PipelineIntegrationTest, MediaSource_ConfigChange_WebM) { | 502 TEST_F(PipelineIntegrationTest, MediaSource_ConfigChange_WebM) { |
| 485 MockMediaSource source("bear-320x240-16x9-aspect.webm", kWebM, | 503 MockMediaSource source("bear-320x240-16x9-aspect.webm", kWebM, |
| 486 kAppendWholeFile); | 504 kAppendWholeFile); |
| 487 StartPipelineWithMediaSource(&source); | 505 StartPipelineWithMediaSource(&source); |
| 488 | 506 |
| 489 scoped_refptr<DecoderBuffer> second_file = | 507 scoped_refptr<DecoderBuffer> second_file = |
| 490 ReadTestDataFile("bear-640x360.webm"); | 508 ReadTestDataFile("bear-640x360.webm"); |
| 491 | 509 |
| 492 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), | 510 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), |
| 493 second_file->GetData(), second_file->GetDataSize()); | 511 second_file->GetData(), second_file->GetDataSize()); |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 925 // Verify that VP8 video with alpha channel can be played back. | 943 // Verify that VP8 video with alpha channel can be played back. |
| 926 TEST_F(PipelineIntegrationTest, BasicPlayback_VP8A_WebM) { | 944 TEST_F(PipelineIntegrationTest, BasicPlayback_VP8A_WebM) { |
| 927 ASSERT_TRUE(Start(GetTestDataFilePath("bear-vp8a.webm"), | 945 ASSERT_TRUE(Start(GetTestDataFilePath("bear-vp8a.webm"), |
| 928 PIPELINE_OK)); | 946 PIPELINE_OK)); |
| 929 Play(); | 947 Play(); |
| 930 ASSERT_TRUE(WaitUntilOnEnded()); | 948 ASSERT_TRUE(WaitUntilOnEnded()); |
| 931 EXPECT_EQ(last_video_frame_format_, VideoFrame::YV12A); | 949 EXPECT_EQ(last_video_frame_format_, VideoFrame::YV12A); |
| 932 } | 950 } |
| 933 | 951 |
| 934 } // namespace media | 952 } // namespace media |
| OLD | NEW |