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

Unified Diff: webrtc/api/peerconnection_unittest.cc

Issue 1772353002: Adds a test for an one-way media PeerConnection. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Review comment Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/api/peerconnection_unittest.cc
diff --git a/webrtc/api/peerconnection_unittest.cc b/webrtc/api/peerconnection_unittest.cc
index a43d075d57416231cbf5765baba5f516763d3b0a..a7d490c0a2563f2dd9aa18ddcbeb374acd47f1da 100644
--- a/webrtc/api/peerconnection_unittest.cc
+++ b/webrtc/api/peerconnection_unittest.cc
@@ -415,7 +415,7 @@ class PeerConnectionTestClient : public webrtc::PeerConnectionObserver,
return data_observer_.get();
}
- webrtc::PeerConnectionInterface* pc() { return peer_connection_.get(); }
+ webrtc::PeerConnectionInterface* pc() const { return peer_connection_.get(); }
void StopVideoCapturers() {
for (std::vector<cricket::VideoCapturer*>::iterator it =
@@ -426,6 +426,10 @@ class PeerConnectionTestClient : public webrtc::PeerConnectionObserver,
}
bool AudioFramesReceivedCheck(int number_of_frames) const {
+ // Only check frames if the incoming stream exists.
+ if (remote_streams()->count() == 0) {
perkj_webrtc 2016/03/08 23:07:50 can you please refactor LocalP2PTest instead? Ther
hta-webrtc 2016/03/09 04:09:53 I'd like not to, because I've got another CL in fl
hta-webrtc 2016/03/09 09:40:17 Only took an hour to restructure the counting. Loo
+ return true;
+ }
return number_of_frames <= fake_audio_capture_module_->frames_received();
}
@@ -434,6 +438,10 @@ class PeerConnectionTestClient : public webrtc::PeerConnectionObserver,
}
bool VideoFramesReceivedCheck(int number_of_frames) {
+ // Only check frames if the incoming stream exists.
+ if (remote_streams()->count() == 0) {
+ return true;
+ }
if (video_decoder_factory_enabled_) {
const std::vector<FakeWebRtcVideoDecoder*>& decoders
= fake_video_decoder_factory_->decoders();
@@ -660,7 +668,7 @@ class PeerConnectionTestClient : public webrtc::PeerConnectionObserver,
return pc()->remote_streams()->count();
}
- StreamCollectionInterface* remote_streams() {
+ StreamCollectionInterface* remote_streams() const {
if (!pc()) {
ADD_FAILURE();
return nullptr;
@@ -1213,6 +1221,14 @@ TEST_F(P2PTestConductor, LocalP2PTestDtls) {
SetupAndVerifyDtlsCall();
}
+// This test sets up an one-way call, with media only from initiator to
+// responder.
+TEST_F(P2PTestConductor, OneWayMediaCall) {
+ ASSERT_TRUE(CreateTestClients());
+ receiving_client()->set_auto_add_stream(false);
+ LocalP2PTest();
+}
+
// This test sets up a audio call initially and then upgrades to audio/video,
// using DTLS.
TEST_F(P2PTestConductor, LocalP2PTestDtlsRenegotiate) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698