| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2012 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 2150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2161 SetRemoteDescriptionAnswerExpectError( | 2161 SetRemoteDescriptionAnswerExpectError( |
| 2162 "Called in wrong state: STATE_INIT", answer); | 2162 "Called in wrong state: STATE_INIT", answer); |
| 2163 } | 2163 } |
| 2164 | 2164 |
| 2165 // Tests that the remote candidates are added and removed successfully. | 2165 // Tests that the remote candidates are added and removed successfully. |
| 2166 TEST_F(WebRtcSessionTest, TestAddAndRemoveRemoteCandidates) { | 2166 TEST_F(WebRtcSessionTest, TestAddAndRemoveRemoteCandidates) { |
| 2167 Init(); | 2167 Init(); |
| 2168 SendAudioVideoStream1(); | 2168 SendAudioVideoStream1(); |
| 2169 | 2169 |
| 2170 cricket::Candidate candidate(1, "udp", rtc::SocketAddress("1.1.1.1", 5000), 0, | 2170 cricket::Candidate candidate(1, "udp", rtc::SocketAddress("1.1.1.1", 5000), 0, |
| 2171 "", "", "host", 0, ""); | 2171 "", "", "local", 0, ""); |
| 2172 candidate.set_transport_name("audio"); | 2172 candidate.set_transport_name("audio"); |
| 2173 JsepIceCandidate ice_candidate1(kMediaContentName0, 0, candidate); | 2173 JsepIceCandidate ice_candidate1(kMediaContentName0, 0, candidate); |
| 2174 | 2174 |
| 2175 // Fail since we have not set a remote description. | 2175 // Fail since we have not set a remote description. |
| 2176 EXPECT_FALSE(session_->ProcessIceMessage(&ice_candidate1)); | 2176 EXPECT_FALSE(session_->ProcessIceMessage(&ice_candidate1)); |
| 2177 | 2177 |
| 2178 SessionDescriptionInterface* offer = CreateOffer(); | 2178 SessionDescriptionInterface* offer = CreateOffer(); |
| 2179 SetLocalDescriptionWithoutError(offer); | 2179 SetLocalDescriptionWithoutError(offer); |
| 2180 | 2180 |
| 2181 // Fail since we have not set a remote description. | 2181 // Fail since we have not set a remote description. |
| (...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3070 // which does not help in the case where state is not changing. This is | 3070 // which does not help in the case where state is not changing. This is |
| 3071 // problematic in this test since we want to verify that adding a video | 3071 // problematic in this test since we want to verify that adding a video |
| 3072 // candidate does _not_ change state. So we interleave candidates and assume | 3072 // candidate does _not_ change state. So we interleave candidates and assume |
| 3073 // that messages are executed in the order they were posted. | 3073 // that messages are executed in the order they were posted. |
| 3074 | 3074 |
| 3075 // First audio candidate. | 3075 // First audio candidate. |
| 3076 cricket::Candidate candidate0; | 3076 cricket::Candidate candidate0; |
| 3077 candidate0.set_address(rtc::SocketAddress("1.1.1.1", 5000)); | 3077 candidate0.set_address(rtc::SocketAddress("1.1.1.1", 5000)); |
| 3078 candidate0.set_component(1); | 3078 candidate0.set_component(1); |
| 3079 candidate0.set_protocol("udp"); | 3079 candidate0.set_protocol("udp"); |
| 3080 candidate0.set_type("local"); |
| 3080 JsepIceCandidate ice_candidate0(kMediaContentName0, kMediaContentIndex0, | 3081 JsepIceCandidate ice_candidate0(kMediaContentName0, kMediaContentIndex0, |
| 3081 candidate0); | 3082 candidate0); |
| 3082 EXPECT_TRUE(session_->ProcessIceMessage(&ice_candidate0)); | 3083 EXPECT_TRUE(session_->ProcessIceMessage(&ice_candidate0)); |
| 3083 | 3084 |
| 3084 // Video candidate. | 3085 // Video candidate. |
| 3085 cricket::Candidate candidate1; | 3086 cricket::Candidate candidate1; |
| 3086 candidate1.set_address(rtc::SocketAddress("1.1.1.1", 6000)); | 3087 candidate1.set_address(rtc::SocketAddress("1.1.1.1", 6000)); |
| 3087 candidate1.set_component(1); | 3088 candidate1.set_component(1); |
| 3088 candidate1.set_protocol("udp"); | 3089 candidate1.set_protocol("udp"); |
| 3090 candidate1.set_type("local"); |
| 3089 JsepIceCandidate ice_candidate1(kMediaContentName1, kMediaContentIndex1, | 3091 JsepIceCandidate ice_candidate1(kMediaContentName1, kMediaContentIndex1, |
| 3090 candidate1); | 3092 candidate1); |
| 3091 EXPECT_TRUE(session_->ProcessIceMessage(&ice_candidate1)); | 3093 EXPECT_TRUE(session_->ProcessIceMessage(&ice_candidate1)); |
| 3092 | 3094 |
| 3093 // Second audio candidate. | 3095 // Second audio candidate. |
| 3094 cricket::Candidate candidate2; | 3096 cricket::Candidate candidate2; |
| 3095 candidate2.set_address(rtc::SocketAddress("1.1.1.1", 5001)); | 3097 candidate2.set_address(rtc::SocketAddress("1.1.1.1", 5001)); |
| 3096 candidate2.set_component(1); | 3098 candidate2.set_component(1); |
| 3097 candidate2.set_protocol("udp"); | 3099 candidate2.set_protocol("udp"); |
| 3100 candidate2.set_type("local"); |
| 3098 JsepIceCandidate ice_candidate2(kMediaContentName0, kMediaContentIndex0, | 3101 JsepIceCandidate ice_candidate2(kMediaContentName0, kMediaContentIndex0, |
| 3099 candidate2); | 3102 candidate2); |
| 3100 EXPECT_TRUE(session_->ProcessIceMessage(&ice_candidate2)); | 3103 EXPECT_TRUE(session_->ProcessIceMessage(&ice_candidate2)); |
| 3101 | 3104 |
| 3102 EXPECT_TRUE_WAIT(connection_with_remote_port(5000), 1000); | 3105 EXPECT_TRUE_WAIT(connection_with_remote_port(5000), 1000); |
| 3103 EXPECT_TRUE_WAIT(connection_with_remote_port(5001), 1000); | 3106 EXPECT_TRUE_WAIT(connection_with_remote_port(5001), 1000); |
| 3104 | 3107 |
| 3105 // No need here for a _WAIT check since we are checking that state hasn't | 3108 // No need here for a _WAIT check since we are checking that state hasn't |
| 3106 // changed: if this is false we would be doing waits for nothing and if this | 3109 // changed: if this is false we would be doing waits for nothing and if this |
| 3107 // is true then there will be no messages processed anyways. | 3110 // is true then there will be no messages processed anyways. |
| (...skipping 1234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4342 } | 4345 } |
| 4343 | 4346 |
| 4344 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test | 4347 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test |
| 4345 // currently fails because upon disconnection and reconnection OnIceComplete is | 4348 // currently fails because upon disconnection and reconnection OnIceComplete is |
| 4346 // called more than once without returning to IceGatheringGathering. | 4349 // called more than once without returning to IceGatheringGathering. |
| 4347 | 4350 |
| 4348 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, | 4351 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, |
| 4349 WebRtcSessionTest, | 4352 WebRtcSessionTest, |
| 4350 testing::Values(ALREADY_GENERATED, | 4353 testing::Values(ALREADY_GENERATED, |
| 4351 DTLS_IDENTITY_STORE)); | 4354 DTLS_IDENTITY_STORE)); |
| OLD | NEW |