OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2007 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2007 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 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 char buf[1024] = {0}; | 665 char buf[1024] = {0}; |
666 | 666 |
667 EXPECT_EQ(1024, client->Send(buf, 1024)); | 667 EXPECT_EQ(1024, client->Send(buf, 1024)); |
668 EXPECT_FALSE(sink.Check(accepted.get(), testing::SSE_READ)); | 668 EXPECT_FALSE(sink.Check(accepted.get(), testing::SSE_READ)); |
669 | 669 |
670 // Shouldn't signal when blocked in a thread Send, where process_io is false. | 670 // Shouldn't signal when blocked in a thread Send, where process_io is false. |
671 std::unique_ptr<Thread> thread(new Thread()); | 671 std::unique_ptr<Thread> thread(new Thread()); |
672 thread->Start(); | 672 thread->Start(); |
673 Sleeper sleeper; | 673 Sleeper sleeper; |
674 TypedMessageData<AsyncSocket*> data(client.get()); | 674 TypedMessageData<AsyncSocket*> data(client.get()); |
675 thread->Send(&sleeper, 0, &data); | 675 thread->Send(RTC_FROM_HERE, &sleeper, 0, &data); |
676 EXPECT_FALSE(sink.Check(accepted.get(), testing::SSE_READ)); | 676 EXPECT_FALSE(sink.Check(accepted.get(), testing::SSE_READ)); |
677 | 677 |
678 // But should signal when process_io is true. | 678 // But should signal when process_io is true. |
679 EXPECT_TRUE_WAIT((sink.Check(accepted.get(), testing::SSE_READ)), kTimeout); | 679 EXPECT_TRUE_WAIT((sink.Check(accepted.get(), testing::SSE_READ)), kTimeout); |
680 EXPECT_LT(0, accepted->Recv(buf, 1024, nullptr)); | 680 EXPECT_LT(0, accepted->Recv(buf, 1024, nullptr)); |
681 } | 681 } |
682 | 682 |
683 void SocketTest::TcpInternal(const IPAddress& loopback, size_t data_size, | 683 void SocketTest::TcpInternal(const IPAddress& loopback, size_t data_size, |
684 ssize_t max_send_size) { | 684 ssize_t max_send_size) { |
685 testing::StreamSink sink; | 685 testing::StreamSink sink; |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1042 | 1042 |
1043 const int64_t kTimeBetweenPacketsMs = 10; | 1043 const int64_t kTimeBetweenPacketsMs = 10; |
1044 Thread::SleepMs(kTimeBetweenPacketsMs); | 1044 Thread::SleepMs(kTimeBetweenPacketsMs); |
1045 | 1045 |
1046 socket->SendTo("bar", 3, address); | 1046 socket->SendTo("bar", 3, address); |
1047 socket->RecvFrom(buffer, 3, nullptr, ×tamp); | 1047 socket->RecvFrom(buffer, 3, nullptr, ×tamp); |
1048 EXPECT_NEAR(timestamp, prev_timestamp + kTimeBetweenPacketsMs * 1000, 2000); | 1048 EXPECT_NEAR(timestamp, prev_timestamp + kTimeBetweenPacketsMs * 1000, 2000); |
1049 } | 1049 } |
1050 | 1050 |
1051 } // namespace rtc | 1051 } // namespace rtc |
OLD | NEW |