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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "content/renderer/media/webrtc/mock_peer_connection_dependency_factory.
h" | 10 #include "content/renderer/media/webrtc/mock_peer_connection_dependency_factory.
h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 streams_.erase(it); | 68 streams_.erase(it); |
69 break; | 69 break; |
70 } | 70 } |
71 } | 71 } |
72 } | 72 } |
73 | 73 |
74 protected: | 74 protected: |
75 virtual ~MockStreamCollection() {} | 75 virtual ~MockStreamCollection() {} |
76 | 76 |
77 private: | 77 private: |
78 typedef std::vector<talk_base::scoped_refptr<MediaStreamInterface> > | 78 typedef std::vector<rtc::scoped_refptr<MediaStreamInterface> > |
79 StreamVector; | 79 StreamVector; |
80 StreamVector streams_; | 80 StreamVector streams_; |
81 }; | 81 }; |
82 | 82 |
83 class MockDataChannel : public webrtc::DataChannelInterface { | 83 class MockDataChannel : public webrtc::DataChannelInterface { |
84 public: | 84 public: |
85 MockDataChannel(const std::string& label, | 85 MockDataChannel(const std::string& label, |
86 const webrtc::DataChannelInit* config) | 86 const webrtc::DataChannelInit* config) |
87 : label_(label), | 87 : label_(label), |
88 reliable_(config->reliable), | 88 reliable_(config->reliable), |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 virtual std::string tones() const OVERRIDE { | 187 virtual std::string tones() const OVERRIDE { |
188 return tones_; | 188 return tones_; |
189 } | 189 } |
190 virtual int duration() const OVERRIDE { return duration_; } | 190 virtual int duration() const OVERRIDE { return duration_; } |
191 virtual int inter_tone_gap() const OVERRIDE { return inter_tone_gap_; } | 191 virtual int inter_tone_gap() const OVERRIDE { return inter_tone_gap_; } |
192 | 192 |
193 protected: | 193 protected: |
194 virtual ~MockDtmfSender() {} | 194 virtual ~MockDtmfSender() {} |
195 | 195 |
196 private: | 196 private: |
197 talk_base::scoped_refptr<AudioTrackInterface> track_; | 197 rtc::scoped_refptr<AudioTrackInterface> track_; |
198 DtmfSenderObserverInterface* observer_; | 198 DtmfSenderObserverInterface* observer_; |
199 std::string tones_; | 199 std::string tones_; |
200 int duration_; | 200 int duration_; |
201 int inter_tone_gap_; | 201 int inter_tone_gap_; |
202 }; | 202 }; |
203 | 203 |
204 const char MockPeerConnectionImpl::kDummyOffer[] = "dummy offer"; | 204 const char MockPeerConnectionImpl::kDummyOffer[] = "dummy offer"; |
205 const char MockPeerConnectionImpl::kDummyAnswer[] = "dummy answer"; | 205 const char MockPeerConnectionImpl::kDummyAnswer[] = "dummy answer"; |
206 | 206 |
207 MockPeerConnectionImpl::MockPeerConnectionImpl( | 207 MockPeerConnectionImpl::MockPeerConnectionImpl( |
208 MockPeerConnectionDependencyFactory* factory) | 208 MockPeerConnectionDependencyFactory* factory) |
209 : dependency_factory_(factory), | 209 : dependency_factory_(factory), |
210 local_streams_(new talk_base::RefCountedObject<MockStreamCollection>), | 210 local_streams_(new rtc::RefCountedObject<MockStreamCollection>), |
211 remote_streams_(new talk_base::RefCountedObject<MockStreamCollection>), | 211 remote_streams_(new rtc::RefCountedObject<MockStreamCollection>), |
212 hint_audio_(false), | 212 hint_audio_(false), |
213 hint_video_(false), | 213 hint_video_(false), |
214 getstats_result_(true), | 214 getstats_result_(true), |
215 sdp_mline_index_(-1) { | 215 sdp_mline_index_(-1) { |
216 ON_CALL(*this, SetLocalDescription(_, _)).WillByDefault(testing::Invoke( | 216 ON_CALL(*this, SetLocalDescription(_, _)).WillByDefault(testing::Invoke( |
217 this, &MockPeerConnectionImpl::SetLocalDescriptionWorker)); | 217 this, &MockPeerConnectionImpl::SetLocalDescriptionWorker)); |
218 ON_CALL(*this, SetRemoteDescription(_, _)).WillByDefault(testing::Invoke( | 218 ON_CALL(*this, SetRemoteDescription(_, _)).WillByDefault(testing::Invoke( |
219 this, &MockPeerConnectionImpl::SetRemoteDescriptionWorker)); | 219 this, &MockPeerConnectionImpl::SetRemoteDescriptionWorker)); |
220 } | 220 } |
221 | 221 |
222 MockPeerConnectionImpl::~MockPeerConnectionImpl() {} | 222 MockPeerConnectionImpl::~MockPeerConnectionImpl() {} |
223 | 223 |
224 talk_base::scoped_refptr<webrtc::StreamCollectionInterface> | 224 rtc::scoped_refptr<webrtc::StreamCollectionInterface> |
225 MockPeerConnectionImpl::local_streams() { | 225 MockPeerConnectionImpl::local_streams() { |
226 return local_streams_; | 226 return local_streams_; |
227 } | 227 } |
228 | 228 |
229 talk_base::scoped_refptr<webrtc::StreamCollectionInterface> | 229 rtc::scoped_refptr<webrtc::StreamCollectionInterface> |
230 MockPeerConnectionImpl::remote_streams() { | 230 MockPeerConnectionImpl::remote_streams() { |
231 return remote_streams_; | 231 return remote_streams_; |
232 } | 232 } |
233 | 233 |
234 bool MockPeerConnectionImpl::AddStream( | 234 bool MockPeerConnectionImpl::AddStream( |
235 MediaStreamInterface* local_stream, | 235 MediaStreamInterface* local_stream, |
236 const MediaConstraintsInterface* constraints) { | 236 const MediaConstraintsInterface* constraints) { |
237 DCHECK(stream_label_.empty()); | 237 DCHECK(stream_label_.empty()); |
238 stream_label_ = local_stream->label(); | 238 stream_label_ = local_stream->label(); |
239 local_streams_->AddStream(local_stream); | 239 local_streams_->AddStream(local_stream); |
240 return true; | 240 return true; |
241 } | 241 } |
242 | 242 |
243 void MockPeerConnectionImpl::RemoveStream( | 243 void MockPeerConnectionImpl::RemoveStream( |
244 MediaStreamInterface* local_stream) { | 244 MediaStreamInterface* local_stream) { |
245 DCHECK_EQ(stream_label_, local_stream->label()); | 245 DCHECK_EQ(stream_label_, local_stream->label()); |
246 stream_label_.clear(); | 246 stream_label_.clear(); |
247 local_streams_->RemoveStream(local_stream); | 247 local_streams_->RemoveStream(local_stream); |
248 } | 248 } |
249 | 249 |
250 talk_base::scoped_refptr<DtmfSenderInterface> | 250 rtc::scoped_refptr<DtmfSenderInterface> |
251 MockPeerConnectionImpl::CreateDtmfSender(AudioTrackInterface* track) { | 251 MockPeerConnectionImpl::CreateDtmfSender(AudioTrackInterface* track) { |
252 if (!track) { | 252 if (!track) { |
253 return NULL; | 253 return NULL; |
254 } | 254 } |
255 return new talk_base::RefCountedObject<MockDtmfSender>(track); | 255 return new rtc::RefCountedObject<MockDtmfSender>(track); |
256 } | 256 } |
257 | 257 |
258 talk_base::scoped_refptr<webrtc::DataChannelInterface> | 258 rtc::scoped_refptr<webrtc::DataChannelInterface> |
259 MockPeerConnectionImpl::CreateDataChannel(const std::string& label, | 259 MockPeerConnectionImpl::CreateDataChannel(const std::string& label, |
260 const webrtc::DataChannelInit* config) { | 260 const webrtc::DataChannelInit* config) { |
261 return new talk_base::RefCountedObject<MockDataChannel>(label, config); | 261 return new rtc::RefCountedObject<MockDataChannel>(label, config); |
262 } | 262 } |
263 | 263 |
264 bool MockPeerConnectionImpl::GetStats( | 264 bool MockPeerConnectionImpl::GetStats( |
265 webrtc::StatsObserver* observer, | 265 webrtc::StatsObserver* observer, |
266 webrtc::MediaStreamTrackInterface* track, | 266 webrtc::MediaStreamTrackInterface* track, |
267 StatsOutputLevel level) { | 267 StatsOutputLevel level) { |
268 if (!getstats_result_) | 268 if (!getstats_result_) |
269 return false; | 269 return false; |
270 | 270 |
271 DCHECK_EQ(kStatsOutputLevelStandard, level); | 271 DCHECK_EQ(kStatsOutputLevelStandard, level); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 sdp_mline_index_ = candidate->sdp_mline_index(); | 359 sdp_mline_index_ = candidate->sdp_mline_index(); |
360 return candidate->ToString(&ice_sdp_); | 360 return candidate->ToString(&ice_sdp_); |
361 } | 361 } |
362 | 362 |
363 void MockPeerConnectionImpl::RegisterUMAObserver( | 363 void MockPeerConnectionImpl::RegisterUMAObserver( |
364 webrtc::UMAObserver* observer) { | 364 webrtc::UMAObserver* observer) { |
365 NOTIMPLEMENTED(); | 365 NOTIMPLEMENTED(); |
366 } | 366 } |
367 | 367 |
368 } // namespace content | 368 } // namespace content |
OLD | NEW |