1 /*
2  *  Copyright (c) 2019 The WebRTC project authors. All Rights Reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 #ifndef TEST_PEER_SCENARIO_SDP_CALLBACKS_H_
11 #define TEST_PEER_SCENARIO_SDP_CALLBACKS_H_
12 
13 #include "api/peer_connection_interface.h"
14 
15 // Helpers to allow usage of std::function/lambdas to observe SDP operation in
16 // the peer conenction API. As they only have handlers for sucess, failures will
17 // cause a crash.
18 
19 namespace webrtc {
20 namespace test {
21 namespace webrtc_sdp_obs_impl {
22 class SdpSetObserversInterface : public SetSessionDescriptionObserver,
23                                  public SetRemoteDescriptionObserverInterface {
24 };
25 }  // namespace webrtc_sdp_obs_impl
26 
27 // Implementation of both SetSessionDescriptionObserver and
28 // SetRemoteDescriptionObserverInterface for use with SDP set operations. This
29 // return a raw owning pointer as it's only intended to be used as input to
30 // PeerConnection API which will take ownership.
31 webrtc_sdp_obs_impl::SdpSetObserversInterface* SdpSetObserver(
32     std::function<void()> callback);
33 
34 // Implementation of CreateSessionDescriptionObserver for use with SDP create
35 // operations. This return a raw owning pointer as it's only intended to be used
36 // as input to PeerConnection API which will take ownership.
37 CreateSessionDescriptionObserver* SdpCreateObserver(
38     std::function<void(SessionDescriptionInterface*)> callback);
39 
40 }  // namespace test
41 }  // namespace webrtc
42 
43 #endif  // TEST_PEER_SCENARIO_SDP_CALLBACKS_H_
44