OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/webrtc/mock_peer_connection_dependency_factory.
h" | 5 #include "content/renderer/media/webrtc/mock_peer_connection_dependency_factory.
h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "content/renderer/media/mock_peer_connection_impl.h" | 9 #include "content/renderer/media/mock_peer_connection_impl.h" |
10 #include "content/renderer/media/webaudio_capturer_source.h" | 10 #include "content/renderer/media/webaudio_capturer_source.h" |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 }; | 397 }; |
398 | 398 |
399 class MockIceCandidate : public IceCandidateInterface { | 399 class MockIceCandidate : public IceCandidateInterface { |
400 public: | 400 public: |
401 MockIceCandidate(const std::string& sdp_mid, | 401 MockIceCandidate(const std::string& sdp_mid, |
402 int sdp_mline_index, | 402 int sdp_mline_index, |
403 const std::string& sdp) | 403 const std::string& sdp) |
404 : sdp_mid_(sdp_mid), | 404 : sdp_mid_(sdp_mid), |
405 sdp_mline_index_(sdp_mline_index), | 405 sdp_mline_index_(sdp_mline_index), |
406 sdp_(sdp) { | 406 sdp_(sdp) { |
| 407 // Assign an valid address to |candidate_| to pass assert in code. |
| 408 candidate_.set_address(rtc::SocketAddress("127.0.0.1", 5000)); |
407 } | 409 } |
408 virtual ~MockIceCandidate() {} | 410 virtual ~MockIceCandidate() {} |
409 virtual std::string sdp_mid() const OVERRIDE { | 411 virtual std::string sdp_mid() const OVERRIDE { |
410 return sdp_mid_; | 412 return sdp_mid_; |
411 } | 413 } |
412 virtual int sdp_mline_index() const OVERRIDE { | 414 virtual int sdp_mline_index() const OVERRIDE { |
413 return sdp_mline_index_; | 415 return sdp_mline_index_; |
414 } | 416 } |
415 virtual const cricket::Candidate& candidate() const OVERRIDE { | 417 virtual const cricket::Candidate& candidate() const OVERRIDE { |
416 // This function should never be called. It will intentionally crash. The | 418 return candidate_; |
417 // base class forces us to return a reference. | |
418 NOTREACHED(); | |
419 cricket::Candidate* candidate = NULL; | |
420 return *candidate; | |
421 } | 419 } |
422 virtual bool ToString(std::string* out) const OVERRIDE { | 420 virtual bool ToString(std::string* out) const OVERRIDE { |
423 *out = sdp_; | 421 *out = sdp_; |
424 return true; | 422 return true; |
425 } | 423 } |
426 | 424 |
427 private: | 425 private: |
428 std::string sdp_mid_; | 426 std::string sdp_mid_; |
429 int sdp_mline_index_; | 427 int sdp_mline_index_; |
430 std::string sdp_; | 428 std::string sdp_; |
| 429 cricket::Candidate candidate_; |
431 }; | 430 }; |
432 | 431 |
433 MockPeerConnectionDependencyFactory::MockPeerConnectionDependencyFactory() | 432 MockPeerConnectionDependencyFactory::MockPeerConnectionDependencyFactory() |
434 : PeerConnectionDependencyFactory(NULL), | 433 : PeerConnectionDependencyFactory(NULL), |
435 fail_to_create_next_audio_capturer_(false) { | 434 fail_to_create_next_audio_capturer_(false) { |
436 } | 435 } |
437 | 436 |
438 MockPeerConnectionDependencyFactory::~MockPeerConnectionDependencyFactory() {} | 437 MockPeerConnectionDependencyFactory::~MockPeerConnectionDependencyFactory() {} |
439 | 438 |
440 scoped_refptr<webrtc::PeerConnectionInterface> | 439 scoped_refptr<webrtc::PeerConnectionInterface> |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 return WebRtcAudioCapturer::CreateCapturer(-1, device_info, | 531 return WebRtcAudioCapturer::CreateCapturer(-1, device_info, |
533 constraints, NULL, audio_source); | 532 constraints, NULL, audio_source); |
534 } | 533 } |
535 | 534 |
536 void MockPeerConnectionDependencyFactory::StartLocalAudioTrack( | 535 void MockPeerConnectionDependencyFactory::StartLocalAudioTrack( |
537 WebRtcLocalAudioTrack* audio_track) { | 536 WebRtcLocalAudioTrack* audio_track) { |
538 audio_track->Start(); | 537 audio_track->Start(); |
539 } | 538 } |
540 | 539 |
541 } // namespace content | 540 } // namespace content |
OLD | NEW |