| 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 12 matching lines...) Expand all Loading... |
| 23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | 23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
| 24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | 24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
| 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 #include <utility> | 29 #include <utility> |
| 30 | 30 |
| 31 #include "talk/app/webrtc/mediastreaminterface.h" | 31 #include "talk/app/webrtc/mediastreaminterface.h" |
| 32 #include "talk/app/webrtc/peerconnectionfactory.h" | 32 #include "talk/app/webrtc/peerconnectionfactory.h" |
| 33 #ifdef WEBRTC_ANDROID |
| 34 #include "talk/app/webrtc/test/androidtestinitializer.h" |
| 35 #endif |
| 33 #include "talk/app/webrtc/test/fakedtlsidentitystore.h" | 36 #include "talk/app/webrtc/test/fakedtlsidentitystore.h" |
| 34 #include "talk/app/webrtc/test/fakevideotrackrenderer.h" | 37 #include "talk/app/webrtc/test/fakevideotrackrenderer.h" |
| 35 #include "talk/app/webrtc/videosourceinterface.h" | 38 #include "talk/app/webrtc/videosourceinterface.h" |
| 36 #include "talk/media/base/fakevideocapturer.h" | 39 #include "talk/media/base/fakevideocapturer.h" |
| 37 #include "talk/media/webrtc/webrtccommon.h" | 40 #include "talk/media/webrtc/webrtccommon.h" |
| 38 #include "talk/media/webrtc/webrtcvoe.h" | 41 #include "talk/media/webrtc/webrtcvoe.h" |
| 39 #include "webrtc/base/gunit.h" | 42 #include "webrtc/base/gunit.h" |
| 40 #include "webrtc/base/scoped_ptr.h" | 43 #include "webrtc/base/scoped_ptr.h" |
| 41 #include "webrtc/base/thread.h" | 44 #include "webrtc/base/thread.h" |
| 42 #include "webrtc/p2p/client/fakeportallocator.h" | 45 #include "webrtc/p2p/client/fakeportallocator.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 PeerConnectionInterface::IceConnectionState new_state) {} | 94 PeerConnectionInterface::IceConnectionState new_state) {} |
| 92 virtual void OnIceGatheringChange( | 95 virtual void OnIceGatheringChange( |
| 93 PeerConnectionInterface::IceGatheringState new_state) {} | 96 PeerConnectionInterface::IceGatheringState new_state) {} |
| 94 virtual void OnIceCandidate(const webrtc::IceCandidateInterface* candidate) {} | 97 virtual void OnIceCandidate(const webrtc::IceCandidateInterface* candidate) {} |
| 95 }; | 98 }; |
| 96 | 99 |
| 97 } // namespace | 100 } // namespace |
| 98 | 101 |
| 99 class PeerConnectionFactoryTest : public testing::Test { | 102 class PeerConnectionFactoryTest : public testing::Test { |
| 100 void SetUp() { | 103 void SetUp() { |
| 104 #ifdef WEBRTC_ANDROID |
| 105 webrtc::InitializeAndroidObjects(); |
| 106 #endif |
| 101 factory_ = webrtc::CreatePeerConnectionFactory(rtc::Thread::Current(), | 107 factory_ = webrtc::CreatePeerConnectionFactory(rtc::Thread::Current(), |
| 102 rtc::Thread::Current(), | 108 rtc::Thread::Current(), |
| 103 NULL, | 109 NULL, |
| 104 NULL, | 110 NULL, |
| 105 NULL); | 111 NULL); |
| 106 | 112 |
| 107 ASSERT_TRUE(factory_.get() != NULL); | 113 ASSERT_TRUE(factory_.get() != NULL); |
| 108 port_allocator_.reset( | 114 port_allocator_.reset( |
| 109 new cricket::FakePortAllocator(rtc::Thread::Current(), nullptr)); | 115 new cricket::FakePortAllocator(rtc::Thread::Current(), nullptr)); |
| 110 raw_port_allocator_ = port_allocator_.get(); | 116 raw_port_allocator_ = port_allocator_.get(); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 136 NullPeerConnectionObserver observer_; | 142 NullPeerConnectionObserver observer_; |
| 137 rtc::scoped_ptr<cricket::FakePortAllocator> port_allocator_; | 143 rtc::scoped_ptr<cricket::FakePortAllocator> port_allocator_; |
| 138 // Since the PC owns the port allocator after it's been initialized, | 144 // Since the PC owns the port allocator after it's been initialized, |
| 139 // this should only be used when known to be safe. | 145 // this should only be used when known to be safe. |
| 140 cricket::FakePortAllocator* raw_port_allocator_; | 146 cricket::FakePortAllocator* raw_port_allocator_; |
| 141 }; | 147 }; |
| 142 | 148 |
| 143 // Verify creation of PeerConnection using internal ADM, video factory and | 149 // Verify creation of PeerConnection using internal ADM, video factory and |
| 144 // internal libjingle threads. | 150 // internal libjingle threads. |
| 145 TEST(PeerConnectionFactoryTestInternal, CreatePCUsingInternalModules) { | 151 TEST(PeerConnectionFactoryTestInternal, CreatePCUsingInternalModules) { |
| 152 #ifdef WEBRTC_ANDROID |
| 153 webrtc::InitializeAndroidObjects(); |
| 154 #endif |
| 155 |
| 146 rtc::scoped_refptr<PeerConnectionFactoryInterface> factory( | 156 rtc::scoped_refptr<PeerConnectionFactoryInterface> factory( |
| 147 webrtc::CreatePeerConnectionFactory()); | 157 webrtc::CreatePeerConnectionFactory()); |
| 148 | 158 |
| 149 NullPeerConnectionObserver observer; | 159 NullPeerConnectionObserver observer; |
| 150 webrtc::PeerConnectionInterface::RTCConfiguration config; | 160 webrtc::PeerConnectionInterface::RTCConfiguration config; |
| 151 | 161 |
| 152 rtc::scoped_ptr<FakeDtlsIdentityStore> dtls_identity_store( | 162 rtc::scoped_ptr<FakeDtlsIdentityStore> dtls_identity_store( |
| 153 new FakeDtlsIdentityStore()); | 163 new FakeDtlsIdentityStore()); |
| 154 rtc::scoped_refptr<PeerConnectionInterface> pc(factory->CreatePeerConnection( | 164 rtc::scoped_refptr<PeerConnectionInterface> pc(factory->CreatePeerConnection( |
| 155 config, nullptr, nullptr, std::move(dtls_identity_store), &observer)); | 165 config, nullptr, nullptr, std::move(dtls_identity_store), &observer)); |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 | 363 |
| 354 track->set_enabled(false); | 364 track->set_enabled(false); |
| 355 EXPECT_TRUE(capturer->CaptureFrame()); | 365 EXPECT_TRUE(capturer->CaptureFrame()); |
| 356 EXPECT_EQ(1, local_renderer.num_rendered_frames()); | 366 EXPECT_EQ(1, local_renderer.num_rendered_frames()); |
| 357 | 367 |
| 358 track->set_enabled(true); | 368 track->set_enabled(true); |
| 359 EXPECT_TRUE(capturer->CaptureFrame()); | 369 EXPECT_TRUE(capturer->CaptureFrame()); |
| 360 EXPECT_EQ(2, local_renderer.num_rendered_frames()); | 370 EXPECT_EQ(2, local_renderer.num_rendered_frames()); |
| 361 } | 371 } |
| 362 | 372 |
| OLD | NEW |