Index: content/renderer/media/mock_media_stream_dependency_factory.cc |
diff --git a/content/renderer/media/mock_media_stream_dependency_factory.cc b/content/renderer/media/mock_media_stream_dependency_factory.cc |
index 2d76882176b022b58e24d1a3cb19058122c67e29..7d54d110cc0834600aab1c0fe2539d31f81776c5 100644 |
--- a/content/renderer/media/mock_media_stream_dependency_factory.cc |
+++ b/content/renderer/media/mock_media_stream_dependency_factory.cc |
@@ -123,6 +123,65 @@ void MockLocalVideoTrack::UnregisterObserver(ObserverInterface* observer) { |
NOTIMPLEMENTED(); |
} |
+class MockSessionDescription : public SessionDescriptionInterface { |
+ public: |
+ MockSessionDescription(const std::string& sdp) |
+ : sdp_(sdp) { |
+ } |
+ virtual ~MockSessionDescription() {} |
+ virtual const cricket::SessionDescription* description() const OVERRIDE { |
+ NOTIMPLEMENTED(); |
+ return NULL; |
+ } |
+ virtual bool AddCandidate(const IceCandidateInterface* candidate) OVERRIDE { |
+ NOTIMPLEMENTED(); |
+ return false; |
+ } |
+ virtual size_t number_of_mediasections() const OVERRIDE { |
+ NOTIMPLEMENTED(); |
+ return 0; |
+ } |
+ virtual const IceCandidateColletion* candidates( |
+ size_t mediasection_index) const OVERRIDE { |
+ NOTIMPLEMENTED(); |
+ return NULL; |
+ } |
+ virtual bool ToString(std::string* out) const OVERRIDE { |
+ *out = sdp_; |
+ return true; |
+ } |
+ |
+ private: |
+ std::string sdp_; |
+}; |
+ |
+class MockIceCandidate : public IceCandidateInterface { |
+ public: |
+ MockIceCandidate(const std::string& label, const std::string& sdp) |
+ : label_(label), |
+ sdp_(sdp) { |
+ } |
+ virtual ~MockIceCandidate() {} |
+ virtual std::string label() const OVERRIDE { |
+ return label_; |
+ } |
+ virtual const cricket::Candidate& candidate() const OVERRIDE { |
+ // This function should never be called. It will intentionally crash. The |
+ // base class forces us to return a reference. |
+ NOTREACHED(); |
+ cricket::Candidate* candidate = NULL; |
+ return *candidate; |
+ } |
+ virtual bool ToString(std::string* out) const OVERRIDE { |
+ *out = sdp_; |
+ return true; |
+ } |
+ |
+ private: |
+ std::string label_; |
+ std::string sdp_; |
+}; |
+ |
} // namespace webrtc |
MockMediaStreamDependencyFactory::MockMediaStreamDependencyFactory() |
@@ -154,7 +213,7 @@ MockMediaStreamDependencyFactory::CreatePeerConnection( |
const std::string& config, |
webrtc::PeerConnectionObserver* observer) { |
DCHECK(mock_pc_factory_created_); |
- return new talk_base::RefCountedObject<webrtc::MockPeerConnectionImpl>(); |
+ return new talk_base::RefCountedObject<webrtc::MockPeerConnectionImpl>(this); |
} |
talk_base::scoped_refptr<webrtc::PeerConnectionInterface> |
@@ -162,7 +221,7 @@ MockMediaStreamDependencyFactory::CreateRoapPeerConnection( |
const std::string& config, |
webrtc::PeerConnectionObserver* observer) { |
DCHECK(mock_pc_factory_created_); |
- return new talk_base::RefCountedObject<webrtc::MockPeerConnectionImpl>(); |
+ return new talk_base::RefCountedObject<webrtc::MockPeerConnectionImpl>(this); |
} |
talk_base::scoped_refptr<webrtc::LocalMediaStreamInterface> |
@@ -189,3 +248,16 @@ MockMediaStreamDependencyFactory::CreateLocalAudioTrack( |
NOTIMPLEMENTED(); |
return NULL; |
} |
+ |
+webrtc::SessionDescriptionInterface* |
+MockMediaStreamDependencyFactory::CreateSessionDescription( |
+ const std::string& sdp) { |
+ return new webrtc::MockSessionDescription(sdp); |
+} |
+ |
+webrtc::IceCandidateInterface* |
+MockMediaStreamDependencyFactory::CreateIceCandidate( |
+ const std::string& label, |
+ const std::string& sdp) { |
+ return new webrtc::MockIceCandidate(label, sdp); |
+} |