OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 13 matching lines...) Expand all Loading... |
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | 24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 */ | 26 */ |
27 | 27 |
28 #include <errno.h> | 28 #include <errno.h> |
29 #include <stdarg.h> | 29 #include <stdarg.h> |
30 #include <stdio.h> | 30 #include <stdio.h> |
31 #include <string> | 31 #include <string> |
32 #include <vector> | 32 #include <vector> |
33 | 33 |
34 #include "talk/media/base/constants.h" | |
35 #include "talk/media/base/mediachannel.h" | |
36 #include "talk/media/sctp/sctpdataengine.h" | |
37 #include "webrtc/base/bind.h" | 34 #include "webrtc/base/bind.h" |
38 #include "webrtc/base/buffer.h" | 35 #include "webrtc/base/buffer.h" |
39 #include "webrtc/base/criticalsection.h" | 36 #include "webrtc/base/criticalsection.h" |
40 #include "webrtc/base/gunit.h" | 37 #include "webrtc/base/gunit.h" |
41 #include "webrtc/base/helpers.h" | 38 #include "webrtc/base/helpers.h" |
42 #include "webrtc/base/messagehandler.h" | 39 #include "webrtc/base/messagehandler.h" |
43 #include "webrtc/base/messagequeue.h" | 40 #include "webrtc/base/messagequeue.h" |
44 #include "webrtc/base/scoped_ptr.h" | 41 #include "webrtc/base/scoped_ptr.h" |
45 #include "webrtc/base/ssladapter.h" | 42 #include "webrtc/base/ssladapter.h" |
46 #include "webrtc/base/thread.h" | 43 #include "webrtc/base/thread.h" |
| 44 #include "webrtc/media/base/constants.h" |
| 45 #include "webrtc/media/base/mediachannel.h" |
| 46 #include "webrtc/media/sctp/sctpdataengine.h" |
47 | 47 |
48 enum { | 48 enum { |
49 MSG_PACKET = 1, | 49 MSG_PACKET = 1, |
50 }; | 50 }; |
51 | 51 |
52 // Fake NetworkInterface that sends/receives sctp packets. The one in | 52 // Fake NetworkInterface that sends/receives sctp packets. The one in |
53 // talk/media/base/fakenetworkinterface.h only works with rtp/rtcp. | 53 // webrtc/media/base/fakenetworkinterface.h only works with rtp/rtcp. |
54 class SctpFakeNetworkInterface : public cricket::MediaChannel::NetworkInterface, | 54 class SctpFakeNetworkInterface : public cricket::MediaChannel::NetworkInterface, |
55 public rtc::MessageHandler { | 55 public rtc::MessageHandler { |
56 public: | 56 public: |
57 explicit SctpFakeNetworkInterface(rtc::Thread* thread) | 57 explicit SctpFakeNetworkInterface(rtc::Thread* thread) |
58 : thread_(thread), | 58 : thread_(thread), |
59 dest_(NULL) { | 59 dest_(NULL) { |
60 } | 60 } |
61 | 61 |
62 void SetDestination(cricket::DataMediaChannel* dest) { dest_ = dest; } | 62 void SetDestination(cricket::DataMediaChannel* dest) { dest_ = dest; } |
63 | 63 |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 // Channel 1 is gone now. | 534 // Channel 1 is gone now. |
535 | 535 |
536 // Create a new channel 1. | 536 // Create a new channel 1. |
537 AddStream(1); | 537 AddStream(1); |
538 ASSERT_TRUE(SendData(channel1(), 1, "hi?", &result)); | 538 ASSERT_TRUE(SendData(channel1(), 1, "hi?", &result)); |
539 EXPECT_EQ(cricket::SDR_SUCCESS, result); | 539 EXPECT_EQ(cricket::SDR_SUCCESS, result); |
540 EXPECT_TRUE_WAIT(ReceivedData(receiver2(), 1, "hi?"), 1000); | 540 EXPECT_TRUE_WAIT(ReceivedData(receiver2(), 1, "hi?"), 1000); |
541 channel1()->RemoveSendStream(1); | 541 channel1()->RemoveSendStream(1); |
542 EXPECT_TRUE_WAIT(chan_2_sig_receiver.StreamCloseCount(1) == 2, 1000); | 542 EXPECT_TRUE_WAIT(chan_2_sig_receiver.StreamCloseCount(1) == 2, 1000); |
543 } | 543 } |
OLD | NEW |