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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 class MockRtcVideoCapturer : public WebRtcVideoCapturerAdapter { | 125 class MockRtcVideoCapturer : public WebRtcVideoCapturerAdapter { |
126 public: | 126 public: |
127 explicit MockRtcVideoCapturer(bool is_screencast) | 127 explicit MockRtcVideoCapturer(bool is_screencast) |
128 : WebRtcVideoCapturerAdapter(is_screencast), | 128 : WebRtcVideoCapturerAdapter(is_screencast), |
129 number_of_capturered_frames_(0), | 129 number_of_capturered_frames_(0), |
130 width_(0), | 130 width_(0), |
131 height_(0) { | 131 height_(0) { |
132 } | 132 } |
133 | 133 |
134 virtual void OnFrameCaptured( | 134 virtual void OnFrameCaptured( |
135 const scoped_refptr<media::VideoFrame>& frame) OVERRIDE { | 135 const scoped_refptr<media::VideoFrame>& frame) override { |
136 ++number_of_capturered_frames_; | 136 ++number_of_capturered_frames_; |
137 width_ = frame->visible_rect().width(); | 137 width_ = frame->visible_rect().width(); |
138 height_ = frame->visible_rect().height(); | 138 height_ = frame->visible_rect().height(); |
139 } | 139 } |
140 | 140 |
141 int GetLastFrameWidth() const { | 141 int GetLastFrameWidth() const { |
142 return width_; | 142 return width_; |
143 } | 143 } |
144 | 144 |
145 int GetLastFrameHeight() const { | 145 int GetLastFrameHeight() const { |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 } | 346 } |
347 | 347 |
348 class MockSessionDescription : public SessionDescriptionInterface { | 348 class MockSessionDescription : public SessionDescriptionInterface { |
349 public: | 349 public: |
350 MockSessionDescription(const std::string& type, | 350 MockSessionDescription(const std::string& type, |
351 const std::string& sdp) | 351 const std::string& sdp) |
352 : type_(type), | 352 : type_(type), |
353 sdp_(sdp) { | 353 sdp_(sdp) { |
354 } | 354 } |
355 virtual ~MockSessionDescription() {} | 355 virtual ~MockSessionDescription() {} |
356 virtual cricket::SessionDescription* description() OVERRIDE { | 356 virtual cricket::SessionDescription* description() override { |
357 NOTIMPLEMENTED(); | 357 NOTIMPLEMENTED(); |
358 return NULL; | 358 return NULL; |
359 } | 359 } |
360 virtual const cricket::SessionDescription* description() const OVERRIDE { | 360 virtual const cricket::SessionDescription* description() const override { |
361 NOTIMPLEMENTED(); | 361 NOTIMPLEMENTED(); |
362 return NULL; | 362 return NULL; |
363 } | 363 } |
364 virtual std::string session_id() const OVERRIDE { | 364 virtual std::string session_id() const override { |
365 NOTIMPLEMENTED(); | 365 NOTIMPLEMENTED(); |
366 return std::string(); | 366 return std::string(); |
367 } | 367 } |
368 virtual std::string session_version() const OVERRIDE { | 368 virtual std::string session_version() const override { |
369 NOTIMPLEMENTED(); | 369 NOTIMPLEMENTED(); |
370 return std::string(); | 370 return std::string(); |
371 } | 371 } |
372 virtual std::string type() const OVERRIDE { | 372 virtual std::string type() const override { |
373 return type_; | 373 return type_; |
374 } | 374 } |
375 virtual bool AddCandidate(const IceCandidateInterface* candidate) OVERRIDE { | 375 virtual bool AddCandidate(const IceCandidateInterface* candidate) override { |
376 NOTIMPLEMENTED(); | 376 NOTIMPLEMENTED(); |
377 return false; | 377 return false; |
378 } | 378 } |
379 virtual size_t number_of_mediasections() const OVERRIDE { | 379 virtual size_t number_of_mediasections() const override { |
380 NOTIMPLEMENTED(); | 380 NOTIMPLEMENTED(); |
381 return 0; | 381 return 0; |
382 } | 382 } |
383 virtual const IceCandidateCollection* candidates( | 383 virtual const IceCandidateCollection* candidates( |
384 size_t mediasection_index) const OVERRIDE { | 384 size_t mediasection_index) const override { |
385 NOTIMPLEMENTED(); | 385 NOTIMPLEMENTED(); |
386 return NULL; | 386 return NULL; |
387 } | 387 } |
388 | 388 |
389 virtual bool ToString(std::string* out) const OVERRIDE { | 389 virtual bool ToString(std::string* out) const override { |
390 *out = sdp_; | 390 *out = sdp_; |
391 return true; | 391 return true; |
392 } | 392 } |
393 | 393 |
394 private: | 394 private: |
395 std::string type_; | 395 std::string type_; |
396 std::string sdp_; | 396 std::string sdp_; |
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. | 407 // Assign an valid address to |candidate_| to pass assert in code. |
408 candidate_.set_address(rtc::SocketAddress("127.0.0.1", 5000)); | 408 candidate_.set_address(rtc::SocketAddress("127.0.0.1", 5000)); |
409 } | 409 } |
410 virtual ~MockIceCandidate() {} | 410 virtual ~MockIceCandidate() {} |
411 virtual std::string sdp_mid() const OVERRIDE { | 411 virtual std::string sdp_mid() const override { |
412 return sdp_mid_; | 412 return sdp_mid_; |
413 } | 413 } |
414 virtual int sdp_mline_index() const OVERRIDE { | 414 virtual int sdp_mline_index() const override { |
415 return sdp_mline_index_; | 415 return sdp_mline_index_; |
416 } | 416 } |
417 virtual const cricket::Candidate& candidate() const OVERRIDE { | 417 virtual const cricket::Candidate& candidate() const override { |
418 return candidate_; | 418 return candidate_; |
419 } | 419 } |
420 virtual bool ToString(std::string* out) const OVERRIDE { | 420 virtual bool ToString(std::string* out) const override { |
421 *out = sdp_; | 421 *out = sdp_; |
422 return true; | 422 return true; |
423 } | 423 } |
424 | 424 |
425 private: | 425 private: |
426 std::string sdp_mid_; | 426 std::string sdp_mid_; |
427 int sdp_mline_index_; | 427 int sdp_mline_index_; |
428 std::string sdp_; | 428 std::string sdp_; |
429 cricket::Candidate candidate_; | 429 cricket::Candidate candidate_; |
430 }; | 430 }; |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 return WebRtcAudioCapturer::CreateCapturer(-1, device_info, | 531 return WebRtcAudioCapturer::CreateCapturer(-1, device_info, |
532 constraints, NULL, audio_source); | 532 constraints, NULL, audio_source); |
533 } | 533 } |
534 | 534 |
535 void MockPeerConnectionDependencyFactory::StartLocalAudioTrack( | 535 void MockPeerConnectionDependencyFactory::StartLocalAudioTrack( |
536 WebRtcLocalAudioTrack* audio_track) { | 536 WebRtcLocalAudioTrack* audio_track) { |
537 audio_track->Start(); | 537 audio_track->Start(); |
538 } | 538 } |
539 | 539 |
540 } // namespace content | 540 } // namespace content |
OLD | NEW |