diff -r 73a1feb507fb -r bc78a40cd63c mmshplugins/mmshsipcrplugin/tsrc/ut_sipcrplugin/src/mussipcrplugintest.cpp --- a/mmshplugins/mmshsipcrplugin/tsrc/ut_sipcrplugin/src/mussipcrplugintest.cpp Tue Aug 31 15:12:07 2010 +0300 +++ b/mmshplugins/mmshsipcrplugin/tsrc/ut_sipcrplugin/src/mussipcrplugintest.cpp Wed Sep 01 12:31:01 2010 +0100 @@ -15,76 +15,25 @@ * */ - +#include #include "musunittesting.h" #include "musmanagerstub.h" #include "mussipcrplugin.h" #include "mussipcrplugintest.h" #include "muslogger.h" #include "musmanager.h" -#include "mussettings.h" #include #include #include #include -#include #include -#include -#include +#include "FeatMgr.h" + // Next row is to disable warning emerging from EUnit code. #pragma warn_illtokenpasting off -_LIT8( KSdpSendOnly, "v=0\r\n\ -o=Inviter2008 63241204263093750 132223800 IN IP4 10.0.0.6\r\n\ -s=-\r\n\ -c=IN IP4 10.0.0.6\r\n\ -t=0 0\r\n\ -m=video 49152 RTP/AVP 98\r\n\ -a=sendonly\r\n\ -a=rtpmap:98 H264/90000\r\n" ); - -_LIT8( KSdpSendRecv, "v=0\r\n\ -o=Inviter2008 63241204263093750 132223800 IN IP4 10.0.0.6\r\n\ -s=-\r\n\ -c=IN IP4 10.0.0.6\r\n\ -t=0 0\r\n\ -m=video 49152 RTP/AVP 98\r\n\ -a=sendrecv\r\n\ -a=rtpmap:98 H264/90000\r\n" ); - -_LIT8( KSdpNoMedia, "v=0\r\n\ -o=Inviter2008 63241204263093750 132223800 IN IP4 10.0.0.6\r\n\ -s=-\r\n\ -c=IN IP4 10.0.0.6\r\n\ -t=0 0\r\n" ); - -_LIT8( KSdpNoVideo, "v=0\r\n\ -o=Inviter2008 63241204263093750 132223800 IN IP4 10.0.0.6\r\n\ -s=-\r\n\ -c=IN IP4 10.0.0.6\r\n\ -t=0 0\r\n\ -m=audio 5000 RTP/AVP 106 8 0\r\n\ -a=sendrecv\r\n\ -a=rtpmap:106 AMR/8000\r\n" ); - -_LIT8( KSdpVideoNoAttributes, "v=0\r\n\ -o=Inviter2008 63241204263093750 132223800 IN IP4 10.0.0.6\r\n\ -s=-\r\n\ -c=IN IP4 10.0.0.6\r\n\ -t=0 0\r\n\ -m=video 49152 RTP/AVP 98\r\n" ); - -_LIT8( KSdpRecvOnly, "v=0\r\n\ -o=Inviter2008 63241204263093750 132223800 IN IP4 10.0.0.6\r\n\ -s=-\r\n\ -c=IN IP4 10.0.0.6\r\n\ -t=0 0\r\n\ -m=video 49152 RTP/AVP 98\r\n\ -a=recvonly\r\n\ -a=rtpmap:98 H264/90000\r\n" ); - // -------------------------------------------------------------------------- // C++ constructor. @@ -140,7 +89,6 @@ void CMusSipCrPluginTest::SetupL( ) { iPlugin = CMusSipCrPlugin::NewL(); - SIPStrings::OpenL(); } @@ -150,7 +98,6 @@ // void CMusSipCrPluginTest::Teardown( ) { - SIPStrings::Close(); delete iPlugin; } @@ -158,29 +105,6 @@ // ------------------------- Test functions begin --------------------------- -// -------------------------------------------------------------------------- -// -// -------------------------------------------------------------------------- -// -void CMusSipCrPluginTest::UT_ConstructL() - { - // 1. String pool was opend by us - EUNIT_ASSERT( iPlugin->iCloseStringPool ); - - // 2. String pool was already opened by someone else, KErrAlreadyExists - delete iPlugin; - iPlugin = NULL; - SdpCodecStringPool::OpenL(); - TRAPD( err, iPlugin = CMusSipCrPlugin::NewL() ); - if ( err != KErrNone ) - { - SdpCodecStringPool::Close(); - User::Leave(err); - } - EUNIT_ASSERT( !iPlugin->iCloseStringPool ); - SdpCodecStringPool::Close(); - } - // -------------------------------------------------------------------------- // @@ -188,6 +112,8 @@ // void CMusSipCrPluginTest::UT_ChannelL() { + SIPStrings::OpenL(); + RPointerArray array; TUid response; @@ -202,7 +128,7 @@ EUNIT_ASSERT( response.iUid == CMusManager::ESipOptions ) - // Everything is OK, 2-way video not supported + // Everything is OK CMusManager::SetAvailability( ( MultimediaSharing::TMusAvailabilityStatus ) KErrNone ); @@ -236,28 +162,53 @@ NULL ); EUNIT_ASSERT( response.iUid == CMusManager::ESipInviteNotDesired ) - - // 2-way video is supported and sendrecv not present in SDP - MultimediaSharingSettings::iVideoDirection = MusSettingsKeys::ETwoWayVideo; + //Feature Manager testing + FeatureManager::MultimediaSharingNotSupported(); + response = iPlugin->ChannelL( + SIPStrings::StringF( SipStrConsts::EOptions ), + KNullDesC8(), + array, + KNullDesC8(), + NULL ); + + EUNIT_ASSERT( response.iUid == CMusManager::ESipInviteNotDesired ) + // Everything is OK CMusManager::SetAvailability( ( MultimediaSharing::TMusAvailabilityStatus ) KErrNone ); - + response = iPlugin->ChannelL( SIPStrings::StringF( SipStrConsts::EMessage ), KNullDesC8(), array, - KSdpSendOnly(), + KNullDesC8(), NULL ); - - EUNIT_ASSERT( response.iUid == CMusManager::ESipInviteDesired ) + + EUNIT_ASSERT( response.iUid == CMusManager::ESipInviteNotDesired ) - // 2-way video is supported and sendrecv is present in SDP + // Server is shut down + CMusManager::SetAvailability( MultimediaSharing::EErrServerShutDown ); + response = iPlugin->ChannelL( SIPStrings::StringF( SipStrConsts::EMessage ), KNullDesC8(), array, - KSdpSendRecv(), + KNullDesC8(), NULL ); - - EUNIT_ASSERT( response.iUid == CMusManager::ESipInviteDesired2WayVideo ) + + EUNIT_ASSERT( response.iUid == CMusManager::ESipInviteNotDesired ) + + // Mus is not supported + CMusManager::SetAvailability( + ( MultimediaSharing::TMusAvailabilityStatus ) KErrNotSupported ); + + response = iPlugin->ChannelL( SIPStrings::StringF( SipStrConsts::EMessage ), + KNullDesC8(), + array, + KNullDesC8(), + NULL ); + + EUNIT_ASSERT( response.iUid == CMusManager::ESipInviteNotDesired ) + FeatureManager::MultimediaSharingSupported(); + SIPStrings::Close(); + } @@ -318,45 +269,6 @@ } -// -------------------------------------------------------------------------- -// -// -------------------------------------------------------------------------- -// -void CMusSipCrPluginTest::UT_CheckForSendRecvAttributeL() - { - CSdpDocument* sdpDocument; - TBool sendRecv; - - // 1. SDP doesn't have a single media field - sdpDocument = CSdpDocument::DecodeLC( KSdpNoMedia() ); - sendRecv = iPlugin->CheckForSendRecvAttributeL( sdpDocument->MediaFields() ); - CleanupStack::PopAndDestroy( sdpDocument ); - EUNIT_ASSERT( !sendRecv ); - - // 2. SDP has audio field, but no video - sdpDocument = CSdpDocument::DecodeLC( KSdpNoVideo() ); - sendRecv = iPlugin->CheckForSendRecvAttributeL( sdpDocument->MediaFields() ); - CleanupStack::PopAndDestroy( sdpDocument ); - EUNIT_ASSERT( !sendRecv ); - - // 3. SDP has video field without any attributes - sdpDocument = CSdpDocument::DecodeLC( KSdpVideoNoAttributes() ); - sendRecv = iPlugin->CheckForSendRecvAttributeL( sdpDocument->MediaFields() ); - CleanupStack::PopAndDestroy( sdpDocument ); - EUNIT_ASSERT( sendRecv ); - - // 4. SDP has video with "sendrecv" attribute - sdpDocument = CSdpDocument::DecodeLC( KSdpSendRecv() ); - sendRecv = iPlugin->CheckForSendRecvAttributeL( sdpDocument->MediaFields() ); - CleanupStack::PopAndDestroy( sdpDocument ); - EUNIT_ASSERT( sendRecv ); - - // 5. SDP has video with "recvonly" attribute - sdpDocument = CSdpDocument::DecodeLC( KSdpRecvOnly() ); - sendRecv = iPlugin->CheckForSendRecvAttributeL( sdpDocument->MediaFields() ); - CleanupStack::PopAndDestroy( sdpDocument ); - EUNIT_ASSERT( !sendRecv ); - } // TEST TABLE @@ -365,13 +277,6 @@ CMusSipCrPluginTest, "CMusSipCrPluginTest", "CMusSipCrPluginTest" ) - -EUNIT_TEST( - "ConstructL - test", - "CMusSipCrPluginTest", - "UT_ConstructL", - "FUNCTIONALITY", - SetupL, UT_ConstructL, Teardown) EUNIT_TEST( "CMusSipCrPluginTest", @@ -401,12 +306,5 @@ "FUNCTIONALITY", SetupL, UT_ImplementationGroupProxy, Teardown) -EUNIT_TEST( - "CheckForSendRecvAttribute - stest", - "CMusSipCrPluginTest", - "UT_CheckForSendRecvAttribute", - "FUNCTIONALITY", - SetupL, UT_CheckForSendRecvAttributeL, Teardown) - EUNIT_END_TEST_TABLE