| 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 | 29 |
| 30 #include "talk/app/webrtc/fakeportallocatorfactory.h" | 30 #include "talk/app/webrtc/fakeportallocatorfactory.h" |
| 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 | 45 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 PeerConnectionInterface::IceConnectionState new_state) {} | 99 PeerConnectionInterface::IceConnectionState new_state) {} |
| 97 virtual void OnIceGatheringChange( | 100 virtual void OnIceGatheringChange( |
| 98 PeerConnectionInterface::IceGatheringState new_state) {} | 101 PeerConnectionInterface::IceGatheringState new_state) {} |
| 99 virtual void OnIceCandidate(const webrtc::IceCandidateInterface* candidate) {} | 102 virtual void OnIceCandidate(const webrtc::IceCandidateInterface* candidate) {} |
| 100 }; | 103 }; |
| 101 | 104 |
| 102 } // namespace | 105 } // namespace |
| 103 | 106 |
| 104 class PeerConnectionFactoryTest : public testing::Test { | 107 class PeerConnectionFactoryTest : public testing::Test { |
| 105 void SetUp() { | 108 void SetUp() { |
| 109 #ifdef WEBRTC_ANDROID |
| 110 webrtc::InitializeAndroidObjects(); |
| 111 #endif |
| 106 factory_ = webrtc::CreatePeerConnectionFactory(rtc::Thread::Current(), | 112 factory_ = webrtc::CreatePeerConnectionFactory(rtc::Thread::Current(), |
| 107 rtc::Thread::Current(), | 113 rtc::Thread::Current(), |
| 108 NULL, | 114 NULL, |
| 109 NULL, | 115 NULL, |
| 110 NULL); | 116 NULL); |
| 111 | 117 |
| 112 ASSERT_TRUE(factory_.get() != NULL); | 118 ASSERT_TRUE(factory_.get() != NULL); |
| 113 allocator_factory_ = webrtc::FakePortAllocatorFactory::Create(); | 119 allocator_factory_ = webrtc::FakePortAllocatorFactory::Create(); |
| 114 } | 120 } |
| 115 | 121 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 143 } | 149 } |
| 144 | 150 |
| 145 rtc::scoped_refptr<PeerConnectionFactoryInterface> factory_; | 151 rtc::scoped_refptr<PeerConnectionFactoryInterface> factory_; |
| 146 NullPeerConnectionObserver observer_; | 152 NullPeerConnectionObserver observer_; |
| 147 rtc::scoped_refptr<PortAllocatorFactoryInterface> allocator_factory_; | 153 rtc::scoped_refptr<PortAllocatorFactoryInterface> allocator_factory_; |
| 148 }; | 154 }; |
| 149 | 155 |
| 150 // Verify creation of PeerConnection using internal ADM, video factory and | 156 // Verify creation of PeerConnection using internal ADM, video factory and |
| 151 // internal libjingle threads. | 157 // internal libjingle threads. |
| 152 TEST(PeerConnectionFactoryTestInternal, CreatePCUsingInternalModules) { | 158 TEST(PeerConnectionFactoryTestInternal, CreatePCUsingInternalModules) { |
| 159 #ifdef WEBRTC_ANDROID |
| 160 webrtc::InitializeAndroidObjects(); |
| 161 #endif |
| 162 |
| 153 rtc::scoped_refptr<PeerConnectionFactoryInterface> factory( | 163 rtc::scoped_refptr<PeerConnectionFactoryInterface> factory( |
| 154 webrtc::CreatePeerConnectionFactory()); | 164 webrtc::CreatePeerConnectionFactory()); |
| 155 | 165 |
| 156 NullPeerConnectionObserver observer; | 166 NullPeerConnectionObserver observer; |
| 157 webrtc::PeerConnectionInterface::IceServers servers; | 167 webrtc::PeerConnectionInterface::IceServers servers; |
| 158 | 168 |
| 159 rtc::scoped_ptr<FakeDtlsIdentityStore> dtls_identity_store( | 169 rtc::scoped_ptr<FakeDtlsIdentityStore> dtls_identity_store( |
| 160 new FakeDtlsIdentityStore()); | 170 new FakeDtlsIdentityStore()); |
| 161 rtc::scoped_refptr<PeerConnectionInterface> pc( | 171 rtc::scoped_refptr<PeerConnectionInterface> pc( |
| 162 factory->CreatePeerConnection( | 172 factory->CreatePeerConnection( |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 | 427 |
| 418 track->set_enabled(false); | 428 track->set_enabled(false); |
| 419 EXPECT_TRUE(capturer->CaptureFrame()); | 429 EXPECT_TRUE(capturer->CaptureFrame()); |
| 420 EXPECT_EQ(1, local_renderer.num_rendered_frames()); | 430 EXPECT_EQ(1, local_renderer.num_rendered_frames()); |
| 421 | 431 |
| 422 track->set_enabled(true); | 432 track->set_enabled(true); |
| 423 EXPECT_TRUE(capturer->CaptureFrame()); | 433 EXPECT_TRUE(capturer->CaptureFrame()); |
| 424 EXPECT_EQ(2, local_renderer.num_rendered_frames()); | 434 EXPECT_EQ(2, local_renderer.num_rendered_frames()); |
| 425 } | 435 } |
| 426 | 436 |
| OLD | NEW |