| 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 14 matching lines...) Expand all Loading... |
| 25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 26 */ | 26 */ |
| 27 | 27 |
| 28 #include <string> | 28 #include <string> |
| 29 | 29 |
| 30 #include "talk/app/webrtc/fakeportallocatorfactory.h" | 30 #include "talk/app/webrtc/fakeportallocatorfactory.h" |
| 31 #include "talk/app/webrtc/jsepsessiondescription.h" | 31 #include "talk/app/webrtc/jsepsessiondescription.h" |
| 32 #include "talk/app/webrtc/mediastreaminterface.h" | 32 #include "talk/app/webrtc/mediastreaminterface.h" |
| 33 #include "talk/app/webrtc/peerconnectioninterface.h" | 33 #include "talk/app/webrtc/peerconnectioninterface.h" |
| 34 #include "talk/app/webrtc/test/fakeconstraints.h" | 34 #include "talk/app/webrtc/test/fakeconstraints.h" |
| 35 #include "talk/app/webrtc/test/fakedtlsidentityservice.h" | 35 #include "talk/app/webrtc/test/fakedtlsidentitystore.h" |
| 36 #include "talk/app/webrtc/test/mockpeerconnectionobservers.h" | 36 #include "talk/app/webrtc/test/mockpeerconnectionobservers.h" |
| 37 #include "talk/app/webrtc/test/testsdpstrings.h" | 37 #include "talk/app/webrtc/test/testsdpstrings.h" |
| 38 #include "talk/app/webrtc/videosource.h" | 38 #include "talk/app/webrtc/videosource.h" |
| 39 #include "talk/media/base/fakevideocapturer.h" | 39 #include "talk/media/base/fakevideocapturer.h" |
| 40 #include "talk/media/sctp/sctpdataengine.h" | 40 #include "talk/media/sctp/sctpdataengine.h" |
| 41 #include "talk/session/media/mediasession.h" | 41 #include "talk/session/media/mediasession.h" |
| 42 #include "webrtc/base/gunit.h" | 42 #include "webrtc/base/gunit.h" |
| 43 #include "webrtc/base/scoped_ptr.h" | 43 #include "webrtc/base/scoped_ptr.h" |
| 44 #include "webrtc/base/ssladapter.h" | 44 #include "webrtc/base/ssladapter.h" |
| 45 #include "webrtc/base/sslstreamadapter.h" | 45 #include "webrtc/base/sslstreamadapter.h" |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 // tests in this file. We only create a FakeIdentityService if the test | 257 // tests in this file. We only create a FakeIdentityService if the test |
| 258 // explicitly sets the constraint. | 258 // explicitly sets the constraint. |
| 259 FakeConstraints default_constraints; | 259 FakeConstraints default_constraints; |
| 260 if (!constraints) { | 260 if (!constraints) { |
| 261 constraints = &default_constraints; | 261 constraints = &default_constraints; |
| 262 | 262 |
| 263 default_constraints.AddMandatory( | 263 default_constraints.AddMandatory( |
| 264 webrtc::MediaConstraintsInterface::kEnableDtlsSrtp, false); | 264 webrtc::MediaConstraintsInterface::kEnableDtlsSrtp, false); |
| 265 } | 265 } |
| 266 | 266 |
| 267 FakeIdentityService* dtls_service = NULL; | 267 scoped_ptr<webrtc::DtlsIdentityStoreInterface> dtls_identity_store; |
| 268 bool dtls; | 268 bool dtls; |
| 269 if (FindConstraint(constraints, | 269 if (FindConstraint(constraints, |
| 270 webrtc::MediaConstraintsInterface::kEnableDtlsSrtp, | 270 webrtc::MediaConstraintsInterface::kEnableDtlsSrtp, |
| 271 &dtls, | 271 &dtls, |
| 272 NULL) && dtls) { | 272 nullptr) && dtls) { |
| 273 dtls_service = new FakeIdentityService(); | 273 dtls_identity_store.reset(new FakeDtlsIdentityStore()); |
| 274 } | 274 } |
| 275 pc_ = pc_factory_->CreatePeerConnection(servers, constraints, | 275 pc_ = pc_factory_->CreatePeerConnection(servers, constraints, |
| 276 port_allocator_factory_.get(), | 276 port_allocator_factory_.get(), |
| 277 dtls_service, | 277 dtls_identity_store.Pass(), |
| 278 &observer_); | 278 &observer_); |
| 279 ASSERT_TRUE(pc_.get() != NULL); | 279 ASSERT_TRUE(pc_.get() != NULL); |
| 280 observer_.SetPeerConnectionInterface(pc_.get()); | 280 observer_.SetPeerConnectionInterface(pc_.get()); |
| 281 EXPECT_EQ(PeerConnectionInterface::kStable, observer_.state_); | 281 EXPECT_EQ(PeerConnectionInterface::kStable, observer_.state_); |
| 282 } | 282 } |
| 283 | 283 |
| 284 void CreatePeerConnectionWithDifferentConfigurations() { | 284 void CreatePeerConnectionWithDifferentConfigurations() { |
| 285 CreatePeerConnection(kStunAddressOnly, "", NULL); | 285 CreatePeerConnection(kStunAddressOnly, "", NULL); |
| 286 EXPECT_EQ(1u, port_allocator_factory_->stun_configs().size()); | 286 EXPECT_EQ(1u, port_allocator_factory_->stun_configs().size()); |
| 287 EXPECT_EQ(0u, port_allocator_factory_->turn_configs().size()); | 287 EXPECT_EQ(0u, port_allocator_factory_->turn_configs().size()); |
| (...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1218 sdp, NULL); | 1218 sdp, NULL); |
| 1219 EXPECT_FALSE(DoSetLocalDescription(local_offer)); | 1219 EXPECT_FALSE(DoSetLocalDescription(local_offer)); |
| 1220 } | 1220 } |
| 1221 | 1221 |
| 1222 // Test that GetStats can still be called after PeerConnection::Close. | 1222 // Test that GetStats can still be called after PeerConnection::Close. |
| 1223 TEST_F(PeerConnectionInterfaceTest, CloseAndGetStats) { | 1223 TEST_F(PeerConnectionInterfaceTest, CloseAndGetStats) { |
| 1224 InitiateCall(); | 1224 InitiateCall(); |
| 1225 pc_->Close(); | 1225 pc_->Close(); |
| 1226 DoGetStats(NULL); | 1226 DoGetStats(NULL); |
| 1227 } | 1227 } |
| OLD | NEW |