mmsharing/mmshindicator/tsrc/ut_indicator/src/ut_cmusindicatorapi.cpp
branchRCL_3
changeset 33 bc78a40cd63c
parent 32 73a1feb507fb
--- a/mmsharing/mmshindicator/tsrc/ut_indicator/src/ut_cmusindicatorapi.cpp	Tue Aug 31 15:12:07 2010 +0300
+++ b/mmsharing/mmshindicator/tsrc/ut_indicator/src/ut_cmusindicatorapi.cpp	Wed Sep 01 12:31:01 2010 +0100
@@ -28,134 +28,8 @@
 
 // Next row is to disable warning emerging from EUnit code.
 #pragma warn_illtokenpasting off
-static TInt stubStatus = KErrNone;
-static TRequestStatus* rstatus = NULL;
 
 
-// ======== CAknGlobalMsgQuery stub ========
-
-
-CAknGlobalMsgQuery* CAknGlobalMsgQuery::NewL()
-    {
-    CAknGlobalMsgQuery* self = CAknGlobalMsgQuery::NewLC();
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-
-CAknGlobalMsgQuery* CAknGlobalMsgQuery::NewLC()
-    {
-    CAknGlobalMsgQuery* self = new (ELeave) CAknGlobalMsgQuery();
-    CleanupStack::PushL( self );
-    return self;
-    }
-
-CAknGlobalMsgQuery::CAknGlobalMsgQuery()
-    {
-    }
-
-CAknGlobalMsgQuery::~CAknGlobalMsgQuery()
-    {
-    CancelMsgQuery();
-    iNotify.Close();
-    }
-
-void CAknGlobalMsgQuery::ShowMsgQueryL( 
-     TRequestStatus& aStatus,
-     const TDesC& /*aMsgText*/,
-     TInt /*aSoftkeys*/,
-     const TDesC& /*HeaderText*/,
-     const TDesC& /*HeaderImageFile*/,
-     TInt /*aImageId*/,
-     TInt /*aImageMaskId*/,
-     CAknQueryDialog::TTone /*aTone*/)
-    {
-    if ( stubStatus == KErrNone )
-        {
-        aStatus = KRequestPending;
-        rstatus = &aStatus;
-        }
-    else
-        {
-        User::Leave( stubStatus );
-        }
-    }
-
-void CAknGlobalMsgQuery::CancelMsgQuery()
-    {
-    if ( rstatus )
-        {
-        User::RequestComplete( rstatus, KErrCancel );
-        rstatus = NULL;
-        }
-    }
-
-
-// ======== CAknGlobalConfirmationQuery stub ========
-
-CAknGlobalConfirmationQuery* CAknGlobalConfirmationQuery::NewL()
-    {
-    CAknGlobalConfirmationQuery* self = CAknGlobalConfirmationQuery::NewLC();
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-
-CAknGlobalConfirmationQuery* CAknGlobalConfirmationQuery::NewLC()
-    {
-    CAknGlobalConfirmationQuery* self = new (ELeave) CAknGlobalConfirmationQuery();
-    CleanupStack::PushL( self );
-    return self;
-    }
-
-CAknGlobalConfirmationQuery::CAknGlobalConfirmationQuery()
-    {
-    }
-
-
-CAknGlobalConfirmationQuery::~CAknGlobalConfirmationQuery()
-    {
-    CancelConfirmationQuery();
-    iNotify.Close();
-    }
-    
-
-
-
-void CAknGlobalConfirmationQuery::ShowConfirmationQueryL( 
-    TRequestStatus& aStatus,
-    const TDesC& /*aPrompt*/,
-    TInt /*aSoftkeys*/,
-    TInt /*aAnimation*/,
-    const TDesC& /*aImageFile*/,
-    TInt /*aImageId*/,
-    TInt /*aImageMaskId*/,
-    CAknQueryDialog::TTone /*aTone*/,
-    TBool /*aDismissWithAllKeys*/ )
-
-    {
-    if ( stubStatus == KErrNone )
-        {
-        TRequestStatus* stat = &aStatus;
-        User::RequestComplete( stat, EAknSoftkeyYes );
-       // rstatus = &aStatus;
-        }
-    else
-        {
-        User::Leave( stubStatus );
-        }
-    
-    }
-
-void CAknGlobalConfirmationQuery::CancelConfirmationQuery()
-    {
-    if ( rstatus )
-        {
-        User::RequestComplete( rstatus, KErrCancel );
-        rstatus = NULL;
-        }
-    }
-
 // ======== MEMBER FUNCTIONS ========
 
 
@@ -204,8 +78,6 @@
 void UT_CMusIndicatorApi::SetupL()
     {
     iIndicatorApi = CMusIndicatorApi::NewL( *this );
-    rstatus = NULL;
-    stubStatus = KErrNone;
     iStartLiveSharingLCalled = EFalse;
     }
 
@@ -217,7 +89,6 @@
 void UT_CMusIndicatorApi::Teardown()
     {
     delete iIndicatorApi;
-    iIndicatorApi = NULL;
     PropertyHelper::Close();
     
     }
@@ -248,19 +119,6 @@
 
 
 // ----------------------------------------------------------------------------
-// @TODO: Can this be tested without a dialog?
-// ----------------------------------------------------------------------------
-//
-void UT_CMusIndicatorApi::UT_CMusIndicatorApi_ConfirmationQueryLL()
-    {
-    TBool ret = iIndicatorApi->ConfirmationQueryL(
-         CMusIndicatorApi::EVsRoamingActivationQuery );
-    
-    EUNIT_ASSERT( ret );
-    }
-
-
-// ----------------------------------------------------------------------------
 // Dummy test. @TODO: Can this be tested?
 // ----------------------------------------------------------------------------
 //
@@ -276,24 +134,16 @@
 //
 void UT_CMusIndicatorApi::UT_CMusIndicatorApi_RunLL()
     {
-    /* NOTE: EUnit reports leak for this test due AVKON resource reservation,
-     * which is not released by AVKON at end of test. Resource reservation
-     * happend in contruction of indicator(dsa)
-     */
-    TRAPD( error, RProperty::Define(
-                                KPSUidCoreApplicationUIs,
-                                KCoreAppUIsVideoSharingIndicator,
-                                RProperty::EInt,
-                                0 ) );
-    if ( error == KErrNoMemory ) User::Leave( error );
-    EUNIT_ASSERT ( error == KErrNone );
+    User::LeaveIfError( RProperty::Define(
+                            KPSUidCoreApplicationUIs,
+                            KCoreAppUIsVideoSharingIndicator,
+                            RProperty::EInt,
+                            0 ) );
         
-    TRAP( error, RProperty::Set(
-            KPSUidCoreApplicationUIs,
-            KCoreAppUIsVideoSharingIndicator,
-            ( TInt ) ECoreAppUIsVideoSharingIndicatorOn ) );
-    if ( error == KErrNoMemory ) User::Leave( error );
-    EUNIT_ASSERT ( error == KErrNone );
+    User::LeaveIfError( RProperty::Set(
+                            KPSUidCoreApplicationUIs,
+                            KCoreAppUIsVideoSharingIndicator,
+                            ( TInt ) ECoreAppUIsVideoSharingIndicatorOn ) );
         
     iIndicatorApi->Cancel();
     iIndicatorApi->iStatus = KErrNotFound;
@@ -303,42 +153,18 @@
     iIndicatorApi->Cancel();
     iIndicatorApi->iStatus = KErrNone;
     iIndicatorApi->RunL();
-    EUNIT_ASSERT( iStartLiveSharingLCalled );
-    EUNIT_ASSERT( !iIndicatorApi->iQuery );
-    
-    delete iIndicatorApi->iLiveSharingQueryTimeout;
-    iIndicatorApi->iLiveSharingQueryTimeout = NULL;
-    iIndicatorApi->iLiveSharingQueryTimeout = 
-                    CPeriodic::NewL( CActive::EPriorityStandard );
-    
-    iIndicatorApi->RunL();
-    EUNIT_ASSERT( !iIndicatorApi->iLiveSharingQueryTimeout );
+    EUNIT_ASSERT( iStartLiveSharingLCalled ); 
     
-    EUNIT_ASSERT( !iIndicatorApi->IsSubscriber() );
-    
-    iIndicatorApi->iObserver = NULL;
-    EUNIT_ASSERT( iIndicatorApi->IsSubscriber() );
-    iIndicatorApi->Indicator( ETrue );
-    
-    iIndicatorApi->Cancel();
-    
-    iIndicatorApi->RunL();
-    
-    TRequestStatus& status = iIndicatorApi->iStatus;
-    rstatus = &status;
-    //User::RequestComplete( rstatus, KErrCancel ); 
     }
 
 
 // ----------------------------------------------------------------------------
-// Asserts that DoCancel removes current activity and deletes used resources.
+// Asserts that DoCancel removes current activity.
 // ----------------------------------------------------------------------------
 //
 void UT_CMusIndicatorApi::UT_CMusIndicatorApi_DoCancelL()
     {
-    iIndicatorApi->ShowLiveSharingQueryL( EFalse );
     iIndicatorApi->Cancel();
-    EUNIT_ASSERT( !iIndicatorApi->iQuery );
     EUNIT_ASSERT( !iIndicatorApi->IsActive() );
     
     }
@@ -381,62 +207,6 @@
     }
 
 
-// ----------------------------------------------------------------------------
-// Asserts that a note text is generated.
-// ----------------------------------------------------------------------------
-//
-void UT_CMusIndicatorApi::UT_CMusIndicatorApi_NoteTextLCL()
-    {
-    HBufC* tmp = iIndicatorApi->NoteTextLC(
-        CMusIndicatorApi::EVsRoamingActivationQuery );
-    EUNIT_ASSERT( tmp );
-    EUNIT_ASSERT( tmp->Length() );
-    CleanupStack::PopAndDestroy();
-    }
-
-
-// ----------------------------------------------------------------------------
-// Asserts that method creates a query and calls CActive::SetActive.
-// ----------------------------------------------------------------------------
-//
-void UT_CMusIndicatorApi::UT_CMusIndicatorApi_ShowLiveSharingQueryLL()
-    {
-    
-    iIndicatorApi->ShowLiveSharingQueryL( EFalse );
-    EUNIT_ASSERT( iIndicatorApi->iQuery );
-    EUNIT_ASSERT( iIndicatorApi->IsActive() );
-    
-    iIndicatorApi->Cancel();
-    EUNIT_ASSERT( !iIndicatorApi->iQuery );
-    EUNIT_ASSERT( !iIndicatorApi->IsActive() );
-    
-    stubStatus = KErrNotFound;
-    iIndicatorApi->ShowLiveSharingQueryL( EFalse );
-    EUNIT_ASSERT( !iIndicatorApi->iQuery );
-    EUNIT_ASSERT( !iIndicatorApi->IsActive() );
-    
-    
-    }
-
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-//
-void UT_CMusIndicatorApi::UT_CMusIndicatorApi_LiveSharingQueryTimeoutL()
-    {
-    iIndicatorApi->ShowLiveSharingQueryL( EFalse );
-    EUNIT_ASSERT( iIndicatorApi->iQuery );
-    EUNIT_ASSERT( iIndicatorApi->IsActive() );
-    
-    EUNIT_ASSERT( CMusIndicatorApi::LiveSharingQueryTimeout( iIndicatorApi ) == KErrNone );
-    
-    EUNIT_ASSERT( !iIndicatorApi->iQuery );
-    EUNIT_ASSERT( !iIndicatorApi->IsActive() );
-    
-    
-    }
-
-
-
 // ======== EUNIT TEST TABLE ========
 
 
@@ -453,13 +223,6 @@
     SetupL, UT_CMusIndicatorApi_NewLL, Teardown )
 
 EUNIT_TEST(
-    "ConfirmationQueryL - test ",
-    "CMusIndicatorApi",
-    "ConfirmationQueryL",
-    "FUNCTIONALITY",
-    SetupL, UT_CMusIndicatorApi_ConfirmationQueryLL, Teardown )
-
-EUNIT_TEST(
     "IndicateAvailabilityL - test ",
     "CMusIndicatorApi",
     "IndicateAvailabilityL",
@@ -501,27 +264,6 @@
     "FUNCTIONALITY",
     SetupL, UT_CMusIndicatorApi_PlayToneLL, Teardown )
 
-EUNIT_TEST(
-    "NoteTextLC - test ",
-    "CMusIndicatorApi",
-    "NoteTextLC",
-    "FUNCTIONALITY",
-    SetupL, UT_CMusIndicatorApi_NoteTextLCL, Teardown )
-
-EUNIT_TEST(
-    "ShowLiveSharingQueryL - test ",
-    "CMusIndicatorApi",
-    "ShowLiveSharingQueryL",
-    "FUNCTIONALITY",
-    SetupL, UT_CMusIndicatorApi_ShowLiveSharingQueryLL, Teardown )
-
-EUNIT_TEST(
-    "LiveSharingQueryTimeout - test ",
-    "CMusIndicatorApi",
-    "LiveSharingQueryTimeout",
-    "FUNCTIONALITY",
-    SetupL, UT_CMusIndicatorApi_LiveSharingQueryTimeoutL, Teardown )
-
     
 
 EUNIT_END_TEST_TABLE