| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 #endif | 656 #endif |
| 657 | 657 |
| 658 class PipelineIntegrationTest : public PipelineIntegrationTestHost { | 658 class PipelineIntegrationTest : public PipelineIntegrationTestHost { |
| 659 public: | 659 public: |
| 660 void StartPipelineWithMediaSource(MockMediaSource* source) { | 660 void StartPipelineWithMediaSource(MockMediaSource* source) { |
| 661 EXPECT_CALL(*source, InitSegmentReceived()).Times(AtLeast(1)); | 661 EXPECT_CALL(*source, InitSegmentReceived()).Times(AtLeast(1)); |
| 662 EXPECT_CALL(*this, OnMetadata(_)) | 662 EXPECT_CALL(*this, OnMetadata(_)) |
| 663 .Times(AtMost(1)) | 663 .Times(AtMost(1)) |
| 664 .WillRepeatedly(SaveArg<0>(&metadata_)); | 664 .WillRepeatedly(SaveArg<0>(&metadata_)); |
| 665 EXPECT_CALL(*this, OnBufferingStateChanged(BUFFERING_HAVE_ENOUGH)) | 665 EXPECT_CALL(*this, OnBufferingStateChanged(BUFFERING_HAVE_ENOUGH)) |
| 666 .Times(AtMost(1)); | 666 .Times(AnyNumber()); |
| 667 EXPECT_CALL(*this, OnBufferingStateChanged(BUFFERING_HAVE_NOTHING)) |
| 668 .Times(AnyNumber()); |
| 667 | 669 |
| 668 // Encrypted content not used, so this is never called. | 670 // Encrypted content not used, so this is never called. |
| 669 EXPECT_CALL(*this, OnWaitingForDecryptionKey()).Times(0); | 671 EXPECT_CALL(*this, OnWaitingForDecryptionKey()).Times(0); |
| 670 | 672 |
| 671 demuxer_ = source->GetDemuxer().Pass(); | 673 demuxer_ = source->GetDemuxer().Pass(); |
| 672 pipeline_->Start( | 674 pipeline_->Start( |
| 673 demuxer_.get(), CreateRenderer(), | 675 demuxer_.get(), CreateRenderer(), |
| 674 base::Bind(&PipelineIntegrationTest::OnEnded, base::Unretained(this)), | 676 base::Bind(&PipelineIntegrationTest::OnEnded, base::Unretained(this)), |
| 675 base::Bind(&PipelineIntegrationTest::OnError, base::Unretained(this)), | 677 base::Bind(&PipelineIntegrationTest::OnError, base::Unretained(this)), |
| 676 base::Bind(&PipelineIntegrationTest::OnStatusCallback, | 678 base::Bind(&PipelineIntegrationTest::OnStatusCallback, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 693 } | 695 } |
| 694 | 696 |
| 695 void StartPipelineWithEncryptedMedia( | 697 void StartPipelineWithEncryptedMedia( |
| 696 MockMediaSource* source, | 698 MockMediaSource* source, |
| 697 FakeEncryptedMedia* encrypted_media) { | 699 FakeEncryptedMedia* encrypted_media) { |
| 698 EXPECT_CALL(*source, InitSegmentReceived()).Times(AtLeast(1)); | 700 EXPECT_CALL(*source, InitSegmentReceived()).Times(AtLeast(1)); |
| 699 EXPECT_CALL(*this, OnMetadata(_)) | 701 EXPECT_CALL(*this, OnMetadata(_)) |
| 700 .Times(AtMost(1)) | 702 .Times(AtMost(1)) |
| 701 .WillRepeatedly(SaveArg<0>(&metadata_)); | 703 .WillRepeatedly(SaveArg<0>(&metadata_)); |
| 702 EXPECT_CALL(*this, OnBufferingStateChanged(BUFFERING_HAVE_ENOUGH)) | 704 EXPECT_CALL(*this, OnBufferingStateChanged(BUFFERING_HAVE_ENOUGH)) |
| 703 .Times(AtMost(1)); | 705 .Times(AnyNumber()); |
| 706 EXPECT_CALL(*this, OnBufferingStateChanged(BUFFERING_HAVE_NOTHING)) |
| 707 .Times(AnyNumber()); |
| 704 EXPECT_CALL(*this, DecryptorAttached(true)); | 708 EXPECT_CALL(*this, DecryptorAttached(true)); |
| 705 | 709 |
| 706 // Encrypted content used but keys provided in advance, so this is | 710 // Encrypted content used but keys provided in advance, so this is |
| 707 // never called. | 711 // never called. |
| 708 EXPECT_CALL(*this, OnWaitingForDecryptionKey()).Times(0); | 712 EXPECT_CALL(*this, OnWaitingForDecryptionKey()).Times(0); |
| 709 | 713 |
| 710 demuxer_ = source->GetDemuxer().Pass(); | 714 demuxer_ = source->GetDemuxer().Pass(); |
| 711 | 715 |
| 712 pipeline_->SetCdm(encrypted_media->GetCdmContext(), | 716 pipeline_->SetCdm(encrypted_media->GetCdmContext(), |
| 713 base::Bind(&PipelineIntegrationTest::DecryptorAttached, | 717 base::Bind(&PipelineIntegrationTest::DecryptorAttached, |
| (...skipping 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1737 | 1741 |
| 1738 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) { | 1742 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) { |
| 1739 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm")); | 1743 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm")); |
| 1740 Play(); | 1744 Play(); |
| 1741 ASSERT_TRUE(WaitUntilOnEnded()); | 1745 ASSERT_TRUE(WaitUntilOnEnded()); |
| 1742 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000), | 1746 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000), |
| 1743 demuxer_->GetStartTime()); | 1747 demuxer_->GetStartTime()); |
| 1744 } | 1748 } |
| 1745 | 1749 |
| 1746 } // namespace media | 1750 } // namespace media |
| OLD | NEW |