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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 } | 260 } |
259 | 261 |
260 talk_base::scoped_refptr<webrtc::PeerConnectionInterface> | 262 talk_base::scoped_refptr<webrtc::PeerConnectionInterface> |
261 MockMediaStreamDependencyFactory::CreatePeerConnection( | 263 MockMediaStreamDependencyFactory::CreatePeerConnection( |
262 const std::string& config, | 264 const std::string& config, |
263 webrtc::PeerConnectionObserver* observer) { | 265 webrtc::PeerConnectionObserver* observer) { |
264 DCHECK(mock_pc_factory_created_); | 266 DCHECK(mock_pc_factory_created_); |
265 return new talk_base::RefCountedObject<webrtc::MockPeerConnectionImpl>(this); | 267 return new talk_base::RefCountedObject<webrtc::MockPeerConnectionImpl>(this); |
266 } | 268 } |
267 | 269 |
| 270 talk_base::scoped_refptr<webrtc::PeerConnectionInterface> |
| 271 MockMediaStreamDependencyFactory::CreatePeerConnection( |
| 272 const webrtc::JsepInterface::IceServers& ice_servers, |
| 273 const webrtc::MediaConstraintsInterface* constraints, |
| 274 webrtc::PeerConnectionObserver* observer) { |
| 275 DCHECK(mock_pc_factory_created_); |
| 276 return new talk_base::RefCountedObject<webrtc::MockPeerConnectionImpl>(this); |
| 277 } |
| 278 |
268 talk_base::scoped_refptr<webrtc::LocalMediaStreamInterface> | 279 talk_base::scoped_refptr<webrtc::LocalMediaStreamInterface> |
269 MockMediaStreamDependencyFactory::CreateLocalMediaStream( | 280 MockMediaStreamDependencyFactory::CreateLocalMediaStream( |
270 const std::string& label) { | 281 const std::string& label) { |
271 DCHECK(mock_pc_factory_created_); | 282 DCHECK(mock_pc_factory_created_); |
272 talk_base::scoped_refptr<webrtc::LocalMediaStreamInterface> stream( | 283 talk_base::scoped_refptr<webrtc::LocalMediaStreamInterface> stream( |
273 new talk_base::RefCountedObject<webrtc::MockLocalMediaStream>(label)); | 284 new talk_base::RefCountedObject<webrtc::MockLocalMediaStream>(label)); |
274 return stream; | 285 return stream; |
275 } | 286 } |
276 | 287 |
277 talk_base::scoped_refptr<webrtc::LocalVideoTrackInterface> | 288 talk_base::scoped_refptr<webrtc::LocalVideoTrackInterface> |
(...skipping 12 matching lines...) Expand all Loading... |
290 webrtc::AudioDeviceModule* audio_device) { | 301 webrtc::AudioDeviceModule* audio_device) { |
291 DCHECK(mock_pc_factory_created_); | 302 DCHECK(mock_pc_factory_created_); |
292 talk_base::scoped_refptr<webrtc::LocalAudioTrackInterface> track( | 303 talk_base::scoped_refptr<webrtc::LocalAudioTrackInterface> track( |
293 new talk_base::RefCountedObject<webrtc::MockLocalAudioTrack>(label)); | 304 new talk_base::RefCountedObject<webrtc::MockLocalAudioTrack>(label)); |
294 return track; | 305 return track; |
295 } | 306 } |
296 | 307 |
297 webrtc::SessionDescriptionInterface* | 308 webrtc::SessionDescriptionInterface* |
298 MockMediaStreamDependencyFactory::CreateSessionDescription( | 309 MockMediaStreamDependencyFactory::CreateSessionDescription( |
299 const std::string& sdp) { | 310 const std::string& sdp) { |
300 return new webrtc::MockSessionDescription(sdp); | 311 return CreateSessionDescription ("unknown", sdp); |
| 312 } |
| 313 |
| 314 webrtc::SessionDescriptionInterface* |
| 315 MockMediaStreamDependencyFactory::CreateSessionDescription( |
| 316 const std::string& type, |
| 317 const std::string& sdp) { |
| 318 return new webrtc::MockSessionDescription(type, sdp); |
301 } | 319 } |
302 | 320 |
303 webrtc::IceCandidateInterface* | 321 webrtc::IceCandidateInterface* |
304 MockMediaStreamDependencyFactory::CreateIceCandidate( | 322 MockMediaStreamDependencyFactory::CreateIceCandidate( |
305 const std::string& sdp_mid, | 323 const std::string& sdp_mid, |
306 int sdp_mline_index, | 324 int sdp_mline_index, |
307 const std::string& sdp) { | 325 const std::string& sdp) { |
308 return new webrtc::MockIceCandidate(sdp_mid, sdp_mline_index, sdp); | 326 return new webrtc::MockIceCandidate(sdp_mid, sdp_mline_index, sdp); |
309 } | 327 } |
310 | 328 |
311 void MockMediaStreamDependencyFactory::SetAudioDeviceSessionId(int session_id) { | 329 void MockMediaStreamDependencyFactory::SetAudioDeviceSessionId(int session_id) { |
312 } | 330 } |
OLD | NEW |