| 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 "content/renderer/media/mock_peer_connection_impl.h" | 5 #include "content/renderer/media/mock_peer_connection_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "content/renderer/media/mock_data_channel_impl.h" | 12 #include "content/renderer/media/mock_data_channel_impl.h" |
| 13 #include "content/renderer/media/webrtc/mock_peer_connection_dependency_factory.
h" | 13 #include "content/renderer/media/webrtc/mock_peer_connection_dependency_factory.
h" |
| 14 | 14 |
| 15 using testing::_; | 15 using testing::_; |
| 16 using webrtc::AudioTrackInterface; | 16 using webrtc::AudioTrackInterface; |
| 17 using webrtc::CreateSessionDescriptionObserver; | 17 using webrtc::CreateSessionDescriptionObserver; |
| 18 using webrtc::DtmfSenderInterface; | 18 using webrtc::DtmfSenderInterface; |
| 19 using webrtc::DtmfSenderObserverInterface; | 19 using webrtc::DtmfSenderObserverInterface; |
| 20 using webrtc::IceCandidateInterface; | 20 using webrtc::IceCandidateInterface; |
| 21 using webrtc::MediaConstraintsInterface; | |
| 22 using webrtc::MediaStreamInterface; | 21 using webrtc::MediaStreamInterface; |
| 23 using webrtc::PeerConnectionInterface; | 22 using webrtc::PeerConnectionInterface; |
| 24 using webrtc::SessionDescriptionInterface; | 23 using webrtc::SessionDescriptionInterface; |
| 25 using webrtc::SetSessionDescriptionObserver; | 24 using webrtc::SetSessionDescriptionObserver; |
| 26 | 25 |
| 27 namespace content { | 26 namespace content { |
| 28 | 27 |
| 29 class MockStreamCollection : public webrtc::StreamCollectionInterface { | 28 class MockStreamCollection : public webrtc::StreamCollectionInterface { |
| 30 public: | 29 public: |
| 31 size_t count() override { return streams_.size(); } | 30 size_t count() override { return streams_.size(); } |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 MockPeerConnectionImpl::remote_description() const { | 218 MockPeerConnectionImpl::remote_description() const { |
| 220 return remote_desc_.get(); | 219 return remote_desc_.get(); |
| 221 } | 220 } |
| 222 | 221 |
| 223 void MockPeerConnectionImpl::AddRemoteStream(MediaStreamInterface* stream) { | 222 void MockPeerConnectionImpl::AddRemoteStream(MediaStreamInterface* stream) { |
| 224 remote_streams_->AddStream(stream); | 223 remote_streams_->AddStream(stream); |
| 225 } | 224 } |
| 226 | 225 |
| 227 void MockPeerConnectionImpl::CreateOffer( | 226 void MockPeerConnectionImpl::CreateOffer( |
| 228 CreateSessionDescriptionObserver* observer, | 227 CreateSessionDescriptionObserver* observer, |
| 229 const MediaConstraintsInterface* constraints) { | 228 const RTCOfferAnswerOptions& options) { |
| 230 DCHECK(observer); | 229 DCHECK(observer); |
| 231 created_sessiondescription_.reset( | 230 created_sessiondescription_.reset( |
| 232 dependency_factory_->CreateSessionDescription("unknown", kDummyOffer, | 231 dependency_factory_->CreateSessionDescription("unknown", kDummyOffer, |
| 233 NULL)); | 232 NULL)); |
| 234 } | 233 } |
| 235 | 234 |
| 236 void MockPeerConnectionImpl::CreateAnswer( | 235 void MockPeerConnectionImpl::CreateAnswer( |
| 237 CreateSessionDescriptionObserver* observer, | 236 CreateSessionDescriptionObserver* observer, |
| 238 const MediaConstraintsInterface* constraints) { | 237 const RTCOfferAnswerOptions& options) { |
| 239 DCHECK(observer); | 238 DCHECK(observer); |
| 240 created_sessiondescription_.reset( | 239 created_sessiondescription_.reset( |
| 241 dependency_factory_->CreateSessionDescription("unknown", kDummyAnswer, | 240 dependency_factory_->CreateSessionDescription("unknown", kDummyAnswer, |
| 242 NULL)); | 241 NULL)); |
| 243 } | 242 } |
| 244 | 243 |
| 245 void MockPeerConnectionImpl::SetLocalDescriptionWorker( | 244 void MockPeerConnectionImpl::SetLocalDescriptionWorker( |
| 246 SetSessionDescriptionObserver* observer, | 245 SetSessionDescriptionObserver* observer, |
| 247 SessionDescriptionInterface* desc) { | 246 SessionDescriptionInterface* desc) { |
| 248 desc->ToString(&description_sdp_); | 247 desc->ToString(&description_sdp_); |
| 249 local_desc_.reset(desc); | 248 local_desc_.reset(desc); |
| 250 } | 249 } |
| 251 | 250 |
| 252 void MockPeerConnectionImpl::SetRemoteDescriptionWorker( | 251 void MockPeerConnectionImpl::SetRemoteDescriptionWorker( |
| 253 SetSessionDescriptionObserver* observer, | 252 SetSessionDescriptionObserver* observer, |
| 254 SessionDescriptionInterface* desc) { | 253 SessionDescriptionInterface* desc) { |
| 255 desc->ToString(&description_sdp_); | 254 desc->ToString(&description_sdp_); |
| 256 remote_desc_.reset(desc); | 255 remote_desc_.reset(desc); |
| 257 } | 256 } |
| 258 | 257 |
| 259 bool MockPeerConnectionImpl::UpdateIce( | 258 bool MockPeerConnectionImpl::UpdateIce(const IceServers& configuration) { |
| 260 const IceServers& configuration, | |
| 261 const MediaConstraintsInterface* constraints) { | |
| 262 return true; | 259 return true; |
| 263 } | 260 } |
| 264 | 261 |
| 265 bool MockPeerConnectionImpl::AddIceCandidate( | 262 bool MockPeerConnectionImpl::AddIceCandidate( |
| 266 const IceCandidateInterface* candidate) { | 263 const IceCandidateInterface* candidate) { |
| 267 sdp_mid_ = candidate->sdp_mid(); | 264 sdp_mid_ = candidate->sdp_mid(); |
| 268 sdp_mline_index_ = candidate->sdp_mline_index(); | 265 sdp_mline_index_ = candidate->sdp_mline_index(); |
| 269 return candidate->ToString(&ice_sdp_); | 266 return candidate->ToString(&ice_sdp_); |
| 270 } | 267 } |
| 271 | 268 |
| 272 void MockPeerConnectionImpl::RegisterUMAObserver( | 269 void MockPeerConnectionImpl::RegisterUMAObserver( |
| 273 webrtc::UMAObserver* observer) { | 270 webrtc::UMAObserver* observer) { |
| 274 NOTIMPLEMENTED(); | 271 NOTIMPLEMENTED(); |
| 275 } | 272 } |
| 276 | 273 |
| 277 } // namespace content | 274 } // namespace content |
| OLD | NEW |