Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: webrtc/media/sctp/sctpdataengine_unittest.cc

Issue 2254003002: Fixing off-by-one error with max SCTP id. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Removing unneeded parentheses. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 SetupConnectedChannels(); 483 SetupConnectedChannels();
484 EXPECT_TRUE_WAIT(channel1()->socket() != NULL, 1000); 484 EXPECT_TRUE_WAIT(channel1()->socket() != NULL, 1000);
485 struct socket *sock = const_cast<struct socket*>(channel1()->socket()); 485 struct socket *sock = const_cast<struct socket*>(channel1()->socket());
486 int prior_count = channel1_ready_to_send_count(); 486 int prior_count = channel1_ready_to_send_count();
487 SctpDataMediaChannel::SendThresholdCallback(sock, 0); 487 SctpDataMediaChannel::SendThresholdCallback(sock, 0);
488 EXPECT_GT(channel1_ready_to_send_count(), prior_count); 488 EXPECT_GT(channel1_ready_to_send_count(), prior_count);
489 } 489 }
490 490
491 TEST_F(SctpDataMediaChannelTest, RefusesHighNumberedChannels) { 491 TEST_F(SctpDataMediaChannelTest, RefusesHighNumberedChannels) {
492 SetupConnectedChannels(); 492 SetupConnectedChannels();
493 EXPECT_TRUE(AddStream(1022)); 493 EXPECT_TRUE(AddStream(kMaxSctpStreams - 1));
494 EXPECT_FALSE(AddStream(1023)); 494 EXPECT_FALSE(AddStream(kMaxSctpStreams));
495 } 495 }
496 496
497 // Flaky, see webrtc:4453. 497 // Flaky, see webrtc:4453.
498 TEST_F(SctpDataMediaChannelTest, DISABLED_ReusesAStream) { 498 TEST_F(SctpDataMediaChannelTest, DISABLED_ReusesAStream) {
499 // Shut down channel 1, then open it up again for reuse. 499 // Shut down channel 1, then open it up again for reuse.
500 SetupConnectedChannels(); 500 SetupConnectedChannels();
501 SendDataResult result; 501 SendDataResult result;
502 SignalChannelClosedObserver chan_2_sig_receiver; 502 SignalChannelClosedObserver chan_2_sig_receiver;
503 chan_2_sig_receiver.BindSelf(channel2()); 503 chan_2_sig_receiver.BindSelf(channel2());
504 504
505 ASSERT_TRUE(SendData(channel1(), 1, "hello?", &result)); 505 ASSERT_TRUE(SendData(channel1(), 1, "hello?", &result));
506 EXPECT_EQ(SDR_SUCCESS, result); 506 EXPECT_EQ(SDR_SUCCESS, result);
507 EXPECT_TRUE_WAIT(ReceivedData(receiver2(), 1, "hello?"), 1000); 507 EXPECT_TRUE_WAIT(ReceivedData(receiver2(), 1, "hello?"), 1000);
508 508
509 channel1()->RemoveSendStream(1); 509 channel1()->RemoveSendStream(1);
510 EXPECT_TRUE_WAIT(chan_2_sig_receiver.WasStreamClosed(1), 1000); 510 EXPECT_TRUE_WAIT(chan_2_sig_receiver.WasStreamClosed(1), 1000);
511 // Channel 1 is gone now. 511 // Channel 1 is gone now.
512 512
513 // Create a new channel 1. 513 // Create a new channel 1.
514 AddStream(1); 514 AddStream(1);
515 ASSERT_TRUE(SendData(channel1(), 1, "hi?", &result)); 515 ASSERT_TRUE(SendData(channel1(), 1, "hi?", &result));
516 EXPECT_EQ(SDR_SUCCESS, result); 516 EXPECT_EQ(SDR_SUCCESS, result);
517 EXPECT_TRUE_WAIT(ReceivedData(receiver2(), 1, "hi?"), 1000); 517 EXPECT_TRUE_WAIT(ReceivedData(receiver2(), 1, "hi?"), 1000);
518 channel1()->RemoveSendStream(1); 518 channel1()->RemoveSendStream(1);
519 EXPECT_TRUE_WAIT(chan_2_sig_receiver.StreamCloseCount(1) == 2, 1000); 519 EXPECT_TRUE_WAIT(chan_2_sig_receiver.StreamCloseCount(1) == 2, 1000);
520 } 520 }
521 521
522 } // namespace cricket 522 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698