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

Side by Side Diff: talk/app/webrtc/peerconnectioninterface_unittest.cc

Issue 1391013007: Adding the ability to change ICE servers through SetConfiguration. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 2 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
OLDNEW
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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 using webrtc::IceCandidateInterface; 77 using webrtc::IceCandidateInterface;
78 using webrtc::MediaStreamInterface; 78 using webrtc::MediaStreamInterface;
79 using webrtc::MediaStreamTrackInterface; 79 using webrtc::MediaStreamTrackInterface;
80 using webrtc::MockCreateSessionDescriptionObserver; 80 using webrtc::MockCreateSessionDescriptionObserver;
81 using webrtc::MockDataChannelObserver; 81 using webrtc::MockDataChannelObserver;
82 using webrtc::MockSetSessionDescriptionObserver; 82 using webrtc::MockSetSessionDescriptionObserver;
83 using webrtc::MockStatsObserver; 83 using webrtc::MockStatsObserver;
84 using webrtc::PeerConnectionInterface; 84 using webrtc::PeerConnectionInterface;
85 using webrtc::PeerConnectionObserver; 85 using webrtc::PeerConnectionObserver;
86 using webrtc::PortAllocatorFactoryInterface; 86 using webrtc::PortAllocatorFactoryInterface;
87 using webrtc::PortAllocatorFactoryInterface;
87 using webrtc::SdpParseError; 88 using webrtc::SdpParseError;
88 using webrtc::SessionDescriptionInterface; 89 using webrtc::SessionDescriptionInterface;
89 using webrtc::VideoSourceInterface; 90 using webrtc::VideoSourceInterface;
90 using webrtc::VideoTrackInterface; 91 using webrtc::VideoTrackInterface;
91 92
92 namespace { 93 namespace {
93 94
94 // Gets the first ssrc of given content type from the ContentInfo. 95 // Gets the first ssrc of given content type from the ContentInfo.
95 bool GetFirstSsrc(const cricket::ContentInfo* content_info, int* ssrc) { 96 bool GetFirstSsrc(const cricket::ContentInfo* content_info, int* ssrc) {
96 if (!content_info || !ssrc) { 97 if (!content_info || !ssrc) {
(...skipping 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after
1147 EXPECT_TRUE(DoSetSessionDescription(answer, false)); 1148 EXPECT_TRUE(DoSetSessionDescription(answer, false));
1148 1149
1149 SessionDescriptionInterface* updated_offer = 1150 SessionDescriptionInterface* updated_offer =
1150 webrtc::CreateSessionDescription(SessionDescriptionInterface::kOffer, 1151 webrtc::CreateSessionDescription(SessionDescriptionInterface::kOffer,
1151 webrtc::kAudioSdpWithUnsupportedCodecs, 1152 webrtc::kAudioSdpWithUnsupportedCodecs,
1152 nullptr); 1153 nullptr);
1153 EXPECT_TRUE(DoSetSessionDescription(updated_offer, false)); 1154 EXPECT_TRUE(DoSetSessionDescription(updated_offer, false));
1154 CreateAnswerAsLocalDescription(); 1155 CreateAnswerAsLocalDescription();
1155 } 1156 }
1156 1157
1158 // Test that we can use SetConfiguration to change the ICE servers of the
1159 // PortAllocator.
1160 TEST_F(PeerConnectionInterfaceTest, SetConfigurationChangesIceServers) {
1161 CreatePeerConnection();
1162
1163 PeerConnectionInterface::RTCConfiguration config;
1164 PeerConnectionInterface::IceServer server;
1165 server.uri = "stun:test_hostname";
1166 config.servers.push_back(server);
1167 EXPECT_TRUE(pc_->SetConfiguration(config));
1168
1169 cricket::FakePortAllocator* allocator =
1170 port_allocator_factory_->last_created_allocator();
1171 EXPECT_EQ(1u, allocator->stun_servers().size());
1172 EXPECT_EQ("test_hostname", allocator->stun_servers().begin()->hostname());
1173 }
1174
1157 // Test that PeerConnection::Close changes the states to closed and all remote 1175 // Test that PeerConnection::Close changes the states to closed and all remote
1158 // tracks change state to ended. 1176 // tracks change state to ended.
1159 TEST_F(PeerConnectionInterfaceTest, CloseAndTestStreamsAndStates) { 1177 TEST_F(PeerConnectionInterfaceTest, CloseAndTestStreamsAndStates) {
1160 // Initialize a PeerConnection and negotiate local and remote session 1178 // Initialize a PeerConnection and negotiate local and remote session
1161 // description. 1179 // description.
1162 InitiateCall(); 1180 InitiateCall();
1163 ASSERT_EQ(1u, pc_->local_streams()->count()); 1181 ASSERT_EQ(1u, pc_->local_streams()->count());
1164 ASSERT_EQ(1u, pc_->remote_streams()->count()); 1182 ASSERT_EQ(1u, pc_->remote_streams()->count());
1165 1183
1166 pc_->Close(); 1184 pc_->Close();
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
1227 sdp, NULL); 1245 sdp, NULL);
1228 EXPECT_FALSE(DoSetLocalDescription(local_offer)); 1246 EXPECT_FALSE(DoSetLocalDescription(local_offer));
1229 } 1247 }
1230 1248
1231 // Test that GetStats can still be called after PeerConnection::Close. 1249 // Test that GetStats can still be called after PeerConnection::Close.
1232 TEST_F(PeerConnectionInterfaceTest, CloseAndGetStats) { 1250 TEST_F(PeerConnectionInterfaceTest, CloseAndGetStats) {
1233 InitiateCall(); 1251 InitiateCall();
1234 pc_->Close(); 1252 pc_->Close();
1235 DoGetStats(NULL); 1253 DoGetStats(NULL);
1236 } 1254 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698