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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 | 699 |
700 PipelineStatus StartPipelineWithMediaSource(MockMediaSource* source, | 700 PipelineStatus StartPipelineWithMediaSource(MockMediaSource* source, |
701 uint8_t test_type) { | 701 uint8_t test_type) { |
702 hashing_enabled_ = test_type & kHashed; | 702 hashing_enabled_ = test_type & kHashed; |
703 clockless_playback_ = test_type & kClockless; | 703 clockless_playback_ = test_type & kClockless; |
704 | 704 |
705 EXPECT_CALL(*source, InitSegmentReceived(_)).Times(AtLeast(1)); | 705 EXPECT_CALL(*source, InitSegmentReceived(_)).Times(AtLeast(1)); |
706 EXPECT_CALL(*this, OnMetadata(_)) | 706 EXPECT_CALL(*this, OnMetadata(_)) |
707 .Times(AtMost(1)) | 707 .Times(AtMost(1)) |
708 .WillRepeatedly(SaveArg<0>(&metadata_)); | 708 .WillRepeatedly(SaveArg<0>(&metadata_)); |
709 EXPECT_CALL(*this, OnBufferingStateChanged(BUFFERING_HAVE_ENOUGH)) | 709 EXPECT_CALL(*this, OnBufferingStateChange(BUFFERING_HAVE_ENOUGH)) |
710 .Times(AnyNumber()); | 710 .Times(AnyNumber()); |
711 EXPECT_CALL(*this, OnBufferingStateChanged(BUFFERING_HAVE_NOTHING)) | 711 EXPECT_CALL(*this, OnBufferingStateChange(BUFFERING_HAVE_NOTHING)) |
712 .Times(AnyNumber()); | 712 .Times(AnyNumber()); |
713 | 713 |
714 // Encrypted content not used, so this is never called. | 714 // Encrypted content not used, so this is never called. |
715 EXPECT_CALL(*this, OnWaitingForDecryptionKey()).Times(0); | 715 EXPECT_CALL(*this, OnWaitingForDecryptionKey()).Times(0); |
716 | 716 |
717 demuxer_ = source->GetDemuxer(); | 717 demuxer_ = source->GetDemuxer(); |
718 pipeline_->Start( | 718 pipeline_->Start(demuxer_.get(), CreateRenderer(), this, |
719 demuxer_.get(), CreateRenderer(), | 719 base::Bind(&PipelineIntegrationTest::OnStatusCallback, |
720 base::Bind(&PipelineIntegrationTest::OnEnded, base::Unretained(this)), | 720 base::Unretained(this))); |
721 base::Bind(&PipelineIntegrationTest::OnError, base::Unretained(this)), | |
722 base::Bind(&PipelineIntegrationTest::OnStatusCallback, | |
723 base::Unretained(this)), | |
724 base::Bind(&PipelineIntegrationTest::OnMetadata, | |
725 base::Unretained(this)), | |
726 base::Bind(&PipelineIntegrationTest::OnBufferingStateChanged, | |
727 base::Unretained(this)), | |
728 base::Closure(), base::Bind(&PipelineIntegrationTest::OnAddTextTrack, | |
729 base::Unretained(this)), | |
730 base::Bind(&PipelineIntegrationTest::OnWaitingForDecryptionKey, | |
731 base::Unretained(this))); | |
732 message_loop_.Run(); | 721 message_loop_.Run(); |
733 EXPECT_EQ(PIPELINE_OK, pipeline_status_); | 722 EXPECT_EQ(PIPELINE_OK, pipeline_status_); |
734 return pipeline_status_; | 723 return pipeline_status_; |
735 } | 724 } |
736 | 725 |
737 void StartPipelineWithEncryptedMedia(MockMediaSource* source, | 726 void StartPipelineWithEncryptedMedia(MockMediaSource* source, |
738 FakeEncryptedMedia* encrypted_media) { | 727 FakeEncryptedMedia* encrypted_media) { |
739 EXPECT_CALL(*source, InitSegmentReceived(_)).Times(AtLeast(1)); | 728 EXPECT_CALL(*source, InitSegmentReceived(_)).Times(AtLeast(1)); |
740 EXPECT_CALL(*this, OnMetadata(_)) | 729 EXPECT_CALL(*this, OnMetadata(_)) |
741 .Times(AtMost(1)) | 730 .Times(AtMost(1)) |
742 .WillRepeatedly(SaveArg<0>(&metadata_)); | 731 .WillRepeatedly(SaveArg<0>(&metadata_)); |
743 EXPECT_CALL(*this, OnBufferingStateChanged(BUFFERING_HAVE_ENOUGH)) | 732 EXPECT_CALL(*this, OnBufferingStateChange(BUFFERING_HAVE_ENOUGH)) |
744 .Times(AnyNumber()); | 733 .Times(AnyNumber()); |
745 EXPECT_CALL(*this, OnBufferingStateChanged(BUFFERING_HAVE_NOTHING)) | 734 EXPECT_CALL(*this, OnBufferingStateChange(BUFFERING_HAVE_NOTHING)) |
746 .Times(AnyNumber()); | 735 .Times(AnyNumber()); |
747 EXPECT_CALL(*this, DecryptorAttached(true)); | 736 EXPECT_CALL(*this, DecryptorAttached(true)); |
748 | 737 |
749 // Encrypted content used but keys provided in advance, so this is | 738 // Encrypted content used but keys provided in advance, so this is |
750 // never called. | 739 // never called. |
751 EXPECT_CALL(*this, OnWaitingForDecryptionKey()).Times(0); | 740 EXPECT_CALL(*this, OnWaitingForDecryptionKey()).Times(0); |
752 | 741 |
753 demuxer_ = source->GetDemuxer(); | 742 demuxer_ = source->GetDemuxer(); |
754 | 743 |
755 pipeline_->SetCdm(encrypted_media->GetCdmContext(), | 744 pipeline_->SetCdm(encrypted_media->GetCdmContext(), |
756 base::Bind(&PipelineIntegrationTest::DecryptorAttached, | 745 base::Bind(&PipelineIntegrationTest::DecryptorAttached, |
757 base::Unretained(this))); | 746 base::Unretained(this))); |
758 | 747 |
759 pipeline_->Start( | 748 pipeline_->Start(demuxer_.get(), CreateRenderer(), this, |
760 demuxer_.get(), CreateRenderer(), | 749 base::Bind(&PipelineIntegrationTest::OnStatusCallback, |
761 base::Bind(&PipelineIntegrationTest::OnEnded, base::Unretained(this)), | 750 base::Unretained(this))); |
762 base::Bind(&PipelineIntegrationTest::OnError, base::Unretained(this)), | |
763 base::Bind(&PipelineIntegrationTest::OnStatusCallback, | |
764 base::Unretained(this)), | |
765 base::Bind(&PipelineIntegrationTest::OnMetadata, | |
766 base::Unretained(this)), | |
767 base::Bind(&PipelineIntegrationTest::OnBufferingStateChanged, | |
768 base::Unretained(this)), | |
769 base::Closure(), base::Bind(&PipelineIntegrationTest::OnAddTextTrack, | |
770 base::Unretained(this)), | |
771 base::Bind(&PipelineIntegrationTest::OnWaitingForDecryptionKey, | |
772 base::Unretained(this))); | |
773 | 751 |
774 source->set_encrypted_media_init_data_cb( | 752 source->set_encrypted_media_init_data_cb( |
775 base::Bind(&FakeEncryptedMedia::OnEncryptedMediaInitData, | 753 base::Bind(&FakeEncryptedMedia::OnEncryptedMediaInitData, |
776 base::Unretained(encrypted_media))); | 754 base::Unretained(encrypted_media))); |
777 | 755 |
778 message_loop_.Run(); | 756 message_loop_.Run(); |
779 EXPECT_EQ(PIPELINE_OK, pipeline_status_); | 757 EXPECT_EQ(PIPELINE_OK, pipeline_status_); |
780 } | 758 } |
781 | 759 |
782 // Verifies that seeking works properly for ChunkDemuxer when the | 760 // Verifies that seeking works properly for ChunkDemuxer when the |
(...skipping 1389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2172 | 2150 |
2173 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) { | 2151 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) { |
2174 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm")); | 2152 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm")); |
2175 Play(); | 2153 Play(); |
2176 ASSERT_TRUE(WaitUntilOnEnded()); | 2154 ASSERT_TRUE(WaitUntilOnEnded()); |
2177 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000), | 2155 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000), |
2178 demuxer_->GetStartTime()); | 2156 demuxer_->GetStartTime()); |
2179 } | 2157 } |
2180 | 2158 |
2181 } // namespace media | 2159 } // namespace media |
OLD | NEW |