#include "third_party/blink/renderer/modules/peerconnection/mock_rtc_peer_connection_handler_platform.h"
#include <memory>
#include <utility>
#include "third_party/blink/public/platform/scheduler/test/renderer_scheduler_test_support.h"
#include "third_party/blink/renderer/modules/mediastream/media_stream_video_track.h"
#include "third_party/blink/renderer/modules/mediastream/mock_media_stream_video_source.h"
#include "third_party/blink/renderer/platform/mediastream/media_stream_audio_track.h"
#include "third_party/blink/renderer/platform/mediastream/media_stream_component_impl.h"
#include "third_party/blink/renderer/platform/mediastream/media_stream_source.h"
#include "third_party/blink/renderer/platform/peerconnection/rtc_dtmf_sender_handler.h"
#include "third_party/blink/renderer/platform/peerconnection/rtc_encoded_audio_stream_transformer.h"
#include "third_party/blink/renderer/platform/peerconnection/rtc_encoded_video_stream_transformer.h"
#include "third_party/blink/renderer/platform/peerconnection/rtc_ice_candidate_platform.h"
#include "third_party/blink/renderer/platform/peerconnection/rtc_rtp_sender_platform.h"
#include "third_party/blink/renderer/platform/peerconnection/rtc_rtp_source.h"
#include "third_party/blink/renderer/platform/peerconnection/rtc_rtp_transceiver_platform.h"
#include "third_party/blink/renderer/platform/peerconnection/rtc_session_description_platform.h"
#include "third_party/blink/renderer/platform/peerconnection/rtc_stats.h"
#include "third_party/blink/renderer/platform/wtf/thread_safe_ref_counted.h"
#include "third_party/webrtc/api/stats/rtc_stats.h"
namespace blink {
namespace {
webrtc::PeerConnectionInterface::RTCConfiguration DefaultConfiguration() { … }
class DummyRtpSenderInternal
: public WTF::ThreadSafeRefCounted<DummyRtpSenderInternal> { … };
uintptr_t DummyRtpSenderInternal::last_id_ = …;
class DummyRTCRtpSenderPlatform : public RTCRtpSenderPlatform { … };
class DummyRTCRtpReceiverPlatform : public RTCRtpReceiverPlatform { … };
uintptr_t DummyRTCRtpReceiverPlatform::last_id_ = …;
class DummyTransceiverInternal
: public WTF::ThreadSafeRefCounted<DummyTransceiverInternal> { … };
uintptr_t DummyTransceiverInternal::last_id_ = …;
}
class MockRTCPeerConnectionHandlerPlatform::DummyRTCRtpTransceiverPlatform
: public RTCRtpTransceiverPlatform { … };
MockRTCPeerConnectionHandlerPlatform::MockRTCPeerConnectionHandlerPlatform()
: … { … }
MockRTCPeerConnectionHandlerPlatform::~MockRTCPeerConnectionHandlerPlatform() =
default;
bool MockRTCPeerConnectionHandlerPlatform::Initialize(
ExecutionContext*,
const webrtc::PeerConnectionInterface::RTCConfiguration&,
WebLocalFrame*,
ExceptionState&,
RTCRtpTransport*) { … }
Vector<std::unique_ptr<RTCRtpTransceiverPlatform>>
MockRTCPeerConnectionHandlerPlatform::CreateOffer(RTCSessionDescriptionRequest*,
RTCOfferOptionsPlatform*) { … }
void MockRTCPeerConnectionHandlerPlatform::CreateAnswer(
RTCSessionDescriptionRequest*,
RTCAnswerOptionsPlatform*) { … }
void MockRTCPeerConnectionHandlerPlatform::SetLocalDescription(
RTCVoidRequest*) { … }
void MockRTCPeerConnectionHandlerPlatform::SetLocalDescription(
RTCVoidRequest*,
ParsedSessionDescription) { … }
void MockRTCPeerConnectionHandlerPlatform::SetRemoteDescription(
RTCVoidRequest*,
ParsedSessionDescription) { … }
const webrtc::PeerConnectionInterface::RTCConfiguration&
MockRTCPeerConnectionHandlerPlatform::GetConfiguration() const { … }
webrtc::RTCErrorType MockRTCPeerConnectionHandlerPlatform::SetConfiguration(
const webrtc::PeerConnectionInterface::RTCConfiguration&) { … }
void MockRTCPeerConnectionHandlerPlatform::AddIceCandidate(
RTCVoidRequest*,
RTCIceCandidatePlatform*) { … }
void MockRTCPeerConnectionHandlerPlatform::RestartIce() { … }
void MockRTCPeerConnectionHandlerPlatform::GetStats(RTCStatsReportCallback) { … }
webrtc::RTCErrorOr<std::unique_ptr<RTCRtpTransceiverPlatform>>
MockRTCPeerConnectionHandlerPlatform::AddTransceiverWithTrack(
MediaStreamComponent* component,
const webrtc::RtpTransceiverInit&) { … }
webrtc::RTCErrorOr<std::unique_ptr<RTCRtpTransceiverPlatform>>
MockRTCPeerConnectionHandlerPlatform::AddTransceiverWithKind(
const String& kind,
const webrtc::RtpTransceiverInit&) { … }
webrtc::RTCErrorOr<std::unique_ptr<RTCRtpTransceiverPlatform>>
MockRTCPeerConnectionHandlerPlatform::AddTrack(
MediaStreamComponent* component,
const MediaStreamDescriptorVector&) { … }
webrtc::RTCErrorOr<std::unique_ptr<RTCRtpTransceiverPlatform>>
MockRTCPeerConnectionHandlerPlatform::RemoveTrack(
RTCRtpSenderPlatform* sender) { … }
rtc::scoped_refptr<webrtc::DataChannelInterface>
MockRTCPeerConnectionHandlerPlatform::CreateDataChannel(
const String& label,
const webrtc::DataChannelInit&) { … }
void MockRTCPeerConnectionHandlerPlatform::Close() { … }
void MockRTCPeerConnectionHandlerPlatform::CloseAndUnregister() { … }
webrtc::PeerConnectionInterface*
MockRTCPeerConnectionHandlerPlatform::NativePeerConnection() { … }
void MockRTCPeerConnectionHandlerPlatform::
RunSynchronousOnceClosureOnSignalingThread(base::OnceClosure closure,
const char* trace_event_name) { … }
void MockRTCPeerConnectionHandlerPlatform::TrackIceConnectionStateChange(
webrtc::PeerConnectionInterface::IceConnectionState state) { … }
}