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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 | 357 |
358 caller_dc_1->Send(webrtc::DataBuffer(message_1)); | 358 caller_dc_1->Send(webrtc::DataBuffer(message_1)); |
359 EXPECT_EQ_WAIT(message_1, dc_1_observer->last_message(), kMaxWait); | 359 EXPECT_EQ_WAIT(message_1, dc_1_observer->last_message(), kMaxWait); |
360 | 360 |
361 caller_dc_2->Send(webrtc::DataBuffer(message_2)); | 361 caller_dc_2->Send(webrtc::DataBuffer(message_2)); |
362 EXPECT_EQ_WAIT(message_2, dc_2_observer->last_message(), kMaxWait); | 362 EXPECT_EQ_WAIT(message_2, dc_2_observer->last_message(), kMaxWait); |
363 | 363 |
364 EXPECT_EQ(1U, dc_1_observer->received_message_count()); | 364 EXPECT_EQ(1U, dc_1_observer->received_message_count()); |
365 EXPECT_EQ(1U, dc_2_observer->received_message_count()); | 365 EXPECT_EQ(1U, dc_2_observer->received_message_count()); |
366 } | 366 } |
| 367 |
| 368 // Verifies that a DataChannel added from an OPEN message functions after |
| 369 // a channel has been previously closed (webrtc issue 3778). |
| 370 // This previously failed because the new channel re-uses the ID of the closed |
| 371 // channel, and the closed channel was incorrectly still assigned to the id. |
| 372 TEST_F(PeerConnectionEndToEndTest, DataChannelFromOpenWorksAfterClose) { |
| 373 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
| 374 |
| 375 CreatePcs(); |
| 376 |
| 377 webrtc::DataChannelInit init; |
| 378 rtc::scoped_refptr<DataChannelInterface> caller_dc( |
| 379 caller_->CreateDataChannel("data", init)); |
| 380 |
| 381 Negotiate(); |
| 382 WaitForConnection(); |
| 383 |
| 384 WaitForDataChannelsToOpen(caller_dc, callee_signaled_data_channels_, 0); |
| 385 CloseDataChannels(caller_dc, callee_signaled_data_channels_, 0); |
| 386 |
| 387 // Create a new channel and ensure it works after closing the previous one. |
| 388 caller_dc = caller_->CreateDataChannel("data2", init); |
| 389 |
| 390 WaitForDataChannelsToOpen(caller_dc, callee_signaled_data_channels_, 1); |
| 391 TestDataChannelSendAndReceive(caller_dc, callee_signaled_data_channels_[1]); |
| 392 |
| 393 CloseDataChannels(caller_dc, callee_signaled_data_channels_, 1); |
| 394 } |
OLD | NEW |