mmshplugins/mmshwpadapterplugin/tsrc/ut_wpadapterplugin/src/ut_muswpadapter.cpp
changeset 22 496ad160a278
parent 0 f0cf47e981f9
equal deleted inserted replaced
15:ccd8e69b5392 22:496ad160a278
       
     1 /*
       
     2 * Copyright (c) 2009 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 //  INTERNAL INCLUDES
       
    20 #include "ut_muswpadapter.h"
       
    21 #include "muswpadapterstubs.h"
       
    22 
       
    23 #include "muswpadapter.h"
       
    24 #include "muswpitem.h"
       
    25 
       
    26 //  SYSTEM INCLUDES
       
    27 #include <digia/eunit/eunitmacros.h>
       
    28 #include <cwpcharacteristic.h>
       
    29 #include <cwpparameter.h>
       
    30 
       
    31 
       
    32 
       
    33 _LIT( KMusSomeName, "Some name" );
       
    34 _LIT( KMusSomeProvider, "SomeProvider" );
       
    35 _LIT( KMusSomeToAppRef, "SomeToAppRef" );
       
    36 _LIT( KMusOurToAppRef, "OurToAppRef" );
       
    37 _LIT( KMusAppID, "w9017" );
       
    38 _LIT( KSipAppID, "w9010" );
       
    39 _LIT( KMUsWpCharacteristicNameCapability, "CAPABILITY" );
       
    40 _LIT( KMUsWpCharacteristicNameActivation, "ACTIVATION" );
       
    41 _LIT( KMUsWpCharacteristicNameUnknown, "UNKNOWN" );
       
    42 _LIT( KMusWpParamNameEdgeDtm, "EDGEDTM" );
       
    43 _LIT( KMusWpParamNameInternetSignaling, "INTERNETSIGNALING" );
       
    44 _LIT( KMusWpParamNameQuery, "QUERY" );
       
    45 _LIT( KMusWpParamNameCondition, "CONDITION" );
       
    46 _LIT( KMusWpParamNameUnknown, "UNKNOWN" );
       
    47 _LIT( KMusWpParamValue1, "1" );
       
    48 _LIT( KMusWpParamValue2, "2" );
       
    49 _LIT( KMusWpParamValue3, "3" );
       
    50 
       
    51 _LIT8( KMusSomeAppID8, "w0000" );
       
    52 _LIT8( KSipAppID8, "w9010" );
       
    53 _LIT8( KMusSomeStorageIdValue8, "9999" );
       
    54 _LIT8( KMusSomeToAppRef8, "SomeToAppRef" );
       
    55 _LIT8( KMusOurToAppRef8, "OurToAppRef" );
       
    56 
       
    57 const TUint32 KMusWpNotSet = 0;
       
    58 const TUint32 KMusSomeStorageIdValueAsTUint = 9999;
       
    59 
       
    60 // -----------------------------------------------------------------------------
       
    61 //
       
    62 // -----------------------------------------------------------------------------
       
    63 //
       
    64 UT_CMusWpAdapter* UT_CMusWpAdapter::NewL()
       
    65     {
       
    66     UT_CMusWpAdapter* self = UT_CMusWpAdapter::NewLC();
       
    67     CleanupStack::Pop( self );
       
    68     return self;
       
    69     }
       
    70 
       
    71 
       
    72 // -----------------------------------------------------------------------------
       
    73 //
       
    74 // -----------------------------------------------------------------------------
       
    75 //
       
    76 UT_CMusWpAdapter* UT_CMusWpAdapter::NewLC()
       
    77     {
       
    78     UT_CMusWpAdapter* self = new( ELeave ) UT_CMusWpAdapter();
       
    79     CleanupStack::PushL( self );
       
    80     self->ConstructL();
       
    81     return self;
       
    82     }
       
    83 
       
    84 
       
    85 // -----------------------------------------------------------------------------
       
    86 //
       
    87 // -----------------------------------------------------------------------------
       
    88 //
       
    89 UT_CMusWpAdapter::~UT_CMusWpAdapter()
       
    90     {
       
    91     // NOP
       
    92     }
       
    93 
       
    94 
       
    95 // -----------------------------------------------------------------------------
       
    96 // Default constructor
       
    97 // -----------------------------------------------------------------------------
       
    98 //
       
    99 UT_CMusWpAdapter::UT_CMusWpAdapter()
       
   100     :iWpAdapter( NULL )
       
   101     {
       
   102     // NOP
       
   103     }
       
   104 
       
   105 
       
   106 // -----------------------------------------------------------------------------
       
   107 // Second phase construct
       
   108 // -----------------------------------------------------------------------------
       
   109 //
       
   110 void UT_CMusWpAdapter::ConstructL()
       
   111     {
       
   112     // The ConstructL from the base class CEUnitTestSuiteClass must be called.
       
   113     // It generates the test case table.
       
   114     CEUnitTestSuiteClass::ConstructL();
       
   115     }
       
   116     
       
   117 
       
   118 // -----------------------------------------------------------------------------
       
   119 //
       
   120 // -----------------------------------------------------------------------------
       
   121 //
       
   122 void UT_CMusWpAdapter::SetupL()
       
   123     {
       
   124     iWpAdapter = CMusWpAdapter::NewL();
       
   125     }
       
   126 
       
   127 
       
   128 // -----------------------------------------------------------------------------
       
   129 //
       
   130 // -----------------------------------------------------------------------------
       
   131 //
       
   132 void UT_CMusWpAdapter::Teardown()
       
   133     {
       
   134     delete iWpAdapter;
       
   135     }
       
   136 
       
   137 
       
   138 
       
   139 // TEST CASES
       
   140 
       
   141 
       
   142 
       
   143     
       
   144 
       
   145 // -----------------------------------------------------------------------------
       
   146 //
       
   147 // -----------------------------------------------------------------------------
       
   148 //
       
   149 void UT_CMusWpAdapter::UT_CMusWpAdapter_NewLL()
       
   150     {
       
   151     EUNIT_ASSERT( iWpAdapter )
       
   152     }
       
   153 
       
   154 
       
   155 // -----------------------------------------------------------------------------
       
   156 //
       
   157 // -----------------------------------------------------------------------------
       
   158 //
       
   159 void UT_CMusWpAdapter::UT_CMusWpAdapter_ItemCountL()
       
   160     {
       
   161     EUNIT_ASSERT( iWpAdapter->ItemCount() == 0 )
       
   162     
       
   163     iWpAdapter->iWpItem = CMusWpItem::NewL();
       
   164     
       
   165     EUNIT_ASSERT( iWpAdapter->ItemCount() == 1 )
       
   166     }
       
   167 
       
   168 
       
   169 // -----------------------------------------------------------------------------
       
   170 //
       
   171 // -----------------------------------------------------------------------------
       
   172 //
       
   173 void UT_CMusWpAdapter::UT_CMusWpAdapter_SummaryTitleL()
       
   174     {
       
   175     EUNIT_ASSERT( iWpAdapter->SummaryTitle( 0 ) == KMusSummaryTitle )
       
   176     }
       
   177 
       
   178 
       
   179 // -----------------------------------------------------------------------------
       
   180 //
       
   181 // -----------------------------------------------------------------------------
       
   182 //
       
   183 void UT_CMusWpAdapter::UT_CMusWpAdapter_SummaryTextL()
       
   184     {
       
   185     // Try to get text when no settings received, default returned
       
   186     EUNIT_ASSERT( !iWpAdapter->iWpItem )
       
   187     EUNIT_ASSERT( iWpAdapter->SummaryText( 0 ) == KMusSummaryTitle )
       
   188     
       
   189     // Try to get text when name received, name returned
       
   190     iWpAdapter->iWpItem = CMusWpItem::NewL();
       
   191     iWpAdapter->iWpItem->iName = KMusSomeName().AllocL();
       
   192 
       
   193     EUNIT_ASSERT( iWpAdapter->SummaryText( 0 ) == KMusSomeName() )    
       
   194     }
       
   195 
       
   196 
       
   197 // -----------------------------------------------------------------------------
       
   198 //
       
   199 // -----------------------------------------------------------------------------
       
   200 //
       
   201 void UT_CMusWpAdapter::UT_CMusWpAdapter_SaveLL()
       
   202     {
       
   203     // dummy, we cannot assert anything
       
   204     iWpAdapter->SaveL( 0 );
       
   205     iWpAdapter->iWpItem = CMusWpItem::NewL();
       
   206     iWpAdapter->SaveL( 0 );
       
   207     }
       
   208 
       
   209 
       
   210 // -----------------------------------------------------------------------------
       
   211 //
       
   212 // -----------------------------------------------------------------------------
       
   213 //
       
   214 void UT_CMusWpAdapter::UT_CMusWpAdapter_CanSetAsDefaultL()
       
   215     {
       
   216     EUNIT_ASSERT( iWpAdapter->CanSetAsDefault( 0 ) == EFalse )
       
   217     }
       
   218 
       
   219 
       
   220 // -----------------------------------------------------------------------------
       
   221 //
       
   222 // -----------------------------------------------------------------------------
       
   223 //
       
   224 void UT_CMusWpAdapter::UT_CMusWpAdapter_SetAsDefaultLL()
       
   225     {
       
   226     TRAPD( error, iWpAdapter->SetAsDefaultL( 0 ) )
       
   227     EUNIT_ASSERT( error == KErrNotSupported )
       
   228     }
       
   229     
       
   230     
       
   231 // -----------------------------------------------------------------------------
       
   232 //
       
   233 // -----------------------------------------------------------------------------
       
   234 //
       
   235 void UT_CMusWpAdapter::UT_CMusWpAdapter_DetailsLL()
       
   236     {
       
   237     TPairVisitorStub visitor;
       
   238         
       
   239     EUNIT_ASSERT( iWpAdapter->DetailsL( 0, visitor ) == KErrNotSupported )
       
   240     }
       
   241     
       
   242     
       
   243 // -----------------------------------------------------------------------------
       
   244 //
       
   245 // -----------------------------------------------------------------------------
       
   246 //
       
   247 void UT_CMusWpAdapter::UT_CMusWpAdapter_SettingsSavedLL()
       
   248     {
       
   249     // Try to tell that some other adapter than SIPAdapter has saved something,
       
   250     // do nothing
       
   251     
       
   252     iWpAdapter->SettingsSavedL( KMusSomeAppID8(), 
       
   253                                 KMusSomeToAppRef8(), 
       
   254                                 KMusSomeStorageIdValue8() );
       
   255     EUNIT_ASSERT( !iWpAdapter->iProfileIdReceived );
       
   256     EUNIT_ASSERT( iWpAdapter->iProfileId == KMusWpNotSet );
       
   257     
       
   258     // Try to tell that sip adapter has saved profile for some other app, 
       
   259     // and we have not received any settings, do nothing
       
   260     iWpAdapter->SettingsSavedL( KSipAppID8(), 
       
   261                                 KMusSomeToAppRef8(), 
       
   262                                 KMusSomeStorageIdValue8() );
       
   263     EUNIT_ASSERT( !iWpAdapter->iProfileIdReceived );
       
   264     EUNIT_ASSERT( iWpAdapter->iProfileId == KMusWpNotSet );
       
   265     
       
   266     // Try to tell that sip adapter has saved profile for some other app, 
       
   267     // and we have also received settings, but not TO-APPREF, do nothing
       
   268     iWpAdapter->iWpItem = CMusWpItem::NewL();
       
   269     
       
   270     iWpAdapter->SettingsSavedL( KSipAppID8(), 
       
   271                                 KMusSomeToAppRef8(), 
       
   272                                 KMusSomeStorageIdValue8() );
       
   273     EUNIT_ASSERT( !iWpAdapter->iProfileIdReceived );
       
   274     EUNIT_ASSERT( iWpAdapter->iProfileId == KMusWpNotSet );
       
   275     
       
   276     // Try to tell that sip adapter has saved profile for us, prepare to save
       
   277     iWpAdapter->iWpItem->iToAppRef = KMusOurToAppRef().AllocL();
       
   278     
       
   279     iWpAdapter->SettingsSavedL( KSipAppID8(), 
       
   280                                 KMusOurToAppRef8(), 
       
   281                                 KMusSomeStorageIdValue8() );
       
   282     EUNIT_ASSERT( iWpAdapter->iProfileIdReceived );
       
   283     EUNIT_ASSERT( iWpAdapter->iProfileId == KMusSomeStorageIdValueAsTUint );
       
   284     }
       
   285     
       
   286     
       
   287 // -----------------------------------------------------------------------------
       
   288 //
       
   289 // -----------------------------------------------------------------------------
       
   290 //
       
   291 void UT_CMusWpAdapter::UT_CMusWpAdapter_SavingFinalizedLL()
       
   292     {
       
   293     // dummy, we cannot assert anything
       
   294     iWpAdapter->SavingFinalizedL();
       
   295     iWpAdapter->iProfileIdReceived = ETrue;
       
   296     iWpAdapter->SavingFinalizedL();
       
   297     }
       
   298     
       
   299     
       
   300 // -----------------------------------------------------------------------------
       
   301 //
       
   302 // -----------------------------------------------------------------------------
       
   303 //
       
   304 void UT_CMusWpAdapter::UT_CMusWpAdapter_VisitCharacteristicLL()
       
   305     {
       
   306     // Try without name and with unknown type, does nothing
       
   307     CWPCharacteristic* characteristic = CWPCharacteristic::NewLC( -1 );
       
   308     iWpAdapter->VisitL( *characteristic );
       
   309     CleanupStack::PopAndDestroy( characteristic );
       
   310     
       
   311     // Try with named characteristic outside application-characteristic
       
   312     characteristic = CWPCharacteristic::NewLC( KWPNamedCharacteristic );
       
   313     iWpAdapter->VisitL( *characteristic );
       
   314     CleanupStack::PopAndDestroy( characteristic );
       
   315     
       
   316     // Try with application characteristic, but without any id
       
   317     characteristic = CWPCharacteristic::NewLC( KWPApplication );
       
   318     
       
   319     iWpAdapter->VisitL( *characteristic );
       
   320     EUNIT_ASSERT( !iWpAdapter->iAppID )
       
   321     EUNIT_ASSERT( !iWpAdapter->iWpItem )
       
   322     
       
   323     CleanupStack::PopAndDestroy( characteristic );
       
   324     
       
   325     // Try with application characteristic, but without our id (w9017)
       
   326     characteristic = CWPCharacteristic::NewLC( KWPApplication );
       
   327    
       
   328     CWPParameter* param = CWPParameter::NewLC();
       
   329     param->SetID( EWPParameterAppID );
       
   330     param->SetValueL( KSipAppID() );
       
   331     characteristic->InsertL( param );
       
   332     CleanupStack::Pop( param );
       
   333     
       
   334     param = CWPParameter::NewLC();
       
   335     param->SetID( EWPParameterName );
       
   336     param->SetValueL( KMusSomeName() );
       
   337     characteristic->InsertL( param );
       
   338     CleanupStack::Pop( param );
       
   339     
       
   340     iWpAdapter->VisitL( *characteristic );
       
   341     EUNIT_ASSERT( *iWpAdapter->iAppID == KSipAppID()  )
       
   342     EUNIT_ASSERT( !iWpAdapter->iWpItem )
       
   343     
       
   344     CleanupStack::PopAndDestroy( characteristic );
       
   345       
       
   346     // Try with application, capability, activation and unknown 
       
   347     // characteristic, our id and proper params
       
   348     characteristic = CWPCharacteristic::NewLC( KWPApplication );
       
   349    
       
   350     param = CWPParameter::NewLC();
       
   351     param->SetID( EWPParameterAppID );
       
   352     param->SetValueL( KMusAppID() );
       
   353     characteristic->InsertL( param );
       
   354     CleanupStack::Pop( param );
       
   355     
       
   356     param = CWPParameter::NewLC();
       
   357     param->SetID( EWPParameterProviderID );
       
   358     param->SetValueL( KMusSomeProvider() );
       
   359     characteristic->InsertL( param );
       
   360     CleanupStack::Pop( param );
       
   361     
       
   362     param = CWPParameter::NewLC();
       
   363     param->SetID( EWPParameterName );
       
   364     param->SetValueL( KMusSomeName() );
       
   365     characteristic->InsertL( param );
       
   366     CleanupStack::Pop( param );
       
   367     
       
   368     param = CWPParameter::NewLC();
       
   369     param->SetID( EWPParameterToAppRef );
       
   370     param->SetValueL( KMusSomeToAppRef() );
       
   371     characteristic->InsertL( param );
       
   372     CleanupStack::Pop( param );
       
   373     
       
   374     CWPCharacteristic* capabilityCharacteristic = 
       
   375                         CWPCharacteristic::NewLC( KWPNamedCharacteristic );
       
   376     capabilityCharacteristic->SetNameL( KMUsWpCharacteristicNameCapability() );
       
   377     characteristic->InsertL( capabilityCharacteristic );
       
   378     CleanupStack::Pop( capabilityCharacteristic );
       
   379     
       
   380     CWPCharacteristic* activityCharacteristic = 
       
   381                         CWPCharacteristic::NewLC( KWPNamedCharacteristic );
       
   382     activityCharacteristic->SetNameL( KMUsWpCharacteristicNameActivation() );
       
   383     characteristic->InsertL( activityCharacteristic );
       
   384     CleanupStack::Pop( activityCharacteristic );
       
   385     
       
   386     CWPCharacteristic* unknownCharacteristic = 
       
   387                         CWPCharacteristic::NewLC( KWPNamedCharacteristic );
       
   388     unknownCharacteristic->SetNameL( KMUsWpCharacteristicNameUnknown() );
       
   389     characteristic->InsertL( unknownCharacteristic );
       
   390     CleanupStack::Pop( unknownCharacteristic );                      
       
   391     
       
   392     iWpAdapter->VisitL( *characteristic );
       
   393     EUNIT_ASSERT( *iWpAdapter->iAppID == KMusAppID()  )
       
   394     EUNIT_ASSERT( iWpAdapter->iWpItem )
       
   395     EUNIT_ASSERT( *iWpAdapter->iWpItem->iProviderId == KMusSomeProvider() )
       
   396     EUNIT_ASSERT( *iWpAdapter->iWpItem->iName == KMusSomeName() )
       
   397     EUNIT_ASSERT( *iWpAdapter->iWpItem->iToAppRef == KMusSomeToAppRef() )
       
   398     
       
   399     CleanupStack::PopAndDestroy( characteristic );
       
   400     }
       
   401     
       
   402     
       
   403 // -----------------------------------------------------------------------------
       
   404 //
       
   405 // -----------------------------------------------------------------------------
       
   406 //
       
   407 void UT_CMusWpAdapter::UT_CMusWpAdapter_VisitParameterLL()
       
   408     {
       
   409     iWpAdapter->iNewWpItem = CMusWpItem::NewL();
       
   410     
       
   411     // Named parameter EDGEDTM
       
   412     CWPParameter* param = CWPParameter::NewLC();
       
   413     param->SetID( EWPNamedParameter );
       
   414     param->SetNameL( KMusWpParamNameEdgeDtm() );
       
   415     iWpAdapter->VisitL( *param );
       
   416     EUNIT_ASSERT( !iWpAdapter->iAppID )
       
   417     EUNIT_ASSERT( !iWpAdapter->iNewWpItem->iProviderId )
       
   418     EUNIT_ASSERT( !iWpAdapter->iNewWpItem->iName )
       
   419     EUNIT_ASSERT( !iWpAdapter->iNewWpItem->iToAppRef )
       
   420     EUNIT_ASSERT( iWpAdapter->iNewWpItem->iEdgeDtmSupport == 
       
   421                   MusSettingsKeys::EDtmModeAllowed)
       
   422     EUNIT_ASSERT( iWpAdapter->iNewWpItem->iForceInternetSignaling ==
       
   423                   MusSettingsKeys::EFollowProfileConfiguration )
       
   424     EUNIT_ASSERT( iWpAdapter->iNewWpItem->iCapabilityQuery ==
       
   425                   MusSettingsKeys::ENoOptions )
       
   426     // Default value is changed for a while so test is conformed to that              
       
   427     //EUNIT_ASSERT( iWpAdapter->iNewWpItem->iActivationCondition ==
       
   428     //              MusSettingsKeys::EActiveInHomeNetworks )
       
   429     EUNIT_ASSERT( iWpAdapter->iNewWpItem->iActivationCondition ==
       
   430                   MusSettingsKeys::EAlwaysActive )
       
   431     CleanupStack::PopAndDestroy( param );
       
   432     
       
   433     // Named parameter INTERNETSIGNALING
       
   434     param = CWPParameter::NewLC();
       
   435     param->SetID( EWPNamedParameter );
       
   436     param->SetNameL( KMusWpParamNameInternetSignaling() );
       
   437     iWpAdapter->VisitL( *param );
       
   438     EUNIT_ASSERT( !iWpAdapter->iAppID )
       
   439     EUNIT_ASSERT( !iWpAdapter->iNewWpItem->iProviderId )
       
   440     EUNIT_ASSERT( !iWpAdapter->iNewWpItem->iName )
       
   441     EUNIT_ASSERT( !iWpAdapter->iNewWpItem->iToAppRef )
       
   442     EUNIT_ASSERT( iWpAdapter->iNewWpItem->iEdgeDtmSupport == 
       
   443                   MusSettingsKeys::EDtmModeAllowed)
       
   444     EUNIT_ASSERT( iWpAdapter->iNewWpItem->iForceInternetSignaling ==
       
   445                   MusSettingsKeys::EForceInternetSignaling )
       
   446     EUNIT_ASSERT( iWpAdapter->iNewWpItem->iCapabilityQuery ==
       
   447                   MusSettingsKeys::ENoOptions )
       
   448     // Default value is changed for a while so test is conformed to that              
       
   449     //EUNIT_ASSERT( iWpAdapter->iNewWpItem->iActivationCondition ==
       
   450     //              MusSettingsKeys::EActiveInHomeNetworks )
       
   451     EUNIT_ASSERT( iWpAdapter->iNewWpItem->iActivationCondition ==
       
   452                   MusSettingsKeys::EAlwaysActive )
       
   453     CleanupStack::PopAndDestroy( param );
       
   454 
       
   455     // Named parameter QUERY
       
   456     param = CWPParameter::NewLC();
       
   457     param->SetID( EWPNamedParameter );
       
   458     param->SetNameL( KMusWpParamNameQuery() );
       
   459     param->SetValueL( KMusWpParamValue2() ); // Sequential
       
   460     iWpAdapter->VisitL( *param );
       
   461     EUNIT_ASSERT( !iWpAdapter->iAppID )
       
   462     EUNIT_ASSERT( !iWpAdapter->iNewWpItem->iProviderId )
       
   463     EUNIT_ASSERT( !iWpAdapter->iNewWpItem->iName )
       
   464     EUNIT_ASSERT( !iWpAdapter->iNewWpItem->iToAppRef )
       
   465     EUNIT_ASSERT( iWpAdapter->iNewWpItem->iEdgeDtmSupport == 
       
   466                   MusSettingsKeys::EDtmModeAllowed)
       
   467     EUNIT_ASSERT( iWpAdapter->iNewWpItem->iForceInternetSignaling ==
       
   468                   MusSettingsKeys::EForceInternetSignaling )
       
   469     EUNIT_ASSERT( iWpAdapter->iNewWpItem->iCapabilityQuery ==
       
   470                   MusSettingsKeys::ESequential )
       
   471     // Default value is changed for a while so test is conformed to that              
       
   472     //EUNIT_ASSERT( iWpAdapter->iNewWpItem->iActivationCondition ==
       
   473     //              MusSettingsKeys::EActiveInHomeNetworks )
       
   474     EUNIT_ASSERT( iWpAdapter->iNewWpItem->iActivationCondition ==
       
   475                   MusSettingsKeys::EAlwaysActive )
       
   476     CleanupStack::PopAndDestroy( param );
       
   477     
       
   478     // Named parameter CONDITION
       
   479     param = CWPParameter::NewLC();
       
   480     param->SetID( EWPNamedParameter );
       
   481     param->SetNameL( KMusWpParamNameCondition() );
       
   482     param->SetValueL( KMusWpParamValue3() ); // Never
       
   483     iWpAdapter->VisitL( *param );
       
   484     EUNIT_ASSERT( !iWpAdapter->iAppID )
       
   485     EUNIT_ASSERT( !iWpAdapter->iNewWpItem->iProviderId )
       
   486     EUNIT_ASSERT( !iWpAdapter->iNewWpItem->iName )
       
   487     EUNIT_ASSERT( !iWpAdapter->iNewWpItem->iToAppRef )
       
   488     EUNIT_ASSERT( iWpAdapter->iNewWpItem->iEdgeDtmSupport == 
       
   489                   MusSettingsKeys::EDtmModeAllowed)
       
   490     EUNIT_ASSERT( iWpAdapter->iNewWpItem->iForceInternetSignaling ==
       
   491                   MusSettingsKeys::EForceInternetSignaling )
       
   492     EUNIT_ASSERT( iWpAdapter->iNewWpItem->iCapabilityQuery ==
       
   493                   MusSettingsKeys::ESequential )
       
   494     EUNIT_ASSERT( iWpAdapter->iNewWpItem->iActivationCondition ==
       
   495                   MusSettingsKeys::ENever )
       
   496     CleanupStack::PopAndDestroy( param );
       
   497 
       
   498     // Unknown named parameter
       
   499     param = CWPParameter::NewLC();
       
   500     param->SetID( EWPNamedParameter );
       
   501     param->SetNameL( KMusWpParamNameUnknown() );
       
   502     iWpAdapter->VisitL( *param );
       
   503     EUNIT_ASSERT( !iWpAdapter->iAppID )
       
   504     EUNIT_ASSERT( !iWpAdapter->iNewWpItem->iProviderId )
       
   505     EUNIT_ASSERT( !iWpAdapter->iNewWpItem->iName )
       
   506     EUNIT_ASSERT( !iWpAdapter->iNewWpItem->iToAppRef )
       
   507     EUNIT_ASSERT( iWpAdapter->iNewWpItem->iEdgeDtmSupport == 
       
   508                   MusSettingsKeys::EDtmModeAllowed)
       
   509     EUNIT_ASSERT( iWpAdapter->iNewWpItem->iForceInternetSignaling ==
       
   510                   MusSettingsKeys::EForceInternetSignaling )
       
   511     EUNIT_ASSERT( iWpAdapter->iNewWpItem->iCapabilityQuery ==
       
   512                   MusSettingsKeys::ESequential )
       
   513     EUNIT_ASSERT( iWpAdapter->iNewWpItem->iActivationCondition ==
       
   514                   MusSettingsKeys::ENever )
       
   515     CleanupStack::PopAndDestroy( param );
       
   516     
       
   517     // Id
       
   518     param = CWPParameter::NewLC();
       
   519     param->SetID( EWPParameterAppID );
       
   520     param->SetValueL( KMusAppID() );
       
   521     iWpAdapter->VisitL( *param );
       
   522     EUNIT_ASSERT( *iWpAdapter->iAppID == KMusAppID() )
       
   523     EUNIT_ASSERT( !iWpAdapter->iNewWpItem->iProviderId )
       
   524     EUNIT_ASSERT( !iWpAdapter->iNewWpItem->iName )
       
   525     EUNIT_ASSERT( !iWpAdapter->iNewWpItem->iToAppRef )
       
   526     EUNIT_ASSERT( iWpAdapter->iNewWpItem->iEdgeDtmSupport == 
       
   527                   MusSettingsKeys::EDtmModeAllowed)
       
   528     EUNIT_ASSERT( iWpAdapter->iNewWpItem->iForceInternetSignaling ==
       
   529                   MusSettingsKeys::EForceInternetSignaling )
       
   530     EUNIT_ASSERT( iWpAdapter->iNewWpItem->iCapabilityQuery ==
       
   531                   MusSettingsKeys::ESequential )
       
   532     EUNIT_ASSERT( iWpAdapter->iNewWpItem->iActivationCondition ==
       
   533                   MusSettingsKeys::ENever )
       
   534     CleanupStack::PopAndDestroy( param );
       
   535     
       
   536     // Provider Id
       
   537     param = CWPParameter::NewLC();
       
   538     param->SetID( EWPParameterProviderID );
       
   539     param->SetValueL( KMusSomeProvider() );
       
   540     iWpAdapter->VisitL( *param );
       
   541     EUNIT_ASSERT( *iWpAdapter->iAppID == KMusAppID() )
       
   542     EUNIT_ASSERT( *iWpAdapter->iNewWpItem->iProviderId == KMusSomeProvider() )
       
   543     EUNIT_ASSERT( !iWpAdapter->iNewWpItem->iName )
       
   544     EUNIT_ASSERT( !iWpAdapter->iNewWpItem->iToAppRef )
       
   545     EUNIT_ASSERT( iWpAdapter->iNewWpItem->iEdgeDtmSupport == 
       
   546                   MusSettingsKeys::EDtmModeAllowed)
       
   547     EUNIT_ASSERT( iWpAdapter->iNewWpItem->iForceInternetSignaling ==
       
   548                   MusSettingsKeys::EForceInternetSignaling )
       
   549     EUNIT_ASSERT( iWpAdapter->iNewWpItem->iCapabilityQuery ==
       
   550                   MusSettingsKeys::ESequential )
       
   551     EUNIT_ASSERT( iWpAdapter->iNewWpItem->iActivationCondition ==
       
   552                   MusSettingsKeys::ENever )
       
   553     CleanupStack::PopAndDestroy( param );
       
   554     
       
   555     // Name
       
   556     param = CWPParameter::NewLC();
       
   557     param->SetID( EWPParameterName );
       
   558     param->SetValueL( KMusSomeName() );
       
   559     iWpAdapter->VisitL( *param );
       
   560     EUNIT_ASSERT( *iWpAdapter->iAppID == KMusAppID() )
       
   561     EUNIT_ASSERT( *iWpAdapter->iNewWpItem->iProviderId == KMusSomeProvider() )
       
   562     EUNIT_ASSERT( *iWpAdapter->iNewWpItem->iName == KMusSomeName() )
       
   563     EUNIT_ASSERT( !iWpAdapter->iNewWpItem->iToAppRef )
       
   564     EUNIT_ASSERT( iWpAdapter->iNewWpItem->iEdgeDtmSupport == 
       
   565                   MusSettingsKeys::EDtmModeAllowed)
       
   566     EUNIT_ASSERT( iWpAdapter->iNewWpItem->iForceInternetSignaling ==
       
   567                   MusSettingsKeys::EForceInternetSignaling )
       
   568     EUNIT_ASSERT( iWpAdapter->iNewWpItem->iCapabilityQuery ==
       
   569                   MusSettingsKeys::ESequential )
       
   570     EUNIT_ASSERT( iWpAdapter->iNewWpItem->iActivationCondition ==
       
   571                   MusSettingsKeys::ENever )
       
   572     CleanupStack::PopAndDestroy( param );
       
   573     
       
   574     // To-AppRef
       
   575     param = CWPParameter::NewLC();
       
   576     param->SetID( EWPParameterToAppRef );
       
   577     param->SetValueL( KMusSomeToAppRef() );
       
   578     iWpAdapter->VisitL( *param );
       
   579     EUNIT_ASSERT( *iWpAdapter->iAppID == KMusAppID() )
       
   580     EUNIT_ASSERT( *iWpAdapter->iNewWpItem->iProviderId == KMusSomeProvider() )
       
   581     EUNIT_ASSERT( *iWpAdapter->iNewWpItem->iName == KMusSomeName() )
       
   582     EUNIT_ASSERT( *iWpAdapter->iNewWpItem->iToAppRef == KMusSomeToAppRef() )
       
   583     EUNIT_ASSERT( iWpAdapter->iNewWpItem->iEdgeDtmSupport == 
       
   584                   MusSettingsKeys::EDtmModeAllowed)
       
   585     EUNIT_ASSERT( iWpAdapter->iNewWpItem->iForceInternetSignaling ==
       
   586                   MusSettingsKeys::EForceInternetSignaling )
       
   587     EUNIT_ASSERT( iWpAdapter->iNewWpItem->iCapabilityQuery ==
       
   588                   MusSettingsKeys::ESequential )
       
   589     EUNIT_ASSERT( iWpAdapter->iNewWpItem->iActivationCondition ==
       
   590                   MusSettingsKeys::ENever )
       
   591     CleanupStack::PopAndDestroy( param );
       
   592     
       
   593     // Unknown, maps to default, nothing changes
       
   594     param = CWPParameter::NewLC();
       
   595     param->SetID( EWPLastParameter );
       
   596     iWpAdapter->VisitL( *param );
       
   597     EUNIT_ASSERT( *iWpAdapter->iAppID == KMusAppID() )
       
   598     EUNIT_ASSERT( *iWpAdapter->iNewWpItem->iProviderId == KMusSomeProvider() )
       
   599     EUNIT_ASSERT( *iWpAdapter->iNewWpItem->iName == KMusSomeName() )
       
   600     EUNIT_ASSERT( *iWpAdapter->iNewWpItem->iToAppRef == KMusSomeToAppRef() )
       
   601     EUNIT_ASSERT( iWpAdapter->iNewWpItem->iEdgeDtmSupport == 
       
   602                   MusSettingsKeys::EDtmModeAllowed)
       
   603     EUNIT_ASSERT( iWpAdapter->iNewWpItem->iForceInternetSignaling ==
       
   604                   MusSettingsKeys::EForceInternetSignaling )
       
   605     EUNIT_ASSERT( iWpAdapter->iNewWpItem->iCapabilityQuery ==
       
   606                   MusSettingsKeys::ESequential )
       
   607     EUNIT_ASSERT( iWpAdapter->iNewWpItem->iActivationCondition ==
       
   608                   MusSettingsKeys::ENever )
       
   609     CleanupStack::PopAndDestroy( param );
       
   610     
       
   611     }
       
   612     
       
   613     
       
   614 // -----------------------------------------------------------------------------
       
   615 //
       
   616 // -----------------------------------------------------------------------------
       
   617 //
       
   618 void UT_CMusWpAdapter::UT_CMusWpAdapter_VisitLinkLL()
       
   619     {
       
   620     // Dummy case
       
   621     CWPCharacteristic* characteristic = CWPCharacteristic::NewLC( 0 );
       
   622     iWpAdapter->VisitLinkL( *characteristic );
       
   623     CleanupStack::PopAndDestroy( characteristic );
       
   624     }
       
   625 
       
   626 
       
   627 
       
   628 
       
   629 
       
   630 //  TEST TABLE
       
   631 
       
   632 EUNIT_BEGIN_TEST_TABLE(
       
   633     UT_CMusWpAdapter,
       
   634     "UT_CMusWpAdapter",
       
   635     "UNIT" )
       
   636 
       
   637 EUNIT_TEST(
       
   638     "NewL - test ",
       
   639     "CMusWpAdapter",
       
   640     "NewL",
       
   641     "FUNCTIONALITY",
       
   642     SetupL, UT_CMusWpAdapter_NewLL, Teardown)
       
   643 
       
   644 EUNIT_TEST(
       
   645     "ItemCount - test ",
       
   646     "CMusWpAdapter",
       
   647     "ItemCount",
       
   648     "FUNCTIONALITY",
       
   649     SetupL, UT_CMusWpAdapter_ItemCountL, Teardown)
       
   650 
       
   651 EUNIT_TEST(
       
   652     "SummaryTitle - test ",
       
   653     "CMusWpAdapter",
       
   654     "SummaryTitle",
       
   655     "FUNCTIONALITY",
       
   656     SetupL, UT_CMusWpAdapter_SummaryTitleL, Teardown)
       
   657 
       
   658 EUNIT_TEST(
       
   659     "SummaryText - test ",
       
   660     "CMusWpAdapter",
       
   661     "SummaryText",
       
   662     "FUNCTIONALITY",
       
   663     SetupL, UT_CMusWpAdapter_SummaryTextL, Teardown)
       
   664     
       
   665 EUNIT_TEST(
       
   666     "SaveL - test ",
       
   667     "CMusWpAdapter",
       
   668     "SaveL",
       
   669     "FUNCTIONALITY",
       
   670     SetupL, UT_CMusWpAdapter_SaveLL, Teardown)
       
   671     
       
   672 EUNIT_TEST(
       
   673     "CanSetAsDefault - test ",
       
   674     "CMusWpAdapter",
       
   675     "CanSetAsDefault",
       
   676     "FUNCTIONALITY",
       
   677     SetupL, UT_CMusWpAdapter_CanSetAsDefaultL, Teardown)
       
   678 
       
   679 EUNIT_TEST(
       
   680     "SetAsDefaultL - test ",
       
   681     "CMusWpAdapter",
       
   682     "SetAsDefaultL",
       
   683     "FUNCTIONALITY",
       
   684     SetupL, UT_CMusWpAdapter_SetAsDefaultLL, Teardown)
       
   685 
       
   686 EUNIT_TEST(
       
   687     "DetailsL - test ",
       
   688     "CMusWpAdapter",
       
   689     "DetailsL",
       
   690     "FUNCTIONALITY",
       
   691     SetupL, UT_CMusWpAdapter_DetailsLL, Teardown) 
       
   692 
       
   693 EUNIT_TEST(
       
   694     "SettingsSavedL - test ",
       
   695     "CMusWpAdapter",
       
   696     "SettingsSavedL",
       
   697     "FUNCTIONALITY",
       
   698     SetupL, UT_CMusWpAdapter_SettingsSavedLL, Teardown) 
       
   699 
       
   700 EUNIT_TEST(
       
   701     "SavingFinalizedL - test ",
       
   702     "CMusWpAdapter",
       
   703     "SavingFinalizedL",
       
   704     "FUNCTIONALITY",
       
   705     SetupL, UT_CMusWpAdapter_SavingFinalizedLL, Teardown)
       
   706 
       
   707 EUNIT_TEST(
       
   708     "VisitCharacteristicL - test ",
       
   709     "CMusWpAdapter",
       
   710     "VisitCharacteristicL",
       
   711     "FUNCTIONALITY",
       
   712     SetupL, UT_CMusWpAdapter_VisitCharacteristicLL, Teardown)
       
   713 
       
   714 EUNIT_TEST(
       
   715     "VisitParameterL - test ",
       
   716     "CMusWpAdapter",
       
   717     "VisitParameterL",
       
   718     "FUNCTIONALITY",
       
   719     SetupL, UT_CMusWpAdapter_VisitParameterLL, Teardown)  
       
   720 
       
   721 EUNIT_TEST(
       
   722     "VisitLinkL - test ",
       
   723     "CMusWpAdapter",
       
   724     "VisitLinkL",
       
   725     "FUNCTIONALITY",
       
   726     SetupL, UT_CMusWpAdapter_VisitLinkLL, Teardown)      
       
   727        
       
   728        
       
   729    
       
   730      
       
   731     
       
   732 EUNIT_END_TEST_TABLE
       
   733 
       
   734 //  END OF FILE
       
   735 
       
   736