Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(230)

Side by Side Diff: media/renderers/renderer_impl_unittest.cc

Issue 2668393002: Rename DemuxerStreamProvider into MediaResource (Closed)
Patch Set: rebase Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include <memory> 7 #include <memory>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 155
156 void CreateAudioAndVideoStream() { 156 void CreateAudioAndVideoStream() {
157 CreateAudioStream(); 157 CreateAudioStream();
158 CreateVideoStream(); 158 CreateVideoStream();
159 } 159 }
160 160
161 void InitializeWithAudio() { 161 void InitializeWithAudio() {
162 CreateAudioStream(); 162 CreateAudioStream();
163 SetAudioRendererInitializeExpectations(PIPELINE_OK); 163 SetAudioRendererInitializeExpectations(PIPELINE_OK);
164 // There is a potential race between HTMLMediaElement/WMPI shutdown and 164 // There is a potential race between HTMLMediaElement/WMPI shutdown and
165 // renderers being initialized which might result in DemuxerStreamProvider 165 // renderers being initialized which might result in MediaResource GetStream
166 // GetStream suddenly returning NULL (see crbug.com/668604). So we are going 166 // suddenly returning NULL (see crbug.com/668604). So we are going to check
167 // to check here that GetStream will be invoked exactly 3 times during 167 // here that GetStream will be invoked exactly 3 times during RendererImpl
168 // RendererImpl initialization to help catch potential issues. Currently the 168 // initialization to help catch potential issues. Currently the GetStream is
169 // GetStream is invoked once directly from RendererImpl::Initialize, once 169 // invoked once directly from RendererImpl::Initialize, once indirectly from
170 // indirectly from RendererImpl::Initialize via HasEncryptedStream and once 170 // RendererImpl::Initialize via HasEncryptedStream and once from
171 // from RendererImpl::InitializeAudioRenderer. 171 // RendererImpl::InitializeAudioRenderer.
172 EXPECT_CALL(*demuxer_, GetStream(DemuxerStream::AUDIO)) 172 EXPECT_CALL(*demuxer_, GetStream(DemuxerStream::AUDIO))
173 .Times(2) 173 .Times(2)
174 .WillRepeatedly(Return(audio_stream_.get())); 174 .WillRepeatedly(Return(audio_stream_.get()));
175 InitializeAndExpect(PIPELINE_OK); 175 InitializeAndExpect(PIPELINE_OK);
176 } 176 }
177 177
178 void InitializeWithVideo() { 178 void InitializeWithVideo() {
179 CreateVideoStream(); 179 CreateVideoStream();
180 SetVideoRendererInitializeExpectations(PIPELINE_OK); 180 SetVideoRendererInitializeExpectations(PIPELINE_OK);
181 // There is a potential race between HTMLMediaElement/WMPI shutdown and 181 // There is a potential race between HTMLMediaElement/WMPI shutdown and
182 // renderers being initialized which might result in DemuxerStreamProvider 182 // renderers being initialized which might result in MediaResource GetStream
183 // GetStream suddenly returning NULL (see crbug.com/668604). So we are going 183 // suddenly returning NULL (see crbug.com/668604). So we are going to check
184 // to check here that GetStream will be invoked exactly 3 times during 184 // here that GetStream will be invoked exactly 3 times during RendererImpl
185 // RendererImpl initialization to help catch potential issues. Currently the 185 // initialization to help catch potential issues. Currently the GetStream is
186 // GetStream is invoked once directly from RendererImpl::Initialize, once 186 // invoked once directly from RendererImpl::Initialize, once indirectly from
187 // indirectly from RendererImpl::Initialize via HasEncryptedStream and once 187 // RendererImpl::Initialize via HasEncryptedStream and once from
188 // from RendererImpl::InitializeVideoRenderer. 188 // RendererImpl::InitializeVideoRenderer.
189 EXPECT_CALL(*demuxer_, GetStream(DemuxerStream::VIDEO)) 189 EXPECT_CALL(*demuxer_, GetStream(DemuxerStream::VIDEO))
190 .Times(2) 190 .Times(2)
191 .WillRepeatedly(Return(video_stream_.get())); 191 .WillRepeatedly(Return(video_stream_.get()));
192 InitializeAndExpect(PIPELINE_OK); 192 InitializeAndExpect(PIPELINE_OK);
193 } 193 }
194 194
195 void InitializeWithAudioAndVideo() { 195 void InitializeWithAudioAndVideo() {
196 CreateAudioAndVideoStream(); 196 CreateAudioAndVideoStream();
197 SetAudioRendererInitializeExpectations(PIPELINE_OK); 197 SetAudioRendererInitializeExpectations(PIPELINE_OK);
198 SetVideoRendererInitializeExpectations(PIPELINE_OK); 198 SetVideoRendererInitializeExpectations(PIPELINE_OK);
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 // change processing involves Flush + StartPlaying when the Flush is done. The 845 // change processing involves Flush + StartPlaying when the Flush is done. The
846 // Flush operation is async in this case, so the second status change will be 846 // Flush operation is async in this case, so the second status change will be
847 // postponed by renderer until after processing the first one is finished. But 847 // postponed by renderer until after processing the first one is finished. But
848 // we must still get two pairs of Flush/StartPlaying calls eventually. 848 // we must still get two pairs of Flush/StartPlaying calls eventually.
849 video_stream_status_change_cb.Run(false, base::TimeDelta()); 849 video_stream_status_change_cb.Run(false, base::TimeDelta());
850 video_stream_status_change_cb.Run(true, base::TimeDelta()); 850 video_stream_status_change_cb.Run(true, base::TimeDelta());
851 base::RunLoop().Run(); 851 base::RunLoop().Run();
852 } 852 }
853 853
854 } // namespace media 854 } // namespace media
OLDNEW
« media/base/media_resource.h ('K') | « media/renderers/renderer_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698