| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2017 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2017 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 #include <memory> | 11 #include <memory> |
| 12 | 12 |
| 13 #include "webrtc/api/ortcfactoryinterface.h" | 13 #include "webrtc/api/ortcfactoryinterface.h" |
| 14 #include "webrtc/base/fakenetwork.h" | 14 #include "webrtc/base/fakenetwork.h" |
| 15 #include "webrtc/base/gunit.h" | 15 #include "webrtc/base/gunit.h" |
| 16 #include "webrtc/base/physicalsocketserver.h" | 16 #include "webrtc/base/physicalsocketserver.h" |
| 17 #include "webrtc/base/virtualsocketserver.h" | 17 #include "webrtc/base/virtualsocketserver.h" |
| 18 #include "webrtc/p2p/base/udptransport.h" | 18 #include "webrtc/p2p/base/udptransport.h" |
| 19 | 19 |
| 20 namespace { | 20 namespace { |
| 21 | 21 |
| 22 const int kDefaultTimeout = 10000; // 10 seconds. | 22 const int kDefaultTimeout = 10000; // 10 seconds. |
| 23 static const rtc::IPAddress kIPv4LocalHostAddress = | 23 static const rtc::IPAddress kIPv4LocalHostAddress = |
| 24 rtc::IPAddress(0x7F000001); // 127.0.0.1 | 24 rtc::IPAddress(0x7F000001); // 127.0.0.1 |
| 25 | 25 |
| 26 class PacketReceiver : public sigslot::has_slots<> { | 26 class PacketReceiver : public sigslot::has_slots<> { |
| 27 public: | 27 public: |
| 28 explicit PacketReceiver(rtc::PacketTransportInterface* transport) { | 28 explicit PacketReceiver(rtc::PacketTransportInternal* transport) { |
| 29 transport->SignalReadPacket.connect(this, &PacketReceiver::OnReadPacket); | 29 transport->SignalReadPacket.connect(this, &PacketReceiver::OnReadPacket); |
| 30 } | 30 } |
| 31 int packets_read() const { return packets_read_; } | 31 int packets_read() const { return packets_read_; } |
| 32 | 32 |
| 33 private: | 33 private: |
| 34 void OnReadPacket(rtc::PacketTransportInterface*, | 34 void OnReadPacket(rtc::PacketTransportInternal*, |
| 35 const char*, | 35 const char*, |
| 36 size_t, | 36 size_t, |
| 37 const rtc::PacketTime&, | 37 const rtc::PacketTime&, |
| 38 int) { | 38 int) { |
| 39 ++packets_read_; | 39 ++packets_read_; |
| 40 } | 40 } |
| 41 | 41 |
| 42 int packets_read_ = 0; | 42 int packets_read_ = 0; |
| 43 }; | 43 }; |
| 44 | 44 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 internal_transport1->SendPacket("foo", sizeof("foo"), | 113 internal_transport1->SendPacket("foo", sizeof("foo"), |
| 114 rtc::PacketOptions(), 0); | 114 rtc::PacketOptions(), 0); |
| 115 internal_transport2->SendPacket("foo", sizeof("foo"), | 115 internal_transport2->SendPacket("foo", sizeof("foo"), |
| 116 rtc::PacketOptions(), 0); | 116 rtc::PacketOptions(), 0); |
| 117 EXPECT_EQ_WAIT(1, receiver1.packets_read(), kDefaultTimeout); | 117 EXPECT_EQ_WAIT(1, receiver1.packets_read(), kDefaultTimeout); |
| 118 EXPECT_EQ_WAIT(1, receiver2.packets_read(), kDefaultTimeout); | 118 EXPECT_EQ_WAIT(1, receiver2.packets_read(), kDefaultTimeout); |
| 119 }); | 119 }); |
| 120 } | 120 } |
| 121 | 121 |
| 122 } // namespace webrtc | 122 } // namespace webrtc |
| OLD | NEW |