Changeset 206856 in webkit


Ignore:
Timestamp:
Oct 6, 2016 1:54:49 AM (8 years ago)
Author:
adam.bergkvist@ericsson.com
Message:

WebRTC: Add support for the icecandidate event in MediaEndpointPeerConnection
https://bugs.webkit.org/show_bug.cgi?id=162957

Reviewed by Eric Carlson.

Source/WebCore:

Implement MediaEndpointPeerConnection's gotIceCandidate and doneGatheringCandidates
callbacks. These are used by the MediaEndpoint (WebRTC backend implementation) to
notify about ICE events.

Add API to Internals to emulate WebRTC platform events, such as dispatching a set of ICE
candidates followed by a gathering done indication. Initially, only a single action,
"dispatch-fake-ice-candidates", is supported, but the intention is to extend the set of
actions to support more test cases.

Test: fast/mediastream/RTCPeerConnection-icecandidate-event.html

  • Modules/mediastream/MediaEndpointPeerConnection.cpp:

(WebCore::MediaEndpointPeerConnection::emulatePlatformEvent):
(WebCore::MediaEndpointPeerConnection::gotIceCandidate):
(WebCore::MediaEndpointPeerConnection::doneGatheringCandidates):

  • Modules/mediastream/MediaEndpointPeerConnection.h:
  • Modules/mediastream/PeerConnectionBackend.h:
  • Modules/mediastream/RTCIceTransport.h: Added.

RTCIceCandidate will eventually be part of the JS API, but right now it's
only used to keep track of the ICE states related to a RTCRtpTranscevier.
(WebCore::RTCIceTransport::create):
(WebCore::RTCIceTransport::~RTCIceTransport):
(WebCore::RTCIceTransport::transportState):
(WebCore::RTCIceTransport::setTransportState):
(WebCore::RTCIceTransport::gatheringState):
(WebCore::RTCIceTransport::setGatheringState):
(WebCore::RTCIceTransport::RTCIceTransport):

  • Modules/mediastream/RTCPeerConnection.cpp:

(WebCore::RTCPeerConnection::emulatePlatformEvent):

  • Modules/mediastream/RTCPeerConnection.h:
  • Modules/mediastream/RTCRtpTransceiver.cpp:

(WebCore::RTCRtpTransceiver::RTCRtpTransceiver):

  • Modules/mediastream/RTCRtpTransceiver.h:

(WebCore::RTCRtpTransceiver::iceTransport):

  • WebCore.xcodeproj/project.pbxproj:
  • platform/mediastream/MediaEndpoint.h:

(WebCore::MediaEndpoint::emulatePlatformEvent):

  • platform/mediastream/PeerConnectionStates.h:
  • platform/mock/MockMediaEndpoint.cpp:

(WebCore::MockMediaEndpoint::MockMediaEndpoint):
(WebCore::MockMediaEndpoint::updateReceiveConfiguration):
(WebCore::MockMediaEndpoint::emulatePlatformEvent):
(WebCore::MockMediaEndpoint::dispatchFakeIceCandidates):
(WebCore::MockMediaEndpoint::iceCandidateTimerFired):

  • platform/mock/MockMediaEndpoint.h:
  • testing/Internals.cpp:

(WebCore::Internals::emulateRTCPeerConnectionPlatformEvent):
Generic API to signal down to the WebRTC platform mock.

  • testing/Internals.h:
  • testing/Internals.idl:

LayoutTests:

Dispatch fake ICE candidates from the WebRTC platform mock (MockMediaEndpoint) and
inspect the result.

  • fast/mediastream/RTCPeerConnection-icecandidate-event-expected.txt: Added.
  • fast/mediastream/RTCPeerConnection-icecandidate-event.html: Added.
  • platform/mac/TestExpectations:

Skip above test until the Mac port builds with WEB_RTC

