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