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

Unified Diff: talk/app/webrtc/peerconnection_unittest.cc

Issue 1581693006: Adding "first packet received" notification to PeerConnectionObserver. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fixing race condition in unit test. Created 4 years, 11 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 | « talk/app/webrtc/peerconnection.cc ('k') | talk/app/webrtc/peerconnectioninterface.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: talk/app/webrtc/peerconnection_unittest.cc
diff --git a/talk/app/webrtc/peerconnection_unittest.cc b/talk/app/webrtc/peerconnection_unittest.cc
index cf53c44f11cc246a989c4d01d28b20266eec7731..f4c896bfe0b491003fc0fc18d243bde64a261e21 100644
--- a/talk/app/webrtc/peerconnection_unittest.cc
+++ b/talk/app/webrtc/peerconnection_unittest.cc
@@ -251,6 +251,7 @@ class PeerConnectionTestClient : public webrtc::PeerConnectionObserver,
signaling_message_receiver_->ReceiveIceMessage(
candidate->sdp_mid(), candidate->sdp_mline_index(), ice_sdp);
}
+ void OnFirstMediaPacketReceived() override { received_media_packet_ = true; }
// MediaStreamInterface callback
void OnChanged() override {
@@ -386,6 +387,8 @@ class PeerConnectionTestClient : public webrtc::PeerConnectionObserver,
return true;
}
+ bool received_media_packet() const { return received_media_packet_; }
+
void OnIceComplete() override { LOG(INFO) << id_ << "OnIceComplete"; }
void OnDataChannel(DataChannelInterface* data_channel) override {
@@ -924,6 +927,10 @@ class PeerConnectionTestClient : public webrtc::PeerConnectionObserver,
rtc::scoped_refptr<DataChannelInterface> data_channel_;
rtc::scoped_ptr<MockDataChannelObserver> data_observer_;
+
+ // "true" if the PeerConnection indicated that a packet was received,
+ // through PeerConnectionObserverInterface.
+ bool received_media_packet_ = false;
};
class P2PTestConductor : public testing::Test {
@@ -1104,6 +1111,12 @@ class P2PTestConductor : public testing::Test {
EXPECT_TRUE_WAIT(FramesNotPending(audio_frame_count, video_frame_count),
kMaxWaitForFramesMs);
+ if (audio_frame_count != -1 || video_frame_count != -1) {
+ EXPECT_TRUE_WAIT(initiating_client_->received_media_packet(),
+ kMaxWaitForFramesMs);
+ EXPECT_TRUE_WAIT(receiving_client_->received_media_packet(),
+ kMaxWaitForFramesMs);
+ }
}
void SetupAndVerifyDtlsCall() {
« no previous file with comments | « talk/app/webrtc/peerconnection.cc ('k') | talk/app/webrtc/peerconnectioninterface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698