Location:
trunk
Files:
2 added
18 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r206855 r206856  
     12016-10-06  Adam Bergkvist  <adam.bergkvist@ericsson.com>
     2
     3        WebRTC: Add support for the icecandidate event in MediaEndpointPeerConnection
     4        https://bugs.webkit.org/show_bug.cgi?id=162957
     5
     6        Reviewed by Eric Carlson.
     7
     8        Dispatch fake ICE candidates from the WebRTC platform mock (MockMediaEndpoint) and
     9        inspect the result.
     10
     11        * fast/mediastream/RTCPeerConnection-icecandidate-event-expected.txt: Added.
     12        * fast/mediastream/RTCPeerConnection-icecandidate-event.html: Added.
     13        * platform/mac/TestExpectations:
     14        Skip above test until the Mac port builds with WEB_RTC
     15
    1162016-10-06  Youenn Fablet  <youenn@apple.com>
    217
  • trunk/LayoutTests/platform/mac/TestExpectations

    r206774 r206856  
    207207fast/mediastream/RTCPeerConnection-media-setup-callbacks-single-dialog.html
    208208fast/mediastream/RTCPeerConnection-legacy-stream-based-api.html
     209fast/mediastream/RTCPeerConnection-icecandidate-event.html
    209210
    210211# Asserts in debug.
  • trunk/Source/WebCore/ChangeLog

    r206854 r206856  
     12016-10-06  Adam Bergkvist  <adam.bergkvist@ericsson.com>
     2
     3        WebRTC: Add support for the icecandidate event in MediaEndpointPeerConnection
     4        https://bugs.webkit.org/show_bug.cgi?id=162957
     5
     6        Reviewed by Eric Carlson.
     7
     8        Implement MediaEndpointPeerConnection's gotIceCandidate and doneGatheringCandidates
     9        callbacks. These are used by the MediaEndpoint (WebRTC backend implementation) to
     10        notify about ICE events.
     11
     12        Add API to Internals to emulate WebRTC platform events, such as dispatching a set of ICE
     13        candidates followed by a gathering done indication. Initially, only a single action,
     14        "dispatch-fake-ice-candidates", is supported, but the intention is to extend the set of
     15        actions to support more test cases.
     16
     17        Test: fast/mediastream/RTCPeerConnection-icecandidate-event.html
     18
     19        * Modules/mediastream/MediaEndpointPeerConnection.cpp:
     20        (WebCore::MediaEndpointPeerConnection::emulatePlatformEvent):
     21        (WebCore::MediaEndpointPeerConnection::gotIceCandidate):
     22        (WebCore::MediaEndpointPeerConnection::doneGatheringCandidates):
     23        * Modules/mediastream/MediaEndpointPeerConnection.h:
     24        * Modules/mediastream/PeerConnectionBackend.h:
     25        * Modules/mediastream/RTCIceTransport.h: Added.
     26        RTCIceCandidate will eventually be part of the JS API, but right now it's
     27        only used to keep track of the ICE states related to a RTCRtpTranscevier.
     28        (WebCore::RTCIceTransport::create):
     29        (WebCore::RTCIceTransport::~RTCIceTransport):
     30        (WebCore::RTCIceTransport::transportState):
     31        (WebCore::RTCIceTransport::setTransportState):
     32        (WebCore::RTCIceTransport::gatheringState):
     33        (WebCore::RTCIceTransport::setGatheringState):
     34        (WebCore::RTCIceTransport::RTCIceTransport):
     35        * Modules/mediastream/RTCPeerConnection.cpp:
     36        (WebCore::RTCPeerConnection::emulatePlatformEvent):
     37        * Modules/mediastream/RTCPeerConnection.h:
     38        * Modules/mediastream/RTCRtpTransceiver.cpp:
     39        (WebCore::RTCRtpTransceiver::RTCRtpTransceiver):
     40        * Modules/mediastream/RTCRtpTransceiver.h:
     41        (WebCore::RTCRtpTransceiver::iceTransport):
     42        * WebCore.xcodeproj/project.pbxproj:
     43        * platform/mediastream/MediaEndpoint.h:
     44        (WebCore::MediaEndpoint::emulatePlatformEvent):
     45        * platform/mediastream/PeerConnectionStates.h:
     46        * platform/mock/MockMediaEndpoint.cpp:
     47        (WebCore::MockMediaEndpoint::MockMediaEndpoint):
     48        (WebCore::MockMediaEndpoint::updateReceiveConfiguration):
     49        (WebCore::MockMediaEndpoint::emulatePlatformEvent):
     50        (WebCore::MockMediaEndpoint::dispatchFakeIceCandidates):
     51        (WebCore::MockMediaEndpoint::iceCandidateTimerFired):
     52        * platform/mock/MockMediaEndpoint.h:
     53        * testing/Internals.cpp:
     54        (WebCore::Internals::emulateRTCPeerConnectionPlatformEvent):
     55        Generic API to signal down to the WebRTC platform mock.
     56        * testing/Internals.h:
     57        * testing/Internals.idl:
     58
    1592016-10-06  Nan Wang  <n_wang@apple.com>
    260
  • trunk/Source/WebCore/Modules/mediastream/MediaEndpointPeerConnection.cpp

    r202671 r206856  
    4343#include "RTCConfiguration.h"
    4444#include "RTCIceCandidate.h"
     45#include "RTCIceCandidateEvent.h"
    4546#include "RTCOfferAnswerOptions.h"
    4647#include "RTCRtpTransceiver.h"
     
    756757}
    757758
     759void MediaEndpointPeerConnection::emulatePlatformEvent(const String& action)
     760{
     761    m_mediaEndpoint->emulatePlatformEvent(action);
     762}
     763
    758764bool MediaEndpointPeerConnection::localDescriptionTypeValidForState(RTCSessionDescription::SdpType type) const
    759765{
     
    819825}
    820826
    821 void MediaEndpointPeerConnection::gotIceCandidate(unsigned mdescIndex, RefPtr<IceCandidate>&& candidate)
     827void MediaEndpointPeerConnection::gotIceCandidate(const String& mid, RefPtr<IceCandidate>&& candidate)
    822828{
    823829    ASSERT(isMainThread());
    824830
    825     UNUSED_PARAM(mdescIndex);
    826     UNUSED_PARAM(candidate);
    827 
    828     notImplemented();
    829 }
    830 
    831 void MediaEndpointPeerConnection::doneGatheringCandidates(unsigned mdescIndex)
     831    const MediaDescriptionVector& mediaDescriptions = internalLocalDescription()->configuration()->mediaDescriptions();
     832    size_t mediaDescriptionIndex = notFound;
     833
     834    for (size_t i = 0; i < mediaDescriptions.size(); ++i) {
     835        if (mediaDescriptions[i]->mid() == mid) {
     836            mediaDescriptionIndex = i;
     837            break;
     838        }
     839    }
     840    ASSERT(mediaDescriptionIndex != notFound);
     841
     842    PeerMediaDescription& mediaDescription = *mediaDescriptions[mediaDescriptionIndex];
     843    mediaDescription.addIceCandidate(candidate.copyRef());
     844
     845    String candidateLine;
     846    SDPProcessor::Result result = m_sdpProcessor->generateCandidateLine(*candidate, candidateLine);
     847    if (result != SDPProcessor::Result::Success) {
     848        LOG_ERROR("SDPProcessor internal error");
     849        return;
     850    }
     851
     852    RefPtr<RTCIceCandidate> iceCandidate = RTCIceCandidate::create(candidateLine, mid, mediaDescriptionIndex);
     853
     854    m_client->fireEvent(RTCIceCandidateEvent::create(false, false, WTFMove(iceCandidate)));
     855}
     856
     857void MediaEndpointPeerConnection::doneGatheringCandidates(const String& mid)
    832858{
    833859    ASSERT(isMainThread());
    834860
    835     UNUSED_PARAM(mdescIndex);
    836 
    837     notImplemented();
     861    RtpTransceiverVector transceivers = RtpTransceiverVector(m_client->getTransceivers());
     862    RTCRtpTransceiver* notifyingTransceiver = matchTransceiverByMid(transceivers, mid);
     863    ASSERT(notifyingTransceiver);
     864
     865    notifyingTransceiver->iceTransport().setGatheringState(RTCIceTransport::GatheringState::Complete);
     866
     867    // Don't notify the script if there are transceivers still gathering.
     868    RTCRtpTransceiver* stillGatheringTransceiver = matchTransceiver(transceivers, [] (RTCRtpTransceiver& current) {
     869        return !current.stopped() && !current.mid().isNull()
     870            && current.iceTransport().gatheringState() != RTCIceTransport::GatheringState::Complete;
     871    });
     872    if (!stillGatheringTransceiver) {
     873        m_client->fireEvent(RTCIceCandidateEvent::create(false, false, nullptr));
     874        m_client->updateIceGatheringState(IceGatheringState::Complete);
     875    }
    838876}
    839877
  • trunk/Source/WebCore/Modules/mediastream/MediaEndpointPeerConnection.h

    r202439 r206856  
    8585    void clearNegotiationNeededState() override { m_negotiationNeeded = false; };
    8686
     87    void emulatePlatformEvent(const String& action) override;
     88
    8789private:
    8890    void runTask(Function<void ()>&&);
     
    108110    // MediaEndpointClient
    109111    void gotDtlsFingerprint(const String& fingerprint, const String& fingerprintFunction) override;
    110     void gotIceCandidate(unsigned mdescIndex, RefPtr<IceCandidate>&&) override;
    111     void doneGatheringCandidates(unsigned mdescIndex) override;
     112    void gotIceCandidate(const String& mid, RefPtr<IceCandidate>&&) override;
     113    void doneGatheringCandidates(const String& mid) override;
    112114
    113115    PeerConnectionBackendClient* m_client;
  • trunk/Source/WebCore/Modules/mediastream/PeerConnectionBackend.h

    r202376 r206856  
    118118    virtual void markAsNeedingNegotiation() = 0;
    119119    virtual void clearNegotiationNeededState() = 0;
     120
     121    virtual void emulatePlatformEvent(const String& action) = 0;
    120122};
    121123
  • trunk/Source/WebCore/Modules/mediastream/RTCIceTransport.h

    r206855 r206856  
    11/*
    2  * Copyright (C) 2015, 2016 Ericsson AB. All rights reserved.
     2 * Copyright (C) 2016 Ericsson AB. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3333#if ENABLE(WEB_RTC)
    3434
     35#include "PeerConnectionStates.h"
     36#include "ScriptWrappable.h"
     37#include <wtf/RefCounted.h>
     38#include <wtf/RefPtr.h>
     39
    3540namespace WebCore {
    3641
    37 namespace PeerConnectionStates {
     42class RTCIceTransport : public RefCounted<RTCIceTransport>, public ScriptWrappable {
     43public:
    3844
    39 enum class SignalingState {
    40     Stable = 1,
    41     HaveLocalOffer = 2,
    42     HaveRemoteOffer = 3,
    43     HaveLocalPrAnswer = 4,
    44     HaveRemotePrAnswer = 5,
    45     Closed = 6
     45    using TransportState = PeerConnectionStates::IceTransportState;
     46    using GatheringState = PeerConnectionStates::IceGatheringState;
     47
     48    static Ref<RTCIceTransport> create()
     49    {
     50        return adoptRef(*new RTCIceTransport());
     51    }
     52    virtual ~RTCIceTransport() { }
     53
     54    TransportState transportState() const { return m_transportState; }
     55    void setTransportState(TransportState state) { m_transportState = state; }
     56
     57    GatheringState gatheringState() const { return m_gatheringState; }
     58    void setGatheringState(GatheringState state) { m_gatheringState = state; }
     59
     60private:
     61    RTCIceTransport() { };
     62
     63    TransportState m_transportState { TransportState::New };
     64    GatheringState m_gatheringState { GatheringState::New };
    4665};
    47 
    48 enum class IceConnectionState {
    49     New = 1,
    50     Checking = 2,
    51     Connected = 3,
    52     Completed = 4,
    53     Failed = 5,
    54     Disconnected = 6,
    55     Closed = 7
    56 };
    57 
    58 enum class IceGatheringState {
    59     New = 1,
    60     Gathering = 2,
    61     Complete = 3
    62 };
    63 
    64 enum class IceTransportPolicy {
    65     Relay,
    66     All
    67 };
    68 
    69 enum class BundlePolicy {
    70     Balanced,
    71     MaxCompat,
    72     MaxBundle
    73 };
    74 
    75 }
    7666
    7767} // namespace WebCore
  • trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp

    r205542 r206856  
    429429}
    430430
     431void RTCPeerConnection::emulatePlatformEvent(const String& action)
     432{
     433    m_backend->emulatePlatformEvent(action);
     434}
     435
    431436void RTCPeerConnection::stop()
    432437{
  • trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.h

    r206094 r206856  
    120120    using RefCounted<RTCPeerConnection>::deref;
    121121
     122    // Used for testing with a mock
     123    void emulatePlatformEvent(const String& action);
     124
    122125private:
    123126    RTCPeerConnection(ScriptExecutionContext&);
  • trunk/Source/WebCore/Modules/mediastream/RTCRtpTransceiver.cpp

    r201601 r206856  
    6565    , m_sender(sender)
    6666    , m_receiver(receiver)
     67    , m_iceTransport(RTCIceTransport::create())
    6768{
    6869}
  • trunk/Source/WebCore/Modules/mediastream/RTCRtpTransceiver.h

    r201601 r206856  
    3434#if ENABLE(WEB_RTC)
    3535
     36#include "RTCIceTransport.h"
    3637#include "RTCRtpReceiver.h"
    3738#include "RTCRtpSender.h"
     
    7172    void stop() { m_stopped = true; }
    7273
     74    // FIXME: Temporary solution to keep track of ICE states for this transceiver. Later, each
     75    // sender and receiver will have up to two DTLS transports, which in turn will have an ICE
     76    // transport each.
     77    RTCIceTransport& iceTransport() const { return *m_iceTransport; }
     78
    7379    static String getNextMid();
    7480
     
    8591
    8692    bool m_stopped { false };
     93
     94    RefPtr<RTCIceTransport> m_iceTransport;
    8795};
    8896
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r206843 r206856  
    94599459                5E5E2B111CFC3E4B000C0D85 /* RTCRtpTransceiver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RTCRtpTransceiver.h; sourceTree = "<group>"; };
    94609460                5E5E2B121CFC3E4B000C0D85 /* RTCRtpTransceiver.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = RTCRtpTransceiver.idl; sourceTree = "<group>"; };
     9461                5E6653091DA437BF00FDD84C /* RTCIceTransport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RTCIceTransport.h; sourceTree = "<group>"; };
    94619462                5EA3D6DD1C859D5300300BBB /* MockMediaEndpoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MockMediaEndpoint.cpp; sourceTree = "<group>"; };
    94629463                5EA3D6DE1C859D5300300BBB /* MockMediaEndpoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MockMediaEndpoint.h; sourceTree = "<group>"; };
     
    1456414565                                07AB996718DA3C010018771E /* RTCIceServer.h */,
    1456514566                                07AB996818DA3C010018771E /* RTCIceServer.idl */,
     14567                                5E6653091DA437BF00FDD84C /* RTCIceTransport.h */,
    1456614568                                073794DB19EE2C5200E5A045 /* RTCOfferAnswerOptions.cpp */,
    1456714569                                073794DC19EE2C5200E5A045 /* RTCOfferAnswerOptions.h */,
  • trunk/Source/WebCore/platform/mediastream/MediaEndpoint.h

    r204466 r206856  
    4949public:
    5050    virtual void gotDtlsFingerprint(const String& fingerprint, const String& fingerprintFunction) = 0;
    51     virtual void gotIceCandidate(unsigned mdescIndex, RefPtr<IceCandidate>&&) = 0;
    52     virtual void doneGatheringCandidates(unsigned mdescIndex) = 0;
     51    virtual void gotIceCandidate(const String& mid, RefPtr<IceCandidate>&&) = 0;
     52    virtual void doneGatheringCandidates(const String& mid) = 0;
    5353
    5454    virtual ~MediaEndpointClient() { }
     
    8686
    8787    virtual void stop() = 0;
     88
     89    virtual void emulatePlatformEvent(const String&) { };
    8890};
    8991
  • trunk/Source/WebCore/platform/mediastream/PeerConnectionStates.h

    r202671 r206856  
    6262};
    6363
     64enum class IceTransportState {
     65    New = 1,
     66    Checking = 2,
     67    Connected = 3,
     68    Completed = 4,
     69    Failed = 5,
     70    Disconnected = 6,
     71    Closed = 7
     72};
     73
    6474enum class IceTransportPolicy {
    6575    Relay,
  • trunk/Source/WebCore/platform/mock/MockMediaEndpoint.cpp

    r202048 r206856  
    3434#include "MockMediaEndpoint.h"
    3535
     36#include "MediaEndpointSessionConfiguration.h"
    3637#include "MediaPayload.h"
    3738#include "MockRealtimeAudioSource.h"
     
    5152MockMediaEndpoint::MockMediaEndpoint(MediaEndpointClient& client)
    5253    : m_client(client)
     54    , m_iceCandidateTimer(*this, &MockMediaEndpoint::iceCandidateTimerFired)
    5355{
    5456}
     
    159161MediaEndpoint::UpdateResult MockMediaEndpoint::updateReceiveConfiguration(MediaEndpointSessionConfiguration* configuration, bool isInitiator)
    160162{
    161     UNUSED_PARAM(configuration);
    162163    UNUSED_PARAM(isInitiator);
     164
     165    Vector<String> mids;
     166    for (const RefPtr<PeerMediaDescription>& mediaDescription : configuration->mediaDescriptions())
     167        mids.append(mediaDescription->mid());
     168    m_mids.swap(mids);
    163169
    164170    return UpdateResult::Success;
     
    201207}
    202208
     209void MockMediaEndpoint::emulatePlatformEvent(const String& action)
     210{
     211    if (action == "dispatch-fake-ice-candidates")
     212        dispatchFakeIceCandidates();
     213}
     214
     215void MockMediaEndpoint::dispatchFakeIceCandidates()
     216{
     217    RefPtr<IceCandidate> iceCandidate = IceCandidate::create();
     218    iceCandidate->setType("host");
     219    iceCandidate->setFoundation("1");
     220    iceCandidate->setComponentId(1);
     221    iceCandidate->setPriority(2013266431);
     222    iceCandidate->setAddress("192.168.0.100");
     223    iceCandidate->setPort(38838);
     224    iceCandidate->setTransport("UDP");
     225    m_fakeIceCandidates.append(WTFMove(iceCandidate));
     226
     227    iceCandidate = IceCandidate::create();
     228    iceCandidate->setType("host");
     229    iceCandidate->setFoundation("2");
     230    iceCandidate->setComponentId(1);
     231    iceCandidate->setPriority(1019216383);
     232    iceCandidate->setAddress("192.168.0.100");
     233    iceCandidate->setPort(9);
     234    iceCandidate->setTransport("TCP");
     235    iceCandidate->setTcpType("active");
     236    m_fakeIceCandidates.append(WTFMove(iceCandidate));
     237
     238    iceCandidate = IceCandidate::create();
     239    iceCandidate->setType("srflx");
     240    iceCandidate->setFoundation("3");
     241    iceCandidate->setComponentId(1);
     242    iceCandidate->setPriority(1677722111);
     243    iceCandidate->setAddress("172.18.0.1");
     244    iceCandidate->setPort(47989);
     245    iceCandidate->setTransport("UDP");
     246    iceCandidate->setRelatedAddress("192.168.0.100");
     247    iceCandidate->setRelatedPort(47989);
     248    m_fakeIceCandidates.append(WTFMove(iceCandidate));
     249
     250    // Reverse order to use takeLast() while keeping the above order
     251    m_fakeIceCandidates.reverse();
     252
     253    m_iceCandidateTimer.startOneShot(0);
     254}
     255
     256void MockMediaEndpoint::iceCandidateTimerFired()
     257{
     258    if (m_mids.isEmpty())
     259        return;
     260
     261    if (!m_fakeIceCandidates.isEmpty()) {
     262        m_client.gotIceCandidate(m_mids[0], m_fakeIceCandidates.takeLast());
     263        m_iceCandidateTimer.startOneShot(0);
     264    } else
     265        m_client.doneGatheringCandidates(m_mids[0]);
     266}
     267
    203268} // namespace WebCore
    204269
  • trunk/Source/WebCore/platform/mock/MockMediaEndpoint.h

    r202048 r206856  
    3535
    3636#include "MediaEndpoint.h"
     37#include "Timer.h"
    3738
    3839namespace WebCore {
     
    6263    void stop() override;
    6364
     65    void emulatePlatformEvent(const String& action) override;
     66
    6467private:
     68    void dispatchFakeIceCandidates();
     69    void iceCandidateTimerFired();
     70
    6571    MediaEndpointClient& m_client;
     72    Vector<String> m_mids;
     73
     74    Vector<RefPtr<IceCandidate>> m_fakeIceCandidates;
     75    Timer m_iceCandidateTimer;
    6676};
    6777
  • trunk/Source/WebCore/testing/Internals.cpp

    r206811 r206856  
    954954    RTCPeerConnectionHandler::create = RTCPeerConnectionHandlerMock::create;
    955955}
     956
     957void Internals::emulateRTCPeerConnectionPlatformEvent(RTCPeerConnection& connection, const String& action)
     958{
     959    connection.emulatePlatformEvent(action);
     960}
    956961#endif
    957962
  • trunk/Source/WebCore/testing/Internals.h

    r206811 r206856  
    6464class Range;
    6565class RenderedDocumentMarker;
     66class RTCPeerConnection;
    6667class SerializedScriptValue;
    6768class SourceBuffer;
     
    369370    void enableMockMediaEndpoint();
    370371    void enableMockRTCPeerConnectionHandler();
     372    void emulateRTCPeerConnectionPlatformEvent(RTCPeerConnection&, const String& action);
    371373#endif
    372374
  • trunk/Source/WebCore/testing/Internals.idl

    r206811 r206856  
    408408    [Conditional=WIRELESS_PLAYBACK_TARGET, MayThrowLegacyException] void setMockMediaPlaybackTargetPickerState(DOMString deviceName, DOMString deviceState);
    409409    [Conditional=MEDIA_STREAM] void setMockMediaCaptureDevicesEnabled(boolean enabled);
     410    [Conditional=WEB_RTC] void emulateRTCPeerConnectionPlatformEvent(RTCPeerConnection connection, DOMString action);
    410411
    411412    [Conditional=VIDEO] void simulateSystemSleep();
Note: See TracChangeset for help on using the changeset viewer.