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/base/pipeline_impl.h" | 5 #include "media/base/pipeline_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <memory> | 8 #include <memory> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
799 MockDemuxerStreamVector streams; | 799 MockDemuxerStreamVector streams; |
800 streams.push_back(audio_stream()); | 800 streams.push_back(audio_stream()); |
801 SetDemuxerExpectations(&streams); | 801 SetDemuxerExpectations(&streams); |
802 SetRendererExpectations(); | 802 SetRendererExpectations(); |
803 StartPipelineAndExpect(PIPELINE_OK); | 803 StartPipelineAndExpect(PIPELINE_OK); |
804 ExpectDemuxerStop(); | 804 ExpectDemuxerStop(); |
805 pipeline_->Stop(); | 805 pipeline_->Stop(); |
806 base::RunLoop().RunUntilIdle(); | 806 base::RunLoop().RunUntilIdle(); |
807 } | 807 } |
808 | 808 |
| 809 TEST_F(PipelineImplTest, GetMediaTime) { |
| 810 CreateAudioStream(); |
| 811 MockDemuxerStreamVector streams; |
| 812 streams.push_back(audio_stream()); |
| 813 SetDemuxerExpectations(&streams); |
| 814 SetRendererExpectations(); |
| 815 StartPipelineAndExpect(PIPELINE_OK); |
| 816 |
| 817 // Pipeline should report the same media time returned by the renderer. |
| 818 base::TimeDelta kMediaTime = base::TimeDelta::FromSeconds(2); |
| 819 EXPECT_CALL(*renderer_, GetMediaTime()).WillRepeatedly(Return(kMediaTime)); |
| 820 EXPECT_EQ(kMediaTime, pipeline_->GetMediaTime()); |
| 821 |
| 822 // Media time should not go backwards even if the renderer returns an |
| 823 // errorneous value. PipelineImpl should clamp it to last reported value. |
| 824 EXPECT_CALL(*renderer_, GetMediaTime()) |
| 825 .WillRepeatedly(Return(base::TimeDelta::FromSeconds(1))); |
| 826 EXPECT_EQ(kMediaTime, pipeline_->GetMediaTime()); |
| 827 } |
| 828 |
809 class PipelineTeardownTest : public PipelineImplTest { | 829 class PipelineTeardownTest : public PipelineImplTest { |
810 public: | 830 public: |
811 enum TeardownState { | 831 enum TeardownState { |
812 kInitDemuxer, | 832 kInitDemuxer, |
813 kInitRenderer, | 833 kInitRenderer, |
814 kFlushing, | 834 kFlushing, |
815 kSeeking, | 835 kSeeking, |
816 kPlaying, | 836 kPlaying, |
817 kSuspending, | 837 kSuspending, |
818 kSuspended, | 838 kSuspended, |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1071 INSTANTIATE_TEARDOWN_TEST(Error, Seeking); | 1091 INSTANTIATE_TEARDOWN_TEST(Error, Seeking); |
1072 INSTANTIATE_TEARDOWN_TEST(Error, Playing); | 1092 INSTANTIATE_TEARDOWN_TEST(Error, Playing); |
1073 INSTANTIATE_TEARDOWN_TEST(Error, Suspending); | 1093 INSTANTIATE_TEARDOWN_TEST(Error, Suspending); |
1074 INSTANTIATE_TEARDOWN_TEST(Error, Suspended); | 1094 INSTANTIATE_TEARDOWN_TEST(Error, Suspended); |
1075 INSTANTIATE_TEARDOWN_TEST(Error, Resuming); | 1095 INSTANTIATE_TEARDOWN_TEST(Error, Resuming); |
1076 | 1096 |
1077 INSTANTIATE_TEARDOWN_TEST(ErrorAndStop, Playing); | 1097 INSTANTIATE_TEARDOWN_TEST(ErrorAndStop, Playing); |
1078 INSTANTIATE_TEARDOWN_TEST(ErrorAndStop, Suspended); | 1098 INSTANTIATE_TEARDOWN_TEST(ErrorAndStop, Suspended); |
1079 | 1099 |
1080 } // namespace media | 1100 } // namespace media |
OLD | NEW |