rtp/srtpstack/tsrc/ut_srtpstack/src/UT_CSRTPStreamIn.cpp
branchRCL_3
changeset 19 b5e99d8877c7
parent 0 307788aac0a8
child 20 0dcb073356a5
equal deleted inserted replaced
18:f54bfd820e04 19:b5e99d8877c7
   345 
   345 
   346 void UT_CSRTPStreamIn::Teardown(  )
   346 void UT_CSRTPStreamIn::Teardown(  )
   347     {
   347     {
   348     delete iDecryptedPayload;
   348     delete iDecryptedPayload;
   349     delete iTestPayload160Bits;
   349     delete iTestPayload160Bits;
       
   350 	
       
   351 	iDecryptedPayload = NULL;
       
   352     iTestPayload160Bits = NULL;
       
   353 
   350 
   354 
   351 
   355 
   352     delete iStreamIn;
   356     delete iStreamIn;
   353     delete iStreamInLateBD;
   357     delete iStreamInLateBD;
   354     delete iSRTPSession;    
   358     delete iSRTPSession;    
       
   359 	
       
   360 	iStreamIn = NULL;
       
   361     iStreamInLateBD = NULL;
       
   362     iSRTPSession = NULL; 
   355 
   363 
   356    
   364    
   357     delete iRFC3711_SessionEncrKey128bits;
   365     delete iRFC3711_SessionEncrKey128bits;
   358     delete iRFC3711_SessionSaltKey128bits;
   366     delete iRFC3711_SessionSaltKey128bits;
   359     delete iRFC3711_SessionAuthKey128bits;    
   367     delete iRFC3711_SessionAuthKey128bits;    
   360     delete iRFC3711_RtcpEncrKey128bits;
   368     delete iRFC3711_RtcpEncrKey128bits;
   361 	delete iRFC3711_RtcpSaltKey128bits;
   369 	delete iRFC3711_RtcpSaltKey128bits;
   362 	delete iRFC3711_RtcpAuthKey128bits;
   370 	delete iRFC3711_RtcpAuthKey128bits;
   363     }
   371 	
   364 
   372 	iRFC3711_SessionEncrKey128bits = NULL;
   365 void UT_CSRTPStreamIn::UT_CSRTPStreamIn_NewL_1L(  )
   373     iRFC3711_SessionSaltKey128bits = NULL;
       
   374     iRFC3711_SessionAuthKey128bits = NULL;    
       
   375     iRFC3711_RtcpEncrKey128bits = NULL;
       
   376 	iRFC3711_RtcpSaltKey128bits = NULL;
       
   377 	iRFC3711_RtcpAuthKey128bits = NULL;
       
   378     }
       
   379 
       
   380 void UT_CSRTPStreamIn::UT_CSRTPStreamIn_NewL_OneL(  )
   366     {        
   381     {        
   367     CSRTPStreamIn* tempStreamIn = CSRTPStreamIn::NewL(*iSRTPSession, (TUint)1);
   382     CSRTPStreamIn* tempStreamIn = CSRTPStreamIn::NewL(*iSRTPSession, (TUint)1);
   368     EUNIT_ASSERT(tempStreamIn->SSRC()== 1);
   383     EUNIT_ASSERT(tempStreamIn->SSRC()== 1);
   369     delete tempStreamIn;
   384     delete tempStreamIn;
   370     }
   385     }
   371 
   386 
   372 void UT_CSRTPStreamIn::UT_CSRTPStreamIn_NewL_2L(  )
   387 void UT_CSRTPStreamIn::UT_CSRTPStreamIn_NewL_TwoL(  )
   373     {
   388     {
   374     HBufC8* masterKey = HBufC8::NewL(KRFC3711_TestMasterKey128bits().Length());
   389     HBufC8* masterKey = HBufC8::NewL(KRFC3711_TestMasterKey128bits().Length());
   375     CleanupStack::PushL( masterKey );
   390     CleanupStack::PushL( masterKey );
   376     *masterKey = KRFC3711_TestMasterKey128bits;
   391     *masterKey = KRFC3711_TestMasterKey128bits;
   377 
   392 
   404     EUNIT_ASSERT(tempStreamIn->SSRC()== 1);
   419     EUNIT_ASSERT(tempStreamIn->SSRC()== 1);
   405     delete tempStreamIn;    
   420     delete tempStreamIn;    
   406      CleanupStack::PopAndDestroy( srtpSession );                   
   421      CleanupStack::PopAndDestroy( srtpSession );                   
   407     }
   422     }
   408 
   423 
   409 void UT_CSRTPStreamIn::UT_CSRTPStreamIn_NewL_3L(  )
   424 void UT_CSRTPStreamIn::UT_CSRTPStreamIn_NewL_ThreeL(  )
   410     {
   425     {
   411     HBufC8* masterKey = HBufC8::NewL(KRFC3711_TestMasterKey128bits().Length());
   426     HBufC8* masterKey = HBufC8::NewL(KRFC3711_TestMasterKey128bits().Length());
   412     CleanupStack::PushL( masterKey );
   427     CleanupStack::PushL( masterKey );
   413     *masterKey = KRFC3711_TestMasterKey128bits;
   428     *masterKey = KRFC3711_TestMasterKey128bits;
   414 
   429 
   440     
   455     
   441     EUNIT_ASSERT(tempStreamIn->GetCryptoContext().Valid()==ETrue); 
   456     EUNIT_ASSERT(tempStreamIn->GetCryptoContext().Valid()==ETrue); 
   442     delete tempStreamIn;   
   457     delete tempStreamIn;   
   443     CleanupStack::PopAndDestroy( srtpSession );                   
   458     CleanupStack::PopAndDestroy( srtpSession );                   
   444     }
   459     }
   445 void UT_CSRTPStreamIn::UT_CSRTPStreamIn_NewL_4L(  )
   460 void UT_CSRTPStreamIn::UT_CSRTPStreamIn_NewL_FourL(  )
   446     {
   461     {
   447      HBufC8* masterKey = HBufC8::NewL(KRFC3711_TestMasterKey128bits().Length());
   462      HBufC8* masterKey = HBufC8::NewL(KRFC3711_TestMasterKey128bits().Length());
   448     CleanupStack::PushL( masterKey );
   463     CleanupStack::PushL( masterKey );
   449     *masterKey = KRFC3711_TestMasterKey128bits;
   464     *masterKey = KRFC3711_TestMasterKey128bits;
   450 
   465 
   477     EUNIT_ASSERT(tempStreamIn->GetCryptoContext().Valid()==ETrue); 
   492     EUNIT_ASSERT(tempStreamIn->GetCryptoContext().Valid()==ETrue); 
   478     delete tempStreamIn;  
   493     delete tempStreamIn;  
   479     CleanupStack::PopAndDestroy( srtpSession );
   494     CleanupStack::PopAndDestroy( srtpSession );
   480     }
   495     }
   481     
   496     
   482 void UT_CSRTPStreamIn::UT_CSRTPStreamIn_NewL_5L(  )
   497 void UT_CSRTPStreamIn::UT_CSRTPStreamIn_NewL_FiveL(  )
   483     {
   498     {
   484      HBufC8* masterKey = HBufC8::NewL(KRFC3711_TestMasterKey128bits().Length());
   499      HBufC8* masterKey = HBufC8::NewL(KRFC3711_TestMasterKey128bits().Length());
   485     CleanupStack::PushL( masterKey );
   500     CleanupStack::PushL( masterKey );
   486     *masterKey = KRFC3711_TestMasterKey128bits;
   501     *masterKey = KRFC3711_TestMasterKey128bits;
   487 
   502 
  1034 EUNIT_TEST(
  1049 EUNIT_TEST(
  1035     "NewL1 - test ",
  1050     "NewL1 - test ",
  1036     "CSRTPStreamIn",
  1051     "CSRTPStreamIn",
  1037     "NewL1",
  1052     "NewL1",
  1038     "FUNCTIONALITY",
  1053     "FUNCTIONALITY",
  1039     SetupL, UT_CSRTPStreamIn_NewL_1L, Teardown)
  1054     SetupL, UT_CSRTPStreamIn_NewL_OneL, Teardown)
  1040 
  1055 
  1041 EUNIT_TEST(
  1056 EUNIT_TEST(
  1042     "NewL2 - test ",
  1057     "NewL2 - test ",
  1043     "CSRTPStreamIn",
  1058     "CSRTPStreamIn",
  1044     "NewL2",
  1059     "NewL2",
  1045     "FUNCTIONALITY",
  1060     "FUNCTIONALITY",
  1046     SetupL, UT_CSRTPStreamIn_NewL_2L, Teardown)
  1061     SetupL, UT_CSRTPStreamIn_NewL_TwoL, Teardown)
  1047 
  1062 
  1048 EUNIT_TEST(
  1063 EUNIT_TEST(
  1049     "NewL3 - test ",
  1064     "NewL3 - test ",
  1050     "CSRTPStreamIn",
  1065     "CSRTPStreamIn",
  1051     "NewL3",
  1066     "NewL3",
  1052     "FUNCTIONALITY",
  1067     "FUNCTIONALITY",
  1053     SetupL, UT_CSRTPStreamIn_NewL_3L, Teardown)
  1068     SetupL, UT_CSRTPStreamIn_NewL_ThreeL, Teardown)
  1054     
  1069     
  1055 EUNIT_TEST(
  1070 EUNIT_TEST(
  1056     "NewL4 - test ",
  1071     "NewL4 - test ",
  1057     "CSRTPStreamIn",
  1072     "CSRTPStreamIn",
  1058     "NewL4",
  1073     "NewL4",
  1059     "FUNCTIONALITY",
  1074     "FUNCTIONALITY",
  1060     SetupL, UT_CSRTPStreamIn_NewL_4L, Teardown)    
  1075     SetupL, UT_CSRTPStreamIn_NewL_FourL, Teardown)    
  1061 
  1076 
  1062 EUNIT_TEST(
  1077 EUNIT_TEST(
  1063     "NewL5 - test ",
  1078     "NewL5 - test ",
  1064     "CSRTPStreamIn",
  1079     "CSRTPStreamIn",
  1065     "NewL5",
  1080     "NewL5",
  1066     "FUNCTIONALITY",
  1081     "FUNCTIONALITY",
  1067     SetupL, UT_CSRTPStreamIn_NewL_5L, Teardown)    
  1082     SetupL, UT_CSRTPStreamIn_NewL_FiveL, Teardown)    
  1068 EUNIT_TEST(
  1083 EUNIT_TEST(
  1069     "UnprotectSrtpL - test ",
  1084     "UnprotectSrtpL - test ",
  1070     "CSRTPStreamIn",
  1085     "CSRTPStreamIn",
  1071     "UnprotectSrtpL",
  1086     "UnprotectSrtpL",
  1072     "FUNCTIONALITY",
  1087     "FUNCTIONALITY",