| 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_PC_TEST_FAKEDATACHANNELPROVIDER_H_ | 11 #ifndef WEBRTC_PC_TEST_FAKEDATACHANNELPROVIDER_H_ |
| 12 #define WEBRTC_PC_TEST_FAKEDATACHANNELPROVIDER_H_ | 12 #define WEBRTC_PC_TEST_FAKEDATACHANNELPROVIDER_H_ |
| 13 | 13 |
| 14 #include "webrtc/pc/datachannel.h" | 14 #include "webrtc/pc/datachannel.h" |
| 15 #include "webrtc/rtc_base/checks.h" | 15 #include "webrtc/rtc_base/checks.h" |
| 16 | 16 |
| 17 class FakeDataChannelProvider : public webrtc::DataChannelProviderInterface { | 17 class FakeDataChannelProvider : public webrtc::DataChannelProviderInterface { |
| 18 public: | 18 public: |
| 19 FakeDataChannelProvider() | 19 FakeDataChannelProvider() |
| 20 : send_blocked_(false), | 20 : send_blocked_(false), |
| 21 transport_available_(false), | 21 transport_available_(false), |
| 22 ready_to_send_(false), | 22 ready_to_send_(false), |
| 23 transport_error_(false) {} | 23 transport_error_(false) {} |
| 24 virtual ~FakeDataChannelProvider() {} | 24 virtual ~FakeDataChannelProvider() {} |
| 25 | 25 |
| 26 bool SendData(const cricket::SendDataParams& params, | 26 bool SendData(const cricket::SendDataParams& params, |
| 27 const rtc::CopyOnWriteBuffer& payload, | 27 const rtc::CopyOnWriteBuffer& payload, |
| 28 cricket::SendDataResult* result) override { | 28 cricket::SendDataResult* result) override { |
| 29 RTC_CHECK(ready_to_send_ && transport_available_); | 29 RTC_CHECK(ready_to_send_); |
| 30 RTC_CHECK(transport_available_); |
| 30 if (send_blocked_) { | 31 if (send_blocked_) { |
| 31 *result = cricket::SDR_BLOCK; | 32 *result = cricket::SDR_BLOCK; |
| 32 return false; | 33 return false; |
| 33 } | 34 } |
| 34 | 35 |
| 35 if (transport_error_ || payload.size() == 0) { | 36 if (transport_error_ || payload.size() == 0) { |
| 36 *result = cricket::SDR_ERROR; | 37 *result = cricket::SDR_ERROR; |
| 37 return false; | 38 return false; |
| 38 } | 39 } |
| 39 | 40 |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 cricket::SendDataParams last_send_data_params_; | 139 cricket::SendDataParams last_send_data_params_; |
| 139 bool send_blocked_; | 140 bool send_blocked_; |
| 140 bool transport_available_; | 141 bool transport_available_; |
| 141 bool ready_to_send_; | 142 bool ready_to_send_; |
| 142 bool transport_error_; | 143 bool transport_error_; |
| 143 std::set<webrtc::DataChannel*> connected_channels_; | 144 std::set<webrtc::DataChannel*> connected_channels_; |
| 144 std::set<uint32_t> send_ssrcs_; | 145 std::set<uint32_t> send_ssrcs_; |
| 145 std::set<uint32_t> recv_ssrcs_; | 146 std::set<uint32_t> recv_ssrcs_; |
| 146 }; | 147 }; |
| 147 #endif // WEBRTC_PC_TEST_FAKEDATACHANNELPROVIDER_H_ | 148 #endif // WEBRTC_PC_TEST_FAKEDATACHANNELPROVIDER_H_ |
| OLD | NEW |