#include "third_party/blink/renderer/modules/peerconnection/mock_peer_connection_dependency_factory.h"
#include <stddef.h>
#include "base/containers/contains.h"
#include "base/not_fatal_until.h"
#include "base/task/single_thread_task_runner.h"
#include "third_party/blink/renderer/modules/peerconnection/mock_peer_connection_impl.h"
#include "third_party/blink/renderer/modules/peerconnection/mock_rtc_peer_connection_handler_platform.h"
#include "third_party/webrtc/api/media_stream_interface.h"
#include "third_party/webrtc/api/metronome/metronome.h"
#include "third_party/webrtc/api/scoped_refptr.h"
#include "third_party/webrtc/api/units/time_delta.h"
AudioSourceInterface;
AudioTrackInterface;
AudioTrackVector;
IceCandidateCollection;
IceCandidateInterface;
MediaStreamInterface;
ObserverInterface;
SessionDescriptionInterface;
VideoTrackInterface;
VideoTrackSourceInterface;
VideoTrackVector;
namespace blink {
namespace {
class FakeMetronome : public webrtc::Metronome { … };
}
template <class V>
static typename V::iterator FindTrack(V* vector, const std::string& track_id) { … }
MockWebRtcAudioSource::MockWebRtcAudioSource(bool is_remote)
: … { … }
void MockWebRtcAudioSource::RegisterObserver(ObserverInterface* observer) { … }
void MockWebRtcAudioSource::UnregisterObserver(ObserverInterface* observer) { … }
MockWebRtcAudioSource::SourceState MockWebRtcAudioSource::state() const { … }
bool MockWebRtcAudioSource::remote() const { … }
MockMediaStream::MockMediaStream(const std::string& id) : … { … }
bool MockMediaStream::AddTrack(rtc::scoped_refptr<AudioTrackInterface> track) { … }
bool MockMediaStream::AddTrack(rtc::scoped_refptr<VideoTrackInterface> track) { … }
bool MockMediaStream::RemoveTrack(
rtc::scoped_refptr<AudioTrackInterface> track) { … }
bool MockMediaStream::RemoveTrack(
rtc::scoped_refptr<VideoTrackInterface> track) { … }
std::string MockMediaStream::id() const { … }
AudioTrackVector MockMediaStream::GetAudioTracks() { … }
VideoTrackVector MockMediaStream::GetVideoTracks() { … }
rtc::scoped_refptr<AudioTrackInterface> MockMediaStream::FindAudioTrack(
const std::string& track_id) { … }
rtc::scoped_refptr<VideoTrackInterface> MockMediaStream::FindVideoTrack(
const std::string& track_id) { … }
void MockMediaStream::RegisterObserver(ObserverInterface* observer) { … }
void MockMediaStream::UnregisterObserver(ObserverInterface* observer) { … }
void MockMediaStream::NotifyObservers() { … }
MockMediaStream::~MockMediaStream() { … }
scoped_refptr<MockWebRtcAudioTrack> MockWebRtcAudioTrack::Create(
const std::string& id) { … }
MockWebRtcAudioTrack::MockWebRtcAudioTrack(const std::string& id)
: … { … }
MockWebRtcAudioTrack::~MockWebRtcAudioTrack() { … }
std::string MockWebRtcAudioTrack::kind() const { … }
webrtc::AudioSourceInterface* MockWebRtcAudioTrack::GetSource() const { … }
std::string MockWebRtcAudioTrack::id() const { … }
bool MockWebRtcAudioTrack::enabled() const { … }
MockWebRtcVideoTrack::TrackState MockWebRtcAudioTrack::state() const { … }
bool MockWebRtcAudioTrack::set_enabled(bool enable) { … }
void MockWebRtcAudioTrack::RegisterObserver(ObserverInterface* observer) { … }
void MockWebRtcAudioTrack::UnregisterObserver(ObserverInterface* observer) { … }
void MockWebRtcAudioTrack::SetEnded() { … }
MockWebRtcVideoTrack::MockWebRtcVideoTrack(
const std::string& id,
webrtc::VideoTrackSourceInterface* source)
: … { … }
MockWebRtcVideoTrack::~MockWebRtcVideoTrack() { … }
scoped_refptr<MockWebRtcVideoTrack> MockWebRtcVideoTrack::Create(
const std::string& id,
scoped_refptr<webrtc::VideoTrackSourceInterface> source) { … }
void MockWebRtcVideoTrack::AddOrUpdateSink(
rtc::VideoSinkInterface<webrtc::VideoFrame>* sink,
const rtc::VideoSinkWants& wants) { … }
void MockWebRtcVideoTrack::RemoveSink(
rtc::VideoSinkInterface<webrtc::VideoFrame>* sink) { … }
VideoTrackSourceInterface* MockWebRtcVideoTrack::GetSource() const { … }
std::string MockWebRtcVideoTrack::kind() const { … }
std::string MockWebRtcVideoTrack::id() const { … }
bool MockWebRtcVideoTrack::enabled() const { … }
MockWebRtcVideoTrack::TrackState MockWebRtcVideoTrack::state() const { … }
bool MockWebRtcVideoTrack::set_enabled(bool enable) { … }
void MockWebRtcVideoTrack::RegisterObserver(ObserverInterface* observer) { … }
void MockWebRtcVideoTrack::UnregisterObserver(ObserverInterface* observer) { … }
void MockWebRtcVideoTrack::SetEnded() { … }
scoped_refptr<MockWebRtcVideoTrackSource> MockWebRtcVideoTrackSource::Create(
bool supports_encoded_output) { … }
MockWebRtcVideoTrackSource::MockWebRtcVideoTrackSource(
bool supports_encoded_output)
: … { … }
bool MockWebRtcVideoTrackSource::is_screencast() const { … }
std::optional<bool> MockWebRtcVideoTrackSource::needs_denoising() const { … }
bool MockWebRtcVideoTrackSource::GetStats(Stats* stats) { … }
bool MockWebRtcVideoTrackSource::SupportsEncodedOutput() const { … }
void MockWebRtcVideoTrackSource::GenerateKeyFrame() { … }
void MockWebRtcVideoTrackSource::AddEncodedSink(
rtc::VideoSinkInterface<webrtc::RecordableEncodedFrame>* sink) { … }
void MockWebRtcVideoTrackSource::RemoveEncodedSink(
rtc::VideoSinkInterface<webrtc::RecordableEncodedFrame>* sink) { … }
void MockWebRtcVideoTrackSource::RegisterObserver(
webrtc::ObserverInterface* observer) { … }
void MockWebRtcVideoTrackSource::UnregisterObserver(
webrtc::ObserverInterface* observer) { … }
webrtc::MediaSourceInterface::SourceState MockWebRtcVideoTrackSource::state()
const { … }
bool MockWebRtcVideoTrackSource::remote() const { … }
void MockWebRtcVideoTrackSource::AddOrUpdateSink(
rtc::VideoSinkInterface<webrtc::VideoFrame>* sink,
const rtc::VideoSinkWants& wants) { … }
void MockWebRtcVideoTrackSource::RemoveSink(
rtc::VideoSinkInterface<webrtc::VideoFrame>* sink) { … }
class MockIceCandidate : public IceCandidateInterface { … };
MockPeerConnectionDependencyFactory::MockPeerConnectionDependencyFactory()
: … { … }
MockPeerConnectionDependencyFactory::~MockPeerConnectionDependencyFactory() { … }
rtc::scoped_refptr<webrtc::PeerConnectionInterface>
MockPeerConnectionDependencyFactory::CreatePeerConnection(
const webrtc::PeerConnectionInterface::RTCConfiguration& config,
blink::WebLocalFrame* frame,
webrtc::PeerConnectionObserver* observer,
ExceptionState& exception_state,
RTCRtpTransport*) { … }
scoped_refptr<webrtc::VideoTrackSourceInterface>
MockPeerConnectionDependencyFactory::CreateVideoTrackSourceProxy(
webrtc::VideoTrackSourceInterface* source) { … }
scoped_refptr<webrtc::MediaStreamInterface>
MockPeerConnectionDependencyFactory::CreateLocalMediaStream(
const String& label) { … }
scoped_refptr<webrtc::VideoTrackInterface>
MockPeerConnectionDependencyFactory::CreateLocalVideoTrack(
const String& id,
webrtc::VideoTrackSourceInterface* source) { … }
webrtc::IceCandidateInterface*
MockPeerConnectionDependencyFactory::CreateIceCandidate(const String& sdp_mid,
int sdp_mline_index,
const String& sdp) { … }
scoped_refptr<base::SingleThreadTaskRunner>
MockPeerConnectionDependencyFactory::GetWebRtcSignalingTaskRunner() { … }
scoped_refptr<base::SingleThreadTaskRunner>
MockPeerConnectionDependencyFactory::GetWebRtcNetworkTaskRunner() { … }
std::unique_ptr<webrtc::Metronome>
MockPeerConnectionDependencyFactory::CreateDecodeMetronome() { … }
void MockPeerConnectionDependencyFactory::SetFailToCreateSessionDescription(
bool fail) { … }
}