Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: content/renderer/media/mock_media_stream_dependency_factory.cc

Issue 10038009: Revert 131949 (multiple memory leaks) - Adding JSEP PeerConnection glue. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 } 116 }
117 117
118 void MockLocalVideoTrack::RegisterObserver(ObserverInterface* observer) { 118 void MockLocalVideoTrack::RegisterObserver(ObserverInterface* observer) {
119 NOTIMPLEMENTED(); 119 NOTIMPLEMENTED();
120 } 120 }
121 121
122 void MockLocalVideoTrack::UnregisterObserver(ObserverInterface* observer) { 122 void MockLocalVideoTrack::UnregisterObserver(ObserverInterface* observer) {
123 NOTIMPLEMENTED(); 123 NOTIMPLEMENTED();
124 } 124 }
125 125
126 class MockSessionDescription : public SessionDescriptionInterface {
127 public:
128 MockSessionDescription(const std::string& sdp)
129 : sdp_(sdp) {
130 }
131 virtual ~MockSessionDescription() {}
132 virtual const cricket::SessionDescription* description() const OVERRIDE {
133 NOTIMPLEMENTED();
134 return NULL;
135 }
136 virtual bool AddCandidate(const IceCandidateInterface* candidate) OVERRIDE {
137 NOTIMPLEMENTED();
138 return false;
139 }
140 virtual size_t number_of_mediasections() const OVERRIDE {
141 NOTIMPLEMENTED();
142 return 0;
143 }
144 virtual const IceCandidateColletion* candidates(
145 size_t mediasection_index) const OVERRIDE {
146 NOTIMPLEMENTED();
147 return NULL;
148 }
149 virtual bool ToString(std::string* out) const OVERRIDE {
150 *out = sdp_;
151 return true;
152 }
153
154 private:
155 std::string sdp_;
156 };
157
158 class MockIceCandidate : public IceCandidateInterface {
159 public:
160 MockIceCandidate(const std::string& label, const std::string& sdp)
161 : label_(label),
162 sdp_(sdp) {
163 }
164 virtual ~MockIceCandidate() {}
165 virtual std::string label() const OVERRIDE {
166 return label_;
167 }
168 virtual const cricket::Candidate& candidate() const OVERRIDE {
169 // This function should never be called. It will intentionally crash. The
170 // base class forces us to return a reference.
171 NOTREACHED();
172 cricket::Candidate* candidate = NULL;
173 return *candidate;
174 }
175 virtual bool ToString(std::string* out) const OVERRIDE {
176 *out = sdp_;
177 return true;
178 }
179
180 private:
181 std::string label_;
182 std::string sdp_;
183 };
184
185 } // namespace webrtc 126 } // namespace webrtc
186 127
187 MockMediaStreamDependencyFactory::MockMediaStreamDependencyFactory() 128 MockMediaStreamDependencyFactory::MockMediaStreamDependencyFactory()
188 : mock_pc_factory_created_(false) { 129 : mock_pc_factory_created_(false) {
189 } 130 }
190 131
191 MockMediaStreamDependencyFactory::~MockMediaStreamDependencyFactory() {} 132 MockMediaStreamDependencyFactory::~MockMediaStreamDependencyFactory() {}
192 133
193 bool MockMediaStreamDependencyFactory::CreatePeerConnectionFactory( 134 bool MockMediaStreamDependencyFactory::CreatePeerConnectionFactory(
194 talk_base::Thread* worker_thread, 135 talk_base::Thread* worker_thread,
(...skipping 11 matching lines...) Expand all
206 147
207 bool MockMediaStreamDependencyFactory::PeerConnectionFactoryCreated() { 148 bool MockMediaStreamDependencyFactory::PeerConnectionFactoryCreated() {
208 return mock_pc_factory_created_; 149 return mock_pc_factory_created_;
209 } 150 }
210 151
211 talk_base::scoped_refptr<webrtc::PeerConnectionInterface> 152 talk_base::scoped_refptr<webrtc::PeerConnectionInterface>
212 MockMediaStreamDependencyFactory::CreatePeerConnection( 153 MockMediaStreamDependencyFactory::CreatePeerConnection(
213 const std::string& config, 154 const std::string& config,
214 webrtc::PeerConnectionObserver* observer) { 155 webrtc::PeerConnectionObserver* observer) {
215 DCHECK(mock_pc_factory_created_); 156 DCHECK(mock_pc_factory_created_);
216 return new talk_base::RefCountedObject<webrtc::MockPeerConnectionImpl>(this); 157 return new talk_base::RefCountedObject<webrtc::MockPeerConnectionImpl>();
217 } 158 }
218 159
219 talk_base::scoped_refptr<webrtc::PeerConnectionInterface> 160 talk_base::scoped_refptr<webrtc::PeerConnectionInterface>
220 MockMediaStreamDependencyFactory::CreateRoapPeerConnection( 161 MockMediaStreamDependencyFactory::CreateRoapPeerConnection(
221 const std::string& config, 162 const std::string& config,
222 webrtc::PeerConnectionObserver* observer) { 163 webrtc::PeerConnectionObserver* observer) {
223 DCHECK(mock_pc_factory_created_); 164 DCHECK(mock_pc_factory_created_);
224 return new talk_base::RefCountedObject<webrtc::MockPeerConnectionImpl>(this); 165 return new talk_base::RefCountedObject<webrtc::MockPeerConnectionImpl>();
225 } 166 }
226 167
227 talk_base::scoped_refptr<webrtc::LocalMediaStreamInterface> 168 talk_base::scoped_refptr<webrtc::LocalMediaStreamInterface>
228 MockMediaStreamDependencyFactory::CreateLocalMediaStream( 169 MockMediaStreamDependencyFactory::CreateLocalMediaStream(
229 const std::string& label) { 170 const std::string& label) {
230 talk_base::scoped_refptr<webrtc::LocalMediaStreamInterface> stream( 171 talk_base::scoped_refptr<webrtc::LocalMediaStreamInterface> stream(
231 new talk_base::RefCountedObject<webrtc::MockLocalMediaStream>(label)); 172 new talk_base::RefCountedObject<webrtc::MockLocalMediaStream>(label));
232 return stream; 173 return stream;
233 } 174 }
234 175
235 talk_base::scoped_refptr<webrtc::LocalVideoTrackInterface> 176 talk_base::scoped_refptr<webrtc::LocalVideoTrackInterface>
236 MockMediaStreamDependencyFactory::CreateLocalVideoTrack( 177 MockMediaStreamDependencyFactory::CreateLocalVideoTrack(
237 const std::string& label, 178 const std::string& label,
238 cricket::VideoCapturer* video_device) { 179 cricket::VideoCapturer* video_device) {
239 talk_base::scoped_refptr<webrtc::LocalVideoTrackInterface> stream( 180 talk_base::scoped_refptr<webrtc::LocalVideoTrackInterface> stream(
240 new talk_base::RefCountedObject<webrtc::MockLocalVideoTrack>(label)); 181 new talk_base::RefCountedObject<webrtc::MockLocalVideoTrack>(label));
241 return stream; 182 return stream;
242 } 183 }
243 184
244 talk_base::scoped_refptr<webrtc::LocalAudioTrackInterface> 185 talk_base::scoped_refptr<webrtc::LocalAudioTrackInterface>
245 MockMediaStreamDependencyFactory::CreateLocalAudioTrack( 186 MockMediaStreamDependencyFactory::CreateLocalAudioTrack(
246 const std::string& label, 187 const std::string& label,
247 webrtc::AudioDeviceModule* audio_device) { 188 webrtc::AudioDeviceModule* audio_device) {
248 NOTIMPLEMENTED(); 189 NOTIMPLEMENTED();
249 return NULL; 190 return NULL;
250 } 191 }
251
252 webrtc::SessionDescriptionInterface*
253 MockMediaStreamDependencyFactory::CreateSessionDescription(
254 const std::string& sdp) {
255 return new webrtc::MockSessionDescription(sdp);
256 }
257
258 webrtc::IceCandidateInterface*
259 MockMediaStreamDependencyFactory::CreateIceCandidate(
260 const std::string& label,
261 const std::string& sdp) {
262 return new webrtc::MockIceCandidate(label, sdp);
263 }
OLDNEW
« no previous file with comments | « content/renderer/media/mock_media_stream_dependency_factory.h ('k') | content/renderer/media/mock_media_stream_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698