rtp/rtpstack/tsrc/ut_rtpstack/src/UT_CRtpSessionSRTP.cpp
branchRCL_3
changeset 44 0dcb073356a5
parent 43 b5e99d8877c7
equal deleted inserted replaced
43:b5e99d8877c7 44:0dcb073356a5
   519     delete iDecryptedPayload;
   519     delete iDecryptedPayload;
   520     delete iTestPayload160Bits;
   520     delete iTestPayload160Bits;
   521     delete iTestMKI128Bits;
   521     delete iTestMKI128Bits;
   522     delete iTestAuthTag80Bits;
   522     delete iTestAuthTag80Bits;
   523 
   523 
   524 	iDecryptedPayload = NULL;
       
   525     iTestPayload160Bits = NULL;
       
   526     iTestMKI128Bits = NULL;
       
   527     iTestAuthTag80Bits = NULL;
       
   528 	
       
   529     delete iStreamIn;
   524     delete iStreamIn;
   530     delete iStreamOut;
   525     delete iStreamOut;
   531     delete iSRTPSession;    
   526     delete iSRTPSession;    
   532     
   527 
   533 	iStreamIn = NULL;
       
   534     iStreamOut = NULL;
       
   535     iSRTPSession = NULL;
       
   536 	
       
   537     delete iRFC3711_SessionEncrKey128bits;
   528     delete iRFC3711_SessionEncrKey128bits;
   538     delete iRFC3711_SessionSaltKey128bits;
   529     delete iRFC3711_SessionSaltKey128bits;
   539     delete iRFC3711_SessionAuthKey128bits;    
   530     delete iRFC3711_SessionAuthKey128bits;    
   540     
   531     iRFC3711_TestMasterKey128bits.Zero();
   541 	iRFC3711_SessionEncrKey128bits = NULL;
       
   542     iRFC3711_SessionSaltKey128bits = NULL;
       
   543     iRFC3711_SessionAuthKey128bits = NULL;   
       
   544 	
       
   545 	
       
   546 	iRFC3711_TestMasterKey128bits.Zero();
       
   547     iRFC3711_TestMasterSalt112bits.Zero();
   532     iRFC3711_TestMasterSalt112bits.Zero();
   548     iMKI.Zero();
   533     iMKI.Zero();
   549 
   534 
   550     
   535     
   551     }
   536     }
   660     iSession->iCommNet->iSender[ERTPPort]->iStatus = TRequestStatus();
   645     iSession->iCommNet->iSender[ERTPPort]->iStatus = TRequestStatus();
   661     User::WaitForRequest( status );
   646     User::WaitForRequest( status );
   662  	RTP_EUNIT_ASSERT_EQUALS(status, KErrNone)
   647  	RTP_EUNIT_ASSERT_EQUALS(status, KErrNone)
   663     }
   648     }
   664 
   649 
   665 void UT_CRtpSessionSrtp::UT_CRtpSessionSrtp_SendRtpPacket_OneL(  )
   650 void UT_CRtpSessionSrtp::UT_CRtpSessionSrtp_SendRtpPacket_1L(  )
   666     {
   651     {
   667     //Test more branch
   652     //Test more branch
   668        TInt error( KErrNone );
   653        TInt error( KErrNone );
   669 
   654 
   670     // Initialise lots of values
   655     // Initialise lots of values
   696     iSession->iCommNet->iSender[ERTPPort]->iStatus = TRequestStatus();
   681     iSession->iCommNet->iSender[ERTPPort]->iStatus = TRequestStatus();
   697     User::WaitForRequest( status );
   682     User::WaitForRequest( status );
   698  	RTP_EUNIT_ASSERT_EQUALS(status, KErrNone)
   683  	RTP_EUNIT_ASSERT_EQUALS(status, KErrNone)
   699     }
   684     }
   700  
   685  
   701 void UT_CRtpSessionSrtp::UT_CRtpSessionSrtp_SendRtpPacket_OneAL(  )
   686 void UT_CRtpSessionSrtp::UT_CRtpSessionSrtp_SendRtpPacket_1AL(  )
   702     {
   687     {
   703        TInt error( KErrNone );
   688        TInt error( KErrNone );
   704 
   689 
   705     // Initialise lots of values
   690     // Initialise lots of values
   706     TRtpSendHeader header;
   691     TRtpSendHeader header;
   770     error = iSession->SendRtpPacket( iTranstreamId, header, data); 
   755     error = iSession->SendRtpPacket( iTranstreamId, header, data); 
   771     RTP_EUNIT_ASSERT_EQUALS(error, KErrNone);
   756     RTP_EUNIT_ASSERT_EQUALS(error, KErrNone);
   772  	
   757  	
   773     }
   758     }
   774   
   759   
   775   void UT_CRtpSessionSrtp::UT_CRtpSessionSrtp_SendRtpPacket_TwoAL(  )
   760   void UT_CRtpSessionSrtp::UT_CRtpSessionSrtp_SendRtpPacket_2AL(  )
   776     {
   761     {
   777        TInt error( KErrNone );
   762        TInt error( KErrNone );
   778 
   763 
   779     // Initialise lots of values
   764     // Initialise lots of values
   780     TRtpSendHeader header;
   765     TRtpSendHeader header;
   884     CleanupStack::PopAndDestroy( packet );
   869     CleanupStack::PopAndDestroy( packet );
   885     CleanupStack::PopAndDestroy( streamOut );
   870     CleanupStack::PopAndDestroy( streamOut );
   886     
   871     
   887     }
   872     }
   888     
   873     
   889 void UT_CRtpSessionSrtp::UT_CRtpSessionSrtp_OnRtpReceived_OneL(  )
   874 void UT_CRtpSessionSrtp::UT_CRtpSessionSrtp_OnRtpReceived_1L(  )
   890     {
   875     {
   891     
   876     
   892     //cover more branch
   877     //cover more branch
   893     TRtpSSRC ssrcOut( 5678 );
   878     TRtpSSRC ssrcOut( 5678 );
   894 	
   879 	
   935     CleanupStack::PopAndDestroy( packet );
   920     CleanupStack::PopAndDestroy( packet );
   936     CleanupStack::PopAndDestroy( streamOut );
   921     CleanupStack::PopAndDestroy( streamOut );
   937     
   922     
   938     }    
   923     }    
   939 
   924 
   940 void UT_CRtpSessionSrtp::UT_CRtpSessionSrtp_SendSRTCPReportL()
   925 void UT_CRtpSessionSrtp::UT_CRtpSessionSrtp_SendSRTCPReport()
   941 	{
   926 	{
   942 	TInt error( KErrNone );
   927 	TInt error( KErrNone );
   943 	TRtpSSRC ssrcOut( 1234 );
   928 	TRtpSSRC ssrcOut( 1234 );
   944 	TBuf8<5> data;
   929 	TBuf8<5> data;
   945     data.Format( _L8( "foo" ) );
   930     data.Format( _L8( "foo" ) );
  1003   	CleanupStack::PopAndDestroy( packet );
   988   	CleanupStack::PopAndDestroy( packet );
  1004   	CleanupStack::PopAndDestroy( streamOut );
   989   	CleanupStack::PopAndDestroy( streamOut );
  1005 	
   990 	
  1006 	}
   991 	}
  1007 	
   992 	
  1008 void UT_CRtpSessionSrtp::UT_CRtpSessionSrtp_OnRtcpReceivedL()
   993 void UT_CRtpSessionSrtp::UT_CRtpSessionSrtp_OnRtcpReceived()
  1009 	{
   994 	{
  1010 	HBufC8* encSrtcpPacket =HBufC8::NewLC(KRTCPPacket().Length());
   995 	HBufC8* encSrtcpPacket =HBufC8::NewLC(KRTCPPacket().Length());
  1011 	*encSrtcpPacket=KRTCPPacket;
   996 	*encSrtcpPacket=KRTCPPacket;
  1012     Hex(*encSrtcpPacket);
   997     Hex(*encSrtcpPacket);
  1013     TInt len= KRTCPPacket().Length();
   998     TInt len= KRTCPPacket().Length();
  1117 EUNIT_TEST(
  1102 EUNIT_TEST(
  1118     "SendRtpPacket3 - test ",
  1103     "SendRtpPacket3 - test ",
  1119     "CRtpSessionSrtp",
  1104     "CRtpSessionSrtp",
  1120     "SendRtpPacket",
  1105     "SendRtpPacket",
  1121     "FUNCTIONALITY",
  1106     "FUNCTIONALITY",
  1122     SetupL, UT_CRtpSessionSrtp_SendRtpPacket_OneL, Teardown)
  1107     SetupL, UT_CRtpSessionSrtp_SendRtpPacket_1L, Teardown)
  1123 
  1108 
  1124 EUNIT_TEST(
  1109 EUNIT_TEST(
  1125     "SendRtpPacket4 - test ",
  1110     "SendRtpPacket4 - test ",
  1126     "CRtpSessionSrtp",
  1111     "CRtpSessionSrtp",
  1127     "SendRtpPacket",
  1112     "SendRtpPacket",
  1128     "FUNCTIONALITY",
  1113     "FUNCTIONALITY",
  1129     SetupL, UT_CRtpSessionSrtp_SendRtpPacket_OneAL, Teardown)
  1114     SetupL, UT_CRtpSessionSrtp_SendRtpPacket_1AL, Teardown)
  1130 
  1115 
  1131 EUNIT_TEST(
  1116 EUNIT_TEST(
  1132     "SendRtpPacket5 - test ",
  1117     "SendRtpPacket5 - test ",
  1133     "CRtpSessionSrtp",
  1118     "CRtpSessionSrtp",
  1134     "SendRtpPacket",
  1119     "SendRtpPacket",
  1138 EUNIT_TEST(
  1123 EUNIT_TEST(
  1139     "SendRtpPacket6 - test ",
  1124     "SendRtpPacket6 - test ",
  1140     "CRtpSessionSrtp",
  1125     "CRtpSessionSrtp",
  1141     "SendRtpPacket",
  1126     "SendRtpPacket",
  1142     "FUNCTIONALITY",
  1127     "FUNCTIONALITY",
  1143     SetupL, UT_CRtpSessionSrtp_SendRtpPacket_TwoAL, Teardown)
  1128     SetupL, UT_CRtpSessionSrtp_SendRtpPacket_2AL, Teardown)
  1144 
  1129 
  1145 EUNIT_TEST(
  1130 EUNIT_TEST(
  1146     "OnRtpReceived1 - test ",
  1131     "OnRtpReceived1 - test ",
  1147     "CRtpSessionSrtp",
  1132     "CRtpSessionSrtp",
  1148     "OnRtpReceived",
  1133     "OnRtpReceived",
  1152 EUNIT_TEST(
  1137 EUNIT_TEST(
  1153     "OnRtpReceived2 - test ",
  1138     "OnRtpReceived2 - test ",
  1154     "CRtpSessionSrtp",
  1139     "CRtpSessionSrtp",
  1155     "OnRtpReceived",
  1140     "OnRtpReceived",
  1156     "FUNCTIONALITY",
  1141     "FUNCTIONALITY",
  1157     SetupL, UT_CRtpSessionSrtp_OnRtpReceived_OneL, Teardown)
  1142     SetupL, UT_CRtpSessionSrtp_OnRtpReceived_1L, Teardown)
  1158 
  1143 
  1159 EUNIT_TEST(
  1144 EUNIT_TEST(
  1160     "SendSRTCPReport ",
  1145     "SendSRTCPReport ",
  1161     "CRtpSessionSrtp",
  1146     "CRtpSessionSrtp",
  1162     "SendSRTCPReport",
  1147     "SendSRTCPReport",
  1163     "FUNCTIONALITY",
  1148     "FUNCTIONALITY",
  1164     SetupL, UT_CRtpSessionSrtp_SendSRTCPReportL, Teardown)
  1149     SetupL, UT_CRtpSessionSrtp_SendSRTCPReport, Teardown)
  1165 EUNIT_TEST(
  1150 EUNIT_TEST(
  1166     "OnRtcpReceived ",
  1151     "OnRtcpReceived ",
  1167     "CRtpSessionSrtp",
  1152     "CRtpSessionSrtp",
  1168     "OnRtcpReceived",
  1153     "OnRtcpReceived",
  1169     "FUNCTIONALITY",
  1154     "FUNCTIONALITY",
  1170     SetupL, UT_CRtpSessionSrtp_OnRtcpReceivedL, Teardown)
  1155     SetupL, UT_CRtpSessionSrtp_OnRtcpReceived, Teardown)
  1171 
  1156 
  1172   
  1157   
  1173 EUNIT_END_TEST_TABLE
  1158 EUNIT_END_TEST_TABLE
  1174 
  1159 
  1175 //  END OF FILE
  1160 //  END OF FILE