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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 void MockLocalAudioTrack::RegisterObserver(ObserverInterface* observer) { | 159 void MockLocalAudioTrack::RegisterObserver(ObserverInterface* observer) { |
160 NOTIMPLEMENTED(); | 160 NOTIMPLEMENTED(); |
161 } | 161 } |
162 | 162 |
163 void MockLocalAudioTrack::UnregisterObserver(ObserverInterface* observer) { | 163 void MockLocalAudioTrack::UnregisterObserver(ObserverInterface* observer) { |
164 NOTIMPLEMENTED(); | 164 NOTIMPLEMENTED(); |
165 } | 165 } |
166 | 166 |
167 class MockSessionDescription : public SessionDescriptionInterface { | 167 class MockSessionDescription : public SessionDescriptionInterface { |
168 public: | 168 public: |
169 MockSessionDescription(const std::string& sdp) | 169 MockSessionDescription(const std::string& type, |
170 : sdp_(sdp) { | 170 const std::string& sdp) |
| 171 : type_(type), |
| 172 sdp_(sdp) { |
171 } | 173 } |
172 virtual ~MockSessionDescription() {} | 174 virtual ~MockSessionDescription() {} |
173 virtual const cricket::SessionDescription* description() const OVERRIDE { | 175 virtual const cricket::SessionDescription* description() const OVERRIDE { |
174 NOTIMPLEMENTED(); | 176 NOTIMPLEMENTED(); |
175 return NULL; | 177 return NULL; |
176 } | 178 } |
177 virtual std::string session_id() const OVERRIDE { | 179 virtual std::string session_id() const OVERRIDE { |
178 NOTIMPLEMENTED(); | 180 NOTIMPLEMENTED(); |
179 return ""; | 181 return ""; |
180 } | 182 } |
181 virtual std::string session_version() const OVERRIDE { | 183 virtual std::string session_version() const OVERRIDE { |
182 NOTIMPLEMENTED(); | 184 NOTIMPLEMENTED(); |
183 return ""; | 185 return ""; |
184 } | 186 } |
185 virtual std::string type() const OVERRIDE { | 187 virtual std::string type() const OVERRIDE { |
186 NOTIMPLEMENTED(); | 188 return type_; |
187 return ""; | |
188 } | 189 } |
189 virtual bool AddCandidate(const IceCandidateInterface* candidate) OVERRIDE { | 190 virtual bool AddCandidate(const IceCandidateInterface* candidate) OVERRIDE { |
190 NOTIMPLEMENTED(); | 191 NOTIMPLEMENTED(); |
191 return false; | 192 return false; |
192 } | 193 } |
193 virtual size_t number_of_mediasections() const OVERRIDE { | 194 virtual size_t number_of_mediasections() const OVERRIDE { |
194 NOTIMPLEMENTED(); | 195 NOTIMPLEMENTED(); |
195 return 0; | 196 return 0; |
196 } | 197 } |
197 virtual const IceCandidateCollection* candidates( | 198 virtual const IceCandidateCollection* candidates( |
198 size_t mediasection_index) const OVERRIDE { | 199 size_t mediasection_index) const OVERRIDE { |
199 NOTIMPLEMENTED(); | 200 NOTIMPLEMENTED(); |
200 return NULL; | 201 return NULL; |
201 } | 202 } |
202 | 203 |
203 virtual bool ToString(std::string* out) const OVERRIDE { | 204 virtual bool ToString(std::string* out) const OVERRIDE { |
204 *out = sdp_; | 205 *out = sdp_; |
205 return true; | 206 return true; |
206 } | 207 } |
207 | 208 |
208 private: | 209 private: |
| 210 std::string type_; |
209 std::string sdp_; | 211 std::string sdp_; |
210 }; | 212 }; |
211 | 213 |
212 class MockIceCandidate : public IceCandidateInterface { | 214 class MockIceCandidate : public IceCandidateInterface { |
213 public: | 215 public: |
214 MockIceCandidate(const std::string& sdp_mid, | 216 MockIceCandidate(const std::string& sdp_mid, |
215 int sdp_mline_index, | 217 int sdp_mline_index, |
216 const std::string& sdp) | 218 const std::string& sdp) |
217 : sdp_mid_(sdp_mid), | 219 : sdp_mid_(sdp_mid), |
218 sdp_mline_index_(sdp_mline_index), | 220 sdp_mline_index_(sdp_mline_index), |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 } | 274 } |
273 | 275 |
274 talk_base::scoped_refptr<webrtc::PeerConnectionInterface> | 276 talk_base::scoped_refptr<webrtc::PeerConnectionInterface> |
275 MockMediaStreamDependencyFactory::CreatePeerConnection( | 277 MockMediaStreamDependencyFactory::CreatePeerConnection( |
276 const std::string& config, | 278 const std::string& config, |
277 webrtc::PeerConnectionObserver* observer) { | 279 webrtc::PeerConnectionObserver* observer) { |
278 DCHECK(mock_pc_factory_created_); | 280 DCHECK(mock_pc_factory_created_); |
279 return new talk_base::RefCountedObject<webrtc::MockPeerConnectionImpl>(this); | 281 return new talk_base::RefCountedObject<webrtc::MockPeerConnectionImpl>(this); |
280 } | 282 } |
281 | 283 |
| 284 talk_base::scoped_refptr<webrtc::PeerConnectionInterface> |
| 285 MockMediaStreamDependencyFactory::CreatePeerConnection( |
| 286 const webrtc::JsepInterface::IceServers& ice_servers, |
| 287 const webrtc::MediaConstraintsInterface* constraints, |
| 288 webrtc::PeerConnectionObserver* observer) { |
| 289 DCHECK(mock_pc_factory_created_); |
| 290 return new talk_base::RefCountedObject<webrtc::MockPeerConnectionImpl>(this); |
| 291 } |
| 292 |
282 talk_base::scoped_refptr<webrtc::LocalMediaStreamInterface> | 293 talk_base::scoped_refptr<webrtc::LocalMediaStreamInterface> |
283 MockMediaStreamDependencyFactory::CreateLocalMediaStream( | 294 MockMediaStreamDependencyFactory::CreateLocalMediaStream( |
284 const std::string& label) { | 295 const std::string& label) { |
285 talk_base::scoped_refptr<webrtc::LocalMediaStreamInterface> stream( | 296 talk_base::scoped_refptr<webrtc::LocalMediaStreamInterface> stream( |
286 new talk_base::RefCountedObject<webrtc::MockLocalMediaStream>(label)); | 297 new talk_base::RefCountedObject<webrtc::MockLocalMediaStream>(label)); |
287 return stream; | 298 return stream; |
288 } | 299 } |
289 | 300 |
290 talk_base::scoped_refptr<webrtc::LocalVideoTrackInterface> | 301 talk_base::scoped_refptr<webrtc::LocalVideoTrackInterface> |
291 MockMediaStreamDependencyFactory::CreateLocalVideoTrack( | 302 MockMediaStreamDependencyFactory::CreateLocalVideoTrack( |
292 const std::string& label, | 303 const std::string& label, |
293 int video_session_id) { | 304 int video_session_id) { |
294 talk_base::scoped_refptr<webrtc::LocalVideoTrackInterface> track( | 305 talk_base::scoped_refptr<webrtc::LocalVideoTrackInterface> track( |
295 new talk_base::RefCountedObject<webrtc::MockLocalVideoTrack>(label)); | 306 new talk_base::RefCountedObject<webrtc::MockLocalVideoTrack>(label)); |
296 return track; | 307 return track; |
297 } | 308 } |
298 | 309 |
299 talk_base::scoped_refptr<webrtc::LocalAudioTrackInterface> | 310 talk_base::scoped_refptr<webrtc::LocalAudioTrackInterface> |
300 MockMediaStreamDependencyFactory::CreateLocalAudioTrack( | 311 MockMediaStreamDependencyFactory::CreateLocalAudioTrack( |
301 const std::string& label, | 312 const std::string& label, |
302 webrtc::AudioDeviceModule* audio_device) { | 313 webrtc::AudioDeviceModule* audio_device) { |
303 talk_base::scoped_refptr<webrtc::LocalAudioTrackInterface> track( | 314 talk_base::scoped_refptr<webrtc::LocalAudioTrackInterface> track( |
304 new talk_base::RefCountedObject<webrtc::MockLocalAudioTrack>(label)); | 315 new talk_base::RefCountedObject<webrtc::MockLocalAudioTrack>(label)); |
305 return track; | 316 return track; |
306 } | 317 } |
307 | 318 |
308 webrtc::SessionDescriptionInterface* | 319 webrtc::SessionDescriptionInterface* |
309 MockMediaStreamDependencyFactory::CreateSessionDescription( | 320 MockMediaStreamDependencyFactory::CreateSessionDescription( |
310 const std::string& sdp) { | 321 const std::string& sdp) { |
311 return new webrtc::MockSessionDescription(sdp); | 322 return CreateSessionDescription ("unknown", sdp); |
| 323 } |
| 324 |
| 325 webrtc::SessionDescriptionInterface* |
| 326 MockMediaStreamDependencyFactory::CreateSessionDescription( |
| 327 const std::string& type, |
| 328 const std::string& sdp) { |
| 329 return new webrtc::MockSessionDescription(type, sdp); |
312 } | 330 } |
313 | 331 |
314 webrtc::IceCandidateInterface* | 332 webrtc::IceCandidateInterface* |
315 MockMediaStreamDependencyFactory::CreateIceCandidate( | 333 MockMediaStreamDependencyFactory::CreateIceCandidate( |
316 const std::string& sdp_mid, | 334 const std::string& sdp_mid, |
317 int sdp_mline_index, | 335 int sdp_mline_index, |
318 const std::string& sdp) { | 336 const std::string& sdp) { |
319 return new webrtc::MockIceCandidate(sdp_mid, sdp_mline_index, sdp); | 337 return new webrtc::MockIceCandidate(sdp_mid, sdp_mline_index, sdp); |
320 } | 338 } |
OLD | NEW |