Catching more errors when parsing ICE server URLs.

Every malformed URL should now produce an error message in JS, rather than
silently failing and possibly printing a warning message to the console (and
possibly crashing).

Also added some unit tests, and made "ParseIceServers" public.

BUG=445002

Review URL: https://codereview.webrtc.org/1344143002

Cr-Commit-Position: refs/heads/master@{#10186}
This commit is contained in:
deadbeef
2015-10-06 11:38:28 -07:00
committed by Commit bot
parent 8104479724
commit 0a6c4ca942
8 changed files with 334 additions and 90 deletions

View File

@ -79,8 +79,6 @@ static const char kStunIceServerWithIPv4AddressWithoutPort[] = "stun:1.2.3.4";
static const char kStunIceServerWithIPv6Address[] = "stun:[2401:fa00:4::]:1234";
static const char kStunIceServerWithIPv6AddressWithoutPort[] =
"stun:[2401:fa00:4::]";
static const char kStunIceServerWithInvalidIPv6Address[] =
"stun:[2401:fa00:4:::3478";
static const char kTurnIceServerWithIPv6Address[] =
"turn:test@[2401:fa00:4::]:1234";
@ -208,7 +206,6 @@ TEST_F(PeerConnectionFactoryTest, CreatePCUsingIceServers) {
TEST_F(PeerConnectionFactoryTest, CreatePCUsingIceServersUrls) {
PeerConnectionInterface::RTCConfiguration config;
webrtc::PeerConnectionInterface::IceServer ice_server;
ice_server.urls.push_back(""); // Empty URLs should be ignored.
ice_server.urls.push_back(kStunIceServer);
ice_server.urls.push_back(kTurnIceServer);
ice_server.urls.push_back(kTurnIceServerWithTransport);
@ -368,8 +365,6 @@ TEST_F(PeerConnectionFactoryTest, CreatePCUsingIPLiteralAddress) {
config.servers.push_back(ice_server);
ice_server.uri = kStunIceServerWithIPv6AddressWithoutPort;
config.servers.push_back(ice_server);
ice_server.uri = kStunIceServerWithInvalidIPv6Address;
config.servers.push_back(ice_server);
ice_server.uri = kTurnIceServerWithIPv6Address;
ice_server.password = kTurnPassword;
config.servers.push_back(ice_server);