mmsharing/mmshengine/tsrc/ut_engine/src/ut_musengsipprofilehandler.cpp
branchRCL_3
changeset 33 bc78a40cd63c
parent 32 73a1feb507fb
--- a/mmsharing/mmshengine/tsrc/ut_engine/src/ut_musengsipprofilehandler.cpp	Tue Aug 31 15:12:07 2010 +0300
+++ b/mmsharing/mmshengine/tsrc/ut_engine/src/ut_musengsipprofilehandler.cpp	Wed Sep 01 12:31:01 2010 +0100
@@ -23,6 +23,7 @@
 #include "musengtestdefs.h"
 #include "sipprofilealrcontroller.h"
 
+
 //  SYSTEM INCLUDES
 #include <sipprofile.h>
 #include <digia/eunit/eunitmacros.h>
@@ -30,6 +31,7 @@
 
 const TUint KSipProfileId( 1 );
 
+
 // -----------------------------------------------------------------------------
 //
 // -----------------------------------------------------------------------------
@@ -85,16 +87,25 @@
     // It generates the test case table.
     CEUnitTestSuiteClass::ConstructL();
     }
+    
 
-
+// -----------------------------------------------------------------------------
+// From MMusSipProfileUser
+// -----------------------------------------------------------------------------
+//
+TBool UT_CMusEngSipProfileHandler::IsRoamingBetweenAPsAllowed()
+    {
+    return iRoamingBetweenAPsAllowed;
+    }
+    
+   
 // -----------------------------------------------------------------------------
 //
 // -----------------------------------------------------------------------------
 //
 void UT_CMusEngSipProfileHandler::SetupL()
     {
-    iObserver = new( ELeave ) CMusEngObserverStub;
-    iProfileHandler = CMusSipProfileHandler::NewL( *iObserver );
+    iProfileHandler = CMusSipProfileHandler::NewL( *this );
     }
 
 
@@ -105,7 +116,7 @@
 void UT_CMusEngSipProfileHandler::Teardown()
     {
     delete iProfileHandler;
-    delete iObserver;
+    iRoamingBetweenAPsAllowed = EFalse;
     }
 
 
@@ -116,7 +127,7 @@
 //
 // -----------------------------------------------------------------------------
 //
-void UT_CMusEngSipProfileHandler::UT_CreateSipProfileLL()
+void UT_CMusEngSipProfileHandler::UT_CMusEngSipProfileHandler_CreateSipProfileLL()
     {
     // SIP profile ID zero
     iProfileHandler->CreateProfileL( 0 );
@@ -137,7 +148,7 @@
 //
 // -----------------------------------------------------------------------------
 //
-void UT_CMusEngSipProfileHandler::UT_ProfileIdL()
+void UT_CMusEngSipProfileHandler::UT_CMusEngSipProfileHandler_ProfileIdL()
     {
     // SIP profile does not yet exist
     EUNIT_ASSERT_EQUALS( 0, iProfileHandler->ProfileId() )
@@ -151,7 +162,7 @@
 //
 // -----------------------------------------------------------------------------
 //
-void UT_CMusEngSipProfileHandler::UT_AlrEventL()
+void UT_CMusEngSipProfileHandler::UT_CMusEngSipProfileHandler_AlrEventL()
     {
     const TUint32 KSnapId( 1 );
     const TUint32 KIapId( 1 );
@@ -218,7 +229,7 @@
     iProfileHandler->iProfileAlrController->iLastUsedIap = 0;
     
     // Event is EIapAvailable, SIP profile ID matches, roaming not allowed
-    iObserver->iRoamingBetweenAPsAllowed = ETrue;
+    iRoamingBetweenAPsAllowed = ETrue;
     iProfileHandler->AlrEvent( 
         MSipProfileAlrObserver::EIapAvailable, 
         KSipProfileId, KSnapId, KIapId );
@@ -240,10 +251,9 @@
 //
 // -----------------------------------------------------------------------------
 //
-void UT_CMusEngSipProfileHandler::UT_NullTestsL()
+void UT_CMusEngSipProfileHandler::UT_CMusEngSipProfileHandler_NullTestsL()
     {
     // Dummies
-    
     CSIPTransactionBase transactionBase;
     CSIPServerTransaction serverTransaction;
     CSIPDialog dialog;
@@ -253,7 +263,8 @@
     CSIPRefresh refresh;
     
     // Tests
-
+    iProfileHandler->ProfileRegistryEventOccurred( 0,
+                                MSIPProfileRegistryObserver::EProfileCreated );
     iProfileHandler->ProfileRegistryErrorOccurred( 0, 0 );
     iProfileHandler->IncomingRequest( 0, NULL );
     iProfileHandler->TimedOut( serverTransaction );
@@ -279,7 +290,7 @@
 //
 // -----------------------------------------------------------------------------
 //
-void UT_CMusEngSipProfileHandler::UT_UserFromProfileLCL()
+void UT_CMusEngSipProfileHandler::UT_CMusEngSipProfileHandler_UserFromProfileLCL()
     {
     iProfileHandler->CreateProfileL( KSipProfileId );
     CSIPProfile* profile = iProfileHandler->Profile();
@@ -302,58 +313,6 @@
     CleanupStack::PopAndDestroy( user );
     }
 
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void UT_CMusEngSipProfileHandler::UT_IsRegisteredL()
-    {
-    EUNIT_ASSERT( !iProfileHandler->IsRegistered( ) )
-    iProfileHandler->CreateProfileL( KSipProfileId );
-    EUNIT_ASSERT( iProfileHandler->IsRegistered( ) )   
-    }
-
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void UT_CMusEngSipProfileHandler::UT_ProfileRegistryEventOccurredL()
-    {    
-    // No profile yet
-    iProfileHandler->ProfileRegistryEventOccurred( 0,
-                            MSIPProfileRegistryObserver::EProfileRegistered );
-    EUNIT_ASSERT( iObserver->IsReseted() )
-    
-    // Create profile, but notify about registration of some other profile
-    iProfileHandler->CreateProfileL( 1 );
-    iProfileHandler->ProfileRegistryEventOccurred( 2,
-                            MSIPProfileRegistryObserver::EProfileRegistered );
-    EUNIT_ASSERT( iObserver->IsReseted() )
-    
-    // Normal case
-    iProfileHandler->ProfileRegistryEventOccurred( 1,
-                                MSIPProfileRegistryObserver::EProfileRegistered );
-    EUNIT_ASSERT( iObserver->iProfileRegisteredCalled )
-    iObserver->Reset();
-    
-    // React exclusively to EProfileRegistered
-    iProfileHandler->ProfileRegistryEventOccurred( 1,
-                            MSIPProfileRegistryObserver::EProfileCreated );
-    EUNIT_ASSERT( iObserver->IsReseted() )
-    iProfileHandler->ProfileRegistryEventOccurred( 1,
-                            MSIPProfileRegistryObserver::EProfileUpdated );
-    EUNIT_ASSERT( iObserver->IsReseted() )
-    iProfileHandler->ProfileRegistryEventOccurred( 1,
-                            MSIPProfileRegistryObserver::EProfileDeregistered );
-    EUNIT_ASSERT( iObserver->IsReseted() )
-    iProfileHandler->ProfileRegistryEventOccurred( 1,
-                            MSIPProfileRegistryObserver::EProfileDestroyed );
-    EUNIT_ASSERT( iObserver->IsReseted() )
-    }
-
-
 //  TEST TABLE
 
 EUNIT_BEGIN_TEST_TABLE(
@@ -366,50 +325,36 @@
     "CMusSipProfileHandler",
     "CreateSipProfileL",
     "FUNCTIONALITY",
-    SetupL, UT_CreateSipProfileLL, Teardown)    
-    
+    SetupL, UT_CMusEngSipProfileHandler_CreateSipProfileLL, Teardown)
+
 EUNIT_TEST(
     "ProfileId - test ",
     "CMusSipProfileHandler",
     "ProfileId",
     "FUNCTIONALITY",
-    SetupL, UT_ProfileIdL, Teardown)
+    SetupL, UT_CMusEngSipProfileHandler_ProfileIdL, Teardown)
     
 EUNIT_TEST(
     "AlrEventL - test ",
     "CMusEngSipProfileHandler",
     "AlrEventL",
     "FUNCTIONALITY",
-    SetupL, UT_AlrEventL, Teardown)
-    
+    SetupL, UT_CMusEngSipProfileHandler_AlrEventL, Teardown)
+
 EUNIT_TEST(
     "Null tests for NOP functions",
     "CMusEngSipProfileHandler",
     "Several NOP functions",
     "FUNCTIONALITY",
-    SetupL, UT_NullTestsL, Teardown)
+    SetupL, UT_CMusEngSipProfileHandler_NullTestsL, Teardown)
 
 EUNIT_TEST(
     "UserFromProfileLC - test ",
-    "CMusEngSipProfileHandler",
+    "CMusEngOutSession",
     "UserFromProfileLC",
     "FUNCTIONALITY",
-    SetupL, UT_UserFromProfileLCL, Teardown)
-
-EUNIT_TEST(
-    "IsRegistered - test ",
-    "CMusEngSipProfileHandler",
-    "IsRegistered",
-    "FUNCTIONALITY",
-    SetupL, UT_IsRegisteredL, Teardown)
-
-EUNIT_TEST(
-    "ProfileRegistryEventOccurred - test ",
-    "CMusEngSipProfileHandler",
-    "ProfileRegistryEventOccurred",
-    "FUNCTIONALITY",
-    SetupL, UT_ProfileRegistryEventOccurredL, Teardown)    
-    
+    SetupL, UT_CMusEngSipProfileHandler_UserFromProfileLCL, Teardown)
+        
 EUNIT_END_TEST_TABLE
 
 //  END OF FILE