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

Side by Side Diff: content/renderer/media/media_stream_impl_unittest.cc

Issue 12320078: Delete old RTCVideoDecoder code path. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: make the line no longer than 80 chars Created 7 years, 9 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
« no previous file with comments | « content/renderer/media/media_stream_impl.cc ('k') | content/renderer/media/rtc_video_decoder.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/memory/scoped_ptr.h" 5 #include "base/memory/scoped_ptr.h"
6 #include "base/message_loop.h"
7 #include "base/utf_string_conversions.h" 6 #include "base/utf_string_conversions.h"
8 #include "content/renderer/media/media_stream_extra_data.h" 7 #include "content/renderer/media/media_stream_extra_data.h"
9 #include "content/renderer/media/media_stream_impl.h" 8 #include "content/renderer/media/media_stream_impl.h"
10 #include "content/renderer/media/mock_media_stream_dependency_factory.h" 9 #include "content/renderer/media/mock_media_stream_dependency_factory.h"
11 #include "content/renderer/media/mock_media_stream_dispatcher.h" 10 #include "content/renderer/media/mock_media_stream_dispatcher.h"
12 #include "content/renderer/media/video_capture_impl_manager.h" 11 #include "content/renderer/media/video_capture_impl_manager.h"
13 #include "media/base/video_decoder.h"
14 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
15 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStream.h" 13 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStream.h"
16 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamSourc e.h" 14 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamSourc e.h"
17 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamTrack .h" 15 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamTrack .h"
18 #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h" 16 #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h"
19 #include "third_party/WebKit/Source/Platform/chromium/public/WebVector.h" 17 #include "third_party/WebKit/Source/Platform/chromium/public/WebVector.h"
20 18
21 namespace content { 19 namespace content {
22 20
23 class MediaStreamImplUnderTest : public MediaStreamImpl { 21 class MediaStreamImplUnderTest : public MediaStreamImpl {
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 150
153 protected: 151 protected:
154 scoped_ptr<MockMediaStreamDispatcher> ms_dispatcher_; 152 scoped_ptr<MockMediaStreamDispatcher> ms_dispatcher_;
155 scoped_ptr<MediaStreamImplUnderTest> ms_impl_; 153 scoped_ptr<MediaStreamImplUnderTest> ms_impl_;
156 scoped_ptr<MockMediaStreamDependencyFactory> dependency_factory_; 154 scoped_ptr<MockMediaStreamDependencyFactory> dependency_factory_;
157 }; 155 };
158 156
159 TEST_F(MediaStreamImplTest, LocalMediaStream) { 157 TEST_F(MediaStreamImplTest, LocalMediaStream) {
160 // Test a stream with both audio and video. 158 // Test a stream with both audio and video.
161 WebKit::WebMediaStream mixed_desc = RequestLocalMediaStream(true, true); 159 WebKit::WebMediaStream mixed_desc = RequestLocalMediaStream(true, true);
162 // Create a renderer for the stream.
163 scoped_refptr<media::VideoDecoder> mixed_decoder(
164 ms_impl_->GetVideoDecoder(GURL(), base::MessageLoopProxy::current()));
165 EXPECT_TRUE(mixed_decoder.get() != NULL);
166 160
167 // Test a stream with audio only. 161 // Test a stream with audio only.
168 WebKit::WebMediaStream audio_desc = RequestLocalMediaStream(true, false); 162 WebKit::WebMediaStream audio_desc = RequestLocalMediaStream(true, false);
169 scoped_refptr<media::VideoDecoder> audio_decoder(
170 ms_impl_->GetVideoDecoder(GURL(), base::MessageLoopProxy::current()));
171 EXPECT_TRUE(audio_decoder.get() == NULL);
172 163
173 // Test a stream with video only. 164 // Test a stream with video only.
174 WebKit::WebMediaStream video_desc = RequestLocalMediaStream(false, true); 165 WebKit::WebMediaStream video_desc = RequestLocalMediaStream(false, true);
175 scoped_refptr<media::VideoDecoder> video_decoder(
176 ms_impl_->GetVideoDecoder(GURL(), base::MessageLoopProxy::current()));
177 EXPECT_TRUE(video_decoder.get() != NULL);
178 166
179 // Stop generated local streams. 167 // Stop generated local streams.
180 ms_impl_->OnLocalMediaStreamStop(mixed_desc.label().utf8()); 168 ms_impl_->OnLocalMediaStreamStop(mixed_desc.label().utf8());
181 EXPECT_EQ(1, ms_dispatcher_->stop_stream_counter()); 169 EXPECT_EQ(1, ms_dispatcher_->stop_stream_counter());
182 ms_impl_->OnLocalMediaStreamStop(audio_desc.label().utf8()); 170 ms_impl_->OnLocalMediaStreamStop(audio_desc.label().utf8());
183 EXPECT_EQ(2, ms_dispatcher_->stop_stream_counter()); 171 EXPECT_EQ(2, ms_dispatcher_->stop_stream_counter());
184 172
185 // Test that the MediaStreams are deleted if the owning WebFrame is deleted. 173 // Test that the MediaStreams are deleted if the owning WebFrame is deleted.
186 // In the unit test the owning frame is NULL. 174 // In the unit test the owning frame is NULL.
187 ms_impl_->FrameWillClose(NULL); 175 ms_impl_->FrameWillClose(NULL);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 WebKit::WebMediaStream mixed_desc = RequestLocalMediaStream(true, true); 235 WebKit::WebMediaStream mixed_desc = RequestLocalMediaStream(true, true);
248 EXPECT_EQ(0, ms_dispatcher_->stop_stream_counter()); 236 EXPECT_EQ(0, ms_dispatcher_->stop_stream_counter());
249 EXPECT_EQ(1, ms_dispatcher_->request_stream_counter()); 237 EXPECT_EQ(1, ms_dispatcher_->request_stream_counter());
250 ms_impl_->FrameWillClose(NULL); 238 ms_impl_->FrameWillClose(NULL);
251 EXPECT_EQ(1, ms_dispatcher_->stop_stream_counter()); 239 EXPECT_EQ(1, ms_dispatcher_->stop_stream_counter());
252 ms_impl_->OnLocalMediaStreamStop(mixed_desc.label().utf8()); 240 ms_impl_->OnLocalMediaStreamStop(mixed_desc.label().utf8());
253 EXPECT_EQ(1, ms_dispatcher_->stop_stream_counter()); 241 EXPECT_EQ(1, ms_dispatcher_->stop_stream_counter());
254 } 242 }
255 243
256 } // namespace content 244 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/media_stream_impl.cc ('k') | content/renderer/media/rtc_video_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698