mmshplugins/mmshaiwplugin/tsrc/ut_aiwplugin/src/ut_musaiwprovider.cpp
changeset 22 496ad160a278
equal deleted inserted replaced
15:ccd8e69b5392 22:496ad160a278
       
     1 /*
       
     2 * Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "ut_musaiwprovider.h"
       
    20 #include "musaiwprovider.h"
       
    21 #include "musaiwprovider.hrh"
       
    22 #include "musmanagerstub.h"
       
    23 #include "musmanagercommon.h"
       
    24 #include "musindicatorapi.h"
       
    25 
       
    26 #include <musresourceproperties.h>
       
    27 #include "mussesseioninformationapi.h"
       
    28 #include "mussettings.h"
       
    29 #include "mustesthelp.h"
       
    30 #include "mussessionproperties.h"
       
    31 #define MUS_MEMORY_LEAVE_CHECKING_ON
       
    32 
       
    33 #include <e32property.h>
       
    34 #include <FeatMgr.h>
       
    35 #include <aiwmenu.h>
       
    36 #include <alwaysonlinemanagercommon.h>
       
    37 #include <alwaysonlinemanagerclient.h>
       
    38 #include <bautils.h>
       
    39 #include <digia/eunit/eunitmacros.h>
       
    40 #include <aknglobalnote.h>
       
    41 #include <apgtask.h>
       
    42 #include <eikmenup.h>
       
    43 #include <uikoninternalpskeys.h>
       
    44 
       
    45 
       
    46 // Next row is to disable warning emerging from EUnit code.
       
    47 // Placement is due to a fact that most test case files
       
    48 // include this file. Directive can be removed when
       
    49 // EUnit is fixed.
       
    50 #pragma warn_illtokenpasting off
       
    51 
       
    52 _LIT( KMusAiwProviderResource, "c:\\sys\\bin\\musaiwproviderui.rsc" );
       
    53 _LIT( KResourceFilenameRom,"z:\\sys\\bin\\musaiwproviderui.rsc" );
       
    54 
       
    55 _LIT( KMusOnHold, "On hold" );
       
    56 
       
    57 _LIT8( KMusOnHold8, "On hold" );
       
    58 _LIT8( KMusNetworkIncompatible8, "Network incompatible" );
       
    59 _LIT8( KMusConferenceCall8, "Conference call" );
       
    60 _LIT8( KMusRecipientIncapable8, "Recipient incapable" );
       
    61 _LIT8( KMusNoReg8, "No registration" );
       
    62 _LIT8( KMusGeneral, "Application error" );
       
    63 
       
    64 
       
    65 CMusIndicatorApi* CMusIndicatorApi::NewL()
       
    66     {
       
    67     CMusIndicatorApi* self = new (ELeave) CMusIndicatorApi( NULL );
       
    68     return self;
       
    69     
       
    70     }
       
    71 
       
    72 
       
    73 
       
    74 CMusIndicatorApi::CMusIndicatorApi( MMusIndicatorObserver* aObserver )
       
    75     : CActive( EPriorityStandard ),
       
    76     iObserver( aObserver )
       
    77     {
       
    78     }
       
    79 
       
    80 void CMusIndicatorApi::DoCancel()
       
    81     {
       
    82     }
       
    83 
       
    84 
       
    85 TInt CMusIndicatorApi::RunError( TInt aError )
       
    86     {
       
    87     return aError;
       
    88     }
       
    89 
       
    90 void CMusIndicatorApi::RunL()
       
    91     {
       
    92     }
       
    93 
       
    94 
       
    95 void CMusIndicatorApi::PlaySoundComplete( TInt /*aError*/ )
       
    96     {
       
    97     }
       
    98 
       
    99 CMusIndicatorApi::~CMusIndicatorApi()
       
   100     {
       
   101     }
       
   102 
       
   103 // -----------------------------------------------------------------------------
       
   104 //
       
   105 // -----------------------------------------------------------------------------
       
   106 //
       
   107 UT_CMusAiwProvider* UT_CMusAiwProvider::NewL()
       
   108     {
       
   109     UT_CMusAiwProvider* self = UT_CMusAiwProvider::NewLC();
       
   110     CleanupStack::Pop( self );
       
   111     return self;
       
   112     
       
   113     }
       
   114 
       
   115 
       
   116 // -----------------------------------------------------------------------------
       
   117 //
       
   118 // -----------------------------------------------------------------------------
       
   119 //
       
   120 UT_CMusAiwProvider* UT_CMusAiwProvider::NewLC()
       
   121     {
       
   122     UT_CMusAiwProvider* self = new (ELeave) UT_CMusAiwProvider();
       
   123     CleanupStack::PushL( self );
       
   124     self->ConstructL();
       
   125     return self;
       
   126     }
       
   127 
       
   128 
       
   129 // -----------------------------------------------------------------------------
       
   130 //
       
   131 // -----------------------------------------------------------------------------
       
   132 //
       
   133 UT_CMusAiwProvider::~UT_CMusAiwProvider()
       
   134     {
       
   135     }
       
   136 
       
   137 
       
   138 // -----------------------------------------------------------------------------
       
   139 //
       
   140 // -----------------------------------------------------------------------------
       
   141 //
       
   142 UT_CMusAiwProvider::UT_CMusAiwProvider()
       
   143     {
       
   144     }
       
   145 
       
   146 
       
   147 // -----------------------------------------------------------------------------
       
   148 //
       
   149 // -----------------------------------------------------------------------------
       
   150 //
       
   151 void UT_CMusAiwProvider::ConstructL()
       
   152     {
       
   153     CEUnitTestSuiteClass::ConstructL();
       
   154     }
       
   155 
       
   156 
       
   157 // -----------------------------------------------------------------------------
       
   158 //
       
   159 // -----------------------------------------------------------------------------
       
   160 //
       
   161 void UT_CMusAiwProvider::SetupL()
       
   162     {
       
   163     iProvider = CMusAiwProvider::NewL();
       
   164     CMusManager::SetUseCase( MultimediaSharing::EMusContinue );
       
   165     CMusManager::SetStartError( KErrNone );
       
   166     CMusManager::SetAvailability( KErrNone );
       
   167     MultimediaSharingSettings::SetPropertyValueL( 
       
   168                   MusSettingsKeys::KFastStartupMode, MusSettingsKeys::EFastModeOff );
       
   169     
       
   170     }
       
   171 
       
   172 
       
   173 // -----------------------------------------------------------------------------
       
   174 //
       
   175 // -----------------------------------------------------------------------------
       
   176 //
       
   177 void UT_CMusAiwProvider::Teardown(  )
       
   178     {
       
   179     delete iProvider;
       
   180     PropertyHelper::Close();
       
   181     }
       
   182 
       
   183 
       
   184 // -----------------------------------------------------------------------------
       
   185 // -----------------------------------------------------------------------------
       
   186 //
       
   187 
       
   188 // -----------------------------------------------------------------------------
       
   189 //
       
   190 // -----------------------------------------------------------------------------
       
   191 //
       
   192 void UT_CMusAiwProvider::SetEmphasis( CCoeControl* /*aMenuControl*/,
       
   193                                       TBool /*aEmphasis*/ )
       
   194     {
       
   195 
       
   196     }
       
   197 
       
   198 
       
   199 // -----------------------------------------------------------------------------
       
   200 //
       
   201 // -----------------------------------------------------------------------------
       
   202 //
       
   203 void UT_CMusAiwProvider::ProcessCommandL( TInt /*aCommandId*/ )
       
   204     {
       
   205 
       
   206     }
       
   207 
       
   208 
       
   209 // -----------------------------------------------------------------------------
       
   210 //
       
   211 // -----------------------------------------------------------------------------
       
   212 //
       
   213 TInt UT_CMusAiwProvider::HandleNotifyL(
       
   214     TInt /*aCmdId*/,
       
   215     TInt /*aEventId*/,
       
   216     CAiwGenericParamList& /*aEventParamList*/,
       
   217     const CAiwGenericParamList& /*aInParamList*/)
       
   218     {
       
   219     return KErrNone;
       
   220     }
       
   221 
       
   222 
       
   223 
       
   224 // ------- Tester functions ----------------------------------------------------
       
   225 
       
   226 /*
       
   227 RFs fs;
       
   228     User::LeaveIfError( fs.Connect() );
       
   229 
       
   230     CleanupClosePushL( fs );
       
   231 
       
   232     BaflUtils::CopyFile( fs, KMusAiwProviderResource(), MusAiwResourceFinder::ResourceFilenameRom() );
       
   233     BaflUtils::CopyFile( fs, KMusAiwProviderResource(), MusAiwResourceFinder::ResourceFilenameRam() );
       
   234 
       
   235     BaflUtils::DeleteFile( fs, MusAiwResourceFinder::ResourceFilenameRom() );
       
   236 
       
   237     BaflUtils::DeleteFile( fs, MusAiwResourceFinder::ResourceFilenameRam() );
       
   238 
       
   239     CleanupStack::PopAndDestroy(); // fs
       
   240 */
       
   241 
       
   242 // ----------------------------------------------------------------------------
       
   243 //
       
   244 // ----------------------------------------------------------------------------
       
   245 //
       
   246 void UT_CMusAiwProvider::UT_CMusAiwProvider_InitialiseLL()
       
   247     {
       
   248     // No implementation, so dummy test is enough
       
   249     RCriteriaArray array;
       
   250     iProvider->InitialiseL( *this, array );
       
   251     iProvider->DoInitialiseL();
       
   252     
       
   253 
       
   254     }
       
   255 
       
   256 
       
   257 // -----------------------------------------------------------------------------
       
   258 //
       
   259 // -----------------------------------------------------------------------------
       
   260 //
       
   261 void UT_CMusAiwProvider::UT_CMusAiwProvider_HandleServiceCmdLL()
       
   262     {
       
   263     // HandleServiceCmdL just forwards request to HandleMenuCmdL
       
   264 
       
   265     CAiwGenericParamList* pl = CAiwGenericParamList::NewLC();
       
   266 
       
   267     EUNIT_ASSERT( CMusManager::UseCase() == MultimediaSharing::EMusContinue )
       
   268 
       
   269     iProvider->HandleServiceCmdL( EMusCommandLiveShare, *pl, *pl, 0, this );
       
   270     EUNIT_ASSERT( CMusManager::UseCase() == MultimediaSharing::EMusLiveVideo )
       
   271 
       
   272     CleanupStack::PopAndDestroy( pl );
       
   273 
       
   274     CMusManager::SetUseCase( MultimediaSharing::EMusContinue );
       
   275     }
       
   276 
       
   277 
       
   278 // -----------------------------------------------------------------------------
       
   279 //
       
   280 // -----------------------------------------------------------------------------
       
   281 //
       
   282 void UT_CMusAiwProvider::UT_CMusAiwProvider_InitializeMenuPaneLL()
       
   283     {    
       
   284     RFs fs;
       
   285     User::LeaveIfError( fs.Connect() );
       
   286     CleanupClosePushL( fs );
       
   287     
       
   288     BaflUtils::CopyFile( fs, KMusAiwProviderResource(),
       
   289                          KResourceFilenameRom() );
       
   290 
       
   291     CAiwGenericParamList* list = CAiwGenericParamList::NewLC();
       
   292 
       
   293     CEikMenuPane* eikPane = NULL;
       
   294     CAiwMenuPane* aiwPane = CreateAiwMenuPaneLC( &eikPane );
       
   295 
       
   296     // ResourceFile is empty 
       
   297     delete iProvider->iResourceFileName;
       
   298     
       
   299     iProvider->iResourceFileName = NULL ;
       
   300 
       
   301     iProvider->InitializeMenuPaneL( *aiwPane, 0, 0, *list );
       
   302     EUNIT_ASSERT( iProvider->iResourceFileName != NULL )
       
   303     // Menu item counter
       
   304     TInt menuPaneCount = eikPane->NumberOfItemsInPane();
       
   305 
       
   306     // test "forbidden" feature: mus NOT allowed, operator variant set to operator
       
   307     MultimediaSharingSettings::SetOperatorVariantSettingL(
       
   308                      MusSettingsKeys::EOperatorSpecific );
       
   309     RProperty::Set( NMusSessionInformationApi::KCategoryUid,
       
   310                     NMusSessionInformationApi::KMUSForbidden,
       
   311                     NMusSessionInformationApi::EMUSForbidden );    
       
   312     EUNIT_ASSERT( eikPane->NumberOfItemsInPane() == menuPaneCount )
       
   313 
       
   314     // set operator back to standard and allow mus
       
   315     RProperty::Set( NMusSessionInformationApi::KCategoryUid ,
       
   316                     NMusSessionInformationApi::KMUSForbidden ,
       
   317                     NMusSessionInformationApi::EMUSAllowed );
       
   318     MultimediaSharingSettings::SetOperatorVariantSettingL(
       
   319                      MusSettingsKeys::EStandard );
       
   320 
       
   321     //Some Negative Cases
       
   322     CMusManager::SetAvailability( MultimediaSharing::EErrNoSipProfile );
       
   323     menuPaneCount = eikPane->NumberOfItemsInPane();
       
   324     iProvider->InitializeMenuPaneL( *aiwPane, 0, 0, *list );
       
   325 
       
   326     EUNIT_ASSERT( eikPane->NumberOfItemsInPane() == menuPaneCount )
       
   327     EUNIT_ASSERT( iProvider->iResourceFileName != NULL )
       
   328 
       
   329     CMusManager::SetAvailability( MultimediaSharing::EErrActivation );
       
   330     menuPaneCount = eikPane->NumberOfItemsInPane();
       
   331     iProvider->InitializeMenuPaneL( *aiwPane, 0, 0, *list );
       
   332 
       
   333     EUNIT_ASSERT( eikPane->NumberOfItemsInPane() == menuPaneCount )
       
   334     EUNIT_ASSERT( iProvider->iResourceFileName != NULL )
       
   335 
       
   336     CMusManager::SetAvailability( ( MultimediaSharing::TMusAvailabilityStatus ) KErrNone );    
       
   337     menuPaneCount = eikPane->NumberOfItemsInPane();
       
   338     iProvider->InitializeMenuPaneL( *aiwPane, 0, 0, *list );
       
   339 
       
   340     EUNIT_ASSERT( eikPane->NumberOfItemsInPane() == menuPaneCount )
       
   341     EUNIT_ASSERT( iProvider->iResourceFileName != NULL )
       
   342 
       
   343     // Cases  for "camera supported"!
       
   344     FeatureManager::CameraSupported(); 
       
   345     // Set it live,clip Menu showing    
       
   346 
       
   347     CMusManager::SetAvailability( MultimediaSharing::ESipRegistrationPending );
       
   348     menuPaneCount = eikPane->NumberOfItemsInPane();
       
   349     iProvider->InitializeMenuPaneL( *aiwPane, 0, 0, *list );
       
   350 
       
   351     //EUNIT_ASSERT( eikPane->NumberOfItemsInPane() == menuPaneCount + 3 )       
       
   352     MUS_CHECK_MEMORY_LEAVE( eikPane->NumberOfItemsInPane() == menuPaneCount + 3 )
       
   353     
       
   354     CMusManager::SetAvailability( MultimediaSharing::EErrConferenceCall );
       
   355     menuPaneCount = eikPane->NumberOfItemsInPane();
       
   356     iProvider->InitializeMenuPaneL( *aiwPane, 0, 0, *list );
       
   357 
       
   358     //EUNIT_ASSERT( eikPane->NumberOfItemsInPane() == menuPaneCount + 3 )
       
   359     MUS_CHECK_MEMORY_LEAVE( eikPane->NumberOfItemsInPane() == menuPaneCount + 3 )
       
   360     
       
   361     // set camera support on
       
   362     FeatureManager::CameraSupported();
       
   363     CleanupStack::PopAndDestroy( aiwPane );
       
   364     CleanupStack::PopAndDestroy( list );
       
   365     BaflUtils::DeleteFile( fs, KResourceFilenameRom() );
       
   366 
       
   367     CleanupStack::PopAndDestroy(); //  
       
   368     }
       
   369 
       
   370 void UT_CMusAiwProvider::UT_CMusAiwProvider_InitializeMenuPaneL2L()
       
   371     {    
       
   372     RFs fs;
       
   373     User::LeaveIfError( fs.Connect() );
       
   374     CleanupClosePushL( fs );
       
   375     
       
   376     BaflUtils::CopyFile( fs, KMusAiwProviderResource(),
       
   377                          KResourceFilenameRom() );
       
   378 
       
   379     CAiwGenericParamList* list = CAiwGenericParamList::NewLC();
       
   380 
       
   381     CEikMenuPane* eikPane = NULL;
       
   382     CAiwMenuPane* aiwPane = CreateAiwMenuPaneLC( &eikPane );
       
   383     
       
   384     // ResourceFile is empty 
       
   385     delete iProvider->iResourceFileName;
       
   386     
       
   387     iProvider->iResourceFileName = NULL ;
       
   388 
       
   389     iProvider->InitializeMenuPaneL( *aiwPane, 0, 0, *list );
       
   390     EUNIT_ASSERT( iProvider->iResourceFileName != NULL )
       
   391 
       
   392     // Menu item counter
       
   393     TInt menuPaneCount = eikPane->NumberOfItemsInPane();
       
   394 
       
   395     // test "forbidden" feature: mus NOT allowed, operator variant set to operator
       
   396     MultimediaSharingSettings::SetOperatorVariantSettingL(
       
   397                      MusSettingsKeys::EOperatorSpecific );
       
   398     RProperty::Set( NMusSessionInformationApi::KCategoryUid,
       
   399                     NMusSessionInformationApi::KMUSForbidden,
       
   400                     NMusSessionInformationApi::EMUSForbidden );    
       
   401     EUNIT_ASSERT( eikPane->NumberOfItemsInPane() == menuPaneCount )
       
   402 
       
   403     // set operator back to standard and allow mus
       
   404     RProperty::Set( NMusSessionInformationApi::KCategoryUid ,
       
   405                     NMusSessionInformationApi::KMUSForbidden ,
       
   406                     NMusSessionInformationApi::EMUSAllowed );
       
   407     MultimediaSharingSettings::SetOperatorVariantSettingL(
       
   408                      MusSettingsKeys::EStandard );
       
   409 
       
   410 
       
   411     CMusManager::SetAvailability( MultimediaSharing::EErrCallOnHold );
       
   412     menuPaneCount = eikPane->NumberOfItemsInPane();
       
   413     iProvider->InitializeMenuPaneL( *aiwPane, 0, 0, *list );
       
   414 
       
   415     //EUNIT_ASSERT( eikPane->NumberOfItemsInPane() == menuPaneCount + 3 )
       
   416     MUS_CHECK_MEMORY_LEAVE( eikPane->NumberOfItemsInPane() == menuPaneCount + 3 )
       
   417 
       
   418     // set camera support on
       
   419     FeatureManager::CameraSupported();
       
   420     CleanupStack::PopAndDestroy( aiwPane );
       
   421     CleanupStack::PopAndDestroy( list );
       
   422     BaflUtils::DeleteFile( fs, KResourceFilenameRom() );
       
   423 
       
   424     CleanupStack::PopAndDestroy(); // fs
       
   425     
       
   426     }
       
   427 
       
   428 
       
   429 void UT_CMusAiwProvider::UT_CMusAiwProvider_InitializeMenuPaneL3L()
       
   430     {    
       
   431     RFs fs;
       
   432     User::LeaveIfError( fs.Connect() );
       
   433     CleanupClosePushL( fs );
       
   434     
       
   435     BaflUtils::CopyFile( fs, KMusAiwProviderResource(),
       
   436                          KResourceFilenameRom() );
       
   437 
       
   438     CAiwGenericParamList* list = CAiwGenericParamList::NewLC();
       
   439 
       
   440     CEikMenuPane* eikPane = NULL;
       
   441     CAiwMenuPane* aiwPane = CreateAiwMenuPaneLC( &eikPane );
       
   442 
       
   443     // ResourceFile is empty 
       
   444     delete iProvider->iResourceFileName;
       
   445     
       
   446     iProvider->iResourceFileName = NULL ;
       
   447     iProvider->InitializeMenuPaneL( *aiwPane, 0, 0, *list );
       
   448     EUNIT_ASSERT( iProvider->iResourceFileName != NULL )
       
   449     // Menu item counter
       
   450     TInt menuPaneCount = eikPane->NumberOfItemsInPane();
       
   451 
       
   452     // test "forbidden" feature: mus NOT allowed, operator variant set to operator
       
   453     MultimediaSharingSettings::SetOperatorVariantSettingL(
       
   454                      MusSettingsKeys::EOperatorSpecific );
       
   455     RProperty::Set( NMusSessionInformationApi::KCategoryUid,
       
   456                     NMusSessionInformationApi::KMUSForbidden,
       
   457                     NMusSessionInformationApi::EMUSForbidden );    
       
   458     EUNIT_ASSERT( eikPane->NumberOfItemsInPane() == menuPaneCount )
       
   459  
       
   460     // set operator back to standard and allow mus
       
   461     RProperty::Set( NMusSessionInformationApi::KCategoryUid ,
       
   462                     NMusSessionInformationApi::KMUSForbidden ,
       
   463                     NMusSessionInformationApi::EMUSAllowed );
       
   464     MultimediaSharingSettings::SetOperatorVariantSettingL(
       
   465                      MusSettingsKeys::EStandard );
       
   466  
       
   467 
       
   468     CMusManager::SetAvailability(MultimediaSharing::ESipOptionsSent);
       
   469     menuPaneCount = eikPane->NumberOfItemsInPane();
       
   470     iProvider->InitializeMenuPaneL( *aiwPane, 0, 0, *list );
       
   471  
       
   472     //EUNIT_ASSERT( eikPane->NumberOfItemsInPane() == menuPaneCount + 3 )     
       
   473     MUS_CHECK_MEMORY_LEAVE( eikPane->NumberOfItemsInPane() == menuPaneCount + 3 )
       
   474  
       
   475     // set camera support on
       
   476     FeatureManager::CameraSupported();
       
   477     CleanupStack::PopAndDestroy( aiwPane );
       
   478     CleanupStack::PopAndDestroy( list );
       
   479     BaflUtils::DeleteFile( fs, KResourceFilenameRom() );
       
   480 
       
   481     CleanupStack::PopAndDestroy(); // fs
       
   482     
       
   483     }
       
   484 
       
   485 
       
   486 void UT_CMusAiwProvider::UT_CMusAiwProvider_InitializeMenuPaneL4L()
       
   487     {    
       
   488     RFs fs;
       
   489     User::LeaveIfError( fs.Connect() );
       
   490     CleanupClosePushL( fs );
       
   491     
       
   492     BaflUtils::CopyFile( fs, KMusAiwProviderResource(),
       
   493                          KResourceFilenameRom() );
       
   494 
       
   495     CAiwGenericParamList* list = CAiwGenericParamList::NewLC();
       
   496 
       
   497     CEikMenuPane* eikPane = NULL;
       
   498     CAiwMenuPane* aiwPane = CreateAiwMenuPaneLC( &eikPane );
       
   499 
       
   500     // ResourceFile is empty 
       
   501     delete iProvider->iResourceFileName;
       
   502     
       
   503     iProvider->iResourceFileName = NULL ;
       
   504     iProvider->InitializeMenuPaneL( *aiwPane, 0, 0, *list );
       
   505     EUNIT_ASSERT( iProvider->iResourceFileName != NULL )
       
   506  
       
   507     // Menu item counter
       
   508     TInt menuPaneCount = eikPane->NumberOfItemsInPane();
       
   509 
       
   510     // test "forbidden" feature: mus NOT allowed, operator variant set to operator
       
   511     MultimediaSharingSettings::SetOperatorVariantSettingL(
       
   512                      MusSettingsKeys::EOperatorSpecific );
       
   513     RProperty::Set( NMusSessionInformationApi::KCategoryUid,
       
   514                     NMusSessionInformationApi::KMUSForbidden,
       
   515                     NMusSessionInformationApi::EMUSForbidden );    
       
   516     EUNIT_ASSERT( eikPane->NumberOfItemsInPane() == menuPaneCount )
       
   517 
       
   518     // set operator back to standard and allow mus
       
   519     RProperty::Set( NMusSessionInformationApi::KCategoryUid ,
       
   520                     NMusSessionInformationApi::KMUSForbidden ,
       
   521                     NMusSessionInformationApi::EMUSAllowed );
       
   522     MultimediaSharingSettings::SetOperatorVariantSettingL(
       
   523                      MusSettingsKeys::EStandard );
       
   524 
       
   525 
       
   526     CMusManager::SetAvailability(MultimediaSharing::ESipOptionsNotSent);
       
   527     menuPaneCount = eikPane->NumberOfItemsInPane();
       
   528     iProvider->InitializeMenuPaneL( *aiwPane, 0, 0, *list );
       
   529 
       
   530     //EUNIT_ASSERT( eikPane->NumberOfItemsInPane() == menuPaneCount + 3 )
       
   531     MUS_CHECK_MEMORY_LEAVE( eikPane->NumberOfItemsInPane() == menuPaneCount + 3 )
       
   532 
       
   533     // set camera support on
       
   534     FeatureManager::CameraSupported();
       
   535     CleanupStack::PopAndDestroy( aiwPane );
       
   536     CleanupStack::PopAndDestroy( list );
       
   537     BaflUtils::DeleteFile( fs, KResourceFilenameRom() );
       
   538 
       
   539     CleanupStack::PopAndDestroy(); // fs
       
   540     
       
   541     }
       
   542 
       
   543 void UT_CMusAiwProvider::UT_CMusAiwProvider_InitializeMenuPaneL5L()
       
   544     {    
       
   545     RFs fs;
       
   546     User::LeaveIfError( fs.Connect() );
       
   547     CleanupClosePushL( fs );
       
   548     
       
   549     BaflUtils::CopyFile( fs, KMusAiwProviderResource(),
       
   550                          KResourceFilenameRom() );
       
   551 
       
   552     CAiwGenericParamList* list = CAiwGenericParamList::NewLC();
       
   553 
       
   554     CEikMenuPane* eikPane = NULL;
       
   555     CAiwMenuPane* aiwPane = CreateAiwMenuPaneLC( &eikPane );
       
   556 
       
   557     // ResourceFile is empty 
       
   558     delete iProvider->iResourceFileName;
       
   559     
       
   560     iProvider->iResourceFileName = NULL ;
       
   561     iProvider->InitializeMenuPaneL( *aiwPane, 0, 0, *list );
       
   562     EUNIT_ASSERT( iProvider->iResourceFileName != NULL )
       
   563     // Menu item counter
       
   564     TInt menuPaneCount = eikPane->NumberOfItemsInPane();
       
   565 
       
   566     // test "forbidden" feature: mus NOT allowed, operator variant set to operator
       
   567     MultimediaSharingSettings::SetOperatorVariantSettingL(
       
   568                      MusSettingsKeys::EOperatorSpecific );
       
   569     RProperty::Set( NMusSessionInformationApi::KCategoryUid,
       
   570                     NMusSessionInformationApi::KMUSForbidden,
       
   571                     NMusSessionInformationApi::EMUSForbidden );    
       
   572     EUNIT_ASSERT( eikPane->NumberOfItemsInPane() == menuPaneCount )
       
   573 
       
   574     // set operator back to standard and allow mus
       
   575     RProperty::Set( NMusSessionInformationApi::KCategoryUid ,
       
   576                     NMusSessionInformationApi::KMUSForbidden ,
       
   577                     NMusSessionInformationApi::EMUSAllowed );
       
   578     MultimediaSharingSettings::SetOperatorVariantSettingL(
       
   579                      MusSettingsKeys::EStandard );
       
   580 
       
   581 
       
   582     CMusManager::SetAvailability(MultimediaSharing::EMultimediaSharingAvailable);
       
   583     menuPaneCount = eikPane->NumberOfItemsInPane();
       
   584     iProvider->InitializeMenuPaneL( *aiwPane, 0, 0, *list );
       
   585     //EUNIT_ASSERT( eikPane->NumberOfItemsInPane() == menuPaneCount + 3 )        
       
   586 
       
   587     MUS_CHECK_MEMORY_LEAVE( eikPane->NumberOfItemsInPane() == menuPaneCount + 3 )
       
   588 
       
   589 
       
   590 
       
   591 
       
   592     // set camera support on
       
   593     FeatureManager::CameraSupported();
       
   594     CleanupStack::PopAndDestroy( aiwPane );
       
   595     CleanupStack::PopAndDestroy( list );
       
   596     BaflUtils::DeleteFile( fs, KResourceFilenameRom() );
       
   597 
       
   598     CleanupStack::PopAndDestroy(); // fs
       
   599     
       
   600     }
       
   601 
       
   602 void UT_CMusAiwProvider::UT_CMusAiwProvider_InitializeMenuPaneL6L()
       
   603     {    
       
   604     RFs fs;
       
   605     User::LeaveIfError( fs.Connect() );
       
   606     CleanupClosePushL( fs );
       
   607     
       
   608     BaflUtils::CopyFile( fs, KMusAiwProviderResource(),
       
   609                          KResourceFilenameRom() );
       
   610 
       
   611     CAiwGenericParamList* list = CAiwGenericParamList::NewLC();
       
   612 
       
   613     CEikMenuPane* eikPane = NULL;
       
   614     CAiwMenuPane* aiwPane = CreateAiwMenuPaneLC( &eikPane );
       
   615 
       
   616     // ResourceFile is empty 
       
   617     delete iProvider->iResourceFileName;
       
   618     
       
   619     iProvider->iResourceFileName = NULL ;
       
   620     iProvider->InitializeMenuPaneL( *aiwPane, 0, 0, *list );
       
   621     EUNIT_ASSERT( iProvider->iResourceFileName != NULL )
       
   622     // Menu item counter
       
   623     TInt menuPaneCount = eikPane->NumberOfItemsInPane();
       
   624 
       
   625     // test "forbidden" feature: mus NOT allowed, operator variant set to operator
       
   626     MultimediaSharingSettings::SetOperatorVariantSettingL(
       
   627                      MusSettingsKeys::EOperatorSpecific );
       
   628     RProperty::Set( NMusSessionInformationApi::KCategoryUid,
       
   629                     NMusSessionInformationApi::KMUSForbidden,
       
   630                     NMusSessionInformationApi::EMUSForbidden );    
       
   631     EUNIT_ASSERT( eikPane->NumberOfItemsInPane() == menuPaneCount )
       
   632 
       
   633     // set operator back to standard and allow mus
       
   634     RProperty::Set( NMusSessionInformationApi::KCategoryUid ,
       
   635                     NMusSessionInformationApi::KMUSForbidden ,
       
   636                     NMusSessionInformationApi::EMUSAllowed );
       
   637     MultimediaSharingSettings::SetOperatorVariantSettingL(
       
   638                      MusSettingsKeys::EStandard );
       
   639 
       
   640     // Cases  for "camera not supported"!
       
   641     FeatureManager::CameraNotSupported();
       
   642     CMusManager::SetAvailability(MultimediaSharing::EMultimediaSharingAvailable);
       
   643     menuPaneCount = eikPane->NumberOfItemsInPane();
       
   644     iProvider->InitializeMenuPaneL( *aiwPane, 0, 0, *list );
       
   645 
       
   646     
       
   647     //EUNIT_ASSERT( eikPane->NumberOfItemsInPane() == menuPaneCount + 1 )     
       
   648     MUS_CHECK_MEMORY_LEAVE( eikPane->NumberOfItemsInPane() == menuPaneCount + 1 )    
       
   649 
       
   650     // set camera support on
       
   651     FeatureManager::CameraSupported();
       
   652     CleanupStack::PopAndDestroy( aiwPane );
       
   653     CleanupStack::PopAndDestroy( list );
       
   654     BaflUtils::DeleteFile( fs, KResourceFilenameRom() );
       
   655 
       
   656     CleanupStack::PopAndDestroy(); // fs
       
   657     
       
   658     }
       
   659 
       
   660 void UT_CMusAiwProvider::UT_CMusAiwProvider_InitializeMenuPaneLFastModeL()
       
   661     {    
       
   662     RFs fs;
       
   663     User::LeaveIfError( fs.Connect() );
       
   664     CleanupClosePushL( fs );
       
   665     
       
   666     BaflUtils::CopyFile( fs, KMusAiwProviderResource(),
       
   667                          KResourceFilenameRom() );
       
   668 
       
   669     CAiwGenericParamList* list = CAiwGenericParamList::NewLC();
       
   670 
       
   671     CEikMenuPane* eikPane = NULL;
       
   672     CAiwMenuPane* aiwPane = CreateAiwMenuPaneLC( &eikPane );
       
   673 
       
   674     // ResourceFile is empty 
       
   675     delete iProvider->iResourceFileName;
       
   676     
       
   677     iProvider->iResourceFileName = NULL ;
       
   678     iProvider->InitializeMenuPaneL( *aiwPane, 0, 0, *list );
       
   679     EUNIT_ASSERT( iProvider->iResourceFileName != NULL )
       
   680     // Menu item counter
       
   681     TInt menuPaneCount = eikPane->NumberOfItemsInPane();
       
   682 
       
   683     // set operator back to standard and allow mus
       
   684     RProperty::Set( NMusSessionInformationApi::KCategoryUid ,
       
   685                     NMusSessionInformationApi::KMUSForbidden ,
       
   686                     NMusSessionInformationApi::EMUSAllowed );
       
   687     MultimediaSharingSettings::SetOperatorVariantSettingL(
       
   688                      MusSettingsKeys::EStandard );
       
   689     MultimediaSharingSettings::SetPropertyValueL( 
       
   690               MusSettingsKeys::KFastStartupMode, MusSettingsKeys::EFastModeOn );
       
   691  
       
   692     // Options not enabled, mus shown in menu
       
   693     //
       
   694     MultimediaSharingSettings::SetCapabilityQuerySettingL(
       
   695               MusSettingsKeys::ENoOptions );
       
   696     CMusManager::SetAvailability(MultimediaSharing::EMultimediaSharingAvailable);
       
   697     menuPaneCount = eikPane->NumberOfItemsInPane();
       
   698     iProvider->InitializeMenuPaneL( *aiwPane, 0, 0, *list );
       
   699     
       
   700     MUS_CHECK_MEMORY_LEAVE( eikPane->NumberOfItemsInPane() == menuPaneCount + 3 )
       
   701 
       
   702     // Options supported, not yet available, mus not shown in menu
       
   703     //
       
   704     MultimediaSharingSettings::SetCapabilityQuerySettingL(
       
   705                   MusSettingsKeys::EParallel );
       
   706     CMusManager::SetAvailability(MultimediaSharing::ESipOptionsSent);
       
   707     menuPaneCount = eikPane->NumberOfItemsInPane();
       
   708     iProvider->InitializeMenuPaneL( *aiwPane, 0, 0, *list );
       
   709    
       
   710     MUS_CHECK_MEMORY_LEAVE( eikPane->NumberOfItemsInPane() == menuPaneCount )
       
   711     
       
   712     CleanupStack::PopAndDestroy( aiwPane );
       
   713     CleanupStack::PopAndDestroy( list );
       
   714     BaflUtils::DeleteFile( fs, KResourceFilenameRom() );
       
   715 
       
   716     CleanupStack::PopAndDestroy(); // fs
       
   717     
       
   718     }
       
   719 
       
   720 // -----------------------------------------------------------------------------
       
   721 //
       
   722 // -----------------------------------------------------------------------------
       
   723 //
       
   724 void UT_CMusAiwProvider::UT_CMusAiwProvider_InitializeMenuPaneLFastMode2L()
       
   725     {
       
   726     RFs fs;
       
   727     User::LeaveIfError( fs.Connect() );
       
   728     CleanupClosePushL( fs );
       
   729     
       
   730     BaflUtils::CopyFile( fs, KMusAiwProviderResource(),
       
   731                          KResourceFilenameRom() );
       
   732 
       
   733     CAiwGenericParamList* list = CAiwGenericParamList::NewLC();
       
   734 
       
   735     CEikMenuPane* eikPane = NULL;
       
   736     CAiwMenuPane* aiwPane = CreateAiwMenuPaneLC( &eikPane );
       
   737    
       
   738     // ResourceFile is empty 
       
   739     delete iProvider->iResourceFileName;
       
   740     
       
   741     iProvider->iResourceFileName = NULL ;
       
   742     iProvider->InitializeMenuPaneL( *aiwPane, 0, 0, *list );
       
   743     EUNIT_ASSERT( iProvider->iResourceFileName != NULL )
       
   744 
       
   745     // Options supported, available, mus shown in menu
       
   746     //
       
   747     MultimediaSharingSettings::SetPropertyValueL( 
       
   748               MusSettingsKeys::KFastStartupMode, MusSettingsKeys::EFastModeOn );
       
   749 
       
   750     MultimediaSharingSettings::SetCapabilityQuerySettingL(
       
   751                   MusSettingsKeys::EParallel );
       
   752 
       
   753     CMusManager::SetAvailability(MultimediaSharing::EMultimediaSharingAvailable);
       
   754     TInt menuPaneCount = eikPane->NumberOfItemsInPane();
       
   755     iProvider->InitializeMenuPaneL( *aiwPane, 0, 0, *list );
       
   756 
       
   757     MUS_CHECK_MEMORY_LEAVE( eikPane->NumberOfItemsInPane() == menuPaneCount + 3 )
       
   758     
       
   759     CleanupStack::PopAndDestroy( aiwPane );
       
   760     CleanupStack::PopAndDestroy( list );
       
   761     BaflUtils::DeleteFile( fs, KResourceFilenameRom() );
       
   762 
       
   763     CleanupStack::PopAndDestroy(); // fs
       
   764     }
       
   765 
       
   766 // -----------------------------------------------------------------------------
       
   767 //
       
   768 // -----------------------------------------------------------------------------
       
   769 //
       
   770 void UT_CMusAiwProvider::UT_CMusAiwProvider_HandleMenuCmdLL()
       
   771     {
       
   772     CAiwGenericParamList* pl = CAiwGenericParamList::NewLC();
       
   773 
       
   774     EUNIT_ASSERT( CMusManager::UseCase() == MultimediaSharing::EMusContinue )
       
   775 
       
   776     iProvider->HandleMenuCmdL( EMusCommandLiveShare, *pl, *pl, 0, this );
       
   777     EUNIT_ASSERT( CMusManager::UseCase() == MultimediaSharing::EMusLiveVideo )
       
   778 
       
   779     iProvider->HandleMenuCmdL( EMusCommandClipShare, *pl, *pl, 0, this );
       
   780     MUS_CHECK_MEMORY_LEAVE( CMusManager::UseCase() == MultimediaSharing::EMusClipVideo  )
       
   781     EUNIT_ASSERT( CMusManager::UseCase() == MultimediaSharing::EMusClipVideo )
       
   782 
       
   783     iProvider->HandleMenuCmdL( EMusCommandImageShare, *pl, *pl, 0, this );
       
   784     MUS_CHECK_MEMORY_LEAVE( CMusManager::UseCase() == MultimediaSharing::EMusStillImage  )
       
   785     EUNIT_ASSERT( CMusManager::UseCase() == MultimediaSharing::EMusStillImage )
       
   786 
       
   787     iProvider->HandleMenuCmdL( EMusCommandContinue, *pl, *pl, 0, this );
       
   788     MUS_CHECK_MEMORY_LEAVE( CMusManager::UseCase() == MultimediaSharing::EMusContinue  )
       
   789     EUNIT_ASSERT( CMusManager::UseCase() == MultimediaSharing::EMusContinue )
       
   790 
       
   791     CMusManager::SetStartError(
       
   792             ( MultimediaSharing::TMusAvailabilityStatus ) KErrNotFound );
       
   793 
       
   794     iProvider->HandleMenuCmdL( EMusCommandLiveShare, *pl, *pl, 0, this );
       
   795     EUNIT_ASSERT( CMusManager::UseCase() == MultimediaSharing::EMusContinue )
       
   796 
       
   797     iProvider->HandleMenuCmdL( EMusCommandClipShare, *pl, *pl, 0, this );
       
   798     EUNIT_ASSERT( CMusManager::UseCase() == MultimediaSharing::EMusContinue )
       
   799 
       
   800     iProvider->HandleMenuCmdL( EMusCommandImageShare, *pl, *pl, 0, this );
       
   801     EUNIT_ASSERT( CMusManager::UseCase() == MultimediaSharing::EMusContinue )
       
   802 
       
   803     iProvider->HandleMenuCmdL( EMusCommandContinue, *pl, *pl, 0, this );
       
   804     EUNIT_ASSERT( CMusManager::UseCase() == MultimediaSharing::EMusContinue )
       
   805 
       
   806     // revert it back to original state
       
   807     CMusManager::SetStartError(
       
   808             ( MultimediaSharing::TMusAvailabilityStatus ) KErrNone );
       
   809 
       
   810     // Try with unknown command, should leave
       
   811 
       
   812     TRAPD( error, iProvider->HandleMenuCmdL( 500, *pl, *pl, 0, this ) );
       
   813     if ( error == KErrNoMemory )
       
   814         {
       
   815         User::Leave( error );
       
   816         }
       
   817     EUNIT_ASSERT( error == KErrArgument )
       
   818     EUNIT_ASSERT( CMusManager::UseCase() == MultimediaSharing::EMusContinue )
       
   819 
       
   820     CleanupStack::PopAndDestroy( pl );
       
   821 
       
   822     }
       
   823 
       
   824 
       
   825 // -----------------------------------------------------------------------------
       
   826 //
       
   827 // -----------------------------------------------------------------------------
       
   828 //
       
   829 void UT_CMusAiwProvider::UT_CMusAiwProvider_HandleMenuCmdLFastModeL()
       
   830     {
       
   831     CAiwGenericParamList* pl = CAiwGenericParamList::NewLC();
       
   832     
       
   833     MultimediaSharingSettings::SetPropertyValueL( 
       
   834                MusSettingsKeys::KFastStartupMode, MusSettingsKeys::EFastModeOn );
       
   835     
       
   836     // Fast mode, start live sharing (handle normally)
       
   837     CMusManager::SetUseCase( MultimediaSharing::EMusContinue );
       
   838     iProvider->HandleMenuCmdL( EMusCommandLiveShare, *pl, *pl, 0, this );
       
   839     MUS_CHECK_MEMORY_LEAVE( CMusManager::UseCase() == MultimediaSharing::EMusLiveVideo  )
       
   840     EUNIT_ASSERT( CMusManager::UseCase() == MultimediaSharing::EMusLiveVideo )
       
   841 
       
   842     // Fast mode, start clip sharing, app not running nor hidden (handle normally)
       
   843     CMusManager::SetUseCase( MultimediaSharing::EMusContinue );
       
   844     iProvider->HandleMenuCmdL( EMusCommandClipShare, *pl, *pl, 0, this );
       
   845     MUS_CHECK_MEMORY_LEAVE( CMusManager::UseCase() == MultimediaSharing::EMusClipVideo  )
       
   846     EUNIT_ASSERT( CMusManager::UseCase() == MultimediaSharing::EMusClipVideo )
       
   847         
       
   848     // Fast mode, start clip sharing, app running and hidden (mus mgr is not
       
   849     // used for starting application, only usecase P&S value is changed)
       
   850     CMusManager::SetUseCase( MultimediaSharing::EMusContinue );
       
   851     
       
   852     TApaTask::iApplicationExist = ETrue;
       
   853     
       
   854     TBuf16< 10 > listOkMus; 
       
   855     TUint16 upperBits = KMusUiUid >> 16;  
       
   856     listOkMus.Append( upperBits );
       
   857     listOkMus.Append( KMusUiUid );
       
   858     listOkMus.Append( 0 );
       
   859     listOkMus.Append( 0 );
       
   860     RProperty::Set( KPSUidUikon, KUikAppHiddenList, listOkMus );  
       
   861     
       
   862     RProperty::Set( NMusSessionApi::KCategoryUid, NMusSessionApi::KUseCase, MultimediaSharing::EMusContinue );
       
   863     
       
   864     iProvider->HandleMenuCmdL( EMusCommandClipShare, *pl, *pl, 0, this );
       
   865     EUNIT_ASSERT( CMusManager::UseCase() == MultimediaSharing::EMusContinue )
       
   866     
       
   867     TInt usecaseAfterFakeStart( 0 );
       
   868     RProperty::Get( NMusSessionApi::KCategoryUid, NMusSessionApi::KUseCase, usecaseAfterFakeStart );
       
   869     EUNIT_ASSERT( usecaseAfterFakeStart == MultimediaSharing::EMusClipVideo );
       
   870     
       
   871     CleanupStack::PopAndDestroy( pl );
       
   872 
       
   873     }
       
   874 
       
   875 // -----------------------------------------------------------------------------
       
   876 //
       
   877 // -----------------------------------------------------------------------------
       
   878 //
       
   879 void UT_CMusAiwProvider::UT_CMusAiwProvider_ApplicationRunningLL()
       
   880     {
       
   881     TApaTask::iApplicationExist = EFalse;
       
   882     EUNIT_ASSERT( !iProvider->ApplicationRunningL() )
       
   883 
       
   884     // Use stub to mimic the existence of application
       
   885     TApaTask::iApplicationExist = ETrue;
       
   886 
       
   887     EUNIT_ASSERT( iProvider->ApplicationRunningL() )
       
   888     
       
   889     // Revert back to old state
       
   890     TApaTask::iApplicationExist = EFalse;
       
   891     }
       
   892 
       
   893 
       
   894 // -----------------------------------------------------------------------------
       
   895 //
       
   896 // -----------------------------------------------------------------------------
       
   897 //
       
   898 void UT_CMusAiwProvider::UT_CMusAiwProvider_ShowErrorNoteLL()
       
   899     {
       
   900     // Dummy test is enough ShowErrorNoteL does not contain any branches,
       
   901     // does not return anything and does not have any side effects that could
       
   902     // be asserted
       
   903     iProvider->iIsWarning = ETrue ;
       
   904     iProvider->ShowErrorNoteL( MultimediaSharing::EErrCallOnHold );
       
   905     iProvider->iIsWarning = EFalse ;
       
   906     iProvider->ShowErrorNoteL( MultimediaSharing::EErrCallOnHold );
       
   907 
       
   908     //Error Case
       
   909     iProvider->ShowErrorNoteL( -1 ); // 100 should not be available    
       
   910     }
       
   911 
       
   912 
       
   913 // -----------------------------------------------------------------------------
       
   914 //
       
   915 // -----------------------------------------------------------------------------
       
   916 //
       
   917 void UT_CMusAiwProvider::UT_CMusAiwProvider_ErrorNoteTextLCL()
       
   918     {
       
   919     HBufC* errorNote = NULL;
       
   920 
       
   921     // It is enough to test with whatever error code since handling is same
       
   922     // for all.
       
   923     errorNote = iProvider->ErrorNoteTextLC( MultimediaSharing::EErrCallOnHold );
       
   924     
       
   925     // NULL TEST, old way not support this comparistaion. 
       
   926     // Maybe to hard byte compare needed!
       
   927     //EUNIT_ASSERT( *errorNote == KMusOnHold() )
       
   928     
       
   929     CleanupStack::PopAndDestroy( errorNote );
       
   930 
       
   931     }
       
   932 
       
   933 
       
   934 // -----------------------------------------------------------------------------
       
   935 //
       
   936 // -----------------------------------------------------------------------------
       
   937 //
       
   938 void UT_CMusAiwProvider::UT_CMusAiwProvider_ErrorNoteText8LL()
       
   939     {
       
   940     RFs fs;
       
   941     User::LeaveIfError( fs.Connect() );
       
   942     CleanupClosePushL( fs );
       
   943 
       
   944     RResourceFile resourceFile;
       
   945     resourceFile.OpenL( fs, KMusAiwProviderResource() );
       
   946     CleanupClosePushL( resourceFile );
       
   947 
       
   948     HBufC8* errorNote = NULL;
       
   949 
       
   950     errorNote = iProvider->ErrorNoteText8L( MultimediaSharing::EErrCallOnHold,
       
   951                                             resourceFile );
       
   952     CleanupStack::PushL( errorNote );
       
   953     EUNIT_ASSERT( *errorNote == KMusOnHold8() )
       
   954     CleanupStack::PopAndDestroy( errorNote );
       
   955 
       
   956 
       
   957     errorNote = iProvider->ErrorNoteText8L( MultimediaSharing::EErrNetwork,
       
   958                                             resourceFile );
       
   959     CleanupStack::PushL( errorNote );
       
   960     EUNIT_ASSERT( *errorNote == KMusNetworkIncompatible8() )
       
   961     CleanupStack::PopAndDestroy( errorNote );
       
   962 
       
   963 
       
   964     errorNote = iProvider->ErrorNoteText8L(
       
   965                             MultimediaSharing::EErrConferenceCall,
       
   966                             resourceFile );
       
   967     CleanupStack::PushL( errorNote );
       
   968     EUNIT_ASSERT( *errorNote == KMusConferenceCall8() )
       
   969     CleanupStack::PopAndDestroy( errorNote );
       
   970 
       
   971 
       
   972     errorNote = iProvider->ErrorNoteText8L(
       
   973                             MultimediaSharing::ESipOptionsNotCapable,
       
   974                             resourceFile );
       
   975     CleanupStack::PushL( errorNote );
       
   976     EUNIT_ASSERT( *errorNote == KMusRecipientIncapable8() )
       
   977     CleanupStack::PopAndDestroy( errorNote );
       
   978 
       
   979 
       
   980     errorNote = iProvider->ErrorNoteText8L(
       
   981                             MultimediaSharing::EErrSipRegistration,
       
   982                             resourceFile );
       
   983     CleanupStack::PushL( errorNote );
       
   984     EUNIT_ASSERT( *errorNote == KMusNoReg8() )
       
   985     CleanupStack::PopAndDestroy( errorNote );
       
   986 
       
   987 
       
   988     errorNote = iProvider->ErrorNoteText8L(
       
   989                             MultimediaSharing::EErrNoActiveCall,
       
   990                             resourceFile );
       
   991     CleanupStack::PushL( errorNote );    
       
   992     EUNIT_ASSERT( *errorNote == KMusGeneral() )
       
   993     CleanupStack::PopAndDestroy( errorNote );
       
   994 
       
   995     CleanupStack::PopAndDestroy(); // resourceFile
       
   996 
       
   997     CleanupStack::PopAndDestroy(); // fs
       
   998     }
       
   999 
       
  1000 
       
  1001 // -----------------------------------------------------------------------------
       
  1002 //
       
  1003 // -----------------------------------------------------------------------------
       
  1004 //
       
  1005 void UT_CMusAiwProvider::UT_ImplementationGroupProxyL()
       
  1006     {
       
  1007     // Dummy test just to raise coverage
       
  1008     TInt tableCount;
       
  1009     ImplementationGroupProxy( tableCount );
       
  1010     }
       
  1011 
       
  1012 // -----------------------------------------------------------------------------
       
  1013 //
       
  1014 // -----------------------------------------------------------------------------
       
  1015 //
       
  1016 void UT_CMusAiwProvider::UT_HiddenFromFastSwapL()
       
  1017     {
       
  1018     // Normal mode
       
  1019     MultimediaSharingSettings::SetPropertyValueL( 
       
  1020                 MusSettingsKeys::KFastStartupMode, MusSettingsKeys::EFastModeOff );
       
  1021     EUNIT_ASSERT( !iProvider->HiddenFromFastSwapL() )
       
  1022     
       
  1023     // Fast mode
       
  1024     //
       
  1025     MultimediaSharingSettings::SetPropertyValueL( 
       
  1026                MusSettingsKeys::KFastStartupMode, MusSettingsKeys::EFastModeOn );
       
  1027     
       
  1028     // Key not found
       
  1029     PropertyHelper::SetErrorCode( KErrNotFound );
       
  1030     EUNIT_ASSERT( !iProvider->HiddenFromFastSwapL() )
       
  1031     
       
  1032     // Malformed key value
       
  1033     PropertyHelper::SetErrorCode( KErrNone );
       
  1034     TBuf16< 5 > listMalformed;
       
  1035     listMalformed.Copy( _L("05645") );
       
  1036     RProperty::Set( KPSUidUikon, KUikAppHiddenList, listMalformed );   
       
  1037     MUS_EUNIT_ASSERT_SPECIFIC_LEAVE( iProvider->HiddenFromFastSwapL(), KErrEof );
       
  1038     
       
  1039     // No musuid in value list
       
  1040     TBuf16< 6 > listOkNoMus;
       
  1041     TUint32 uid1 = 10002000;
       
  1042     TUint32 uid2 = 20003000;
       
  1043     // avkoncapserver publishes values in following manner
       
  1044     TUint16 upperBits = uid1 >> 16;
       
  1045     listOkNoMus.Append( upperBits );
       
  1046     listOkNoMus.Append( uid1 );
       
  1047     upperBits = uid2 >> 16;
       
  1048     listOkNoMus.Append( upperBits );
       
  1049     listOkNoMus.Append( uid2 );
       
  1050     listOkNoMus.Append( 0 );
       
  1051     listOkNoMus.Append( 0 );
       
  1052     RProperty::Set( KPSUidUikon, KUikAppHiddenList, listOkNoMus );  
       
  1053     EUNIT_ASSERT( !iProvider->HiddenFromFastSwapL() )
       
  1054     
       
  1055     // Musuid in value list
       
  1056     TBuf16< 10 > listOkMus;
       
  1057     TUint32 uid3 = 30005000;
       
  1058     upperBits = uid1 >> 16;
       
  1059     listOkMus.Append( upperBits );
       
  1060     listOkMus.Append( uid1 );
       
  1061     upperBits = uid2 >> 16;
       
  1062     listOkMus.Append( upperBits );
       
  1063     listOkMus.Append( uid2 );
       
  1064     
       
  1065     upperBits = KMusUiUid >> 16;  
       
  1066     listOkMus.Append( upperBits );
       
  1067     listOkMus.Append( KMusUiUid );
       
  1068     
       
  1069     upperBits = uid3 >> 16;
       
  1070     listOkMus.Append( upperBits );
       
  1071     listOkMus.Append( uid3 );
       
  1072     
       
  1073     listOkMus.Append( 0 );
       
  1074     listOkMus.Append( 0 );
       
  1075     RProperty::Set( KPSUidUikon, KUikAppHiddenList, listOkMus );  
       
  1076     EUNIT_ASSERT( iProvider->HiddenFromFastSwapL() )
       
  1077     }
       
  1078 
       
  1079 // HELPERS
       
  1080 
       
  1081 CAiwMenuPane* UT_CMusAiwProvider::CreateAiwMenuPaneLC( CEikMenuPane** aEikPane )
       
  1082     {
       
  1083     CEikMenuPane* eikPane = new( ELeave ) CEikMenuPane( this );
       
  1084     CleanupStack::PushL( eikPane );
       
  1085 
       
  1086     // Constructing eikPane is not compulsory for testing and leads to a memory
       
  1087     // leak.
       
  1088     //eikPane->ConstructL( NULL, this );
       
  1089 
       
  1090     CAiwMenuPane* aiwPane = new( ELeave ) CAiwMenuPane( *eikPane, 0 ); //Takes ownership
       
  1091     CleanupStack::Pop( eikPane );
       
  1092     CleanupStack::PushL( aiwPane );
       
  1093     *aEikPane = eikPane;
       
  1094     return aiwPane;
       
  1095     }
       
  1096 
       
  1097 //  TEST TABLE
       
  1098 
       
  1099 EUNIT_BEGIN_TEST_TABLE(
       
  1100     UT_CMusAiwProvider,
       
  1101     "CMusAiwProvider",
       
  1102     "UT_CMusAiwProvider" )
       
  1103 
       
  1104 EUNIT_TEST(
       
  1105     "InitialiseL - test",
       
  1106     "CMusAiwProvider",
       
  1107     "InitialiseL",
       
  1108     "FUNCTIONALITY",
       
  1109     SetupL, UT_CMusAiwProvider_InitialiseLL, Teardown)
       
  1110 
       
  1111 EUNIT_TEST(
       
  1112     "HandleServiceCmdL - test",
       
  1113     "CMusAiwProvider",
       
  1114     "HandleServiceCmdL",
       
  1115     "FUNCTIONALITY",
       
  1116     SetupL, UT_CMusAiwProvider_HandleServiceCmdLL, Teardown)
       
  1117 
       
  1118 EUNIT_TEST(
       
  1119     "InitializeMenuPaneL - test",
       
  1120     "CMusAiwProvider",
       
  1121     "InitializeMenuPaneL",
       
  1122     "FUNCTIONALITY",
       
  1123     SetupL, UT_CMusAiwProvider_InitializeMenuPaneLL, Teardown)
       
  1124 
       
  1125 EUNIT_TEST(
       
  1126     "InitializeMenuPaneL - test2",
       
  1127     "CMusAiwProvider",
       
  1128     "InitializeMenuPaneL",
       
  1129     "FUNCTIONALITY",
       
  1130     SetupL, UT_CMusAiwProvider_InitializeMenuPaneL2L, Teardown)
       
  1131     
       
  1132 EUNIT_TEST(
       
  1133     "InitializeMenuPaneL - test3",
       
  1134     "CMusAiwProvider",
       
  1135     "InitializeMenuPaneL",
       
  1136     "FUNCTIONALITY",
       
  1137     SetupL, UT_CMusAiwProvider_InitializeMenuPaneL3L, Teardown)
       
  1138 EUNIT_TEST(
       
  1139     "InitializeMenuPaneL - test4",
       
  1140     "CMusAiwProvider",
       
  1141     "InitializeMenuPaneL",
       
  1142     "FUNCTIONALITY",
       
  1143     SetupL, UT_CMusAiwProvider_InitializeMenuPaneL4L, Teardown)
       
  1144 EUNIT_TEST(
       
  1145     "InitializeMenuPaneL - test5",
       
  1146     "CMusAiwProvider",
       
  1147     "InitializeMenuPaneL",
       
  1148     "FUNCTIONALITY",
       
  1149     SetupL, UT_CMusAiwProvider_InitializeMenuPaneL5L, Teardown)
       
  1150 EUNIT_TEST(
       
  1151     "InitializeMenuPaneL - test6",
       
  1152     "CMusAiwProvider",
       
  1153     "InitializeMenuPaneL",
       
  1154     "FUNCTIONALITY",
       
  1155     SetupL, UT_CMusAiwProvider_InitializeMenuPaneL6L, Teardown)
       
  1156 
       
  1157 EUNIT_TEST(
       
  1158     "InitializeMenuPaneL - fast mode",
       
  1159     "CMusAiwProvider",
       
  1160     "InitializeMenuPaneL",
       
  1161     "FUNCTIONALITY",
       
  1162     SetupL, UT_CMusAiwProvider_InitializeMenuPaneLFastModeL, Teardown)
       
  1163 
       
  1164 EUNIT_TEST(
       
  1165     "InitializeMenuPaneL - fast mode 2",
       
  1166     "CMusAiwProvider",
       
  1167     "InitializeMenuPaneL",
       
  1168     "FUNCTIONALITY",
       
  1169     SetupL, UT_CMusAiwProvider_InitializeMenuPaneLFastMode2L, Teardown)
       
  1170 
       
  1171 EUNIT_TEST(
       
  1172     "HandleMenuCmdL - test",
       
  1173     "CMusAiwProvider",
       
  1174     "HandleMenuCmdL",
       
  1175     "FUNCTIONALITY",
       
  1176     SetupL, UT_CMusAiwProvider_HandleMenuCmdLL, Teardown)
       
  1177 
       
  1178 EUNIT_TEST(
       
  1179     "HandleMenuCmdL - fastmode test",
       
  1180     "CMusAiwProvider",
       
  1181     "HandleMenuCmdL",
       
  1182     "FUNCTIONALITY",
       
  1183     SetupL, UT_CMusAiwProvider_HandleMenuCmdLFastModeL, Teardown)   
       
  1184 
       
  1185 EUNIT_TEST(
       
  1186     "ApplicationRunningL - test",
       
  1187     "CMusAiwProvider",
       
  1188     "ApplicationRunningL",
       
  1189     "FUNCTIONALITY",
       
  1190     SetupL, UT_CMusAiwProvider_ApplicationRunningLL, Teardown)
       
  1191 
       
  1192 EUNIT_TEST(
       
  1193     "ShowErrorNoteL - test",
       
  1194     "CMusAiwProvider",
       
  1195     "ShowErrorNoteL",
       
  1196     "FUNCTIONALITY",
       
  1197     SetupL, UT_CMusAiwProvider_ShowErrorNoteLL, Teardown)
       
  1198 
       
  1199 EUNIT_TEST(
       
  1200     "ErrorNoteTextLC - test",
       
  1201     "CMusAiwProvider",
       
  1202     "ErrorNoteTextLC",
       
  1203     "FUNCTIONALITY",
       
  1204     SetupL, UT_CMusAiwProvider_ErrorNoteTextLCL, Teardown)
       
  1205 
       
  1206 EUNIT_TEST(
       
  1207     "ErrorNoteText8L - test",
       
  1208     "CMusAiwProvider",
       
  1209     "ErrorNoteText8L",
       
  1210     "FUNCTIONALITY",
       
  1211     SetupL, UT_CMusAiwProvider_ErrorNoteText8LL, Teardown)
       
  1212 
       
  1213 EUNIT_TEST(
       
  1214     "ImplementationGroupProxy",
       
  1215     "CMusAiwProvider",
       
  1216     "ImplementationGroupProxy",
       
  1217     "FUNCTIONALITY",
       
  1218     SetupL, UT_ImplementationGroupProxyL, Teardown)
       
  1219     
       
  1220 EUNIT_TEST(
       
  1221     "HiddenFromFastSwapL",
       
  1222     "CMusAiwProvider",
       
  1223     "HiddenFromFastSwapL",
       
  1224     "FUNCTIONALITY",
       
  1225     SetupL, UT_HiddenFromFastSwapL, Teardown)
       
  1226 
       
  1227 EUNIT_END_TEST_TABLE
       
  1228