| 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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 std::unique_ptr<StrictMock<MockDemuxerStream>> stream( | 164 std::unique_ptr<StrictMock<MockDemuxerStream>> stream( |
| 165 new StrictMock<MockDemuxerStream>(type)); | 165 new StrictMock<MockDemuxerStream>(type)); |
| 166 return stream; | 166 return stream; |
| 167 } | 167 } |
| 168 | 168 |
| 169 // Sets up expectations to allow the video renderer to initialize. | 169 // Sets up expectations to allow the video renderer to initialize. |
| 170 void SetRendererExpectations() { | 170 void SetRendererExpectations() { |
| 171 EXPECT_CALL(*renderer_, Initialize(_, _, _)) | 171 EXPECT_CALL(*renderer_, Initialize(_, _, _)) |
| 172 .WillOnce( | 172 .WillOnce( |
| 173 DoAll(SaveArg<1>(&renderer_client_), PostCallback<2>(PIPELINE_OK))); | 173 DoAll(SaveArg<1>(&renderer_client_), PostCallback<2>(PIPELINE_OK))); |
| 174 EXPECT_CALL(*renderer_, HasAudio()).WillRepeatedly(Return(audio_stream())); | |
| 175 EXPECT_CALL(*renderer_, HasVideo()).WillRepeatedly(Return(video_stream())); | |
| 176 } | 174 } |
| 177 | 175 |
| 178 void AddTextStream() { | 176 void AddTextStream() { |
| 179 EXPECT_CALL(callbacks_, OnAddTextTrack(_, _)) | 177 EXPECT_CALL(callbacks_, OnAddTextTrack(_, _)) |
| 180 .WillOnce(Invoke(this, &PipelineImplTest::DoOnAddTextTrack)); | 178 .WillOnce(Invoke(this, &PipelineImplTest::DoOnAddTextTrack)); |
| 181 demuxer_host_->AddTextStream(text_stream(), | 179 demuxer_host_->AddTextStream(text_stream(), |
| 182 TextTrackConfig(kTextSubtitles, "", "", "")); | 180 TextTrackConfig(kTextSubtitles, "", "", "")); |
| 183 base::RunLoop().RunUntilIdle(); | 181 base::RunLoop().RunUntilIdle(); |
| 184 } | 182 } |
| 185 | 183 |
| (...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 903 return; | 901 return; |
| 904 } | 902 } |
| 905 | 903 |
| 906 CreateAudioStream(); | 904 CreateAudioStream(); |
| 907 CreateVideoStream(); | 905 CreateVideoStream(); |
| 908 MockDemuxerStreamVector streams; | 906 MockDemuxerStreamVector streams; |
| 909 streams.push_back(audio_stream()); | 907 streams.push_back(audio_stream()); |
| 910 streams.push_back(video_stream()); | 908 streams.push_back(video_stream()); |
| 911 SetDemuxerExpectations(&streams, base::TimeDelta::FromSeconds(3000)); | 909 SetDemuxerExpectations(&streams, base::TimeDelta::FromSeconds(3000)); |
| 912 | 910 |
| 913 EXPECT_CALL(*renderer_, HasAudio()).WillRepeatedly(Return(true)); | |
| 914 EXPECT_CALL(*renderer_, HasVideo()).WillRepeatedly(Return(true)); | |
| 915 | |
| 916 if (state == kInitRenderer) { | 911 if (state == kInitRenderer) { |
| 917 if (stop_or_error == kStop) { | 912 if (stop_or_error == kStop) { |
| 918 EXPECT_CALL(*renderer_, Initialize(_, _, _)) | 913 EXPECT_CALL(*renderer_, Initialize(_, _, _)) |
| 919 .WillOnce( | 914 .WillOnce( |
| 920 DoAll(Stop(pipeline_.get()), PostCallback<2>(PIPELINE_OK))); | 915 DoAll(Stop(pipeline_.get()), PostCallback<2>(PIPELINE_OK))); |
| 921 // Note: OnStart is not callback after pipeline is stopped. | 916 // Note: OnStart is not callback after pipeline is stopped. |
| 922 } else { | 917 } else { |
| 923 EXPECT_CALL(*renderer_, Initialize(_, _, _)) | 918 EXPECT_CALL(*renderer_, Initialize(_, _, _)) |
| 924 .WillOnce(PostCallback<2>(PIPELINE_ERROR_INITIALIZATION_FAILED)); | 919 .WillOnce(PostCallback<2>(PIPELINE_ERROR_INITIALIZATION_FAILED)); |
| 925 EXPECT_CALL(callbacks_, OnStart(PIPELINE_ERROR_INITIALIZATION_FAILED)); | 920 EXPECT_CALL(callbacks_, OnStart(PIPELINE_ERROR_INITIALIZATION_FAILED)); |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1091 INSTANTIATE_TEARDOWN_TEST(Error, Seeking); | 1086 INSTANTIATE_TEARDOWN_TEST(Error, Seeking); |
| 1092 INSTANTIATE_TEARDOWN_TEST(Error, Playing); | 1087 INSTANTIATE_TEARDOWN_TEST(Error, Playing); |
| 1093 INSTANTIATE_TEARDOWN_TEST(Error, Suspending); | 1088 INSTANTIATE_TEARDOWN_TEST(Error, Suspending); |
| 1094 INSTANTIATE_TEARDOWN_TEST(Error, Suspended); | 1089 INSTANTIATE_TEARDOWN_TEST(Error, Suspended); |
| 1095 INSTANTIATE_TEARDOWN_TEST(Error, Resuming); | 1090 INSTANTIATE_TEARDOWN_TEST(Error, Resuming); |
| 1096 | 1091 |
| 1097 INSTANTIATE_TEARDOWN_TEST(ErrorAndStop, Playing); | 1092 INSTANTIATE_TEARDOWN_TEST(ErrorAndStop, Playing); |
| 1098 INSTANTIATE_TEARDOWN_TEST(ErrorAndStop, Suspended); | 1093 INSTANTIATE_TEARDOWN_TEST(ErrorAndStop, Suspended); |
| 1099 | 1094 |
| 1100 } // namespace media | 1095 } // namespace media |
| OLD | NEW |