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

Unified Diff: talk/app/webrtc/peerconnectioninterface_unittest.cc

Issue 1344143002: Catching more errors when parsing ICE server URLs. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Merging with master. Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « talk/app/webrtc/peerconnectionfactory_unittest.cc ('k') | webrtc/base/stringencode.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: talk/app/webrtc/peerconnectioninterface_unittest.cc
diff --git a/talk/app/webrtc/peerconnectioninterface_unittest.cc b/talk/app/webrtc/peerconnectioninterface_unittest.cc
index 03ceaf2e101418aa4c4029f7f76fea47a3a31bd9..5e135df647376bddb4632f8271a0b5f540e4444a 100644
--- a/talk/app/webrtc/peerconnectioninterface_unittest.cc
+++ b/talk/app/webrtc/peerconnectioninterface_unittest.cc
@@ -247,9 +247,11 @@ class PeerConnectionInterfaceTest : public testing::Test {
webrtc::MediaConstraintsInterface* constraints) {
PeerConnectionInterface::IceServer server;
PeerConnectionInterface::IceServers servers;
- server.uri = uri;
- server.password = password;
- servers.push_back(server);
+ if (!uri.empty()) {
+ server.uri = uri;
+ server.password = password;
+ servers.push_back(server);
+ }
port_allocator_factory_ = FakePortAllocatorFactory::Create();
@@ -281,6 +283,21 @@ class PeerConnectionInterfaceTest : public testing::Test {
EXPECT_EQ(PeerConnectionInterface::kStable, observer_.state_);
}
+ void CreatePeerConnectionExpectFail(const std::string& uri) {
+ PeerConnectionInterface::IceServer server;
+ PeerConnectionInterface::IceServers servers;
+ server.uri = uri;
+ servers.push_back(server);
+
+ scoped_ptr<webrtc::DtlsIdentityStoreInterface> dtls_identity_store;
+ port_allocator_factory_ = FakePortAllocatorFactory::Create();
+ scoped_refptr<PeerConnectionInterface> pc;
+ pc = pc_factory_->CreatePeerConnection(
+ servers, nullptr, port_allocator_factory_.get(),
+ dtls_identity_store.Pass(), &observer_);
+ ASSERT_EQ(nullptr, pc);
+ }
+
void CreatePeerConnectionWithDifferentConfigurations() {
CreatePeerConnection(kStunAddressOnly, "", NULL);
EXPECT_EQ(1u, port_allocator_factory_->stun_configs().size());
@@ -290,17 +307,9 @@ class PeerConnectionInterfaceTest : public testing::Test {
EXPECT_EQ(kDefaultStunPort,
port_allocator_factory_->stun_configs()[0].server.port());
- CreatePeerConnection(kStunInvalidPort, "", NULL);
- EXPECT_EQ(0u, port_allocator_factory_->stun_configs().size());
- EXPECT_EQ(0u, port_allocator_factory_->turn_configs().size());
-
- CreatePeerConnection(kStunAddressPortAndMore1, "", NULL);
- EXPECT_EQ(0u, port_allocator_factory_->stun_configs().size());
- EXPECT_EQ(0u, port_allocator_factory_->turn_configs().size());
-
- CreatePeerConnection(kStunAddressPortAndMore2, "", NULL);
- EXPECT_EQ(0u, port_allocator_factory_->stun_configs().size());
- EXPECT_EQ(0u, port_allocator_factory_->turn_configs().size());
+ CreatePeerConnectionExpectFail(kStunInvalidPort);
+ CreatePeerConnectionExpectFail(kStunAddressPortAndMore1);
+ CreatePeerConnectionExpectFail(kStunAddressPortAndMore2);
CreatePeerConnection(kTurnIceServerUri, kTurnPassword, NULL);
EXPECT_EQ(0u, port_allocator_factory_->stun_configs().size());
« no previous file with comments | « talk/app/webrtc/peerconnectionfactory_unittest.cc ('k') | webrtc/base/stringencode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698