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 "base/logging.h" | 5 #include "base/logging.h" |
6 #include "content/renderer/media/mock_media_stream_dependency_factory.h" | 6 #include "content/renderer/media/mock_media_stream_dependency_factory.h" |
7 #include "content/renderer/media/mock_peer_connection_impl.h" | 7 #include "content/renderer/media/mock_peer_connection_impl.h" |
8 #include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" | 8 #include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" |
9 #include "third_party/libjingle/source/talk/base/scoped_ref_ptr.h" | 9 #include "third_party/libjingle/source/talk/base/scoped_ref_ptr.h" |
10 | 10 |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 } | 238 } |
239 | 239 |
240 private: | 240 private: |
241 std::string sdp_mid_; | 241 std::string sdp_mid_; |
242 int sdp_mline_index_; | 242 int sdp_mline_index_; |
243 std::string sdp_; | 243 std::string sdp_; |
244 }; | 244 }; |
245 | 245 |
246 } // namespace webrtc | 246 } // namespace webrtc |
247 | 247 |
248 MockMediaStreamDependencyFactory::MockMediaStreamDependencyFactory( | 248 MockMediaStreamDependencyFactory::MockMediaStreamDependencyFactory() |
249 VideoCaptureImplManager* vc_manager) | 249 : MediaStreamDependencyFactory(NULL, NULL), |
250 : MediaStreamDependencyFactory(vc_manager), | |
251 mock_pc_factory_created_(false) { | 250 mock_pc_factory_created_(false) { |
252 } | 251 } |
253 | 252 |
254 MockMediaStreamDependencyFactory::~MockMediaStreamDependencyFactory() {} | 253 MockMediaStreamDependencyFactory::~MockMediaStreamDependencyFactory() {} |
255 | 254 |
256 bool MockMediaStreamDependencyFactory::CreatePeerConnectionFactory( | 255 bool MockMediaStreamDependencyFactory::EnsurePeerConnectionFactory() { |
257 talk_base::Thread* worker_thread, | |
258 talk_base::Thread* signaling_thread, | |
259 content::P2PSocketDispatcher* socket_dispatcher, | |
260 talk_base::NetworkManager* network_manager, | |
261 talk_base::PacketSocketFactory* socket_factory) { | |
262 mock_pc_factory_created_ = true; | 256 mock_pc_factory_created_ = true; |
263 return true; | 257 return true; |
264 } | 258 } |
265 | 259 |
266 void MockMediaStreamDependencyFactory::ReleasePeerConnectionFactory() { | |
267 mock_pc_factory_created_ = false; | |
268 } | |
269 | |
270 bool MockMediaStreamDependencyFactory::PeerConnectionFactoryCreated() { | |
271 return mock_pc_factory_created_; | |
272 } | |
273 | |
274 talk_base::scoped_refptr<webrtc::PeerConnectionInterface> | 260 talk_base::scoped_refptr<webrtc::PeerConnectionInterface> |
275 MockMediaStreamDependencyFactory::CreatePeerConnection( | 261 MockMediaStreamDependencyFactory::CreatePeerConnection( |
276 const std::string& config, | 262 const std::string& config, |
277 webrtc::PeerConnectionObserver* observer) { | 263 webrtc::PeerConnectionObserver* observer) { |
278 DCHECK(mock_pc_factory_created_); | 264 DCHECK(mock_pc_factory_created_); |
279 return new talk_base::RefCountedObject<webrtc::MockPeerConnectionImpl>(this); | 265 return new talk_base::RefCountedObject<webrtc::MockPeerConnectionImpl>(this); |
280 } | 266 } |
281 | 267 |
282 talk_base::scoped_refptr<webrtc::LocalMediaStreamInterface> | 268 talk_base::scoped_refptr<webrtc::LocalMediaStreamInterface> |
283 MockMediaStreamDependencyFactory::CreateLocalMediaStream( | 269 MockMediaStreamDependencyFactory::CreateLocalMediaStream( |
284 const std::string& label) { | 270 const std::string& label) { |
| 271 DCHECK(mock_pc_factory_created_); |
285 talk_base::scoped_refptr<webrtc::LocalMediaStreamInterface> stream( | 272 talk_base::scoped_refptr<webrtc::LocalMediaStreamInterface> stream( |
286 new talk_base::RefCountedObject<webrtc::MockLocalMediaStream>(label)); | 273 new talk_base::RefCountedObject<webrtc::MockLocalMediaStream>(label)); |
287 return stream; | 274 return stream; |
288 } | 275 } |
289 | 276 |
290 talk_base::scoped_refptr<webrtc::LocalVideoTrackInterface> | 277 talk_base::scoped_refptr<webrtc::LocalVideoTrackInterface> |
291 MockMediaStreamDependencyFactory::CreateLocalVideoTrack( | 278 MockMediaStreamDependencyFactory::CreateLocalVideoTrack( |
292 const std::string& label, | 279 const std::string& label, |
293 int video_session_id) { | 280 int video_session_id) { |
| 281 DCHECK(mock_pc_factory_created_); |
294 talk_base::scoped_refptr<webrtc::LocalVideoTrackInterface> track( | 282 talk_base::scoped_refptr<webrtc::LocalVideoTrackInterface> track( |
295 new talk_base::RefCountedObject<webrtc::MockLocalVideoTrack>(label)); | 283 new talk_base::RefCountedObject<webrtc::MockLocalVideoTrack>(label)); |
296 return track; | 284 return track; |
297 } | 285 } |
298 | 286 |
299 talk_base::scoped_refptr<webrtc::LocalAudioTrackInterface> | 287 talk_base::scoped_refptr<webrtc::LocalAudioTrackInterface> |
300 MockMediaStreamDependencyFactory::CreateLocalAudioTrack( | 288 MockMediaStreamDependencyFactory::CreateLocalAudioTrack( |
301 const std::string& label, | 289 const std::string& label, |
302 webrtc::AudioDeviceModule* audio_device) { | 290 webrtc::AudioDeviceModule* audio_device) { |
| 291 DCHECK(mock_pc_factory_created_); |
303 talk_base::scoped_refptr<webrtc::LocalAudioTrackInterface> track( | 292 talk_base::scoped_refptr<webrtc::LocalAudioTrackInterface> track( |
304 new talk_base::RefCountedObject<webrtc::MockLocalAudioTrack>(label)); | 293 new talk_base::RefCountedObject<webrtc::MockLocalAudioTrack>(label)); |
305 return track; | 294 return track; |
306 } | 295 } |
307 | 296 |
308 webrtc::SessionDescriptionInterface* | 297 webrtc::SessionDescriptionInterface* |
309 MockMediaStreamDependencyFactory::CreateSessionDescription( | 298 MockMediaStreamDependencyFactory::CreateSessionDescription( |
310 const std::string& sdp) { | 299 const std::string& sdp) { |
311 return new webrtc::MockSessionDescription(sdp); | 300 return new webrtc::MockSessionDescription(sdp); |
312 } | 301 } |
313 | 302 |
314 webrtc::IceCandidateInterface* | 303 webrtc::IceCandidateInterface* |
315 MockMediaStreamDependencyFactory::CreateIceCandidate( | 304 MockMediaStreamDependencyFactory::CreateIceCandidate( |
316 const std::string& sdp_mid, | 305 const std::string& sdp_mid, |
317 int sdp_mline_index, | 306 int sdp_mline_index, |
318 const std::string& sdp) { | 307 const std::string& sdp) { |
319 return new webrtc::MockIceCandidate(sdp_mid, sdp_mline_index, sdp); | 308 return new webrtc::MockIceCandidate(sdp_mid, sdp_mline_index, sdp); |
320 } | 309 } |
321 | 310 |
322 void MockMediaStreamDependencyFactory::SetAudioDeviceSessionId(int session_id) { | 311 void MockMediaStreamDependencyFactory::SetAudioDeviceSessionId(int session_id) { |
323 } | 312 } |
OLD | NEW |