| 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/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "media/base/cdm_callback_promise.h" | 10 #include "media/base/cdm_callback_promise.h" |
| (...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 }; | 624 }; |
| 625 | 625 |
| 626 #if defined(MOJO_RENDERER) | 626 #if defined(MOJO_RENDERER) |
| 627 class PipelineIntegrationTestHost : public mojo::test::ApplicationTestBase, | 627 class PipelineIntegrationTestHost : public mojo::test::ApplicationTestBase, |
| 628 public PipelineIntegrationTestBase { | 628 public PipelineIntegrationTestBase { |
| 629 public: | 629 public: |
| 630 bool ShouldCreateDefaultRunLoop() override { return false; } | 630 bool ShouldCreateDefaultRunLoop() override { return false; } |
| 631 | 631 |
| 632 void SetUp() override { | 632 void SetUp() override { |
| 633 ApplicationTestBase::SetUp(); | 633 ApplicationTestBase::SetUp(); |
| 634 | 634 if (!IsMediaLibraryInitialized()) |
| 635 // TODO(dalecurtis): For some reason this isn't done... | |
| 636 if (!base::CommandLine::InitializedForCurrentProcess()) { | |
| 637 base::CommandLine::Init(0, NULL); | |
| 638 InitializeMediaLibraryForTesting(); | 635 InitializeMediaLibraryForTesting(); |
| 639 } | |
| 640 } | 636 } |
| 641 | 637 |
| 642 protected: | 638 protected: |
| 643 scoped_ptr<Renderer> CreateRenderer() override { | 639 scoped_ptr<Renderer> CreateRenderer() override { |
| 644 mojo::ServiceProvider* service_provider = | 640 mojo::ServiceProvider* service_provider = |
| 645 application_impl() | 641 application_impl() |
| 646 ->ConnectToApplication("mojo://media") | 642 ->ConnectToApplication("mojo://media") |
| 647 ->GetServiceProvider(); | 643 ->GetServiceProvider(); |
| 648 | 644 |
| 649 mojo::MediaRendererPtr mojo_media_renderer; | 645 mojo::MediaRendererPtr mojo_media_renderer; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 674 pipeline_->Start( | 670 pipeline_->Start( |
| 675 demuxer_.get(), CreateRenderer(), | 671 demuxer_.get(), CreateRenderer(), |
| 676 base::Bind(&PipelineIntegrationTest::OnEnded, base::Unretained(this)), | 672 base::Bind(&PipelineIntegrationTest::OnEnded, base::Unretained(this)), |
| 677 base::Bind(&PipelineIntegrationTest::OnError, base::Unretained(this)), | 673 base::Bind(&PipelineIntegrationTest::OnError, base::Unretained(this)), |
| 678 base::Bind(&PipelineIntegrationTest::OnStatusCallback, | 674 base::Bind(&PipelineIntegrationTest::OnStatusCallback, |
| 679 base::Unretained(this)), | 675 base::Unretained(this)), |
| 680 base::Bind(&PipelineIntegrationTest::OnMetadata, | 676 base::Bind(&PipelineIntegrationTest::OnMetadata, |
| 681 base::Unretained(this)), | 677 base::Unretained(this)), |
| 682 base::Bind(&PipelineIntegrationTest::OnBufferingStateChanged, | 678 base::Bind(&PipelineIntegrationTest::OnBufferingStateChanged, |
| 683 base::Unretained(this)), | 679 base::Unretained(this)), |
| 684 base::Bind(&PipelineIntegrationTest::OnVideoFramePaint, | |
| 685 base::Unretained(this)), | |
| 686 base::Closure(), base::Bind(&PipelineIntegrationTest::OnAddTextTrack, | 680 base::Closure(), base::Bind(&PipelineIntegrationTest::OnAddTextTrack, |
| 687 base::Unretained(this)), | 681 base::Unretained(this)), |
| 688 base::Bind(&PipelineIntegrationTest::OnWaitingForDecryptionKey, | 682 base::Bind(&PipelineIntegrationTest::OnWaitingForDecryptionKey, |
| 689 base::Unretained(this))); | 683 base::Unretained(this))); |
| 690 message_loop_.Run(); | 684 message_loop_.Run(); |
| 691 EXPECT_EQ(PIPELINE_OK, pipeline_status_); | 685 EXPECT_EQ(PIPELINE_OK, pipeline_status_); |
| 692 } | 686 } |
| 693 | 687 |
| 694 void StartHashedPipelineWithMediaSource(MockMediaSource* source) { | 688 void StartHashedPipelineWithMediaSource(MockMediaSource* source) { |
| 695 hashing_enabled_ = true; | 689 hashing_enabled_ = true; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 720 pipeline_->Start( | 714 pipeline_->Start( |
| 721 demuxer_.get(), CreateRenderer(), | 715 demuxer_.get(), CreateRenderer(), |
| 722 base::Bind(&PipelineIntegrationTest::OnEnded, base::Unretained(this)), | 716 base::Bind(&PipelineIntegrationTest::OnEnded, base::Unretained(this)), |
| 723 base::Bind(&PipelineIntegrationTest::OnError, base::Unretained(this)), | 717 base::Bind(&PipelineIntegrationTest::OnError, base::Unretained(this)), |
| 724 base::Bind(&PipelineIntegrationTest::OnStatusCallback, | 718 base::Bind(&PipelineIntegrationTest::OnStatusCallback, |
| 725 base::Unretained(this)), | 719 base::Unretained(this)), |
| 726 base::Bind(&PipelineIntegrationTest::OnMetadata, | 720 base::Bind(&PipelineIntegrationTest::OnMetadata, |
| 727 base::Unretained(this)), | 721 base::Unretained(this)), |
| 728 base::Bind(&PipelineIntegrationTest::OnBufferingStateChanged, | 722 base::Bind(&PipelineIntegrationTest::OnBufferingStateChanged, |
| 729 base::Unretained(this)), | 723 base::Unretained(this)), |
| 730 base::Bind(&PipelineIntegrationTest::OnVideoFramePaint, | |
| 731 base::Unretained(this)), | |
| 732 base::Closure(), base::Bind(&PipelineIntegrationTest::OnAddTextTrack, | 724 base::Closure(), base::Bind(&PipelineIntegrationTest::OnAddTextTrack, |
| 733 base::Unretained(this)), | 725 base::Unretained(this)), |
| 734 base::Bind(&PipelineIntegrationTest::OnWaitingForDecryptionKey, | 726 base::Bind(&PipelineIntegrationTest::OnWaitingForDecryptionKey, |
| 735 base::Unretained(this))); | 727 base::Unretained(this))); |
| 736 | 728 |
| 737 source->set_encrypted_media_init_data_cb( | 729 source->set_encrypted_media_init_data_cb( |
| 738 base::Bind(&FakeEncryptedMedia::OnEncryptedMediaInitData, | 730 base::Bind(&FakeEncryptedMedia::OnEncryptedMediaInitData, |
| 739 base::Unretained(encrypted_media))); | 731 base::Unretained(encrypted_media))); |
| 740 | 732 |
| 741 message_loop_.Run(); | 733 message_loop_.Run(); |
| (...skipping 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1742 | 1734 |
| 1743 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) { | 1735 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) { |
| 1744 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm")); | 1736 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm")); |
| 1745 Play(); | 1737 Play(); |
| 1746 ASSERT_TRUE(WaitUntilOnEnded()); | 1738 ASSERT_TRUE(WaitUntilOnEnded()); |
| 1747 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000), | 1739 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000), |
| 1748 demuxer_->GetStartTime()); | 1740 demuxer_->GetStartTime()); |
| 1749 } | 1741 } |
| 1750 | 1742 |
| 1751 } // namespace media | 1743 } // namespace media |
| OLD | NEW |