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

Side by Side Diff: webrtc/pc/channel_unittest.cc

Issue 1970223002: Fix race in BaseChannel destructor when network thread differ from worker thread (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 4 years, 7 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
« no previous file with comments | « webrtc/pc/channel.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2009 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2009 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 982 matching lines...) Expand 10 before | Expand all | Expand 10 after
993 EXPECT_EQ(1U, GetTransport2()->channels().size()); 993 EXPECT_EQ(1U, GetTransport2()->channels().size());
994 SendRtp1(); 994 SendRtp1();
995 SendRtp2(); 995 SendRtp2();
996 WaitForThreads(); 996 WaitForThreads();
997 EXPECT_TRUE(CheckRtp1()); 997 EXPECT_TRUE(CheckRtp1());
998 EXPECT_TRUE(CheckRtp2()); 998 EXPECT_TRUE(CheckRtp2());
999 EXPECT_TRUE(CheckNoRtp1()); 999 EXPECT_TRUE(CheckNoRtp1());
1000 EXPECT_TRUE(CheckNoRtp2()); 1000 EXPECT_TRUE(CheckNoRtp2());
1001 } 1001 }
1002 1002
1003 void TestDeinit() {
1004 CreateChannels(RTCP, RTCP);
1005 EXPECT_TRUE(SendInitiate());
1006 EXPECT_TRUE(SendAccept());
1007 SendRtp1();
1008 SendRtp2();
1009 SendRtcp1();
1010 SendRtcp2();
1011 // Do not wait, destroy channels.
1012 channel1_.reset(nullptr);
1013 channel2_.reset(nullptr);
1014 }
1015
1003 // Check that RTCP is not transmitted if both sides don't support RTCP. 1016 // Check that RTCP is not transmitted if both sides don't support RTCP.
1004 void SendNoRtcpToNoRtcp() { 1017 void SendNoRtcpToNoRtcp() {
1005 CreateChannels(0, 0); 1018 CreateChannels(0, 0);
1006 EXPECT_TRUE(SendInitiate()); 1019 EXPECT_TRUE(SendInitiate());
1007 EXPECT_TRUE(SendAccept()); 1020 EXPECT_TRUE(SendAccept());
1008 ASSERT_TRUE(GetTransport1()); 1021 ASSERT_TRUE(GetTransport1());
1009 ASSERT_TRUE(GetTransport2()); 1022 ASSERT_TRUE(GetTransport2());
1010 EXPECT_EQ(1U, GetTransport1()->channels().size()); 1023 EXPECT_EQ(1U, GetTransport1()->channels().size());
1011 EXPECT_EQ(1U, GetTransport2()->channels().size()); 1024 EXPECT_EQ(1U, GetTransport2()->channels().size());
1012 SendRtcp1(); 1025 SendRtcp1();
(...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after
2069 : Base(false, kH264Packet, kRtcpReport, NetworkIsWorker::No) {} 2082 : Base(false, kH264Packet, kRtcpReport, NetworkIsWorker::No) {}
2070 }; 2083 };
2071 2084
2072 // VoiceChannelSingleThreadTest 2085 // VoiceChannelSingleThreadTest
2073 TEST_F(VoiceChannelSingleThreadTest, TestInit) { 2086 TEST_F(VoiceChannelSingleThreadTest, TestInit) {
2074 Base::TestInit(); 2087 Base::TestInit();
2075 EXPECT_FALSE(media_channel1_->IsStreamMuted(0)); 2088 EXPECT_FALSE(media_channel1_->IsStreamMuted(0));
2076 EXPECT_TRUE(media_channel1_->dtmf_info_queue().empty()); 2089 EXPECT_TRUE(media_channel1_->dtmf_info_queue().empty());
2077 } 2090 }
2078 2091
2092 TEST_F(VoiceChannelSingleThreadTest, TestDeinit) {
2093 Base::TestDeinit();
2094 }
2095
2079 TEST_F(VoiceChannelSingleThreadTest, TestSetContents) { 2096 TEST_F(VoiceChannelSingleThreadTest, TestSetContents) {
2080 Base::TestSetContents(); 2097 Base::TestSetContents();
2081 } 2098 }
2082 2099
2083 TEST_F(VoiceChannelSingleThreadTest, TestSetContentsNullOffer) { 2100 TEST_F(VoiceChannelSingleThreadTest, TestSetContentsNullOffer) {
2084 Base::TestSetContentsNullOffer(); 2101 Base::TestSetContentsNullOffer();
2085 } 2102 }
2086 2103
2087 TEST_F(VoiceChannelSingleThreadTest, TestSetContentsRtcpMux) { 2104 TEST_F(VoiceChannelSingleThreadTest, TestSetContentsRtcpMux) {
2088 Base::TestSetContentsRtcpMux(); 2105 Base::TestSetContentsRtcpMux();
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
2395 Base::CanChangeMaxBitrate(); 2412 Base::CanChangeMaxBitrate();
2396 } 2413 }
2397 2414
2398 // VoiceChannelDoubleThreadTest 2415 // VoiceChannelDoubleThreadTest
2399 TEST_F(VoiceChannelDoubleThreadTest, TestInit) { 2416 TEST_F(VoiceChannelDoubleThreadTest, TestInit) {
2400 Base::TestInit(); 2417 Base::TestInit();
2401 EXPECT_FALSE(media_channel1_->IsStreamMuted(0)); 2418 EXPECT_FALSE(media_channel1_->IsStreamMuted(0));
2402 EXPECT_TRUE(media_channel1_->dtmf_info_queue().empty()); 2419 EXPECT_TRUE(media_channel1_->dtmf_info_queue().empty());
2403 } 2420 }
2404 2421
2422 TEST_F(VoiceChannelDoubleThreadTest, TestDeinit) {
2423 Base::TestDeinit();
2424 }
2425
2405 TEST_F(VoiceChannelDoubleThreadTest, TestSetContents) { 2426 TEST_F(VoiceChannelDoubleThreadTest, TestSetContents) {
2406 Base::TestSetContents(); 2427 Base::TestSetContents();
2407 } 2428 }
2408 2429
2409 TEST_F(VoiceChannelDoubleThreadTest, TestSetContentsNullOffer) { 2430 TEST_F(VoiceChannelDoubleThreadTest, TestSetContentsNullOffer) {
2410 Base::TestSetContentsNullOffer(); 2431 Base::TestSetContentsNullOffer();
2411 } 2432 }
2412 2433
2413 TEST_F(VoiceChannelDoubleThreadTest, TestSetContentsRtcpMux) { 2434 TEST_F(VoiceChannelDoubleThreadTest, TestSetContentsRtcpMux) {
2414 Base::TestSetContentsRtcpMux(); 2435 Base::TestSetContentsRtcpMux();
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
2719 2740
2720 TEST_F(VoiceChannelDoubleThreadTest, CanChangeMaxBitrate) { 2741 TEST_F(VoiceChannelDoubleThreadTest, CanChangeMaxBitrate) {
2721 Base::CanChangeMaxBitrate(); 2742 Base::CanChangeMaxBitrate();
2722 } 2743 }
2723 2744
2724 // VideoChannelSingleThreadTest 2745 // VideoChannelSingleThreadTest
2725 TEST_F(VideoChannelSingleThreadTest, TestInit) { 2746 TEST_F(VideoChannelSingleThreadTest, TestInit) {
2726 Base::TestInit(); 2747 Base::TestInit();
2727 } 2748 }
2728 2749
2750 TEST_F(VideoChannelSingleThreadTest, TestDeinit) {
2751 Base::TestDeinit();
2752 }
2753
2729 TEST_F(VideoChannelSingleThreadTest, TestSetContents) { 2754 TEST_F(VideoChannelSingleThreadTest, TestSetContents) {
2730 Base::TestSetContents(); 2755 Base::TestSetContents();
2731 } 2756 }
2732 2757
2733 TEST_F(VideoChannelSingleThreadTest, TestSetContentsNullOffer) { 2758 TEST_F(VideoChannelSingleThreadTest, TestSetContentsNullOffer) {
2734 Base::TestSetContentsNullOffer(); 2759 Base::TestSetContentsNullOffer();
2735 } 2760 }
2736 2761
2737 TEST_F(VideoChannelSingleThreadTest, TestSetContentsRtcpMux) { 2762 TEST_F(VideoChannelSingleThreadTest, TestSetContentsRtcpMux) {
2738 Base::TestSetContentsRtcpMux(); 2763 Base::TestSetContentsRtcpMux();
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
2959 2984
2960 TEST_F(VideoChannelSingleThreadTest, CanChangeMaxBitrate) { 2985 TEST_F(VideoChannelSingleThreadTest, CanChangeMaxBitrate) {
2961 Base::CanChangeMaxBitrate(); 2986 Base::CanChangeMaxBitrate();
2962 } 2987 }
2963 2988
2964 // VideoChannelDoubleThreadTest 2989 // VideoChannelDoubleThreadTest
2965 TEST_F(VideoChannelDoubleThreadTest, TestInit) { 2990 TEST_F(VideoChannelDoubleThreadTest, TestInit) {
2966 Base::TestInit(); 2991 Base::TestInit();
2967 } 2992 }
2968 2993
2994 TEST_F(VideoChannelDoubleThreadTest, TestDeinit) {
2995 Base::TestDeinit();
2996 }
2997
2969 TEST_F(VideoChannelDoubleThreadTest, TestSetContents) { 2998 TEST_F(VideoChannelDoubleThreadTest, TestSetContents) {
2970 Base::TestSetContents(); 2999 Base::TestSetContents();
2971 } 3000 }
2972 3001
2973 TEST_F(VideoChannelDoubleThreadTest, TestSetContentsNullOffer) { 3002 TEST_F(VideoChannelDoubleThreadTest, TestSetContentsNullOffer) {
2974 Base::TestSetContentsNullOffer(); 3003 Base::TestSetContentsNullOffer();
2975 } 3004 }
2976 3005
2977 TEST_F(VideoChannelDoubleThreadTest, TestSetContentsRtcpMux) { 3006 TEST_F(VideoChannelDoubleThreadTest, TestSetContentsRtcpMux) {
2978 Base::TestSetContentsRtcpMux(); 3007 Base::TestSetContentsRtcpMux();
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
3270 int flags, 3299 int flags,
3271 cricket::DataContentDescription* data) { 3300 cricket::DataContentDescription* data) {
3272 data->AddLegacyStream(ssrc); 3301 data->AddLegacyStream(ssrc);
3273 } 3302 }
3274 3303
3275 TEST_F(DataChannelSingleThreadTest, TestInit) { 3304 TEST_F(DataChannelSingleThreadTest, TestInit) {
3276 Base::TestInit(); 3305 Base::TestInit();
3277 EXPECT_FALSE(media_channel1_->IsStreamMuted(0)); 3306 EXPECT_FALSE(media_channel1_->IsStreamMuted(0));
3278 } 3307 }
3279 3308
3309 TEST_F(DataChannelSingleThreadTest, TestDeinit) {
3310 Base::TestDeinit();
3311 }
3312
3280 TEST_F(DataChannelSingleThreadTest, TestSetContents) { 3313 TEST_F(DataChannelSingleThreadTest, TestSetContents) {
3281 Base::TestSetContents(); 3314 Base::TestSetContents();
3282 } 3315 }
3283 3316
3284 TEST_F(DataChannelSingleThreadTest, TestSetContentsNullOffer) { 3317 TEST_F(DataChannelSingleThreadTest, TestSetContentsNullOffer) {
3285 Base::TestSetContentsNullOffer(); 3318 Base::TestSetContentsNullOffer();
3286 } 3319 }
3287 3320
3288 TEST_F(DataChannelSingleThreadTest, TestSetContentsRtcpMux) { 3321 TEST_F(DataChannelSingleThreadTest, TestSetContentsRtcpMux) {
3289 Base::TestSetContentsRtcpMux(); 3322 Base::TestSetContentsRtcpMux();
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
3410 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result)); 3443 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result));
3411 EXPECT_EQ(params.ssrc, media_channel1_->last_sent_data_params().ssrc); 3444 EXPECT_EQ(params.ssrc, media_channel1_->last_sent_data_params().ssrc);
3412 EXPECT_EQ("foo", media_channel1_->last_sent_data()); 3445 EXPECT_EQ("foo", media_channel1_->last_sent_data());
3413 } 3446 }
3414 3447
3415 TEST_F(DataChannelDoubleThreadTest, TestInit) { 3448 TEST_F(DataChannelDoubleThreadTest, TestInit) {
3416 Base::TestInit(); 3449 Base::TestInit();
3417 EXPECT_FALSE(media_channel1_->IsStreamMuted(0)); 3450 EXPECT_FALSE(media_channel1_->IsStreamMuted(0));
3418 } 3451 }
3419 3452
3453 TEST_F(DataChannelDoubleThreadTest, TestDeinit) {
3454 Base::TestDeinit();
3455 }
3456
3420 TEST_F(DataChannelDoubleThreadTest, TestSetContents) { 3457 TEST_F(DataChannelDoubleThreadTest, TestSetContents) {
3421 Base::TestSetContents(); 3458 Base::TestSetContents();
3422 } 3459 }
3423 3460
3424 TEST_F(DataChannelDoubleThreadTest, TestSetContentsNullOffer) { 3461 TEST_F(DataChannelDoubleThreadTest, TestSetContentsNullOffer) {
3425 Base::TestSetContentsNullOffer(); 3462 Base::TestSetContentsNullOffer();
3426 } 3463 }
3427 3464
3428 TEST_F(DataChannelDoubleThreadTest, TestSetContentsRtcpMux) { 3465 TEST_F(DataChannelDoubleThreadTest, TestSetContentsRtcpMux) {
3429 Base::TestSetContentsRtcpMux(); 3466 Base::TestSetContentsRtcpMux();
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
3549 }; 3586 };
3550 rtc::CopyOnWriteBuffer payload(data, 3); 3587 rtc::CopyOnWriteBuffer payload(data, 3);
3551 cricket::SendDataResult result; 3588 cricket::SendDataResult result;
3552 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result)); 3589 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result));
3553 EXPECT_EQ(params.ssrc, 3590 EXPECT_EQ(params.ssrc,
3554 media_channel1_->last_sent_data_params().ssrc); 3591 media_channel1_->last_sent_data_params().ssrc);
3555 EXPECT_EQ("foo", media_channel1_->last_sent_data()); 3592 EXPECT_EQ("foo", media_channel1_->last_sent_data());
3556 } 3593 }
3557 3594
3558 // TODO(pthatcher): TestSetReceiver? 3595 // TODO(pthatcher): TestSetReceiver?
OLDNEW
« no previous file with comments | « webrtc/pc/channel.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698