| 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_media_stream_dependency_factory.h" | 5 #include "content/renderer/media/mock_media_stream_dependency_factory.h" |
| 6 #include "content/renderer/media/mock_peer_connection_impl.h" | 6 #include "content/renderer/media/mock_peer_connection_impl.h" |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 const char MockPeerConnectionImpl::kDummyOffer[] = "dummy offer"; | 177 const char MockPeerConnectionImpl::kDummyOffer[] = "dummy offer"; |
| 178 const char MockPeerConnectionImpl::kDummyAnswer[] = "dummy answer"; | 178 const char MockPeerConnectionImpl::kDummyAnswer[] = "dummy answer"; |
| 179 | 179 |
| 180 MockPeerConnectionImpl::MockPeerConnectionImpl( | 180 MockPeerConnectionImpl::MockPeerConnectionImpl( |
| 181 MockMediaStreamDependencyFactory* factory) | 181 MockMediaStreamDependencyFactory* factory) |
| 182 : dependency_factory_(factory), | 182 : dependency_factory_(factory), |
| 183 local_streams_(new talk_base::RefCountedObject<MockStreamCollection>), | 183 local_streams_(new talk_base::RefCountedObject<MockStreamCollection>), |
| 184 remote_streams_(new talk_base::RefCountedObject<MockStreamCollection>), | 184 remote_streams_(new talk_base::RefCountedObject<MockStreamCollection>), |
| 185 hint_audio_(false), | 185 hint_audio_(false), |
| 186 hint_video_(false), | 186 hint_video_(false), |
| 187 sdp_mline_index_(-1), | 187 sdp_mline_index_(-1) { |
| 188 signaling_state_(kStable), | |
| 189 ice_state_(kIceNew) { | |
| 190 } | 188 } |
| 191 | 189 |
| 192 MockPeerConnectionImpl::~MockPeerConnectionImpl() {} | 190 MockPeerConnectionImpl::~MockPeerConnectionImpl() {} |
| 193 | 191 |
| 194 talk_base::scoped_refptr<webrtc::StreamCollectionInterface> | 192 talk_base::scoped_refptr<webrtc::StreamCollectionInterface> |
| 195 MockPeerConnectionImpl::local_streams() { | 193 MockPeerConnectionImpl::local_streams() { |
| 196 return local_streams_; | 194 return local_streams_; |
| 197 } | 195 } |
| 198 | 196 |
| 199 talk_base::scoped_refptr<webrtc::StreamCollectionInterface> | 197 talk_base::scoped_refptr<webrtc::StreamCollectionInterface> |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 value.value = "somevalue"; | 252 value.value = "somevalue"; |
| 255 report.local.values.push_back(value); | 253 report.local.values.push_back(value); |
| 256 reports.push_back(report); | 254 reports.push_back(report); |
| 257 } | 255 } |
| 258 // Note that the callback is synchronous, not asynchronous; it will | 256 // Note that the callback is synchronous, not asynchronous; it will |
| 259 // happen before the request call completes. | 257 // happen before the request call completes. |
| 260 observer->OnComplete(reports); | 258 observer->OnComplete(reports); |
| 261 return true; | 259 return true; |
| 262 } | 260 } |
| 263 | 261 |
| 264 MockPeerConnectionImpl::ReadyState MockPeerConnectionImpl::ready_state() { | |
| 265 return signaling_state_; | |
| 266 } | |
| 267 | |
| 268 MockPeerConnectionImpl::ReadyState MockPeerConnectionImpl::signaling_state() { | |
| 269 return signaling_state_; | |
| 270 } | |
| 271 | |
| 272 const webrtc::SessionDescriptionInterface* | 262 const webrtc::SessionDescriptionInterface* |
| 273 MockPeerConnectionImpl::local_description() const { | 263 MockPeerConnectionImpl::local_description() const { |
| 274 return local_desc_.get(); | 264 return local_desc_.get(); |
| 275 } | 265 } |
| 276 | 266 |
| 277 const webrtc::SessionDescriptionInterface* | 267 const webrtc::SessionDescriptionInterface* |
| 278 MockPeerConnectionImpl::remote_description() const { | 268 MockPeerConnectionImpl::remote_description() const { |
| 279 return remote_desc_.get(); | 269 return remote_desc_.get(); |
| 280 } | 270 } |
| 281 | 271 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 return true; | 311 return true; |
| 322 } | 312 } |
| 323 | 313 |
| 324 bool MockPeerConnectionImpl::AddIceCandidate( | 314 bool MockPeerConnectionImpl::AddIceCandidate( |
| 325 const IceCandidateInterface* candidate) { | 315 const IceCandidateInterface* candidate) { |
| 326 sdp_mid_ = candidate->sdp_mid(); | 316 sdp_mid_ = candidate->sdp_mid(); |
| 327 sdp_mline_index_ = candidate->sdp_mline_index(); | 317 sdp_mline_index_ = candidate->sdp_mline_index(); |
| 328 return candidate->ToString(&ice_sdp_); | 318 return candidate->ToString(&ice_sdp_); |
| 329 } | 319 } |
| 330 | 320 |
| 331 PeerConnectionInterface::IceState MockPeerConnectionImpl::ice_state() { | |
| 332 return ice_state_; | |
| 333 } | |
| 334 | |
| 335 PeerConnectionInterface::IceConnectionState | |
| 336 MockPeerConnectionImpl::ice_connection_state() { | |
| 337 NOTIMPLEMENTED(); | |
| 338 return PeerConnectionInterface::kIceConnectionNew; | |
| 339 } | |
| 340 | |
| 341 PeerConnectionInterface::IceGatheringState | |
| 342 MockPeerConnectionImpl::ice_gathering_state() { | |
| 343 NOTIMPLEMENTED(); | |
| 344 return PeerConnectionInterface::kIceGatheringNew; | |
| 345 } | |
| 346 | |
| 347 } // namespace content | 321 } // namespace content |
| OLD | NEW |