Do more actions on SDP fuzzing.

This will wait for completion of the setRemoteDescription() call,
and if the setRemoteDescription() is successful, it will do a
setLocalDescription() (default description).

Bug: none
Change-Id: Id1cb6b1ecbdc90d4f2c5b46a7f8e92b7491ff401
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/210682
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33400}
This commit is contained in:
Harald Alvestrand
2021-03-08 09:46:28 +00:00
committed by Commit Bot
parent a113d231a6
commit f00cd533ae

View File

@ -31,7 +31,8 @@ void FuzzOneInput(const uint8_t* data, size_t size) {
FuzzerTest test;
test.CreatePeerConnectionWrappers();
test.ConnectFakeSignaling();
// Note - we do not do test.ConnectFakeSignaling(); all signals
// generated are discarded.
rtc::scoped_refptr<MockSetSessionDescriptionObserver> srd_observer(
new rtc::RefCountedObject<MockSetSessionDescriptionObserver>());
@ -41,6 +42,17 @@ void FuzzOneInput(const uint8_t* data, size_t size) {
CreateSessionDescription("offer", message, &error));
// Note: This form of SRD takes ownership of the description.
test.caller()->pc()->SetRemoteDescription(srd_observer, sdp.release());
// Wait a short time for observer to be called. Timeout is short
// because the fuzzer should be trying many branches.
EXPECT_TRUE_WAIT(srd_observer->called(), 100);
// If set-remote-description was successful, try to answer.
rtc::scoped_refptr<MockSetSessionDescriptionObserver> sld_observer(
new rtc::RefCountedObject<MockSetSessionDescriptionObserver>());
if (srd_observer->result()) {
test.caller()->pc()->SetLocalDescription(sld_observer.get());
EXPECT_TRUE_WAIT(sld_observer->called(), 100);
}
}
} // namespace webrtc