OLD | NEW |
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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 "turn:test.com:1234"; | 72 "turn:test.com:1234"; |
73 static const char kTurnPassword[] = "turnpassword"; | 73 static const char kTurnPassword[] = "turnpassword"; |
74 static const int kDefaultStunPort = 3478; | 74 static const int kDefaultStunPort = 3478; |
75 static const int kDefaultStunTlsPort = 5349; | 75 static const int kDefaultStunTlsPort = 5349; |
76 static const char kTurnUsername[] = "test"; | 76 static const char kTurnUsername[] = "test"; |
77 static const char kStunIceServerWithIPv4Address[] = "stun:1.2.3.4:1234"; | 77 static const char kStunIceServerWithIPv4Address[] = "stun:1.2.3.4:1234"; |
78 static const char kStunIceServerWithIPv4AddressWithoutPort[] = "stun:1.2.3.4"; | 78 static const char kStunIceServerWithIPv4AddressWithoutPort[] = "stun:1.2.3.4"; |
79 static const char kStunIceServerWithIPv6Address[] = "stun:[2401:fa00:4::]:1234"; | 79 static const char kStunIceServerWithIPv6Address[] = "stun:[2401:fa00:4::]:1234"; |
80 static const char kStunIceServerWithIPv6AddressWithoutPort[] = | 80 static const char kStunIceServerWithIPv6AddressWithoutPort[] = |
81 "stun:[2401:fa00:4::]"; | 81 "stun:[2401:fa00:4::]"; |
82 static const char kStunIceServerWithInvalidIPv6Address[] = | |
83 "stun:[2401:fa00:4:::3478"; | |
84 static const char kTurnIceServerWithIPv6Address[] = | 82 static const char kTurnIceServerWithIPv6Address[] = |
85 "turn:test@[2401:fa00:4::]:1234"; | 83 "turn:test@[2401:fa00:4::]:1234"; |
86 | 84 |
87 class NullPeerConnectionObserver : public PeerConnectionObserver { | 85 class NullPeerConnectionObserver : public PeerConnectionObserver { |
88 public: | 86 public: |
89 virtual void OnMessage(const std::string& msg) {} | 87 virtual void OnMessage(const std::string& msg) {} |
90 virtual void OnSignalingMessage(const std::string& msg) {} | 88 virtual void OnSignalingMessage(const std::string& msg) {} |
91 virtual void OnSignalingChange( | 89 virtual void OnSignalingChange( |
92 PeerConnectionInterface::SignalingState new_state) {} | 90 PeerConnectionInterface::SignalingState new_state) {} |
93 virtual void OnAddStream(MediaStreamInterface* stream) {} | 91 virtual void OnAddStream(MediaStreamInterface* stream) {} |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 "hello.com", kDefaultStunPort, "test", kTurnPassword, "tcp", false); | 199 "hello.com", kDefaultStunPort, "test", kTurnPassword, "tcp", false); |
202 turn_configs.push_back(turn2); | 200 turn_configs.push_back(turn2); |
203 VerifyTurnConfigurations(turn_configs); | 201 VerifyTurnConfigurations(turn_configs); |
204 } | 202 } |
205 | 203 |
206 // This test verifies creation of PeerConnection with valid STUN and TURN | 204 // This test verifies creation of PeerConnection with valid STUN and TURN |
207 // configuration. Also verifies the list of URL's parsed correctly as expected. | 205 // configuration. Also verifies the list of URL's parsed correctly as expected. |
208 TEST_F(PeerConnectionFactoryTest, CreatePCUsingIceServersUrls) { | 206 TEST_F(PeerConnectionFactoryTest, CreatePCUsingIceServersUrls) { |
209 PeerConnectionInterface::RTCConfiguration config; | 207 PeerConnectionInterface::RTCConfiguration config; |
210 webrtc::PeerConnectionInterface::IceServer ice_server; | 208 webrtc::PeerConnectionInterface::IceServer ice_server; |
211 ice_server.urls.push_back(""); // Empty URLs should be ignored. | |
212 ice_server.urls.push_back(kStunIceServer); | 209 ice_server.urls.push_back(kStunIceServer); |
213 ice_server.urls.push_back(kTurnIceServer); | 210 ice_server.urls.push_back(kTurnIceServer); |
214 ice_server.urls.push_back(kTurnIceServerWithTransport); | 211 ice_server.urls.push_back(kTurnIceServerWithTransport); |
215 ice_server.password = kTurnPassword; | 212 ice_server.password = kTurnPassword; |
216 config.servers.push_back(ice_server); | 213 config.servers.push_back(ice_server); |
217 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store( | 214 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store( |
218 new FakeDtlsIdentityStore()); | 215 new FakeDtlsIdentityStore()); |
219 rtc::scoped_refptr<PeerConnectionInterface> pc( | 216 rtc::scoped_refptr<PeerConnectionInterface> pc( |
220 factory_->CreatePeerConnection(config, nullptr, | 217 factory_->CreatePeerConnection(config, nullptr, |
221 allocator_factory_.get(), | 218 allocator_factory_.get(), |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 PeerConnectionInterface::RTCConfiguration config; | 358 PeerConnectionInterface::RTCConfiguration config; |
362 webrtc::PeerConnectionInterface::IceServer ice_server; | 359 webrtc::PeerConnectionInterface::IceServer ice_server; |
363 ice_server.uri = kStunIceServerWithIPv4Address; | 360 ice_server.uri = kStunIceServerWithIPv4Address; |
364 config.servers.push_back(ice_server); | 361 config.servers.push_back(ice_server); |
365 ice_server.uri = kStunIceServerWithIPv4AddressWithoutPort; | 362 ice_server.uri = kStunIceServerWithIPv4AddressWithoutPort; |
366 config.servers.push_back(ice_server); | 363 config.servers.push_back(ice_server); |
367 ice_server.uri = kStunIceServerWithIPv6Address; | 364 ice_server.uri = kStunIceServerWithIPv6Address; |
368 config.servers.push_back(ice_server); | 365 config.servers.push_back(ice_server); |
369 ice_server.uri = kStunIceServerWithIPv6AddressWithoutPort; | 366 ice_server.uri = kStunIceServerWithIPv6AddressWithoutPort; |
370 config.servers.push_back(ice_server); | 367 config.servers.push_back(ice_server); |
371 ice_server.uri = kStunIceServerWithInvalidIPv6Address; | |
372 config.servers.push_back(ice_server); | |
373 ice_server.uri = kTurnIceServerWithIPv6Address; | 368 ice_server.uri = kTurnIceServerWithIPv6Address; |
374 ice_server.password = kTurnPassword; | 369 ice_server.password = kTurnPassword; |
375 config.servers.push_back(ice_server); | 370 config.servers.push_back(ice_server); |
376 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store( | 371 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store( |
377 new FakeDtlsIdentityStore()); | 372 new FakeDtlsIdentityStore()); |
378 rtc::scoped_refptr<PeerConnectionInterface> pc( | 373 rtc::scoped_refptr<PeerConnectionInterface> pc( |
379 factory_->CreatePeerConnection(config, nullptr, | 374 factory_->CreatePeerConnection(config, nullptr, |
380 allocator_factory_.get(), | 375 allocator_factory_.get(), |
381 dtls_identity_store.Pass(), | 376 dtls_identity_store.Pass(), |
382 &observer_)); | 377 &observer_)); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 | 417 |
423 track->set_enabled(false); | 418 track->set_enabled(false); |
424 EXPECT_TRUE(capturer->CaptureFrame()); | 419 EXPECT_TRUE(capturer->CaptureFrame()); |
425 EXPECT_EQ(1, local_renderer.num_rendered_frames()); | 420 EXPECT_EQ(1, local_renderer.num_rendered_frames()); |
426 | 421 |
427 track->set_enabled(true); | 422 track->set_enabled(true); |
428 EXPECT_TRUE(capturer->CaptureFrame()); | 423 EXPECT_TRUE(capturer->CaptureFrame()); |
429 EXPECT_EQ(2, local_renderer.num_rendered_frames()); | 424 EXPECT_EQ(2, local_renderer.num_rendered_frames()); |
430 } | 425 } |
431 | 426 |
OLD | NEW |