| 1 | /* |
| 2 | * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies). |
| 3 | * Copyright (C) 2017 Apple Inc. All rights reserved. |
| 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions |
| 7 | * are met: |
| 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 in the |
| 12 | * documentation and/or other materials provided with the distribution. |
| 13 | * |
| 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 15 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 16 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 17 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 18 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 19 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 20 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 24 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 25 | */ |
| 26 | |
| 27 | #pragma once |
| 28 | |
| 29 | #if ENABLE(WEB_RTC) |
| 30 | |
| 31 | #include "RTCDataChannelHandlerClient.h" |
| 32 | #include "RTCPeerConnectionHandlerClient.h" |
| 33 | #include "TimerEventBasedMock.h" |
| 34 | #include <wtf/RefPtr.h> |
| 35 | #include <wtf/text/WTFString.h> |
| 36 | |
| 37 | namespace WebCore { |
| 38 | |
| 39 | class RTCSessionDescriptionDescriptor; |
| 40 | class RTCSessionDescriptionRequest; |
| 41 | class RTCVoidRequest; |
| 42 | |
| 43 | class SessionRequestNotifier : public MockNotifier { |
| 44 | public: |
| 45 | SessionRequestNotifier(RefPtr<RTCSessionDescriptionRequest>&&, RefPtr<RTCSessionDescriptionDescriptor>&&, const String& = emptyString()); |
| 46 | |
| 47 | void fire() override; |
| 48 | |
| 49 | private: |
| 50 | RefPtr<RTCSessionDescriptionRequest> m_request; |
| 51 | RefPtr<RTCSessionDescriptionDescriptor> m_descriptor; |
| 52 | String m_errorName; |
| 53 | }; |
| 54 | |
| 55 | class VoidRequestNotifier : public MockNotifier { |
| 56 | public: |
| 57 | VoidRequestNotifier(RefPtr<RTCVoidRequest>&&, bool, const String& = emptyString()); |
| 58 | |
| 59 | void fire() override; |
| 60 | |
| 61 | private: |
| 62 | RefPtr<RTCVoidRequest> m_request; |
| 63 | bool m_success; |
| 64 | String m_errorName; |
| 65 | }; |
| 66 | |
| 67 | class IceConnectionNotifier : public MockNotifier { |
| 68 | public: |
| 69 | IceConnectionNotifier(RTCPeerConnectionHandlerClient*, RTCIceConnectionState, RTCIceGatheringState); |
| 70 | |
| 71 | void fire() override; |
| 72 | |
| 73 | private: |
| 74 | RTCPeerConnectionHandlerClient* m_client; |
| 75 | RTCIceConnectionState m_connectionState; |
| 76 | RTCIceGatheringState m_gatheringState; |
| 77 | }; |
| 78 | |
| 79 | class SignalingStateNotifier : public MockNotifier { |
| 80 | public: |
| 81 | SignalingStateNotifier(RTCPeerConnectionHandlerClient*, RTCSignalingState); |
| 82 | |
| 83 | void fire() override; |
| 84 | |
| 85 | private: |
| 86 | RTCPeerConnectionHandlerClient* m_client; |
| 87 | RTCSignalingState m_signalingState; |
| 88 | }; |
| 89 | |
| 90 | class RemoteDataChannelNotifier : public MockNotifier { |
| 91 | public: |
| 92 | RemoteDataChannelNotifier(RTCPeerConnectionHandlerClient*); |
| 93 | |
| 94 | void fire() override; |
| 95 | |
| 96 | private: |
| 97 | RTCPeerConnectionHandlerClient* m_client; |
| 98 | }; |
| 99 | |
| 100 | class DataChannelStateNotifier : public MockNotifier { |
| 101 | public: |
| 102 | DataChannelStateNotifier(RTCDataChannelHandlerClient*, RTCDataChannelState); |
| 103 | |
| 104 | void fire() override; |
| 105 | |
| 106 | private: |
| 107 | RTCDataChannelHandlerClient* m_client; |
| 108 | RTCDataChannelState m_state; |
| 109 | }; |
| 110 | |
| 111 | } // namespace WebCore |
| 112 | |
| 113 | #endif // ENABLE(WEB_RTC) |
| 114 | |