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 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1180 } | 1180 } |
1181 | 1181 |
1182 void EnableVideoDecoderFactory() { | 1182 void EnableVideoDecoderFactory() { |
1183 initiating_client_->EnableVideoDecoderFactory(); | 1183 initiating_client_->EnableVideoDecoderFactory(); |
1184 receiving_client_->EnableVideoDecoderFactory(); | 1184 receiving_client_->EnableVideoDecoderFactory(); |
1185 } | 1185 } |
1186 | 1186 |
1187 // This test sets up a call between two parties. Both parties send static | 1187 // This test sets up a call between two parties. Both parties send static |
1188 // frames to each other. Once the test is finished the number of sent frames | 1188 // frames to each other. Once the test is finished the number of sent frames |
1189 // is compared to the number of received frames. | 1189 // is compared to the number of received frames. |
1190 void LocalP2PTest() { LocalP2PTest(false); } | 1190 void LocalP2PTest() { |
1191 // TODO(perkj); Remove the flag bug5752 when | |
1192 // https://bugs.chromium.org/p/webrtc/issues/detail?id=5752 is fixed. | |
1193 void LocalP2PTest(bool bug5752) { | |
1194 if (initiating_client_->NumberOfLocalMediaStreams() == 0) { | 1191 if (initiating_client_->NumberOfLocalMediaStreams() == 0) { |
1195 initiating_client_->AddMediaStream(true, true); | 1192 initiating_client_->AddMediaStream(true, true); |
1196 } | 1193 } |
1197 initiating_client_->Negotiate(); | 1194 initiating_client_->Negotiate(); |
1198 // Assert true is used here since next tests are guaranteed to fail and | 1195 // Assert true is used here since next tests are guaranteed to fail and |
1199 // would eat up 5 seconds. | 1196 // would eat up 5 seconds. |
1200 ASSERT_TRUE_WAIT(SessionActive(), kMaxWaitForActivationMs); | 1197 ASSERT_TRUE_WAIT(SessionActive(), kMaxWaitForActivationMs); |
1201 VerifySessionDescriptions(); | 1198 VerifySessionDescriptions(); |
1202 | 1199 |
1203 int audio_frame_count = kEndAudioFrameCount; | 1200 int audio_frame_count = kEndAudioFrameCount; |
1204 int video_frame_count = kEndVideoFrameCount; | 1201 int video_frame_count = kEndVideoFrameCount; |
1205 // TODO(ronghuawu): Add test to cover the case of sendonly and recvonly. | 1202 // TODO(ronghuawu): Add test to cover the case of sendonly and recvonly. |
1206 | 1203 |
1207 if ((!initiating_client_->can_receive_audio() && | 1204 if ((!initiating_client_->can_receive_audio() && |
1208 !initiating_client_->can_receive_video()) || | 1205 !initiating_client_->can_receive_video()) || |
1209 (!receiving_client_->can_receive_audio() && | 1206 (!receiving_client_->can_receive_audio() && |
1210 !receiving_client_->can_receive_video())) { | 1207 !receiving_client_->can_receive_video())) { |
1211 // Neither audio nor video will flow, so connections won't be | 1208 // Neither audio nor video will flow, so connections won't be |
1212 // established. There's nothing more to check. | 1209 // established. There's nothing more to check. |
1213 // TODO(hta): Check connection if there's a data channel. | 1210 // TODO(hta): Check connection if there's a data channel. |
1214 return; | 1211 return; |
1215 } | 1212 } |
1216 | 1213 |
1217 // Audio or video is expected to flow, so both clients should reach the | 1214 // Audio or video is expected to flow, so both clients should reach the |
1218 // Connected state, and the offerer (ICE controller) should proceed to | 1215 // Connected state, and the offerer (ICE controller) should proceed to |
1219 // Completed. | 1216 // Completed. |
1220 // Note: These tests have been observed to fail under heavy load at | 1217 // Note: These tests have been observed to fail under heavy load at |
1221 // shorter timeouts, so they may be flaky. | 1218 // shorter timeouts, so they may be flaky. |
1222 if (bug5752) { | 1219 EXPECT_EQ_WAIT(webrtc::PeerConnectionInterface::kIceConnectionCompleted, |
1223 EXPECT_TRUE_WAIT( | 1220 initiating_client_->ice_connection_state(), |
1224 initiating_client_->ice_connection_state() == | 1221 kMaxWaitForFramesMs); |
1225 webrtc::PeerConnectionInterface::kIceConnectionCompleted || | |
1226 initiating_client_->ice_connection_state() == | |
1227 webrtc::PeerConnectionInterface::kIceConnectionConnected, | |
1228 kMaxWaitForFramesMs); | |
1229 } else { | |
1230 EXPECT_EQ_WAIT(webrtc::PeerConnectionInterface::kIceConnectionCompleted, | |
1231 initiating_client_->ice_connection_state(), | |
1232 kMaxWaitForFramesMs); | |
1233 } | |
1234 EXPECT_EQ_WAIT(webrtc::PeerConnectionInterface::kIceConnectionConnected, | 1222 EXPECT_EQ_WAIT(webrtc::PeerConnectionInterface::kIceConnectionConnected, |
1235 receiving_client_->ice_connection_state(), | 1223 receiving_client_->ice_connection_state(), |
1236 kMaxWaitForFramesMs); | 1224 kMaxWaitForFramesMs); |
1237 | 1225 |
1238 // The ICE gathering state should end up in kIceGatheringComplete, | 1226 // The ICE gathering state should end up in kIceGatheringComplete, |
1239 // but there's a bug that prevents this at the moment, and the state | 1227 // but there's a bug that prevents this at the moment, and the state |
1240 // machine is being updated by the WEBRTC WG. | 1228 // machine is being updated by the WEBRTC WG. |
1241 // TODO(hta): Update this check when spec revisions finish. | 1229 // TODO(hta): Update this check when spec revisions finish. |
1242 EXPECT_NE(webrtc::PeerConnectionInterface::kIceGatheringNew, | 1230 EXPECT_NE(webrtc::PeerConnectionInterface::kIceGatheringNew, |
1243 initiating_client_->ice_gathering_state()); | 1231 initiating_client_->ice_gathering_state()); |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1454 SetupAndVerifyDtlsCall(); | 1442 SetupAndVerifyDtlsCall(); |
1455 | 1443 |
1456 // Keeping the original peer around which will still send packets to the | 1444 // Keeping the original peer around which will still send packets to the |
1457 // receiving client. These SRTP packets will be dropped. | 1445 // receiving client. These SRTP packets will be dropped. |
1458 rtc::scoped_ptr<PeerConnectionTestClient> original_peer( | 1446 rtc::scoped_ptr<PeerConnectionTestClient> original_peer( |
1459 set_receiving_client(CreateDtlsClientWithAlternateKey())); | 1447 set_receiving_client(CreateDtlsClientWithAlternateKey())); |
1460 original_peer->pc()->Close(); | 1448 original_peer->pc()->Close(); |
1461 | 1449 |
1462 SetSignalingReceivers(); | 1450 SetSignalingReceivers(); |
1463 initializing_client()->IceRestart(); | 1451 initializing_client()->IceRestart(); |
1464 // TODO(perkj): Remove the flag bug5752 when | 1452 LocalP2PTest(); |
1465 // https://bugs.chromium.org/p/webrtc/issues/detail?id=5752 is fixed. | |
1466 LocalP2PTest(true /* bug5752 */); | |
1467 VerifyRenderedSize(640, 480); | 1453 VerifyRenderedSize(640, 480); |
1468 } | 1454 } |
1469 | 1455 |
1470 TEST_F(P2PTestConductor, LocalP2PTestCVO) { | 1456 TEST_F(P2PTestConductor, LocalP2PTestCVO) { |
1471 ASSERT_TRUE(CreateTestClients()); | 1457 ASSERT_TRUE(CreateTestClients()); |
1472 SetCaptureRotation(webrtc::kVideoRotation_90); | 1458 SetCaptureRotation(webrtc::kVideoRotation_90); |
1473 LocalP2PTest(); | 1459 LocalP2PTest(); |
1474 VerifyRenderedSize(640, 480, webrtc::kVideoRotation_90); | 1460 VerifyRenderedSize(640, 480, webrtc::kVideoRotation_90); |
1475 } | 1461 } |
1476 | 1462 |
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2180 server.urls.push_back("turn:hostname2"); | 2166 server.urls.push_back("turn:hostname2"); |
2181 servers.push_back(server); | 2167 servers.push_back(server); |
2182 EXPECT_TRUE(webrtc::ParseIceServers(servers, &stun_servers_, &turn_servers_)); | 2168 EXPECT_TRUE(webrtc::ParseIceServers(servers, &stun_servers_, &turn_servers_)); |
2183 EXPECT_EQ(2U, turn_servers_.size()); | 2169 EXPECT_EQ(2U, turn_servers_.size()); |
2184 EXPECT_NE(turn_servers_[0].priority, turn_servers_[1].priority); | 2170 EXPECT_NE(turn_servers_[0].priority, turn_servers_[1].priority); |
2185 } | 2171 } |
2186 | 2172 |
2187 #endif // if !defined(THREAD_SANITIZER) | 2173 #endif // if !defined(THREAD_SANITIZER) |
2188 | 2174 |
2189 } // namespace | 2175 } // namespace |
OLD | NEW |