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