Skip to content
Snippets Groups Projects
Commit 7d76a423 authored by Alexandre Savard's avatar Alexandre Savard
Browse files

[#5331] Added first SDP session tests

parent 02236589
Branches
Tags
No related merge requests found
...@@ -258,18 +258,18 @@ void AudioRtpFactory::updateSessionMedia (AudioCodec *audiocodec) ...@@ -258,18 +258,18 @@ void AudioRtpFactory::updateSessionMedia (AudioCodec *audiocodec)
} }
switch (_rtpSessionType) { switch (_rtpSessionType) {
case Sdes: case Sdes:
static_cast<AudioSrtpSession *> (_rtpSession)->updateSessionMedia (audiocodec); static_cast<AudioSrtpSession *> (_rtpSession)->updateSessionMedia (audiocodec);
break; break;
case Symmetric: case Symmetric:
static_cast<AudioSymmetricRtpSession *> (_rtpSession)->updateSessionMedia (audiocodec); static_cast<AudioSymmetricRtpSession *> (_rtpSession)->updateSessionMedia (audiocodec);
break; break;
case Zrtp: case Zrtp:
static_cast<AudioZrtpSession *> (_rtpSession)->updateSessionMedia (audiocodec); static_cast<AudioZrtpSession *> (_rtpSession)->updateSessionMedia (audiocodec);
break; break;
default:
_debug("AudioRtpFactory: Unknown session type");
break;
} }
} }
......
...@@ -30,7 +30,9 @@ test_SOURCES = \ ...@@ -30,7 +30,9 @@ test_SOURCES = \
instantmessagingtest.h \ instantmessagingtest.h \
instantmessagingtest.cpp \ instantmessagingtest.cpp \
siptest.h \ siptest.h \
siptest.cpp siptest.cpp \
sdptest.h \
sdptest.cpp
LLIBS=$(CPPUNIT_LIBS) \ LLIBS=$(CPPUNIT_LIBS) \
../src/sflphoned-logger.o \ ../src/sflphoned-logger.o \
......
...@@ -49,29 +49,10 @@ ...@@ -49,29 +49,10 @@
void RtpTest::setUp() void RtpTest::setUp()
{ {
pjsipInit();
CallID cid = "123456";
sipcall = new SIPCall (cid, Call::Incoming, _pool);
sipcall->setLocalIp ("127.0.0.1");
sipcall->setLocalAudioPort (RANDOM_LOCAL_PORT);
sipcall->setLocalExternAudioPort (RANDOM_LOCAL_PORT);
} }
bool RtpTest::pjsipInit() bool RtpTest::pjsipInit()
{ {
// Create memory cache for pool
pj_caching_pool_init (&_cp, &pj_pool_factory_default_policy, 0);
// Create memory pool for application.
_pool = pj_pool_create (&_cp.factory, "rtpTest", 4000, 4000, NULL);
if (!_pool) {
_debug ("----- RtpTest: Could not initialize pjsip memory pool ------");
return PJ_ENOMEM;
}
return true; return true;
} }
...@@ -80,46 +61,8 @@ void RtpTest::testRtpInitClose() ...@@ -80,46 +61,8 @@ void RtpTest::testRtpInitClose()
{ {
_debug ("-------------------- RtpTest::testRtpInitClose --------------------\n"); _debug ("-------------------- RtpTest::testRtpInitClose --------------------\n");
audiortp = new AudioRtpFactory();
try {
_debug ("-------- Open Rtp Session ----------");
audiortp->initAudioRtpConfig (sipcall);
audiortp->initAudioRtpSession (sipcall);
//AudioCodecType codecType = PAYLOAD_CODEC_ULAW;
//AudioCodec* audioCodec = Manager::instance().getCodecDescriptorMap().instantiateCodec(codecType);
//audiortp->start(audioCodec);
} catch (...) {
_debug ("!!! Exception occured while Oppenning Rtp !!!");
CPPUNIT_ASSERT (false);
}
CPPUNIT_ASSERT (audiortp != NULL);
sleep (1);
_debug ("------ RtpTest::testRtpClose() ------");
try {
_debug ("------ Close Rtp Session -------");
audiortp->stop();
} catch (...) {
_debug ("!!! Exception occured while closing Rtp !!!");
CPPUNIT_ASSERT (false);
}
delete audiortp;
audiortp = NULL;
} }
void RtpTest::tearDown() void RtpTest::tearDown()
{ {
delete sipcall;
sipcall = NULL;
} }
...@@ -53,7 +53,7 @@ class SIPTest : public CppUnit::TestCase { ...@@ -53,7 +53,7 @@ class SIPTest : public CppUnit::TestCase {
* Use cppunit library macros to add unit test the factory * Use cppunit library macros to add unit test the factory
*/ */
CPPUNIT_TEST_SUITE( SIPTest ); CPPUNIT_TEST_SUITE( SIPTest );
CPPUNIT_TEST ( testSimpleOutgoingIpCall ); // CPPUNIT_TEST ( testSimpleOutgoingIpCall );
// CPPUNIT_TEST ( testSimpleIncomingIpCall ); // CPPUNIT_TEST ( testSimpleIncomingIpCall );
// CPPUNIT_TEST ( testTwoOutgoingIpCall ); // CPPUNIT_TEST ( testTwoOutgoingIpCall );
// CPPUNIT_TEST ( testTwoIncomingIpCall ); // CPPUNIT_TEST ( testTwoIncomingIpCall );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment