mmsharing/mmshavailability/tsrc/ut_availability/src/UT_CMusAvaCapability.cpp
branchRCL_3
changeset 22 73a1feb507fb
parent 0 f0cf47e981f9
child 23 bc78a40cd63c
--- a/mmsharing/mmshavailability/tsrc/ut_availability/src/UT_CMusAvaCapability.cpp	Thu Aug 19 09:51:39 2010 +0300
+++ b/mmsharing/mmshavailability/tsrc/ut_availability/src/UT_CMusAvaCapability.cpp	Tue Aug 31 15:12:07 2010 +0300
@@ -22,6 +22,7 @@
 //  EXTERNAL INCLUDES
 #include <digia/eunit/eunitmacros.h>
 #include <sdpmediafield.h>
+#include <sdpattributefield.h>
 
 
 //  INTERNAL INCLUDES
@@ -110,7 +111,9 @@
     iCapability = iOptionHandler->iSwisCapability;
     
     CSipSseTestTls::OpenL();
-    
+    iStorage = CSipSseTestTls::Storage();
+    iStorage->Set( MusSettingsKeys::KFastStartupMode, 
+         MusSettingsKeys::EFastModeOff );
     }
 
 void UT_CMusAvaCapability::Teardown(  )
@@ -118,8 +121,13 @@
     delete iOptionHandler;
     delete iAvailabilityObserver;
     delete iConcreteSettings;
-    CSipSseTestTls::Close();
-    
+    if ( iStorage )
+        {
+        iStorage->Clear();
+        CSipSseTestTls::Close();
+        iStorage = NULL;
+        }
+
     delete iSIPConnection;
     delete iProfile;
     delete iSIP;
@@ -173,11 +181,9 @@
                                              KCapabilityTestTerminalID_B );
     CleanupStack::PushL( options );                                         
 
-    // Test  : AVC enabled => H263 & H264
-    TInt32 KMusDisableAVC = 0x0ffffff1; // some value other than disable magic value
-    MultimediaSharingSettings::SetPropertyValueL(MusSettingsKeys::KEncodingDevice,
-                                                         KMusDisableAVC );
-    CSdpDocument* sdpContent = CMusAvaCapability::ResponseContentLC( *options );
+    CSdpDocument* sdpContent = 
+            CMusAvaCapability::ResponseContentLC( *options );
+
     RPointerArray<CSIPHeaderBase> responseHeaders;
     CSIPHeaderBase::PushLC( &responseHeaders );
 
@@ -187,20 +193,7 @@
     EUNIT_ASSERT( sdpContent->AttributeFields().Count() == 2 );
     EUNIT_ASSERT( sdpContent->MediaFields().Count() == 1 );
     EUNIT_ASSERT( sdpContent->MediaFields()[0]->FormatAttributeFields().Count() == 2 );
-    CleanupStack::PopAndDestroy( &responseHeaders );
-    CleanupStack::PopAndDestroy( sdpContent );
-    
-    // Test : AVC disabled => H263
-    KMusDisableAVC = 0x0fffffff; // disable magic value
-    MultimediaSharingSettings::SetPropertyValueL(MusSettingsKeys::KEncodingDevice,
-                                                     KMusDisableAVC );
-    sdpContent = CMusAvaCapability::ResponseContentLC( *options );
-    CSIPHeaderBase::PushLC( &responseHeaders );
-    iCapability->PopulateResponseL( *options, responseHeaders, *sdpContent );
-    EUNIT_ASSERT( responseHeaders.Count() == 1 );
-    EUNIT_ASSERT( sdpContent->AttributeFields().Count() == 2 );
-    EUNIT_ASSERT( sdpContent->MediaFields().Count() == 1 );
-    EUNIT_ASSERT( sdpContent->MediaFields()[0]->FormatAttributeFields().Count() == 1 );
+
     CleanupStack::PopAndDestroy( &responseHeaders );
     CleanupStack::PopAndDestroy( sdpContent );
     CleanupStack::PopAndDestroy( options );
@@ -216,11 +209,19 @@
     iExchange = CMusAvaCapabilityExchange::NewL( KTestTerminalId, *iCapabQueryObserver );
     iCapability = CMusAvaCapability::NewL( *iExchange );
     CSipSseTestTls::OpenL();
+    iStorage = CSipSseTestTls::Storage();
+    iStorage->Set( MusSettingsKeys::KFastStartupMode, 
+         MusSettingsKeys::EFastModeOff );
     }
 
 void UT_CMusAvaCapability::Teardown1(  )
     {
-    CSipSseTestTls::Close();
+    if ( iStorage )
+        {
+        iStorage->Clear();
+        CSipSseTestTls::Close();
+        iStorage = NULL;
+        }
     delete iCapability;
     delete iExchange;
     delete iCapabQueryObserver;     
@@ -344,6 +345,49 @@
     }
 
 
+void UT_CMusAvaCapability::UT_CMusAvaCapability_ResolveFastModeLL()
+    {
+    // Fast mode feature is disabled in cenrep, fast mode is present in SDP
+    CSdpDocument* sdpContent = CSdpDocument::DecodeLC( KCapabilityTestSDPFastMode );
+    MusSettingsKeys::TFastMode mode = iCapability->ResolveFastModeL( *sdpContent );
+    EUNIT_ASSERT( mode == MusSettingsKeys::EFastModeOff );
+    CleanupStack::PopAndDestroy( sdpContent );
+    
+    // Fast mode feature is enabled in cenrep, fast mode is present in SDP
+    iStorage->Set( MusSettingsKeys::KFastStartupMode, MusSettingsKeys::EFastModeOn );
+    sdpContent = CSdpDocument::DecodeLC( KCapabilityTestSDPFastMode );
+    mode = iCapability->ResolveFastModeL( *sdpContent );
+    EUNIT_ASSERT( mode == MusSettingsKeys::EFastModeOn );
+    CleanupStack::PopAndDestroy( sdpContent );
+
+    // Fast mode feature is enabled in cenrep, fast mode isn't present in SDP
+    sdpContent = CSdpDocument::DecodeLC( KCapabilityTestSDP );
+    mode = iCapability->ResolveFastModeL( *sdpContent );
+    EUNIT_ASSERT( mode == MusSettingsKeys::EFastModeOff );
+    CleanupStack::PopAndDestroy( sdpContent );
+    }
+
+void UT_CMusAvaCapability::UT_CMusAvaCapability_AddFastModeLL()
+    {
+    // Fast mode feature is disabled in cenrep
+    CSdpDocument* sdpContent = CSdpDocument::DecodeLC( KCapabilityTestSDP );
+    EUNIT_ASSERT( sdpContent->AttributeFields().Count() == 2 );
+    iCapability->AddFastModeL( *sdpContent );
+    EUNIT_ASSERT( sdpContent->AttributeFields().Count() == 2 );
+    
+    // Fast mode feature is enabled in cenrep, a=keywds:fastmode added
+    iStorage->Set( MusSettingsKeys::KFastStartupMode, MusSettingsKeys::EFastModeOn );
+    iCapability->AddFastModeL( *sdpContent );
+    EUNIT_ASSERT( sdpContent->AttributeFields().Count() == 3 );
+    const CSdpAttributeField* field = sdpContent->AttributeFields()[2];
+    RStringF keywds = MusAvaCapabilityContext::SDPStringL( 
+            SdpCodecStringConstants::EAttributeKeywds );
+    EUNIT_ASSERT( field->Attribute() == keywds );
+    EUNIT_ASSERT( field->Value().Compare( KCapabilitySDPAttributeFastMode ) == 0 );
+    CleanupStack::PopAndDestroy( sdpContent );
+    }
+
+
 //  TEST TABLE
 
 EUNIT_BEGIN_TEST_TABLE(
@@ -392,7 +436,20 @@
     "PopulateResponseL",
     "FUNCTIONALITY",
     Setup1L, UT_CMusAvaCapability_PopulateResponseL_OpSpecificL, Teardown1 )         
+   
+EUNIT_TEST(
+    "ResolveFastModeL - test ",
+    "CMusAvaCapability",
+    "ResolveFastModeL",
+    "FUNCTIONALITY",
+    SetupL, UT_CMusAvaCapability_ResolveFastModeLL, Teardown)
     
+EUNIT_TEST(
+    "AddFastModeL - test ",
+    "CMusAvaCapability",
+    "AddFastModeL",
+    "FUNCTIONALITY",
+    SetupL, UT_CMusAvaCapability_AddFastModeLL, Teardown)
 
 EUNIT_END_TEST_TABLE