OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2013 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #ifndef WEBRTC_API_TEST_FAKEDATACHANNELPROVIDER_H_ | 11 #ifndef WEBRTC_API_TEST_FAKEDATACHANNELPROVIDER_H_ |
12 #define WEBRTC_API_TEST_FAKEDATACHANNELPROVIDER_H_ | 12 #define WEBRTC_API_TEST_FAKEDATACHANNELPROVIDER_H_ |
13 | 13 |
14 #include "webrtc/api/datachannel.h" | 14 #include "webrtc/api/datachannel.h" |
15 | 15 |
16 class FakeDataChannelProvider : public webrtc::DataChannelProviderInterface { | 16 class FakeDataChannelProvider : public webrtc::DataChannelProviderInterface { |
17 public: | 17 public: |
18 FakeDataChannelProvider() | 18 FakeDataChannelProvider() |
19 : send_blocked_(false), | 19 : send_blocked_(false), |
20 transport_available_(false), | 20 transport_available_(false), |
21 ready_to_send_(false), | 21 ready_to_send_(false), |
22 transport_error_(false) {} | 22 transport_error_(false) {} |
23 virtual ~FakeDataChannelProvider() {} | 23 virtual ~FakeDataChannelProvider() {} |
24 | 24 |
25 bool SendData(const cricket::SendDataParams& params, | 25 bool SendData(const cricket::SendDataParams& params, |
26 const rtc::Buffer& payload, | 26 const rtc::CopyOnWriteBuffer& payload, |
27 cricket::SendDataResult* result) override { | 27 cricket::SendDataResult* result) override { |
28 ASSERT(ready_to_send_ && transport_available_); | 28 ASSERT(ready_to_send_ && transport_available_); |
29 if (send_blocked_) { | 29 if (send_blocked_) { |
30 *result = cricket::SDR_BLOCK; | 30 *result = cricket::SDR_BLOCK; |
31 return false; | 31 return false; |
32 } | 32 } |
33 | 33 |
34 if (transport_error_ || payload.size() == 0) { | 34 if (transport_error_ || payload.size() == 0) { |
35 *result = cricket::SDR_ERROR; | 35 *result = cricket::SDR_ERROR; |
36 return false; | 36 return false; |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 cricket::SendDataParams last_send_data_params_; | 135 cricket::SendDataParams last_send_data_params_; |
136 bool send_blocked_; | 136 bool send_blocked_; |
137 bool transport_available_; | 137 bool transport_available_; |
138 bool ready_to_send_; | 138 bool ready_to_send_; |
139 bool transport_error_; | 139 bool transport_error_; |
140 std::set<webrtc::DataChannel*> connected_channels_; | 140 std::set<webrtc::DataChannel*> connected_channels_; |
141 std::set<uint32_t> send_ssrcs_; | 141 std::set<uint32_t> send_ssrcs_; |
142 std::set<uint32_t> recv_ssrcs_; | 142 std::set<uint32_t> recv_ssrcs_; |
143 }; | 143 }; |
144 #endif // WEBRTC_API_TEST_FAKEDATACHANNELPROVIDER_H_ | 144 #endif // WEBRTC_API_TEST_FAKEDATACHANNELPROVIDER_H_ |
OLD | NEW |