OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 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 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 void SetDestination(cricket::DataMediaChannel* dest) { dest_ = dest; } | 46 void SetDestination(cricket::DataMediaChannel* dest) { dest_ = dest; } |
47 | 47 |
48 protected: | 48 protected: |
49 // Called to send raw packet down the wire (e.g. SCTP an packet). | 49 // Called to send raw packet down the wire (e.g. SCTP an packet). |
50 virtual bool SendPacket(rtc::CopyOnWriteBuffer* packet, | 50 virtual bool SendPacket(rtc::CopyOnWriteBuffer* packet, |
51 const rtc::PacketOptions& options) { | 51 const rtc::PacketOptions& options) { |
52 LOG(LS_VERBOSE) << "SctpFakeNetworkInterface::SendPacket"; | 52 LOG(LS_VERBOSE) << "SctpFakeNetworkInterface::SendPacket"; |
53 | 53 |
54 rtc::CopyOnWriteBuffer* buffer = new rtc::CopyOnWriteBuffer(*packet); | 54 rtc::CopyOnWriteBuffer* buffer = new rtc::CopyOnWriteBuffer(*packet); |
55 thread_->Post(this, MSG_PACKET, rtc::WrapMessageData(buffer)); | 55 thread_->Post(FROM_HERE, this, MSG_PACKET, rtc::WrapMessageData(buffer)); |
56 LOG(LS_VERBOSE) << "SctpFakeNetworkInterface::SendPacket, Posted message."; | 56 LOG(LS_VERBOSE) << "SctpFakeNetworkInterface::SendPacket, Posted message."; |
57 return true; | 57 return true; |
58 } | 58 } |
59 | 59 |
60 // Called when a raw packet has been recieved. This passes the data to the | 60 // Called when a raw packet has been recieved. This passes the data to the |
61 // code that will interpret the packet. e.g. to get the content payload from | 61 // code that will interpret the packet. e.g. to get the content payload from |
62 // an SCTP packet. | 62 // an SCTP packet. |
63 virtual void OnMessage(rtc::Message* msg) { | 63 virtual void OnMessage(rtc::Message* msg) { |
64 LOG(LS_VERBOSE) << "SctpFakeNetworkInterface::OnMessage"; | 64 LOG(LS_VERBOSE) << "SctpFakeNetworkInterface::OnMessage"; |
65 std::unique_ptr<rtc::CopyOnWriteBuffer> buffer( | 65 std::unique_ptr<rtc::CopyOnWriteBuffer> buffer( |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 // Channel 1 is gone now. | 516 // Channel 1 is gone now. |
517 | 517 |
518 // Create a new channel 1. | 518 // Create a new channel 1. |
519 AddStream(1); | 519 AddStream(1); |
520 ASSERT_TRUE(SendData(channel1(), 1, "hi?", &result)); | 520 ASSERT_TRUE(SendData(channel1(), 1, "hi?", &result)); |
521 EXPECT_EQ(cricket::SDR_SUCCESS, result); | 521 EXPECT_EQ(cricket::SDR_SUCCESS, result); |
522 EXPECT_TRUE_WAIT(ReceivedData(receiver2(), 1, "hi?"), 1000); | 522 EXPECT_TRUE_WAIT(ReceivedData(receiver2(), 1, "hi?"), 1000); |
523 channel1()->RemoveSendStream(1); | 523 channel1()->RemoveSendStream(1); |
524 EXPECT_TRUE_WAIT(chan_2_sig_receiver.StreamCloseCount(1) == 2, 1000); | 524 EXPECT_TRUE_WAIT(chan_2_sig_receiver.StreamCloseCount(1) == 2, 1000); |
525 } | 525 } |
OLD | NEW |