2 * Copyright (C) 2015 Ericsson AB. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the
14 * 3. Neither the name of Ericsson nor the names of its contributors
15 * may be used to endorse or promote products derived from this
16 * software without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 #ifndef MockMediaEndpoint_h
32 #define MockMediaEndpoint_h
36 #include "MediaEndpoint.h"
41 class MockMediaEndpoint : public MediaEndpoint {
43 WEBCORE_EXPORT static std::unique_ptr<MediaEndpoint> create(MediaEndpointClient&);
45 MockMediaEndpoint(MediaEndpointClient&);
48 void setConfiguration(RefPtr<MediaEndpointConfiguration>&&) override;
50 void generateDtlsInfo() override;
51 MediaPayloadVector getDefaultAudioPayloads() override;
52 MediaPayloadVector getDefaultVideoPayloads() override;
53 MediaPayloadVector filterPayloads(const MediaPayloadVector& remotePayloads, const MediaPayloadVector& defaultPayloads) override;
55 UpdateResult updateReceiveConfiguration(MediaEndpointSessionConfiguration*, bool isInitiator) override;
56 UpdateResult updateSendConfiguration(MediaEndpointSessionConfiguration*, const RealtimeMediaSourceMap&, bool isInitiator) override;
58 void addRemoteCandidate(IceCandidate&, const String& mid, const String& ufrag, const String& password) override;
60 Ref<RealtimeMediaSource> createMutedRemoteSource(const String& mid, RealtimeMediaSource::Type) override;
61 void replaceSendSource(RealtimeMediaSource&, const String& mid) override;
65 void emulatePlatformEvent(const String& action) override;
68 void dispatchFakeIceCandidates();
69 void iceCandidateTimerFired();
71 void stepIceTransportStates();
72 void iceTransportTimerFired();
74 MediaEndpointClient& m_client;
75 Vector<String> m_mids;
77 Vector<RefPtr<IceCandidate>> m_fakeIceCandidates;
78 Timer m_iceCandidateTimer;
80 Vector<std::pair<String, MediaEndpoint::IceTransportState>> m_iceTransportStateChanges;
81 Timer m_iceTransportTimer;
84 } // namespace WebCore
86 #endif // ENABLE(WEB_RTC)
88 #endif // MockMediaEndpoint_h