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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 PipelineImplTest() | 98 PipelineImplTest() |
99 : pipeline_( | 99 : pipeline_( |
100 new PipelineImpl(message_loop_.task_runner(), new MediaLog())), | 100 new PipelineImpl(message_loop_.task_runner(), new MediaLog())), |
101 demuxer_(new StrictMock<MockDemuxer>()), | 101 demuxer_(new StrictMock<MockDemuxer>()), |
102 demuxer_host_(nullptr), | 102 demuxer_host_(nullptr), |
103 scoped_renderer_(new StrictMock<MockRenderer>()), | 103 scoped_renderer_(new StrictMock<MockRenderer>()), |
104 renderer_(scoped_renderer_.get()), | 104 renderer_(scoped_renderer_.get()), |
105 renderer_client_(nullptr) { | 105 renderer_client_(nullptr) { |
106 // SetDemuxerExpectations() adds overriding expectations for expected | 106 // SetDemuxerExpectations() adds overriding expectations for expected |
107 // non-NULL streams. | 107 // non-NULL streams. |
108 DemuxerStream* null_pointer = NULL; | 108 std::vector<DemuxerStream*> empty; |
109 EXPECT_CALL(*demuxer_, GetStream(_)).WillRepeatedly(Return(null_pointer)); | 109 EXPECT_CALL(*demuxer_, GetStreams()).WillRepeatedly(Return(empty)); |
110 | 110 |
111 EXPECT_CALL(*demuxer_, GetTimelineOffset()) | 111 EXPECT_CALL(*demuxer_, GetTimelineOffset()) |
112 .WillRepeatedly(Return(base::Time())); | 112 .WillRepeatedly(Return(base::Time())); |
113 | 113 |
114 EXPECT_CALL(*renderer_, GetMediaTime()) | 114 EXPECT_CALL(*renderer_, GetMediaTime()) |
115 .WillRepeatedly(Return(base::TimeDelta())); | 115 .WillRepeatedly(Return(base::TimeDelta())); |
116 | 116 |
117 EXPECT_CALL(*demuxer_, GetStartTime()).WillRepeatedly(Return(start_time_)); | 117 EXPECT_CALL(*demuxer_, GetStartTime()).WillRepeatedly(Return(start_time_)); |
118 } | 118 } |
119 | 119 |
(...skipping 20 matching lines...) Expand all Loading... |
140 typedef std::vector<MockDemuxerStream*> MockDemuxerStreamVector; | 140 typedef std::vector<MockDemuxerStream*> MockDemuxerStreamVector; |
141 void SetDemuxerExpectations(MockDemuxerStreamVector* streams, | 141 void SetDemuxerExpectations(MockDemuxerStreamVector* streams, |
142 const base::TimeDelta& duration) { | 142 const base::TimeDelta& duration) { |
143 EXPECT_CALL(callbacks_, OnDurationChange()); | 143 EXPECT_CALL(callbacks_, OnDurationChange()); |
144 EXPECT_CALL(*demuxer_, Initialize(_, _, _)) | 144 EXPECT_CALL(*demuxer_, Initialize(_, _, _)) |
145 .WillOnce(DoAll(SaveArg<0>(&demuxer_host_), | 145 .WillOnce(DoAll(SaveArg<0>(&demuxer_host_), |
146 SetDemuxerProperties(duration), | 146 SetDemuxerProperties(duration), |
147 PostCallback<1>(PIPELINE_OK))); | 147 PostCallback<1>(PIPELINE_OK))); |
148 | 148 |
149 // Configure the demuxer to return the streams. | 149 // Configure the demuxer to return the streams. |
| 150 std::vector<DemuxerStream*> mock_streams; |
150 for (size_t i = 0; i < streams->size(); ++i) { | 151 for (size_t i = 0; i < streams->size(); ++i) { |
151 DemuxerStream* stream = (*streams)[i]; | 152 DemuxerStream* stream = (*streams)[i]; |
152 EXPECT_CALL(*demuxer_, GetStream(stream->type())) | 153 mock_streams.push_back(stream); |
153 .WillRepeatedly(Return(stream)); | |
154 } | 154 } |
| 155 EXPECT_CALL(*demuxer_, GetStreams()).WillRepeatedly(Return(mock_streams)); |
155 } | 156 } |
156 | 157 |
157 void SetDemuxerExpectations(MockDemuxerStreamVector* streams) { | 158 void SetDemuxerExpectations(MockDemuxerStreamVector* streams) { |
158 // Initialize with a default non-zero duration. | 159 // Initialize with a default non-zero duration. |
159 SetDemuxerExpectations(streams, base::TimeDelta::FromSeconds(10)); | 160 SetDemuxerExpectations(streams, base::TimeDelta::FromSeconds(10)); |
160 } | 161 } |
161 | 162 |
162 std::unique_ptr<StrictMock<MockDemuxerStream>> CreateStream( | 163 std::unique_ptr<StrictMock<MockDemuxerStream>> CreateStream( |
163 DemuxerStream::Type type) { | 164 DemuxerStream::Type type) { |
164 std::unique_ptr<StrictMock<MockDemuxerStream>> stream( | 165 std::unique_ptr<StrictMock<MockDemuxerStream>> stream( |
(...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1123 INSTANTIATE_TEARDOWN_TEST(Error, Seeking); | 1124 INSTANTIATE_TEARDOWN_TEST(Error, Seeking); |
1124 INSTANTIATE_TEARDOWN_TEST(Error, Playing); | 1125 INSTANTIATE_TEARDOWN_TEST(Error, Playing); |
1125 INSTANTIATE_TEARDOWN_TEST(Error, Suspending); | 1126 INSTANTIATE_TEARDOWN_TEST(Error, Suspending); |
1126 INSTANTIATE_TEARDOWN_TEST(Error, Suspended); | 1127 INSTANTIATE_TEARDOWN_TEST(Error, Suspended); |
1127 INSTANTIATE_TEARDOWN_TEST(Error, Resuming); | 1128 INSTANTIATE_TEARDOWN_TEST(Error, Resuming); |
1128 | 1129 |
1129 INSTANTIATE_TEARDOWN_TEST(ErrorAndStop, Playing); | 1130 INSTANTIATE_TEARDOWN_TEST(ErrorAndStop, Playing); |
1130 INSTANTIATE_TEARDOWN_TEST(ErrorAndStop, Suspended); | 1131 INSTANTIATE_TEARDOWN_TEST(ErrorAndStop, Suspended); |
1131 | 1132 |
1132 } // namespace media | 1133 } // namespace media |
OLD | NEW |