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

Side by Side Diff: webrtc/api/rtpsenderreceiver_unittest.cc

Issue 1917193008: Adding getParameters/setParameters APIs to RtpReceiver. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: objc compile errors Created 4 years, 7 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
« no previous file with comments | « webrtc/api/rtpsender.cc ('k') | webrtc/api/webrtcsession.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 52
53 MOCK_METHOD2(SetAudioPlayout, 53 MOCK_METHOD2(SetAudioPlayout,
54 void(uint32_t ssrc, 54 void(uint32_t ssrc,
55 bool enable)); 55 bool enable));
56 MOCK_METHOD4(SetAudioSend, 56 MOCK_METHOD4(SetAudioSend,
57 void(uint32_t ssrc, 57 void(uint32_t ssrc,
58 bool enable, 58 bool enable,
59 const cricket::AudioOptions& options, 59 const cricket::AudioOptions& options,
60 cricket::AudioSource* source)); 60 cricket::AudioSource* source));
61 MOCK_METHOD2(SetAudioPlayoutVolume, void(uint32_t ssrc, double volume)); 61 MOCK_METHOD2(SetAudioPlayoutVolume, void(uint32_t ssrc, double volume));
62 MOCK_CONST_METHOD1(GetAudioRtpParameters, RtpParameters(uint32_t ssrc)); 62 MOCK_CONST_METHOD1(GetAudioRtpSendParameters, RtpParameters(uint32_t ssrc));
63 MOCK_METHOD2(SetAudioRtpParameters, 63 MOCK_METHOD2(SetAudioRtpSendParameters,
64 bool(uint32_t ssrc, const RtpParameters&));
65 MOCK_CONST_METHOD1(GetAudioRtpReceiveParameters,
66 RtpParameters(uint32_t ssrc));
67 MOCK_METHOD2(SetAudioRtpReceiveParameters,
64 bool(uint32_t ssrc, const RtpParameters&)); 68 bool(uint32_t ssrc, const RtpParameters&));
65 69
66 void SetRawAudioSink( 70 void SetRawAudioSink(
67 uint32_t, std::unique_ptr<AudioSinkInterface> sink) /* override */ { 71 uint32_t, std::unique_ptr<AudioSinkInterface> sink) /* override */ {
68 sink_ = std::move(sink); 72 sink_ = std::move(sink);
69 } 73 }
70 74
71 private: 75 private:
72 std::unique_ptr<AudioSinkInterface> sink_; 76 std::unique_ptr<AudioSinkInterface> sink_;
73 }; 77 };
74 78
75 // Helper class to test RtpSender/RtpReceiver. 79 // Helper class to test RtpSender/RtpReceiver.
76 class MockVideoProvider : public VideoProviderInterface { 80 class MockVideoProvider : public VideoProviderInterface {
77 public: 81 public:
78 virtual ~MockVideoProvider() {} 82 virtual ~MockVideoProvider() {}
79 MOCK_METHOD2(SetSource, 83 MOCK_METHOD2(SetSource,
80 bool(uint32_t ssrc, 84 bool(uint32_t ssrc,
81 rtc::VideoSourceInterface<cricket::VideoFrame>* source)); 85 rtc::VideoSourceInterface<cricket::VideoFrame>* source));
82 MOCK_METHOD3(SetVideoPlayout, 86 MOCK_METHOD3(SetVideoPlayout,
83 void(uint32_t ssrc, 87 void(uint32_t ssrc,
84 bool enable, 88 bool enable,
85 rtc::VideoSinkInterface<cricket::VideoFrame>* sink)); 89 rtc::VideoSinkInterface<cricket::VideoFrame>* sink));
86 MOCK_METHOD3(SetVideoSend, 90 MOCK_METHOD3(SetVideoSend,
87 void(uint32_t ssrc, 91 void(uint32_t ssrc,
88 bool enable, 92 bool enable,
89 const cricket::VideoOptions* options)); 93 const cricket::VideoOptions* options));
90 94
91 MOCK_CONST_METHOD1(GetVideoRtpParameters, RtpParameters(uint32_t ssrc)); 95 MOCK_CONST_METHOD1(GetVideoRtpSendParameters, RtpParameters(uint32_t ssrc));
92 MOCK_METHOD2(SetVideoRtpParameters, 96 MOCK_METHOD2(SetVideoRtpSendParameters,
97 bool(uint32_t ssrc, const RtpParameters&));
98 MOCK_CONST_METHOD1(GetVideoRtpReceiveParameters,
99 RtpParameters(uint32_t ssrc));
100 MOCK_METHOD2(SetVideoRtpReceiveParameters,
93 bool(uint32_t ssrc, const RtpParameters&)); 101 bool(uint32_t ssrc, const RtpParameters&));
94 }; 102 };
95 103
96 class RtpSenderReceiverTest : public testing::Test { 104 class RtpSenderReceiverTest : public testing::Test {
97 public: 105 public:
98 virtual void SetUp() { 106 virtual void SetUp() {
99 stream_ = MediaStream::Create(kStreamLabel1); 107 stream_ = MediaStream::Create(kStreamLabel1);
100 } 108 }
101 109
102 void AddVideoTrack() { 110 void AddVideoTrack() {
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 sender->SetSsrc(kVideoSsrc2); 505 sender->SetSsrc(kVideoSsrc2);
498 506
499 // Calls expected from destructor. 507 // Calls expected from destructor.
500 EXPECT_CALL(video_provider_, SetSource(kVideoSsrc2, nullptr)).Times(1); 508 EXPECT_CALL(video_provider_, SetSource(kVideoSsrc2, nullptr)).Times(1);
501 EXPECT_CALL(video_provider_, SetVideoSend(kVideoSsrc2, false, _)).Times(1); 509 EXPECT_CALL(video_provider_, SetVideoSend(kVideoSsrc2, false, _)).Times(1);
502 } 510 }
503 511
504 TEST_F(RtpSenderReceiverTest, AudioSenderCanSetParameters) { 512 TEST_F(RtpSenderReceiverTest, AudioSenderCanSetParameters) {
505 CreateAudioRtpSender(); 513 CreateAudioRtpSender();
506 514
507 EXPECT_CALL(audio_provider_, GetAudioRtpParameters(kAudioSsrc)) 515 EXPECT_CALL(audio_provider_, GetAudioRtpSendParameters(kAudioSsrc))
508 .WillOnce(Return(RtpParameters())); 516 .WillOnce(Return(RtpParameters()));
509 EXPECT_CALL(audio_provider_, SetAudioRtpParameters(kAudioSsrc, _)) 517 EXPECT_CALL(audio_provider_, SetAudioRtpSendParameters(kAudioSsrc, _))
510 .WillOnce(Return(true)); 518 .WillOnce(Return(true));
511 RtpParameters params = audio_rtp_sender_->GetParameters(); 519 RtpParameters params = audio_rtp_sender_->GetParameters();
512 EXPECT_TRUE(audio_rtp_sender_->SetParameters(params)); 520 EXPECT_TRUE(audio_rtp_sender_->SetParameters(params));
513 521
514 DestroyAudioRtpSender(); 522 DestroyAudioRtpSender();
515 } 523 }
516 524
517 TEST_F(RtpSenderReceiverTest, VideoSenderCanSetParameters) { 525 TEST_F(RtpSenderReceiverTest, VideoSenderCanSetParameters) {
518 CreateVideoRtpSender(); 526 CreateVideoRtpSender();
519 527
520 EXPECT_CALL(video_provider_, GetVideoRtpParameters(kVideoSsrc)) 528 EXPECT_CALL(video_provider_, GetVideoRtpSendParameters(kVideoSsrc))
521 .WillOnce(Return(RtpParameters())); 529 .WillOnce(Return(RtpParameters()));
522 EXPECT_CALL(video_provider_, SetVideoRtpParameters(kVideoSsrc, _)) 530 EXPECT_CALL(video_provider_, SetVideoRtpSendParameters(kVideoSsrc, _))
523 .WillOnce(Return(true)); 531 .WillOnce(Return(true));
524 RtpParameters params = video_rtp_sender_->GetParameters(); 532 RtpParameters params = video_rtp_sender_->GetParameters();
525 EXPECT_TRUE(video_rtp_sender_->SetParameters(params)); 533 EXPECT_TRUE(video_rtp_sender_->SetParameters(params));
526 534
527 DestroyVideoRtpSender(); 535 DestroyVideoRtpSender();
528 } 536 }
529 537
538 TEST_F(RtpSenderReceiverTest, AudioReceiverCanSetParameters) {
539 CreateAudioRtpReceiver();
540
541 EXPECT_CALL(audio_provider_, GetAudioRtpReceiveParameters(kAudioSsrc))
542 .WillOnce(Return(RtpParameters()));
543 EXPECT_CALL(audio_provider_, SetAudioRtpReceiveParameters(kAudioSsrc, _))
544 .WillOnce(Return(true));
545 RtpParameters params = audio_rtp_receiver_->GetParameters();
546 EXPECT_TRUE(audio_rtp_receiver_->SetParameters(params));
547
548 DestroyAudioRtpReceiver();
549 }
550
551 TEST_F(RtpSenderReceiverTest, VideoReceiverCanSetParameters) {
552 CreateVideoRtpReceiver();
553
554 EXPECT_CALL(video_provider_, GetVideoRtpReceiveParameters(kVideoSsrc))
555 .WillOnce(Return(RtpParameters()));
556 EXPECT_CALL(video_provider_, SetVideoRtpReceiveParameters(kVideoSsrc, _))
557 .WillOnce(Return(true));
558 RtpParameters params = video_rtp_receiver_->GetParameters();
559 EXPECT_TRUE(video_rtp_receiver_->SetParameters(params));
560
561 DestroyVideoRtpReceiver();
562 }
563
530 } // namespace webrtc 564 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/api/rtpsender.cc ('k') | webrtc/api/webrtcsession.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698