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