OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 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 1976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1987 // description doesn't contain any streams but does support MSID. | 1987 // description doesn't contain any streams but does support MSID. |
1988 TEST_F(PeerConnectionInterfaceTest, SdpWithMsidDontCreatesDefaultStream) { | 1988 TEST_F(PeerConnectionInterfaceTest, SdpWithMsidDontCreatesDefaultStream) { |
1989 FakeConstraints constraints; | 1989 FakeConstraints constraints; |
1990 constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp, | 1990 constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp, |
1991 true); | 1991 true); |
1992 CreatePeerConnection(&constraints); | 1992 CreatePeerConnection(&constraints); |
1993 CreateAndSetRemoteOffer(kSdpStringWithMsidWithoutStreams); | 1993 CreateAndSetRemoteOffer(kSdpStringWithMsidWithoutStreams); |
1994 EXPECT_EQ(0u, observer_.remote_streams()->count()); | 1994 EXPECT_EQ(0u, observer_.remote_streams()->count()); |
1995 } | 1995 } |
1996 | 1996 |
| 1997 // This tests that when setting a new description, the old default tracks are |
| 1998 // not destroyed and recreated. |
| 1999 // See: https://bugs.chromium.org/p/webrtc/issues/detail?id=5250 |
| 2000 TEST_F(PeerConnectionInterfaceTest, DefaultTracksNotDestroyedAndRecreated) { |
| 2001 FakeConstraints constraints; |
| 2002 constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp, |
| 2003 true); |
| 2004 CreatePeerConnection(&constraints); |
| 2005 CreateAndSetRemoteOffer(kSdpStringWithoutStreamsAudioOnly); |
| 2006 |
| 2007 ASSERT_EQ(1u, observer_.remote_streams()->count()); |
| 2008 MediaStreamInterface* remote_stream = observer_.remote_streams()->at(0); |
| 2009 ASSERT_EQ(1u, remote_stream->GetAudioTracks().size()); |
| 2010 |
| 2011 // Set the track to "disabled", then set a new description and ensure the |
| 2012 // track is still disabled, which ensures it hasn't been recreated. |
| 2013 remote_stream->GetAudioTracks()[0]->set_enabled(false); |
| 2014 CreateAndSetRemoteOffer(kSdpStringWithoutStreamsAudioOnly); |
| 2015 ASSERT_EQ(1u, remote_stream->GetAudioTracks().size()); |
| 2016 EXPECT_FALSE(remote_stream->GetAudioTracks()[0]->enabled()); |
| 2017 } |
| 2018 |
1997 // This tests that a default MediaStream is not created if a remote session | 2019 // This tests that a default MediaStream is not created if a remote session |
1998 // description is updated to not have any MediaStreams. | 2020 // description is updated to not have any MediaStreams. |
1999 TEST_F(PeerConnectionInterfaceTest, VerifyDefaultStreamIsNotCreated) { | 2021 TEST_F(PeerConnectionInterfaceTest, VerifyDefaultStreamIsNotCreated) { |
2000 FakeConstraints constraints; | 2022 FakeConstraints constraints; |
2001 constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp, | 2023 constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp, |
2002 true); | 2024 true); |
2003 CreatePeerConnection(&constraints); | 2025 CreatePeerConnection(&constraints); |
2004 CreateAndSetRemoteOffer(kSdpStringWithStream1); | 2026 CreateAndSetRemoteOffer(kSdpStringWithStream1); |
2005 rtc::scoped_refptr<StreamCollection> reference(CreateStreamCollection(1)); | 2027 rtc::scoped_refptr<StreamCollection> reference(CreateStreamCollection(1)); |
2006 EXPECT_TRUE( | 2028 EXPECT_TRUE( |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2325 FakeConstraints updated_answer_c; | 2347 FakeConstraints updated_answer_c; |
2326 answer_c.SetMandatoryReceiveAudio(false); | 2348 answer_c.SetMandatoryReceiveAudio(false); |
2327 answer_c.SetMandatoryReceiveVideo(false); | 2349 answer_c.SetMandatoryReceiveVideo(false); |
2328 | 2350 |
2329 cricket::MediaSessionOptions updated_answer_options; | 2351 cricket::MediaSessionOptions updated_answer_options; |
2330 EXPECT_TRUE( | 2352 EXPECT_TRUE( |
2331 ParseConstraintsForAnswer(&updated_answer_c, &updated_answer_options)); | 2353 ParseConstraintsForAnswer(&updated_answer_c, &updated_answer_options)); |
2332 EXPECT_TRUE(updated_answer_options.has_audio()); | 2354 EXPECT_TRUE(updated_answer_options.has_audio()); |
2333 EXPECT_TRUE(updated_answer_options.has_video()); | 2355 EXPECT_TRUE(updated_answer_options.has_video()); |
2334 } | 2356 } |
OLD | NEW |