contextframework/cfw/tsrc/public/basic/mt_cfservices/mt_cfservices.cpp
changeset 0 2e3d3ce01487
child 19 924385140d98
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     1 /*
       
     2 * Copyright (c) 2004 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 // CLASS HEADER
       
    20 #include "MT_CFServices.h"
       
    21 
       
    22 // EXTERNAL INCLUDES
       
    23 #include <EUnitMacros.h>
       
    24 #include <S32MEM.H>
       
    25 
       
    26 // INTERNAL INCLUDES
       
    27 #include "CFActionIndicationImpl.h"
       
    28 #include "CFActionSubscriptionImpl.h"
       
    29 #include "CFContextIndicationImpl.h"
       
    30 #include "cfcontextobjectimpl.h"
       
    31 #include "CFContextQueryImpl.h"
       
    32 #include "CFContextSubscriptionImpl.h"
       
    33 #include "CFKeyValuePair.h"
       
    34 #include "cfserviceutils.h"
       
    35 #include "cfcontextdataproxy.h"
       
    36 #include "cfenvutils.h"
       
    37 
       
    38 // CONSTANTS
       
    39 _LIT( KKey, "Key_%d" );
       
    40 _LIT( KValue, "Value_%d" );
       
    41 _LIT( KActionId, "ActionID" );
       
    42 _LIT( KShortActionId, "ActID" );
       
    43 _LIT( KLongActionId, "LongActionIdentifier" );
       
    44 static const TInt KParamCount = 10;
       
    45 
       
    46 _LIT( KContextSource, "ContextSource" );
       
    47 _LIT( KContextSourceLong, "ContextSourceQuiteABitLonger" );
       
    48 _LIT( KContextType, "ContextType" );
       
    49 _LIT( KContextTypeLong, "ContextTypeQuiteABitLonger" );
       
    50 _LIT( KContextValue, "ContextValue" );
       
    51 _LIT( KContextValueLong, "ContextValueQuiteABitLonger" );
       
    52 
       
    53 // CONSTRUCTION
       
    54 MT_CFServices* MT_CFServices::NewL()
       
    55     {
       
    56     MT_CFServices* self = MT_CFServices::NewLC();
       
    57     CleanupStack::Pop();
       
    58 
       
    59     return self;
       
    60     }
       
    61 
       
    62 MT_CFServices* MT_CFServices::NewLC()
       
    63     {
       
    64     MT_CFServices* self = new( ELeave ) MT_CFServices();
       
    65     CleanupStack::PushL( self );
       
    66 
       
    67     self->ConstructL();
       
    68 
       
    69     return self;
       
    70     }
       
    71 
       
    72 // Destructor (virtual by CBase)
       
    73 MT_CFServices::~MT_CFServices()
       
    74     {
       
    75     Teardown();
       
    76 
       
    77     // Enable screen saver
       
    78     CFEnvUtils::EnableScreenSaver( ETrue );
       
    79     }
       
    80 
       
    81 // Default constructor
       
    82 MT_CFServices::MT_CFServices()
       
    83     {
       
    84     }
       
    85 
       
    86 // Second phase construct
       
    87 void MT_CFServices::ConstructL()
       
    88     {
       
    89     // The ConstructL from the base class CEUnitTestSuiteClass must be called.
       
    90     // It generates the test case table.
       
    91     CEUnitTestSuiteClass::ConstructL();
       
    92 
       
    93     // Disable screen saver
       
    94     CFEnvUtils::EnableScreenSaver( EFalse );
       
    95     }
       
    96 
       
    97 // METHODS
       
    98 
       
    99 void MT_CFServices::ActionIndicationL( CCFActionIndication* /*aIndication*/ )
       
   100     {
       
   101     
       
   102     }
       
   103 
       
   104 void MT_CFServices::ContextIndicationL( CCFContextIndication* aIndication )
       
   105     {
       
   106     delete iIndicatedContext;
       
   107     iIndicatedContext = NULL;
       
   108     
       
   109     iIndicatedContext = CCFContextObject::NewL();
       
   110     iIndicatedContext->CopyL( aIndication->Context() );
       
   111     
       
   112     delete aIndication;
       
   113     }
       
   114 
       
   115 TInt MT_CFServices::Client( RThread& /*aThread*/ ) const
       
   116     {
       
   117     return KErrNone;
       
   118     }
       
   119 
       
   120 void MT_CFServices::HandleContextSubscriptionError( TInt /*aError*/,
       
   121     const TDesC& /*aSource*/,
       
   122     const TDesC& /*aType*/ )
       
   123     {
       
   124 
       
   125     }
       
   126 
       
   127 void MT_CFServices::SetupL(  )
       
   128     {
       
   129 
       
   130     }
       
   131 
       
   132 void MT_CFServices::SetupActionIndicationL(  )
       
   133     {
       
   134     iActionIndication = CCFActionIndicationImpl::NewL();
       
   135     }
       
   136 
       
   137 void MT_CFServices::Teardown(  )
       
   138     {
       
   139     delete iActionIndication;
       
   140     iActionIndication = NULL;
       
   141     
       
   142     delete iIndicatedContext;
       
   143     iIndicatedContext = NULL;
       
   144     }
       
   145     
       
   146 CCFActionIndicationImpl* MT_CFServices::ConfigureActionIndicationL(
       
   147     const TDesC& aActionId,
       
   148     TInt aNumOfParams )
       
   149     {
       
   150     TBuf<20> key( KNullDesC );
       
   151     TBuf<20> value( KNullDesC );
       
   152 
       
   153     CCFActionIndicationImpl* actionIndication = CCFActionIndicationImpl::NewLC();
       
   154     if( aActionId.Length() )
       
   155         {
       
   156         actionIndication->SetIdentifierL( aActionId );
       
   157         }
       
   158     for( TInt i = 0; i < aNumOfParams; i++ )
       
   159         {
       
   160         key.Format( KKey, i );
       
   161         value.Format( KValue, i );
       
   162         actionIndication->AddParameterL( key, value );
       
   163         }
       
   164     
       
   165     CleanupStack::Pop( actionIndication );
       
   166     return actionIndication;
       
   167     }
       
   168 
       
   169 CCFActionSubscriptionImpl* MT_CFServices::ConfigureActionSubscriptionL(
       
   170     const TDesC& aActionId )
       
   171     {
       
   172     CCFActionSubscriptionImpl* actionSubscription =
       
   173         CCFActionSubscriptionImpl::NewLC();
       
   174     
       
   175     if( aActionId.Length() )
       
   176         {
       
   177         actionSubscription->SetActionIdentifierL( aActionId );
       
   178         }
       
   179     
       
   180     CleanupStack::Pop( actionSubscription );
       
   181     return actionSubscription;
       
   182     }
       
   183     
       
   184 CCFContextObjectImpl* MT_CFServices::ConfigureContextObjectLC(
       
   185     const TDesC& aSource,
       
   186     const TDesC& aType,
       
   187     const TDesC& aValue,
       
   188     TUint aConfidence,
       
   189     const TTime& aTime )
       
   190     {
       
   191     CCFContextObjectImpl* context = CCFContextObjectImpl::NewLC();
       
   192     
       
   193     if( aSource.Length() )
       
   194         {
       
   195         context->SetSourceL( aSource );
       
   196         }
       
   197     if( aType.Length() )
       
   198         {
       
   199         context->SetTypeL( aType );
       
   200         }
       
   201     if( aValue.Length() )
       
   202         {
       
   203         context->SetValueL( aValue );
       
   204         }
       
   205     context->SetConfidence( aConfidence );
       
   206     context->SetTimestamp( aTime );
       
   207     
       
   208     return context;
       
   209     }
       
   210     
       
   211 CCFContextSubscriptionImpl* MT_CFServices::ConfigureContextSubscriptionLC(
       
   212     const TDesC& aSource,
       
   213     const TDesC& aType,
       
   214     TBool aSubTypeMatch,
       
   215     TBool aIndicateOnlyChanges )
       
   216     {
       
   217     CCFContextSubscriptionImpl* subscription = CCFContextSubscriptionImpl::NewLC();
       
   218     
       
   219     if( aSource.Length() )
       
   220         {
       
   221         subscription->SetContextSourceL( aSource );
       
   222         }
       
   223     if( aType.Length() )
       
   224         {
       
   225         subscription->SetContextTypeL( aType );
       
   226         }
       
   227     subscription->SetSubTypeMatch( aSubTypeMatch );
       
   228     subscription->SetOnlyChangesIndicated( aIndicateOnlyChanges );
       
   229     
       
   230     return subscription;
       
   231     }
       
   232     
       
   233 //-----------------------------------------------------------------------------
       
   234 // CCFActionIndication class unit test cases
       
   235 //-----------------------------------------------------------------------------
       
   236 //
       
   237 void MT_CFServices::MT_CCFActionIndication_NewLL(  )
       
   238     {
       
   239     CCFActionIndication* instance = CCFActionIndication::NewL();
       
   240     CleanupStack::PushL( instance );
       
   241     
       
   242     EUNIT_ASSERT_DESC( instance, "CCFActionIndication class instance not created!" );
       
   243     
       
   244     CleanupStack::PopAndDestroy( instance );
       
   245     }
       
   246 
       
   247 void MT_CFServices::MT_CCFActionIndication_NewLCL(  )
       
   248     {
       
   249     CCFActionIndication* instance = CCFActionIndication::NewLC();
       
   250     
       
   251     EUNIT_ASSERT_DESC( instance, "CCFActionIndication class instance not created!" );
       
   252     
       
   253     CleanupStack::PopAndDestroy( instance );
       
   254     }
       
   255 
       
   256 //-----------------------------------------------------------------------------
       
   257 // CCFActionIndicationImpl class unit test cases
       
   258 //-----------------------------------------------------------------------------
       
   259 //
       
   260 void MT_CFServices::MT_CCFActionIndicationImpl_NewLL(  )
       
   261     {
       
   262     CCFActionIndicationImpl* instance = CCFActionIndicationImpl::NewL();
       
   263     CleanupStack::PushL( instance );
       
   264     
       
   265     EUNIT_ASSERT_DESC( instance, "CCFActionIndicationImpl class instance not created!" );
       
   266     
       
   267     CleanupStack::PopAndDestroy( instance );
       
   268     }
       
   269 
       
   270 void MT_CFServices::MT_CCFActionIndicationImpl_NewLCL(  )
       
   271     {
       
   272     CCFActionIndicationImpl* instance = CCFActionIndicationImpl::NewLC();
       
   273     
       
   274     EUNIT_ASSERT_DESC( instance, "CCFActionIndicationImpl class instance not created!" );
       
   275     
       
   276     CleanupStack::PopAndDestroy( instance );
       
   277     }
       
   278 
       
   279 void MT_CFServices::MT_CCFActionIndicationImpl_SetIdentifierLL(  )
       
   280     {
       
   281     TPtrC id( KNullDesC );
       
   282     
       
   283     id.Set( iActionIndication->Identifier() );
       
   284     EUNIT_ASSERT_DESC( id == KNullDesC, "Invalid action ID!" );
       
   285     
       
   286     iActionIndication->SetIdentifierL( KActionId );
       
   287     id.Set( iActionIndication->Identifier() );
       
   288     EUNIT_ASSERT_DESC( id == KActionId, "Invalid action ID!" );
       
   289 
       
   290     iActionIndication->SetIdentifierL( KShortActionId );
       
   291     id.Set( iActionIndication->Identifier() );
       
   292     EUNIT_ASSERT_DESC( id == KShortActionId, "Invalid action ID!" );
       
   293 
       
   294     iActionIndication->SetIdentifierL( KLongActionId );
       
   295     id.Set( iActionIndication->Identifier() );
       
   296     EUNIT_ASSERT_DESC( id == KLongActionId, "Invalid action ID!" );
       
   297     }
       
   298 
       
   299 void MT_CFServices::MT_CCFActionIndicationImpl_AddParameterLL(  )
       
   300     {
       
   301     TInt count = 0;
       
   302     TBuf<20> key( KNullDesC );
       
   303     TBuf<20> value( KNullDesC );
       
   304     
       
   305     count = iActionIndication->Parameters().Count();
       
   306     EUNIT_ASSERT_DESC( !count, "Invalid parameter count!" );
       
   307     
       
   308     delete iActionIndication;
       
   309     iActionIndication = NULL;
       
   310     iActionIndication = ConfigureActionIndicationL( KActionId, KParamCount );
       
   311     count = iActionIndication->Parameters().Count();
       
   312     EUNIT_ASSERT_DESC( count == KParamCount, "Invalid parameter count!" );
       
   313     
       
   314     const RKeyValueArray& params = iActionIndication->Parameters();
       
   315     for( TInt i = 0; i < KParamCount; i++ )
       
   316         {
       
   317         key.Format( KKey, i );
       
   318         EUNIT_ASSERT_DESC( key == params[i]->Key(), "Invalid key!" );
       
   319         
       
   320         value.Format( KValue, i );
       
   321         EUNIT_ASSERT_DESC( value == params[i]->Value(), "Invalid value!" );
       
   322         }
       
   323     }
       
   324 
       
   325 void MT_CFServices::MT_CCFActionIndicationImpl_ExternalizeLL(  )
       
   326     {
       
   327     TInt size = 0;
       
   328     CCFActionIndicationImpl* actionIndication = NULL;
       
   329     
       
   330     static const TInt KCount = 2;
       
   331     for( TInt i = 0; i < KCount; i++ )
       
   332         {
       
   333         switch( i )
       
   334             {
       
   335             case 0:
       
   336                 {
       
   337                 // Create action indication
       
   338                 actionIndication = ConfigureActionIndicationL( KActionId, KParamCount );
       
   339                 CleanupStack::PushL( actionIndication );
       
   340                 break;
       
   341                 }
       
   342             case 1:
       
   343             default:
       
   344                 {
       
   345                 // Create action indication
       
   346                 actionIndication = ConfigureActionIndicationL( KNullDesC, KParamCount * 2 );
       
   347                 CleanupStack::PushL( actionIndication );
       
   348                 break;
       
   349                 }
       
   350             }
       
   351         
       
   352         // Externalize
       
   353         size = actionIndication->Size();
       
   354         HBufC8* buffer = HBufC8::NewLC( size );
       
   355         TPtr8 bufferPtr = buffer->Des();
       
   356         RDesWriteStream writeStream( bufferPtr );
       
   357         writeStream.PushL();
       
   358         actionIndication->ExternalizeL( writeStream );
       
   359         CleanupStack::PopAndDestroy( &writeStream );
       
   360         
       
   361         // Internalize
       
   362         CCFActionIndicationImpl* newActionIndication = CCFActionIndicationImpl::NewLC();
       
   363         RDesReadStream readStream( bufferPtr );
       
   364         readStream.PushL();
       
   365         newActionIndication->InternalizeL( readStream );
       
   366 
       
   367         // Clean up
       
   368         CleanupStack::PopAndDestroy( &readStream );
       
   369         
       
   370         // Check result
       
   371         EUNIT_ASSERT_DESC(
       
   372             actionIndication->Identifier() == newActionIndication->Identifier(),
       
   373                 "Invalid identifier!" );
       
   374         EUNIT_ASSERT_DESC(
       
   375             actionIndication->Parameters().Count() == newActionIndication->Parameters().Count(),
       
   376                 "Invalid parameter count!");
       
   377         TInt count = actionIndication->Parameters().Count();
       
   378         for( TInt i = 0; i < count; i++ )
       
   379             {
       
   380             EUNIT_ASSERT_DESC(
       
   381                 actionIndication->Parameters()[i]->Key() == newActionIndication->Parameters()[i]->Key(),
       
   382                     "Invalid key!" );
       
   383             EUNIT_ASSERT_DESC(
       
   384                 actionIndication->Parameters()[i]->Value() == newActionIndication->Parameters()[i]->Value(),
       
   385                     "Invalid value!" );
       
   386             }
       
   387         
       
   388         // Clean up
       
   389         CleanupStack::PopAndDestroy( newActionIndication );
       
   390         CleanupStack::PopAndDestroy( buffer );
       
   391         CleanupStack::PopAndDestroy( actionIndication );
       
   392         }
       
   393     }
       
   394 
       
   395 //-----------------------------------------------------------------------------
       
   396 // CCFActionSubscription class unit test cases
       
   397 //-----------------------------------------------------------------------------
       
   398 //
       
   399 void MT_CFServices::MT_CCFActionSubscription_NewLL(  )
       
   400     {
       
   401     CCFActionSubscription* instance = CCFActionSubscription::NewL();
       
   402     CleanupStack::PushL( instance );
       
   403     
       
   404     EUNIT_ASSERT_DESC( instance, "CCFActionSubscription class instance not created!" );
       
   405     
       
   406     CleanupStack::PopAndDestroy( instance );
       
   407     }
       
   408 
       
   409 void MT_CFServices::MT_CCFActionSubscription_NewLCL(  )
       
   410     {
       
   411     CCFActionSubscription* instance = CCFActionSubscription::NewLC();
       
   412     
       
   413     EUNIT_ASSERT_DESC( instance, "CCFActionSubscription class instance not created!" );
       
   414     
       
   415     CleanupStack::PopAndDestroy( instance );
       
   416     }
       
   417 
       
   418 //-----------------------------------------------------------------------------
       
   419 // CCFActionSubscriptionImpl class unit test cases
       
   420 //-----------------------------------------------------------------------------
       
   421 //
       
   422 void MT_CFServices::MT_CCFActionSubscriptionImpl_NewLL(  )
       
   423     {
       
   424     CCFActionSubscriptionImpl* instance = CCFActionSubscriptionImpl::NewL();
       
   425     CleanupStack::PushL( instance );
       
   426     
       
   427     EUNIT_ASSERT_DESC( instance, "CCFActionSubscriptionImpl class instance not created!" );
       
   428     
       
   429     CleanupStack::PopAndDestroy( instance );
       
   430     }
       
   431 
       
   432 void MT_CFServices::MT_CCFActionSubscriptionImpl_NewLCL(  )
       
   433     {
       
   434     CCFActionSubscriptionImpl* instance = CCFActionSubscriptionImpl::NewLC();
       
   435     
       
   436     EUNIT_ASSERT_DESC( instance, "CCFActionSubscriptionImpl class instance not created!" );
       
   437     
       
   438     CleanupStack::PopAndDestroy( instance );
       
   439     }
       
   440 
       
   441 void MT_CFServices::MT_CCFActionSubscriptionImpl_SetActionIdentifierLL(  )
       
   442     {
       
   443     CCFActionSubscriptionImpl* instance = CCFActionSubscriptionImpl::NewLC();
       
   444     
       
   445     EUNIT_ASSERT_DESC( instance->ActionIdentifier() == KNullDesC,
       
   446         "Incorrect action identifier!" );
       
   447         
       
   448     instance->SetActionIdentifierL( KActionId );
       
   449     EUNIT_ASSERT_DESC( instance->ActionIdentifier() == KActionId,
       
   450         "Incorrect action identifier!" );
       
   451     
       
   452     // Clean up
       
   453     CleanupStack::PopAndDestroy( instance );
       
   454     }
       
   455 
       
   456 void MT_CFServices::MT_CCFActionSubscriptionImpl_ExternalizeLL(  )
       
   457     {
       
   458     static const TInt KCount = 2;
       
   459     CCFActionSubscriptionImpl* instance = NULL;
       
   460     for( TInt i = 0; i < KCount; i++ )
       
   461         {
       
   462         switch( i )
       
   463             {
       
   464             case 0:
       
   465                 {
       
   466                 instance = ConfigureActionSubscriptionL( KActionId );
       
   467                 CleanupStack::PushL( instance );
       
   468                 break;
       
   469                 }
       
   470             case 1:
       
   471             default:
       
   472                 {
       
   473                 instance = ConfigureActionSubscriptionL( KNullDesC );
       
   474                 CleanupStack::PushL( instance );
       
   475                 break;
       
   476                 }
       
   477             }
       
   478             
       
   479         // Externalize
       
   480         HBufC8* buffer = HBufC8::NewLC( instance->Size() );
       
   481         TPtr8 bufferPtr = buffer->Des();
       
   482         RDesWriteStream writeStream( bufferPtr );
       
   483         writeStream.PushL();
       
   484         instance->ExternalizeL( writeStream );
       
   485         CleanupStack::PopAndDestroy( &writeStream );
       
   486         
       
   487         // Internalize
       
   488         CCFActionSubscriptionImpl* newInstance = CCFActionSubscriptionImpl::NewLC();
       
   489         RDesReadStream readStream( bufferPtr );
       
   490         readStream.PushL();
       
   491         newInstance->InternalizeL( readStream );
       
   492         CleanupStack::PopAndDestroy( &readStream );
       
   493         
       
   494         // Check result
       
   495         EUNIT_ASSERT_DESC(
       
   496             instance->ActionIdentifier() == newInstance->ActionIdentifier(),
       
   497                 "Incorrect action identifier!" );
       
   498         
       
   499         // Clean up
       
   500         CleanupStack::PopAndDestroy( newInstance );
       
   501         CleanupStack::PopAndDestroy( buffer );
       
   502         CleanupStack::PopAndDestroy( instance );
       
   503         }
       
   504     }
       
   505 
       
   506 void MT_CFServices::MT_CCFActionSubscriptionImpl_SetListenerL(  )
       
   507     {
       
   508     CCFActionSubscriptionImpl* instance = CCFActionSubscriptionImpl::NewLC();
       
   509     
       
   510     EUNIT_ASSERT_DESC( !( &instance->Listener() ), "Invalid listener!" );
       
   511     
       
   512     instance->SetListener( this );
       
   513     EUNIT_ASSERT_DESC( ( &instance->Listener() ), "Invalid listener!" );
       
   514     
       
   515     CleanupStack::PopAndDestroy( instance );
       
   516     }
       
   517 
       
   518 //-----------------------------------------------------------------------------
       
   519 // CCFContextIndication class unit test cases
       
   520 //-----------------------------------------------------------------------------
       
   521 //
       
   522 void MT_CFServices::MT_CCFContextIndication_NewLL(  )
       
   523     {
       
   524     CCFContextIndication* instance = CCFContextIndication::NewL( KNullUid );
       
   525     CleanupStack::PushL( instance );
       
   526     
       
   527     EUNIT_ASSERT_DESC( instance, "CCFContextIndication class instance not created!" );
       
   528     
       
   529     CleanupStack::PopAndDestroy( instance );
       
   530     }
       
   531 
       
   532 void MT_CFServices::MT_CCFContextIndication_NewLCL(  )
       
   533     {
       
   534     CCFContextIndication* instance = CCFContextIndication::NewLC( KNullUid );
       
   535     
       
   536     EUNIT_ASSERT_DESC( instance, "CCFContextIndication class instance not created!" );
       
   537     
       
   538     CleanupStack::PopAndDestroy( instance );
       
   539     }
       
   540 
       
   541 //-----------------------------------------------------------------------------
       
   542 // CCFContextIndicationImpl class unit test cases
       
   543 //-----------------------------------------------------------------------------
       
   544 //
       
   545 void MT_CFServices::MT_CCFContextIndicationImpl_NewLL(  )
       
   546     {
       
   547     CCFContextIndicationImpl* instance = CCFContextIndicationImpl::NewL( KNullUid );
       
   548     CleanupStack::PushL( instance );
       
   549     
       
   550     EUNIT_ASSERT_DESC( instance, "CCFContextIndicationImpl class instance not created!" );
       
   551     
       
   552     CleanupStack::PopAndDestroy( instance );
       
   553     }
       
   554 
       
   555 void MT_CFServices::MT_CCFContextIndicationImpl_NewLCL(  )
       
   556     {
       
   557     CCFContextIndicationImpl* instance = CCFContextIndicationImpl::NewLC( KNullUid );
       
   558     
       
   559     EUNIT_ASSERT_DESC( instance, "CCFContextIndicationImpl class instance not created!" );
       
   560     
       
   561     CleanupStack::PopAndDestroy( instance );
       
   562     }
       
   563 
       
   564 void MT_CFServices::MT_CCFContextIndicationImpl_SetContextLL(  )
       
   565     {
       
   566     static const TUint KConfidence = 100;
       
   567     TTime time;
       
   568     time.HomeTime();
       
   569     CCFContextObjectImpl* context = ConfigureContextObjectLC(
       
   570         KContextSource,
       
   571         KContextType,
       
   572         KContextValue,
       
   573         KConfidence,
       
   574         time );
       
   575         
       
   576     CCFContextIndicationImpl* indication = CCFContextIndicationImpl::NewLC( KNullUid );
       
   577     indication->SetContextL( *context );
       
   578     EUNIT_ASSERT_DESC(
       
   579         CCFContextObjectImpl::IsSame( *context, indication->Context() ),
       
   580             "Incorrect comparison result!" );
       
   581             
       
   582     context->SetSourceL( KContextSourceLong );
       
   583     EUNIT_ASSERT_DESC(
       
   584         !CCFContextObjectImpl::IsSame( *context, indication->Context() ),
       
   585             "Incorrect comparison result!" );
       
   586         
       
   587     // clean up
       
   588     CleanupStack::PopAndDestroy( indication );
       
   589     CleanupStack::PopAndDestroy( context );
       
   590     }
       
   591 
       
   592 void MT_CFServices::MT_CCFContextIndicationImpl_ExternalizeLL(  )
       
   593     {
       
   594     static const TUint KConfidence = 100;
       
   595     TTime time;
       
   596     static const TInt KCount = 3;
       
   597     CCFContextObjectImpl* context = NULL;
       
   598     CCFContextIndicationImpl* indication = NULL;
       
   599     CCFContextIndicationImpl* copyIndication = NULL;
       
   600     for( TInt i = 0; i < KCount; i++ )
       
   601         {
       
   602         time.HomeTime();
       
   603         switch( i )
       
   604             {
       
   605             case 0:
       
   606                 {
       
   607                 context = ConfigureContextObjectLC(
       
   608                     KContextSource,
       
   609                     KNullDesC,
       
   610                     KNullDesC,
       
   611                     KConfidence,
       
   612                     time );
       
   613                 break;
       
   614                 }
       
   615             case 1:
       
   616                 {
       
   617                 context = ConfigureContextObjectLC(
       
   618                     KContextSource,
       
   619                     KContextType,
       
   620                     KNullDesC,
       
   621                     KConfidence,
       
   622                     time );
       
   623                 break;
       
   624                 }
       
   625             case 2:
       
   626             default:
       
   627                 {
       
   628                 context = ConfigureContextObjectLC(
       
   629                     KContextSource,
       
   630                     KContextType,
       
   631                     KContextValue,
       
   632                     KConfidence,
       
   633                     time );
       
   634                 break;
       
   635                 }
       
   636             }
       
   637         
       
   638         indication = CCFContextIndicationImpl::NewLC( KNullUid );
       
   639         indication->SetContextL( *context );
       
   640         
       
   641         // Externalize
       
   642         HBufC8* buffer = HBufC8::NewLC( indication->Size() );
       
   643         TPtr8 bufferPtr = buffer->Des();
       
   644         RDesWriteStream writeStream( bufferPtr );
       
   645         writeStream.PushL();
       
   646         indication->ExternalizeL( writeStream );
       
   647         CleanupStack::PopAndDestroy( &writeStream );
       
   648         
       
   649         // Internalize
       
   650         RDesReadStream readStream( bufferPtr );
       
   651         readStream.PushL();
       
   652         copyIndication = CCFContextIndicationImpl::NewLC( readStream );
       
   653         
       
   654         // Check result
       
   655         EUNIT_ASSERT_DESC(
       
   656             CCFContextObjectImpl::IsSame( indication->Context(), copyIndication->Context() ),
       
   657                 "Incorrect externalize result!" );
       
   658             
       
   659         // Clean up
       
   660         CleanupStack::PopAndDestroy( copyIndication );
       
   661         CleanupStack::PopAndDestroy( &readStream );
       
   662         CleanupStack::PopAndDestroy( buffer );
       
   663         CleanupStack::PopAndDestroy( indication );
       
   664         CleanupStack::PopAndDestroy( context );
       
   665         }
       
   666     }
       
   667 
       
   668 //-----------------------------------------------------------------------------
       
   669 // CCFContextObject class unit test cases
       
   670 //-----------------------------------------------------------------------------
       
   671 //
       
   672 void MT_CFServices::MT_CCFContextObject_NewLL(  )
       
   673     {
       
   674     CCFContextObject* context = CCFContextObject::NewL();
       
   675     CleanupStack::PushL( context );
       
   676     EUNIT_ASSERT_DESC( context, "CCFContextObject class instance not created!" );
       
   677     CleanupStack::PopAndDestroy( context );
       
   678 
       
   679     context = CCFContextObject::NewL(
       
   680         _L("Source"), _L("Type"), _L("Value") );
       
   681     CleanupStack::PushL( context );
       
   682     EUNIT_ASSERT_DESC( context, "CCFContextObject class instance not created!" );
       
   683     CleanupStack::PopAndDestroy( context );
       
   684     }
       
   685 
       
   686 void MT_CFServices::MT_CCFContextObject_NewLCL(  )
       
   687     {
       
   688     CCFContextObject* context = CCFContextObject::NewLC();
       
   689     EUNIT_ASSERT_DESC( context, "CCFContextObject class instance not created!" );
       
   690     CleanupStack::PopAndDestroy( context );
       
   691 
       
   692     context = CCFContextObject::NewLC(
       
   693         _L("Source"), _L("Type"), _L("Value") );
       
   694     EUNIT_ASSERT_DESC( context, "CCFContextObject class instance not created!" );
       
   695     CleanupStack::PopAndDestroy( context );
       
   696     }
       
   697 
       
   698 //-----------------------------------------------------------------------------
       
   699 // CCFContextObjectImpl class unit test cases
       
   700 //-----------------------------------------------------------------------------
       
   701 //
       
   702 void MT_CFServices::MT_CCFContextObjectImpl_NewLL(  )
       
   703     {
       
   704     CCFContextObjectImpl* context = CCFContextObjectImpl::NewL();
       
   705     CleanupStack::PushL( context );
       
   706     
       
   707     EUNIT_ASSERT_DESC( context, "CCFContextObjectImpl class instance not created!" );
       
   708     
       
   709     CleanupStack::PopAndDestroy( context );
       
   710     }
       
   711 
       
   712 void MT_CFServices::MT_CCFContextObjectImpl_NewLCL(  )
       
   713     {
       
   714     CCFContextObjectImpl* context = CCFContextObjectImpl::NewLC();
       
   715     
       
   716     EUNIT_ASSERT_DESC( context, "CCFContextObjectImpl class instance not created!" );
       
   717     
       
   718     CleanupStack::PopAndDestroy( context );
       
   719     }
       
   720 
       
   721 void MT_CFServices::MT_CCFContextObjectImpl_SetTypeLL(  )
       
   722     {
       
   723     CCFContextObjectImpl* context = CCFContextObjectImpl::NewLC();
       
   724     
       
   725     EUNIT_ASSERT_DESC( context->Type() == KNullDesC,
       
   726         "Invalid context type!" );
       
   727         
       
   728     context->SetTypeL( KContextType );
       
   729     EUNIT_ASSERT_DESC( context->Type() == KContextType,
       
   730         "Invalid context type!" );
       
   731     
       
   732     context->SetTypeL( KContextTypeLong );
       
   733     EUNIT_ASSERT_DESC( context->Type() == KContextTypeLong,
       
   734         "Invalid context type!" );
       
   735     
       
   736     // Clean up
       
   737     CleanupStack::PopAndDestroy( context );
       
   738     }
       
   739 
       
   740 void MT_CFServices::MT_CCFContextObjectImpl_SetValueLL(  )
       
   741     {
       
   742     CCFContextObjectImpl* context = CCFContextObjectImpl::NewLC();
       
   743     
       
   744     EUNIT_ASSERT_DESC( context->Value() == KNullDesC,
       
   745         "Invalid context value!" );
       
   746         
       
   747     context->SetValueL( KContextValue );
       
   748     EUNIT_ASSERT_DESC( context->Value() == KContextValue,
       
   749         "Invalid context value!" );
       
   750     
       
   751     context->SetValueL( KContextValueLong );
       
   752     EUNIT_ASSERT_DESC( context->Value() == KContextValueLong,
       
   753         "Invalid context value!" );
       
   754     
       
   755     // Clean up
       
   756     CleanupStack::PopAndDestroy( context );
       
   757     }
       
   758 
       
   759 void MT_CFServices::MT_CCFContextObjectImpl_SetSourceLL(  )
       
   760     {
       
   761     CCFContextObjectImpl* context = CCFContextObjectImpl::NewLC();
       
   762     
       
   763     EUNIT_ASSERT_DESC( context->Source() == KNullDesC,
       
   764         "Invalid context source!" );
       
   765         
       
   766     context->SetSourceL( KContextSource );
       
   767     EUNIT_ASSERT_DESC( context->Source() == KContextSource,
       
   768         "Invalid context source!" );
       
   769 
       
   770     context->SetSourceL( KContextSourceLong );
       
   771     EUNIT_ASSERT_DESC( context->Source() == KContextSourceLong,
       
   772         "Invalid context source!" );
       
   773 
       
   774     // Clean up
       
   775     CleanupStack::PopAndDestroy( context );
       
   776     }
       
   777 
       
   778 void MT_CFServices::MT_CCFContextObjectImpl_SetConfidenceL(  )
       
   779     {
       
   780     CCFContextObjectImpl* context = CCFContextObjectImpl::NewLC();
       
   781     
       
   782     EUNIT_ASSERT_DESC( context->Confidence() == 100,
       
   783         "Invalid confidence!" );
       
   784         
       
   785     context->SetConfidence( 50 );
       
   786     EUNIT_ASSERT_DESC( context->Confidence() == 50,
       
   787         "Invalid confidence!" );
       
   788     
       
   789     // Clean up
       
   790     CleanupStack::PopAndDestroy( context );
       
   791     }
       
   792 
       
   793 void MT_CFServices::MT_CCFContextObjectImpl_SetTimestampToHomeTimeL(  )
       
   794     {
       
   795     CCFContextObjectImpl* context = CCFContextObjectImpl::NewLC();
       
   796     
       
   797     TTime now;
       
   798     now.HomeTime();
       
   799     
       
   800     User::After( 1000 );
       
   801     context->SetTimestampToHomeTime();
       
   802     User::After( 1000 );
       
   803     
       
   804     TTime after;
       
   805     after.HomeTime();
       
   806     
       
   807     const TTime& time = context->Timestamp();
       
   808     EUNIT_ASSERT_DESC( time > now, "Invalid home timestamp!" );
       
   809     EUNIT_ASSERT_DESC( time < after, "Invalid home timestamp!" );
       
   810 
       
   811     // Clean up
       
   812     CleanupStack::PopAndDestroy( context );
       
   813     }
       
   814 
       
   815 void MT_CFServices::MT_CCFContextObjectImpl_SetTimestampL(  )
       
   816     {
       
   817     CCFContextObjectImpl* context = CCFContextObjectImpl::NewLC();
       
   818     TTime now;
       
   819     now.HomeTime();
       
   820     
       
   821     EUNIT_ASSERT_DESC( now != context->Timestamp(), "Invalid time stamp!" );
       
   822     
       
   823     context->SetTimestamp( now );
       
   824     EUNIT_ASSERT_DESC( now == context->Timestamp(), "Invalid time stamp!" );
       
   825     
       
   826     User::After( 1000 );
       
   827     now.HomeTime();
       
   828 
       
   829     context->SetTimestamp( now.Int64() );
       
   830     EUNIT_ASSERT_DESC( now == context->Timestamp(), "Invalid time stamp!" );
       
   831     
       
   832     // Clean up
       
   833     CleanupStack::PopAndDestroy( context );
       
   834     }
       
   835 
       
   836 void MT_CFServices::MT_CCFContextObjectImpl_CopyLL(  )
       
   837     {
       
   838     static const TInt KConfidence = 50;
       
   839     TTime time;
       
   840     time.HomeTime();
       
   841     CCFContextObjectImpl* context = ConfigureContextObjectLC(
       
   842         KContextSource,
       
   843         KContextType,
       
   844         KContextValue,
       
   845         KConfidence,
       
   846         time
       
   847         );
       
   848 
       
   849     CCFContextObjectImpl* copyContext = CCFContextObjectImpl::NewLC();
       
   850     copyContext->CopyL( *context );
       
   851     
       
   852     EUNIT_ASSERT_DESC( context->Source() == copyContext->Source(),
       
   853         "Invalid source copy!" );
       
   854     EUNIT_ASSERT_DESC( context->Type() == copyContext->Type(),
       
   855         "Invalid type copy!" );
       
   856     EUNIT_ASSERT_DESC( context->Value() == copyContext->Value(),
       
   857         "Invalid value copy!" );
       
   858     EUNIT_ASSERT_DESC( context->Confidence() == copyContext->Confidence(),
       
   859         "Invalid confidence copy!" );
       
   860     EUNIT_ASSERT_DESC( context->Timestamp() == copyContext->Timestamp(),
       
   861         "Invalid timestamp copy!" );
       
   862     
       
   863     // Clean up
       
   864     CleanupStack::PopAndDestroy( copyContext );
       
   865     CleanupStack::PopAndDestroy( context );
       
   866     }
       
   867 
       
   868 void MT_CFServices::MT_CCFContextObjectImpl_ExternalizeLL(  )
       
   869     {
       
   870     static const TInt KConfidence = 50;
       
   871     static const TInt KCount = 3;
       
   872     TTime time;
       
   873     CCFContextObjectImpl* context = NULL;
       
   874     for( TInt i = 0; i < KCount; i++ )
       
   875         {
       
   876         switch( i )
       
   877             {
       
   878             case 1:
       
   879                 {
       
   880                 context = ConfigureContextObjectLC(
       
   881                     KContextSource,
       
   882                     KNullDesC,
       
   883                     KContextValue,
       
   884                     KConfidence,
       
   885                     time );
       
   886                 break;
       
   887                 }
       
   888             case 2:
       
   889                 {
       
   890                 context = ConfigureContextObjectLC(
       
   891                     KContextSource,
       
   892                     KNullDesC,
       
   893                     KNullDesC,
       
   894                     KConfidence,
       
   895                     time );
       
   896                 break;
       
   897                 }
       
   898             case 0:
       
   899             default:
       
   900                 {
       
   901                 context = ConfigureContextObjectLC(
       
   902                     KContextSource,
       
   903                     KContextType,
       
   904                     KContextValue,
       
   905                     KConfidence,
       
   906                     time );
       
   907                 break;
       
   908                 }
       
   909             }
       
   910         time.HomeTime();
       
   911         
       
   912         // Externalize
       
   913         HBufC8* buffer = HBufC8::NewLC( context->Size() );
       
   914         TPtr8 bufferPtr = buffer->Des();
       
   915         RDesWriteStream writeStream( bufferPtr );
       
   916         writeStream.PushL();
       
   917         context->ExternalizeL( writeStream );
       
   918         CleanupStack::PopAndDestroy( &writeStream );
       
   919         
       
   920         // Internalize
       
   921         CCFContextObjectImpl* copyContext = CCFContextObjectImpl::NewLC();
       
   922         RDesReadStream readStream( bufferPtr );
       
   923         readStream.PushL();
       
   924         copyContext->InternalizeL( readStream );
       
   925         CleanupStack::PopAndDestroy( &readStream );
       
   926         
       
   927         // Check results
       
   928         EUNIT_ASSERT_DESC( context->Source() == copyContext->Source(),
       
   929             "Invalid source copy!" );
       
   930         EUNIT_ASSERT_DESC( context->Type() == copyContext->Type(),
       
   931             "Invalid type copy!" );
       
   932         EUNIT_ASSERT_DESC( context->Value() == copyContext->Value(),
       
   933             "Invalid value copy!" );
       
   934         EUNIT_ASSERT_DESC( context->Confidence() == copyContext->Confidence(),
       
   935             "Invalid confidence copy!" );
       
   936         EUNIT_ASSERT_DESC( context->Timestamp() == copyContext->Timestamp(),
       
   937             "Invalid timestamp copy!" );
       
   938         
       
   939         // Clean up
       
   940         CleanupStack::PopAndDestroy( copyContext );
       
   941         CleanupStack::PopAndDestroy( buffer );
       
   942         CleanupStack::PopAndDestroy( context );
       
   943         }
       
   944     }
       
   945 
       
   946 void MT_CFServices::MT_CCFContextObjectImpl_CompareValueL(  )
       
   947     {
       
   948     static const TInt KConfidence = 50;
       
   949     TTime time;
       
   950     time.HomeTime();
       
   951     CCFContextObjectImpl* context1 = ConfigureContextObjectLC(
       
   952         KContextSource,
       
   953         KContextType,
       
   954         KContextValue,
       
   955         KConfidence,
       
   956         time );
       
   957     CCFContextObjectImpl* context2 = ConfigureContextObjectLC(
       
   958         KNullDesC,
       
   959         KNullDesC,
       
   960         KContextValue,
       
   961         KConfidence,
       
   962         time );
       
   963     CCFContextObjectImpl* context3 = ConfigureContextObjectLC(
       
   964         KNullDesC,
       
   965         KNullDesC,
       
   966         KContextValueLong,
       
   967         KConfidence,
       
   968         time );
       
   969         
       
   970     EUNIT_ASSERT_DESC( context1->CompareValue( *context2 ) == KErrNone,
       
   971         "Incorrect comparison result!" );
       
   972     EUNIT_ASSERT_DESC( context1->CompareValue( *context3 ) != KErrNone,
       
   973         "Incorrect comparison result!" );
       
   974         
       
   975     CleanupStack::PopAndDestroy( context3 );
       
   976     CleanupStack::PopAndDestroy( context2 );
       
   977     CleanupStack::PopAndDestroy( context1 );
       
   978     }
       
   979 
       
   980 void MT_CFServices::MT_CCFContextObjectImpl_CompareByTypeL(  )
       
   981     {
       
   982     static const TInt KConfidence = 50;
       
   983     TTime time;
       
   984     time.HomeTime();
       
   985     CCFContextObjectImpl* context1 = ConfigureContextObjectLC(
       
   986         KContextSource,
       
   987         KContextType,
       
   988         KContextValue,
       
   989         KConfidence,
       
   990         time );
       
   991     CCFContextObjectImpl* context2 = ConfigureContextObjectLC(
       
   992         KNullDesC,
       
   993         KContextType,
       
   994         KNullDesC,
       
   995         KConfidence,
       
   996         time );
       
   997     CCFContextObjectImpl* context3 = ConfigureContextObjectLC(
       
   998         KNullDesC,
       
   999         KContextTypeLong,
       
  1000         KContextValueLong,
       
  1001         KConfidence,
       
  1002         time );
       
  1003         
       
  1004     EUNIT_ASSERT_DESC(
       
  1005         CCFContextObjectImpl::CompareByType( *context1, *context2 ) == KErrNone,
       
  1006             "Incorrect comparison result!" );
       
  1007     EUNIT_ASSERT_DESC(
       
  1008         CCFContextObjectImpl::CompareByType( *context1, *context3 ) != KErrNone,
       
  1009             "Incorrect comparison result!" );
       
  1010         
       
  1011     CleanupStack::PopAndDestroy( context3 );
       
  1012     CleanupStack::PopAndDestroy( context2 );
       
  1013     CleanupStack::PopAndDestroy( context1 );
       
  1014     }
       
  1015 
       
  1016 void MT_CFServices::MT_CCFContextObjectImpl_CompareByTypeAndSourceL(  )
       
  1017     {
       
  1018     static const TInt KConfidence = 50;
       
  1019     TTime time;
       
  1020     time.HomeTime();
       
  1021     CCFContextObjectImpl* context1 = ConfigureContextObjectLC(
       
  1022         KContextSource,
       
  1023         KContextType,
       
  1024         KContextValue,
       
  1025         KConfidence,
       
  1026         time );
       
  1027     CCFContextObjectImpl* context2 = ConfigureContextObjectLC(
       
  1028         KContextSource,
       
  1029         KContextType,
       
  1030         KNullDesC,
       
  1031         KConfidence,
       
  1032         time );
       
  1033     CCFContextObjectImpl* context3 = ConfigureContextObjectLC(
       
  1034         KNullDesC,
       
  1035         KContextTypeLong,
       
  1036         KContextValueLong,
       
  1037         KConfidence,
       
  1038         time );
       
  1039         
       
  1040     EUNIT_ASSERT_DESC(
       
  1041         CCFContextObjectImpl::CompareByTypeAndSource( *context1, *context2 ) == KErrNone,
       
  1042             "Incorrect comparison result!" );
       
  1043     EUNIT_ASSERT_DESC(
       
  1044         CCFContextObjectImpl::CompareByTypeAndSource( *context1, *context3 ) != KErrNone,
       
  1045             "Incorrect comparison result!" );
       
  1046         
       
  1047     CleanupStack::PopAndDestroy( context3 );
       
  1048     CleanupStack::PopAndDestroy( context2 );
       
  1049     CleanupStack::PopAndDestroy( context1 );
       
  1050     }
       
  1051 
       
  1052 void MT_CFServices::MT_CCFContextObjectImpl_CompareByTimeDescendingL(  )
       
  1053     {
       
  1054     static const TInt KConfidence = 50;
       
  1055     TTime time;
       
  1056     time.HomeTime();
       
  1057     CCFContextObjectImpl* context1 = ConfigureContextObjectLC(
       
  1058         KContextSource,
       
  1059         KContextType,
       
  1060         KContextValue,
       
  1061         KConfidence,
       
  1062         time );
       
  1063     CCFContextObjectImpl* context2 = ConfigureContextObjectLC(
       
  1064         KContextSource,
       
  1065         KContextType,
       
  1066         KNullDesC,
       
  1067         KConfidence,
       
  1068         time );
       
  1069     User::After( 1000 );
       
  1070     time.HomeTime();
       
  1071     CCFContextObjectImpl* context3 = ConfigureContextObjectLC(
       
  1072         KNullDesC,
       
  1073         KContextTypeLong,
       
  1074         KContextValueLong,
       
  1075         KConfidence,
       
  1076         time );
       
  1077         
       
  1078     EUNIT_ASSERT_DESC(
       
  1079         CCFContextObjectImpl::CompareByTimeDescending( *context1, *context2 ) == 0,
       
  1080             "Incorrect comparison result!" );
       
  1081     EUNIT_ASSERT_DESC(
       
  1082         CCFContextObjectImpl::CompareByTypeAndSource( *context1, *context3 ) < 0,
       
  1083             "Incorrect comparison result!" );
       
  1084     EUNIT_ASSERT_DESC(
       
  1085         CCFContextObjectImpl::CompareByTypeAndSource( *context3, *context2 ) > 0,
       
  1086             "Incorrect comparison result!" );
       
  1087         
       
  1088     CleanupStack::PopAndDestroy( context3 );
       
  1089     CleanupStack::PopAndDestroy( context2 );
       
  1090     CleanupStack::PopAndDestroy( context1 );
       
  1091     }
       
  1092 
       
  1093 void MT_CFServices::MT_CCFContextObjectImpl_IsSameL(  )
       
  1094     {
       
  1095     static const TInt KConfidence = 50;
       
  1096     TTime time;
       
  1097     time.HomeTime();
       
  1098     CCFContextObjectImpl* context1 = ConfigureContextObjectLC(
       
  1099         KContextSource,
       
  1100         KContextType,
       
  1101         KContextValue,
       
  1102         KConfidence,
       
  1103         time );
       
  1104     CCFContextObjectImpl* context2 = ConfigureContextObjectLC(
       
  1105         KContextSource,
       
  1106         KContextType,
       
  1107         KContextValue,
       
  1108         KConfidence,
       
  1109         time );
       
  1110     CCFContextObjectImpl* context3 = ConfigureContextObjectLC(
       
  1111         KContextSource,
       
  1112         KContextType,
       
  1113         KNullDesC,
       
  1114         KConfidence,
       
  1115         time );
       
  1116     
       
  1117     EUNIT_ASSERT_DESC( CCFContextObjectImpl::IsSame( *context1, *context2 ),
       
  1118         "Contexts are not same!" );
       
  1119     EUNIT_ASSERT_DESC( !CCFContextObjectImpl::IsSame( *context1, *context3 ),
       
  1120         "Contexts are same!" );
       
  1121         
       
  1122     CleanupStack::PopAndDestroy( context3 );
       
  1123     CleanupStack::PopAndDestroy( context2 );
       
  1124     CleanupStack::PopAndDestroy( context1 );
       
  1125     }
       
  1126 
       
  1127 //-----------------------------------------------------------------------------
       
  1128 // CCFContextQuery class unit test cases
       
  1129 //-----------------------------------------------------------------------------
       
  1130 //
       
  1131 void MT_CFServices::MT_CCFContextQuery_NewLL(  )
       
  1132     {
       
  1133     CCFContextQuery* query = CCFContextQuery::NewL();
       
  1134     CleanupStack::PushL( query );
       
  1135     EUNIT_ASSERT_DESC( query, "CCFContextQuery class instance not created!" );
       
  1136     CleanupStack::PopAndDestroy( query );
       
  1137 
       
  1138     query = CCFContextQuery::NewL( KContextSource, KContextType );
       
  1139     CleanupStack::PushL( query );
       
  1140     EUNIT_ASSERT_DESC( query, "CCFContextQuery class instance not created!" );
       
  1141     CleanupStack::PopAndDestroy( query );
       
  1142     }
       
  1143 
       
  1144 void MT_CFServices::MT_CCFContextQuery_NewLCL(  )
       
  1145     {
       
  1146     CCFContextQuery* query = CCFContextQuery::NewLC();
       
  1147     EUNIT_ASSERT_DESC( query, "CCFContextQuery class instance not created!" );
       
  1148     CleanupStack::PopAndDestroy( query );
       
  1149 
       
  1150     query = CCFContextQuery::NewLC( KContextSource, KContextType );
       
  1151     EUNIT_ASSERT_DESC( query, "CCFContextQuery class instance not created!" );
       
  1152     CleanupStack::PopAndDestroy( query );
       
  1153     }
       
  1154 
       
  1155 //-----------------------------------------------------------------------------
       
  1156 // CCFContextQueryImpl class unit test cases
       
  1157 //-----------------------------------------------------------------------------
       
  1158 //
       
  1159 void MT_CFServices::MT_CCFContextQueryImpl_NewLL(  )
       
  1160     {
       
  1161     CCFContextQueryImpl* query = CCFContextQueryImpl::NewL( KNullDesC, KNullDesC );
       
  1162     CleanupStack::PushL( query );
       
  1163     
       
  1164     EUNIT_ASSERT_DESC( query, "CCFContextQueryImpl class instance not created!" );
       
  1165     
       
  1166     CleanupStack::PopAndDestroy( query );
       
  1167     }
       
  1168 
       
  1169 void MT_CFServices::MT_CCFContextQueryImpl_NewLCL(  )
       
  1170     {
       
  1171     CCFContextQueryImpl* query = CCFContextQueryImpl::NewLC( KNullDesC, KNullDesC );
       
  1172     
       
  1173     EUNIT_ASSERT_DESC( query, "CCFContextQueryImpl class instance not created!" );
       
  1174     
       
  1175     CleanupStack::PopAndDestroy( query );
       
  1176     }
       
  1177 
       
  1178 void MT_CFServices::MT_CCFContextQueryImpl_SetTypeLL(  )
       
  1179     {
       
  1180     CCFContextQueryImpl* query = CCFContextQueryImpl::NewLC( KNullDesC, KNullDesC );
       
  1181     
       
  1182     EUNIT_ASSERT_DESC( query->Type() == KNullDesC,
       
  1183         "Incorrect query type!" );
       
  1184     
       
  1185     query->SetTypeL( KContextType );
       
  1186     EUNIT_ASSERT_DESC( query->Type() == KContextType,
       
  1187         "Incorrect query type!" );
       
  1188 
       
  1189     query->SetTypeL( KContextTypeLong );
       
  1190     EUNIT_ASSERT_DESC( query->Type() == KContextTypeLong,
       
  1191         "Incorrect query type!" );
       
  1192     
       
  1193     CleanupStack::PopAndDestroy( query );
       
  1194     }
       
  1195 
       
  1196 void MT_CFServices::MT_CCFContextQueryImpl_SetSourceLL(  )
       
  1197     {
       
  1198     CCFContextQueryImpl* query = CCFContextQueryImpl::NewLC( KNullDesC, KNullDesC );
       
  1199     
       
  1200     EUNIT_ASSERT_DESC( query->Source() == KNullDesC,
       
  1201         "Incorrect query source!" );
       
  1202     
       
  1203     query->SetSourceL( KContextSource );
       
  1204     EUNIT_ASSERT_DESC( query->Source() == KContextSource,
       
  1205         "Incorrect query source!" );
       
  1206     
       
  1207     query->SetSourceL( KContextSourceLong );
       
  1208     EUNIT_ASSERT_DESC( query->Source() == KContextSourceLong,
       
  1209         "Incorrect query source!" );
       
  1210     
       
  1211     CleanupStack::PopAndDestroy( query );
       
  1212     }
       
  1213 
       
  1214 void MT_CFServices::MT_CCFContextQueryImpl_SetSubTypeMatchL(  )
       
  1215     {
       
  1216     CCFContextQueryImpl* query = CCFContextQueryImpl::NewLC( KNullDesC, KNullDesC );
       
  1217     
       
  1218     EUNIT_ASSERT_DESC( !query->SubTypeMatch(),
       
  1219         "Incorrect query sub type match!" );
       
  1220         
       
  1221     query->SetSubTypeMatch( ETrue );
       
  1222     EUNIT_ASSERT_DESC( query->SubTypeMatch(),
       
  1223         "Incorrect query sub type match!" );
       
  1224     
       
  1225     query->SetSubTypeMatch( EFalse );
       
  1226     EUNIT_ASSERT_DESC( !query->SubTypeMatch(),
       
  1227         "Incorrect query sub type match!" );
       
  1228     
       
  1229     CleanupStack::PopAndDestroy( query );
       
  1230     }
       
  1231 
       
  1232 void MT_CFServices::MT_CCFContextQueryImpl_ExternalizeLL(  )
       
  1233     {
       
  1234     static const TInt KCount = 3;
       
  1235     CCFContextQueryImpl* query = NULL;
       
  1236     CCFContextQueryImpl* copyQuery = NULL;
       
  1237     for( TInt i = 0; i < KCount; i++ )
       
  1238         {
       
  1239         switch( i )
       
  1240             {
       
  1241             case 0:
       
  1242                 {
       
  1243                 query = CCFContextQueryImpl::NewLC( KContextSource, KNullDesC );
       
  1244                 break;
       
  1245                 }
       
  1246             case 1:
       
  1247                 {
       
  1248                 query = CCFContextQueryImpl::NewLC( KNullDesC, KContextType );
       
  1249                 break;
       
  1250                 }
       
  1251             case 2:
       
  1252             default:
       
  1253                 {
       
  1254                 query = CCFContextQueryImpl::NewLC( KContextSource, KContextType );
       
  1255                 break;
       
  1256                 }
       
  1257             }
       
  1258         
       
  1259         // Externalize
       
  1260         HBufC8* buffer = HBufC8::NewLC( query->Size() );
       
  1261         TPtr8 bufferPtr = buffer->Des();
       
  1262         RDesWriteStream writeStream( bufferPtr );
       
  1263         writeStream.PushL();
       
  1264         query->ExternalizeL( writeStream );
       
  1265         CleanupStack::PopAndDestroy( &writeStream );
       
  1266         
       
  1267         // Internalize
       
  1268         copyQuery = CCFContextQueryImpl::NewLC( KNullDesC, KNullDesC );
       
  1269         RDesReadStream readStream( bufferPtr );
       
  1270         readStream.PushL();
       
  1271         copyQuery->InternalizeL( readStream );
       
  1272         CleanupStack::PopAndDestroy( &readStream );
       
  1273         
       
  1274         // Check results
       
  1275         EUNIT_ASSERT_DESC( CCFContextQueryImpl::IsSame( *query, *copyQuery ),
       
  1276             "Query externalization failed!" );
       
  1277         
       
  1278         // Clean up
       
  1279         CleanupStack::PopAndDestroy( copyQuery );
       
  1280         CleanupStack::PopAndDestroy( buffer );
       
  1281         CleanupStack::PopAndDestroy( query );
       
  1282         }
       
  1283     }
       
  1284 
       
  1285 void MT_CFServices::MT_CCFContextQueryImpl_MatchesL(  )
       
  1286     {
       
  1287     CCFContextQueryImpl* query =
       
  1288         CCFContextQueryImpl::NewLC( KContextSource, KContextType );
       
  1289         
       
  1290     EUNIT_ASSERT_DESC( query->Matches( KContextType, KContextSource ),
       
  1291         "Invalid query match!" );
       
  1292     EUNIT_ASSERT_DESC( !query->Matches( KContextType, KNullDesC ),
       
  1293         "Invalid query match!" );
       
  1294     EUNIT_ASSERT_DESC( !query->Matches( KNullDesC, KContextSource ),
       
  1295         "Invalid query match!" );
       
  1296     
       
  1297     // Clean up
       
  1298     CleanupStack::PopAndDestroy( query );
       
  1299     }
       
  1300 
       
  1301 void MT_CFServices::MT_CCFContextQueryImpl_MatchesQueryL(  )
       
  1302     {
       
  1303     CCFContextQueryImpl* query =
       
  1304         CCFContextQueryImpl::NewLC( KContextSource, KContextType );
       
  1305     query->SetSubTypeMatch( ETrue );
       
  1306         
       
  1307     EUNIT_ASSERT_DESC(
       
  1308         CCFContextQueryImpl::MatchesQuery( *query, KContextType, KContextSource, EFalse ),
       
  1309             "Invalid query match!" );
       
  1310     EUNIT_ASSERT_DESC(
       
  1311         CCFContextQueryImpl::MatchesQuery( *query, KContextTypeLong, KContextSource, ETrue ),
       
  1312             "Invalid query match!" );
       
  1313     EUNIT_ASSERT_DESC(
       
  1314         !CCFContextQueryImpl::MatchesQuery( *query, KNullDesC, KContextSource, ETrue ),
       
  1315             "Invalid query match!" );
       
  1316     EUNIT_ASSERT_DESC(
       
  1317         !CCFContextQueryImpl::MatchesQuery( *query, KContextType, KNullDesC, ETrue ),
       
  1318             "Invalid query match!" );
       
  1319 
       
  1320     // Clean up
       
  1321     CleanupStack::PopAndDestroy( query );
       
  1322     }
       
  1323 
       
  1324 void MT_CFServices::MT_CCFContextQueryImpl_IsSameL(  )
       
  1325     {
       
  1326     CCFContextQueryImpl* query1 =
       
  1327         CCFContextQueryImpl::NewLC( KContextSource, KContextType );
       
  1328     CCFContextQueryImpl* query2 =
       
  1329         CCFContextQueryImpl::NewLC( KContextSource, KContextType );
       
  1330     CCFContextQueryImpl* query3 =
       
  1331         CCFContextQueryImpl::NewLC( KContextSource, KContextTypeLong );
       
  1332         
       
  1333     EUNIT_ASSERT_DESC(
       
  1334         CCFContextQueryImpl::IsSame( *query1, *query2 ),
       
  1335             "Invalid query match!" );
       
  1336     EUNIT_ASSERT_DESC(
       
  1337         !CCFContextQueryImpl::IsSame( *query1, *query3 ),
       
  1338             "Invalid query match!" );
       
  1339         
       
  1340     // Clean up
       
  1341     CleanupStack::PopAndDestroy( query3 );
       
  1342     CleanupStack::PopAndDestroy( query2 );
       
  1343     CleanupStack::PopAndDestroy( query1 );
       
  1344     }
       
  1345 
       
  1346 //-----------------------------------------------------------------------------
       
  1347 // CCFContextSubscription class unit test cases
       
  1348 //-----------------------------------------------------------------------------
       
  1349 //
       
  1350 void MT_CFServices::MT_CCFContextSubscription_NewLL(  )
       
  1351     {
       
  1352     CCFContextSubscription* subscription = CCFContextSubscription::NewL();
       
  1353     CleanupStack::PushL( subscription );
       
  1354     
       
  1355     EUNIT_ASSERT_DESC( subscription, "CCFContextSubscription class instance not created!" );
       
  1356     
       
  1357     CleanupStack::PopAndDestroy( subscription );
       
  1358     }
       
  1359 
       
  1360 void MT_CFServices::MT_CCFContextSubscription_NewLCL(  )
       
  1361     {
       
  1362     CCFContextSubscription* subscription = CCFContextSubscription::NewLC();
       
  1363     
       
  1364     EUNIT_ASSERT_DESC( subscription, "CCFContextSubscription class instance not created!" );
       
  1365     
       
  1366     CleanupStack::PopAndDestroy( subscription );
       
  1367     }
       
  1368 
       
  1369 //-----------------------------------------------------------------------------
       
  1370 // CCFContextSubscriptionImpl class unit test cases
       
  1371 //-----------------------------------------------------------------------------
       
  1372 //
       
  1373 void MT_CFServices::MT_CCFContextSubscriptionImpl_NewLL(  )
       
  1374     {
       
  1375     CCFContextSubscriptionImpl* subscription = CCFContextSubscriptionImpl::NewL();
       
  1376     CleanupStack::PushL( subscription );
       
  1377     
       
  1378     EUNIT_ASSERT_DESC( subscription, "CCFContextSubscriptionImpl class instance not created!" );
       
  1379     
       
  1380     CleanupStack::PopAndDestroy( subscription );
       
  1381     }
       
  1382 
       
  1383 void MT_CFServices::MT_CCFContextSubscriptionImpl_NewLCL(  )
       
  1384     {
       
  1385     CCFContextSubscriptionImpl* subscription = CCFContextSubscriptionImpl::NewLC();
       
  1386     
       
  1387     EUNIT_ASSERT_DESC( subscription, "CCFContextSubscriptionImpl class instance not created!" );
       
  1388     
       
  1389     CleanupStack::PopAndDestroy( subscription );
       
  1390     }
       
  1391 
       
  1392 void MT_CFServices::MT_CCFContextSubscriptionImpl_SetContextTypeLL(  )
       
  1393     {
       
  1394     CCFContextSubscriptionImpl* subscription = CCFContextSubscriptionImpl::NewLC();
       
  1395     
       
  1396     EUNIT_ASSERT_DESC( subscription->ContextType() == KNullDesC,
       
  1397         "Invalid contex type in subscription!" );
       
  1398         
       
  1399     subscription->SetContextTypeL( KContextType );
       
  1400     EUNIT_ASSERT_DESC( subscription->ContextType() == KContextType,
       
  1401         "Invalid contex type in subscription!" );
       
  1402     
       
  1403     subscription->SetContextTypeL( KContextTypeLong );
       
  1404     EUNIT_ASSERT_DESC( subscription->ContextType() == KContextTypeLong,
       
  1405         "Invalid contex type in subscription!" );
       
  1406     
       
  1407     subscription->SetContextTypeL( KContextType );
       
  1408     EUNIT_ASSERT_DESC( subscription->ContextType() == KContextType,
       
  1409         "Invalid contex type in subscription!" );
       
  1410     
       
  1411     // Clean up
       
  1412     CleanupStack::PopAndDestroy( subscription );
       
  1413     }
       
  1414 
       
  1415 void MT_CFServices::MT_CCFContextSubscriptionImpl_SetContextSourceLL(  )
       
  1416     {
       
  1417     CCFContextSubscriptionImpl* subscription = CCFContextSubscriptionImpl::NewLC();
       
  1418     
       
  1419     EUNIT_ASSERT_DESC( subscription->ContextSource() == KNullDesC,
       
  1420         "Invalid context source in subscription!" );
       
  1421         
       
  1422     subscription->SetContextSourceL( KContextSource );
       
  1423     EUNIT_ASSERT_DESC( subscription->ContextSource() == KContextSource,
       
  1424         "Invalid context source in subscription!" );
       
  1425 
       
  1426     subscription->SetContextSourceL( KContextSourceLong );
       
  1427     EUNIT_ASSERT_DESC( subscription->ContextSource() == KContextSourceLong,
       
  1428         "Invalid context source in subscription!" );
       
  1429 
       
  1430     subscription->SetContextSourceL( KContextSource );
       
  1431     EUNIT_ASSERT_DESC( subscription->ContextSource() == KContextSource,
       
  1432         "Invalid context source in subscription!" );
       
  1433 
       
  1434     // Clean up
       
  1435     CleanupStack::PopAndDestroy( subscription );
       
  1436     }
       
  1437 
       
  1438 void MT_CFServices::MT_CCFContextSubscriptionImpl_SetSubTypeMatchL(  )
       
  1439     {
       
  1440     CCFContextSubscriptionImpl* subscription = CCFContextSubscriptionImpl::NewLC();
       
  1441     
       
  1442     EUNIT_ASSERT_DESC( !subscription->SubTypeMatch(),
       
  1443         "Invalid sub type match in subscription!" );
       
  1444         
       
  1445     subscription->SetSubTypeMatch( ETrue );
       
  1446     EUNIT_ASSERT_DESC( subscription->SubTypeMatch(),
       
  1447         "Invalid sub type match in subscription!" );
       
  1448     
       
  1449     subscription->SetSubTypeMatch( EFalse );
       
  1450     EUNIT_ASSERT_DESC( !subscription->SubTypeMatch(),
       
  1451         "Invalid sub type match in subscription!" );
       
  1452     
       
  1453     // Clean up
       
  1454     CleanupStack::PopAndDestroy( subscription );
       
  1455     }
       
  1456 
       
  1457 void MT_CFServices::MT_CCFContextSubscriptionImpl_SetOnlyChangesIndicatedL(  )
       
  1458     {
       
  1459     CCFContextSubscriptionImpl* subscription = CCFContextSubscriptionImpl::NewLC();
       
  1460     
       
  1461     EUNIT_ASSERT_DESC( !subscription->OnlyChangesIndicated(),
       
  1462         "Invalid only changes indicated flag in subscription!" );
       
  1463     
       
  1464     subscription->SetOnlyChangesIndicated( ETrue );
       
  1465     EUNIT_ASSERT_DESC( subscription->OnlyChangesIndicated(),
       
  1466         "Invalid only changes indicated flag in subscription!" );
       
  1467     
       
  1468     subscription->SetOnlyChangesIndicated( EFalse );
       
  1469     EUNIT_ASSERT_DESC( !subscription->OnlyChangesIndicated(),
       
  1470         "Invalid only changes indicated flag in subscription!" );
       
  1471     
       
  1472     // Clean up
       
  1473     CleanupStack::PopAndDestroy( subscription );
       
  1474     }
       
  1475 
       
  1476 void MT_CFServices::MT_CCFContextSubscriptionImpl_SetDataObjectEnabledL(  )
       
  1477     {
       
  1478     CCFContextSubscriptionImpl* subscription = CCFContextSubscriptionImpl::NewLC();
       
  1479     
       
  1480     EUNIT_ASSERT_DESC( !subscription->DataObjectEnabled(),
       
  1481         "Incorrect DataObjectEnabled value!" );
       
  1482     
       
  1483     subscription->SetDataObjectEnabled( ETrue );
       
  1484     EUNIT_ASSERT_DESC( subscription->DataObjectEnabled(),
       
  1485         "Incorrect DataObjectEnabled value!" );
       
  1486     
       
  1487     subscription->SetDataObjectEnabled( EFalse );
       
  1488     EUNIT_ASSERT_DESC( !subscription->DataObjectEnabled(),
       
  1489         "Incorrect DataObjectEnabled value!" );
       
  1490     
       
  1491     // Clean up
       
  1492     CleanupStack::PopAndDestroy( subscription );
       
  1493     }
       
  1494 
       
  1495 void MT_CFServices::MT_CCFContextSubscriptionImpl_ExternalizeLL(  )
       
  1496     {
       
  1497     static const TInt KCount = 4;
       
  1498     CCFContextSubscriptionImpl* subscription = NULL;
       
  1499     CCFContextSubscriptionImpl* copySubscription = NULL;
       
  1500     for( TInt i = 0; i < KCount; i++ )
       
  1501         {
       
  1502         switch( i )
       
  1503             {
       
  1504             case 0:
       
  1505                 {
       
  1506                 subscription = ConfigureContextSubscriptionLC(
       
  1507                     KContextSource,
       
  1508                     KContextType,
       
  1509                     ETrue,
       
  1510                     ETrue );
       
  1511                 subscription->SetDataObjectEnabled( ETrue );
       
  1512                 break;
       
  1513                 }
       
  1514             case 1:
       
  1515                 {
       
  1516                 subscription = ConfigureContextSubscriptionLC(
       
  1517                     KNullDesC,
       
  1518                     KContextType,
       
  1519                     EFalse,
       
  1520                     ETrue );
       
  1521                 break;
       
  1522                 }
       
  1523             case 2:
       
  1524                 {
       
  1525                 subscription = ConfigureContextSubscriptionLC(
       
  1526                     KNullDesC,
       
  1527                     KNullDesC,
       
  1528                     EFalse,
       
  1529                     ETrue );
       
  1530                 break;
       
  1531                 }
       
  1532             case 3:
       
  1533             default:
       
  1534                 {
       
  1535                 subscription = ConfigureContextSubscriptionLC(
       
  1536                     KContextSource,
       
  1537                     KNullDesC,
       
  1538                     EFalse,
       
  1539                     EFalse );
       
  1540                 break;
       
  1541                 }
       
  1542             }
       
  1543         // Externalize
       
  1544         HBufC8* buffer = HBufC8::NewLC( subscription->Size() );
       
  1545         TPtr8 bufferPtr = buffer->Des();
       
  1546         RDesWriteStream writeStream( bufferPtr );
       
  1547         writeStream.PushL();
       
  1548         subscription->ExternalizeL( writeStream );
       
  1549         CleanupStack::PopAndDestroy( &writeStream );
       
  1550         
       
  1551         // Internalize
       
  1552         RDesReadStream readStream( bufferPtr );
       
  1553         readStream.PushL();
       
  1554         copySubscription = CCFContextSubscriptionImpl::NewLC( readStream );
       
  1555         
       
  1556         // Check results
       
  1557         EUNIT_ASSERT_DESC( subscription->ContextSource() == copySubscription->ContextSource(),
       
  1558             "Invalid context source on subscription!" );
       
  1559         EUNIT_ASSERT_DESC( subscription->ContextType() == copySubscription->ContextType(),
       
  1560             "Invalid context type on subscription!" );
       
  1561         EUNIT_ASSERT_DESC( subscription->SubTypeMatch() == copySubscription->SubTypeMatch(),
       
  1562             "Invalid sub type match on subscription!" );
       
  1563         EUNIT_ASSERT_DESC( subscription->OnlyChangesIndicated() == copySubscription->OnlyChangesIndicated(),
       
  1564             "Invalid only changes indicated flag on subscription!" );
       
  1565         EUNIT_ASSERT_DESC( subscription->DataObjectEnabled() == copySubscription->DataObjectEnabled(),
       
  1566             "Invalid only changes indicated flag on subscription!" );
       
  1567         
       
  1568         // Clean up
       
  1569         CleanupStack::PopAndDestroy( copySubscription );
       
  1570         CleanupStack::PopAndDestroy( &readStream );
       
  1571         CleanupStack::PopAndDestroy( buffer );
       
  1572         CleanupStack::PopAndDestroy( subscription );
       
  1573         }
       
  1574     }
       
  1575 
       
  1576 void MT_CFServices::MT_CCFContextSubscriptionImpl_SetSubscriptionListenerL(  )
       
  1577     {
       
  1578     CCFContextSubscriptionImpl* subscription = CCFContextSubscriptionImpl::NewLC();
       
  1579     
       
  1580     EUNIT_ASSERT_DESC( !( &subscription->SubscriptionListener() ),
       
  1581         "Invalid subscription listener!" );
       
  1582         
       
  1583     subscription->SetSubscriptionListener( *this );
       
  1584     MCFContextSubscriptionListener* listener = this;
       
  1585     EUNIT_ASSERT_DESC( &subscription->SubscriptionListener() == listener,
       
  1586         "Invalid subscription listener!" );
       
  1587     
       
  1588     // Clean up
       
  1589     CleanupStack::PopAndDestroy( subscription );
       
  1590     }
       
  1591 
       
  1592 void MT_CFServices::MT_CCFContextSubscriptionImpl_EvaluateContextChangeLL(  )
       
  1593     {
       
  1594     TTime time;
       
  1595     time.HomeTime();
       
  1596     CCFContextObjectImpl* newContext = ConfigureContextObjectLC(
       
  1597         KContextSource,
       
  1598         KContextType,
       
  1599         KContextValue,
       
  1600         100,
       
  1601         time );
       
  1602     CCFContextSubscriptionImpl* subscription = ConfigureContextSubscriptionLC(
       
  1603         KContextSource,
       
  1604         KContextType,
       
  1605         EFalse,
       
  1606         EFalse );
       
  1607     subscription->SetSubscriptionListener( *this );
       
  1608        
       
  1609     delete iIndicatedContext;
       
  1610     iIndicatedContext = NULL;
       
  1611     subscription->EvaluateContextChangeL( *newContext, *newContext, EFalse );
       
  1612     EUNIT_ASSERT_DESC( iIndicatedContext, "Context change not indicated!" );
       
  1613     EUNIT_ASSERT_DESC( iIndicatedContext->Source() == newContext->Source(),
       
  1614         "Context source incorrect!" );
       
  1615     EUNIT_ASSERT_DESC( iIndicatedContext->Type() == newContext->Type(),
       
  1616         "Context type incorrect!" );
       
  1617     EUNIT_ASSERT_DESC( iIndicatedContext->Value() == newContext->Value(),
       
  1618         "Context value incorrect!" );
       
  1619         
       
  1620     subscription->SetOnlyChangesIndicated( ETrue );
       
  1621     delete iIndicatedContext;
       
  1622     iIndicatedContext = NULL;
       
  1623     subscription->EvaluateContextChangeL( *newContext, *newContext, EFalse );
       
  1624     EUNIT_ASSERT_DESC( !iIndicatedContext, "Context change not indicated!" );
       
  1625     subscription->EvaluateContextChangeL( *newContext, *newContext, ETrue );
       
  1626     EUNIT_ASSERT_DESC( iIndicatedContext, "Context change not indicated!" );
       
  1627     
       
  1628     subscription->SetSubTypeMatch( ETrue );
       
  1629     delete iIndicatedContext;
       
  1630     iIndicatedContext = NULL;
       
  1631     subscription->EvaluateContextChangeL( *newContext, *newContext, ETrue );
       
  1632     EUNIT_ASSERT_DESC( iIndicatedContext, "Context change not indicated!" );
       
  1633     delete iIndicatedContext;
       
  1634     iIndicatedContext = NULL;
       
  1635     newContext->SetTypeL( KContextTypeLong );
       
  1636     subscription->EvaluateContextChangeL( *newContext, *newContext, ETrue );
       
  1637     EUNIT_ASSERT_DESC( iIndicatedContext, "Context change not indicated!" );
       
  1638     delete iIndicatedContext;
       
  1639     iIndicatedContext = NULL;
       
  1640     
       
  1641     // Clean up
       
  1642     CleanupStack::PopAndDestroy( subscription );
       
  1643     CleanupStack::PopAndDestroy( newContext );
       
  1644     }
       
  1645 
       
  1646 void MT_CFServices::MT_CCFContextSubscriptionImpl_IsSameL(  )
       
  1647     {
       
  1648     CCFContextSubscriptionImpl* subscription1 = ConfigureContextSubscriptionLC(
       
  1649         KContextSource,
       
  1650         KContextType,
       
  1651         EFalse,
       
  1652         EFalse );
       
  1653     CCFContextSubscriptionImpl* subscription2 = ConfigureContextSubscriptionLC(
       
  1654         KContextSource,
       
  1655         KContextType,
       
  1656         EFalse,
       
  1657         EFalse );
       
  1658     CCFContextSubscriptionImpl* subscription3 = ConfigureContextSubscriptionLC(
       
  1659         KContextSource,
       
  1660         KContextTypeLong,
       
  1661         EFalse,
       
  1662         EFalse );
       
  1663         
       
  1664     EUNIT_ASSERT_DESC( subscription1->IsSame( *subscription2 ),
       
  1665         "Invalid subscription match!" );
       
  1666     EUNIT_ASSERT_DESC( !subscription1->IsSame( *subscription3 ),
       
  1667         "Invalid subscription match!" );
       
  1668         
       
  1669     // Clean up
       
  1670     CleanupStack::PopAndDestroy( subscription3 );
       
  1671     CleanupStack::PopAndDestroy( subscription2 );
       
  1672     CleanupStack::PopAndDestroy( subscription1 );
       
  1673     }
       
  1674 
       
  1675 void MT_CFServices::MT_CCFContextSubscriptionImpl_MatchesL(  )
       
  1676     {
       
  1677     CCFContextSubscriptionImpl* subscription = ConfigureContextSubscriptionLC(
       
  1678         KContextSource,
       
  1679         KContextType,
       
  1680         EFalse,
       
  1681         EFalse );
       
  1682         
       
  1683     EUNIT_ASSERT_DESC( subscription->Matches( KContextType ),
       
  1684         "Invalid subscription match!" );
       
  1685     EUNIT_ASSERT_DESC( !subscription->Matches( KContextTypeLong ),
       
  1686         "Invalid subscription match!" );
       
  1687     EUNIT_ASSERT_DESC( !subscription->Matches( KNullDesC ),
       
  1688         "Invalid subscription match!" );
       
  1689     EUNIT_ASSERT_DESC( subscription->Matches( KContextType, KContextSource ),
       
  1690         "Invalid subscription match!" );
       
  1691     EUNIT_ASSERT_DESC( !subscription->Matches( KContextType, KContextSourceLong ),
       
  1692         "Invalid subscription match!" );
       
  1693     EUNIT_ASSERT_DESC( !subscription->Matches( KContextType, KNullDesC ),
       
  1694         "Invalid subscription match!" );
       
  1695 
       
  1696     // Clean up
       
  1697     CleanupStack::PopAndDestroy( subscription );
       
  1698     }
       
  1699 
       
  1700 //-----------------------------------------------------------------------------
       
  1701 // CCFKeyValuePair class unit test cases
       
  1702 //-----------------------------------------------------------------------------
       
  1703 //
       
  1704 void MT_CFServices::MT_CCFKeyValuePair_NewLL(  )
       
  1705     {
       
  1706     CCFKeyValuePair* instance = CCFKeyValuePair::NewL( KKey, KValue );
       
  1707     CleanupStack::PushL( instance );
       
  1708     
       
  1709     EUNIT_ASSERT_DESC( instance, "CCFKeyValuePair class instance not created!" );
       
  1710     
       
  1711     CleanupStack::PopAndDestroy( instance );
       
  1712     }
       
  1713 
       
  1714 void MT_CFServices::MT_CCFKeyValuePair_NewLCL(  )
       
  1715     {
       
  1716     CCFKeyValuePair* instance = CCFKeyValuePair::NewLC( KKey, KValue );
       
  1717     
       
  1718     EUNIT_ASSERT_DESC( instance, "CCFKeyValuePair class instance not created!" );
       
  1719     
       
  1720     CleanupStack::PopAndDestroy( instance );
       
  1721     }
       
  1722 
       
  1723 void MT_CFServices::MT_CCFKeyValuePair_NewL_1L(  )
       
  1724     {
       
  1725     HBufC* key = KKey().AllocLC();
       
  1726     HBufC* value = KValue().AllocLC();
       
  1727     CCFKeyValuePair* instance = CCFKeyValuePair::NewL( key, value );
       
  1728     CleanupStack::PushL( instance );
       
  1729     
       
  1730     EUNIT_ASSERT_DESC( instance, "CCFKeyValuePair class instance not created!" );
       
  1731     
       
  1732     CleanupStack::PopAndDestroy( instance );
       
  1733     CleanupStack::Pop( value );
       
  1734     CleanupStack::Pop( key );
       
  1735     }
       
  1736 
       
  1737 void MT_CFServices::MT_CCFKeyValuePair_NewLC_1L(  )
       
  1738     {
       
  1739     HBufC* key = KKey().AllocLC();
       
  1740     HBufC* value = KValue().AllocLC();
       
  1741     CCFKeyValuePair* instance = CCFKeyValuePair::NewLC( key, value );
       
  1742     
       
  1743     EUNIT_ASSERT_DESC( instance, "CCFKeyValuePair class instance not created!" );
       
  1744     
       
  1745     CleanupStack::PopAndDestroy( instance );
       
  1746     CleanupStack::Pop( value );
       
  1747     CleanupStack::Pop( key );
       
  1748     }
       
  1749 
       
  1750 void MT_CFServices::MT_CCFKeyValuePair_KeyL(  )
       
  1751     {
       
  1752     CCFKeyValuePair* instance = CCFKeyValuePair::NewLC( KKey, KValue );
       
  1753     
       
  1754     EUNIT_ASSERT_DESC( instance->Key() == KKey, "Invalid key!" );
       
  1755     
       
  1756     // Clean up
       
  1757     CleanupStack::PopAndDestroy( instance );
       
  1758     }
       
  1759 
       
  1760 void MT_CFServices::MT_CCFKeyValuePair_ValueL(  )
       
  1761     {
       
  1762     CCFKeyValuePair* instance = CCFKeyValuePair::NewLC( KKey, KValue );
       
  1763     
       
  1764     EUNIT_ASSERT_DESC( instance->Value() == KValue, "Invalid value!" );
       
  1765     
       
  1766     // Clean up
       
  1767     CleanupStack::PopAndDestroy( instance );
       
  1768     }
       
  1769 
       
  1770 //-----------------------------------------------------------------------------
       
  1771 // CFServiceMTils class unit test cases
       
  1772 //-----------------------------------------------------------------------------
       
  1773 //
       
  1774 void MT_CFServices::MT_CFServiceMTils_UpdateBufferLL(  )
       
  1775     {
       
  1776     HBufC* buffer = KNullDesC().AllocL();
       
  1777     
       
  1778     CFServiceUtils::UpdateBufferL( buffer, KContextSource );
       
  1779     EUNIT_ASSERT_DESC( buffer, "Buffer not created!" );
       
  1780     EUNIT_ASSERT_DESC( *buffer == KContextSource, "Incorrect buffer value!" );
       
  1781 
       
  1782     CFServiceUtils::UpdateBufferL( buffer, KContextSourceLong );
       
  1783     EUNIT_ASSERT_DESC( buffer, "Buffer not created!" );
       
  1784     EUNIT_ASSERT_DESC( *buffer == KContextSourceLong, "Incorrect buffer value!" );
       
  1785 
       
  1786     CFServiceUtils::UpdateBufferL( buffer, KContextSource );
       
  1787     EUNIT_ASSERT_DESC( buffer, "Buffer not created!" );
       
  1788     EUNIT_ASSERT_DESC( *buffer == KContextSource, "Incorrect buffer value!" );
       
  1789     
       
  1790     // Clean up
       
  1791     delete buffer;
       
  1792     }
       
  1793 
       
  1794 void MT_CFServices::MT_CFServiceMTils_WriteIntoStreamLL(  )
       
  1795     {
       
  1796     static const TInt KCount = 2;
       
  1797     HBufC8* buffer = NULL;
       
  1798     HBufC* desc = NULL;
       
  1799     for( TInt i = 0; i < KCount; i++ )
       
  1800         {
       
  1801         switch( i )
       
  1802             {
       
  1803             case 0:
       
  1804                 {
       
  1805                 buffer = HBufC8::NewLC( KContextSource().Size() );
       
  1806                 desc = KContextSource().AllocLC();
       
  1807                 break;
       
  1808                 }
       
  1809             case 1:
       
  1810             default:
       
  1811                 {
       
  1812                 buffer = HBufC8::NewLC( KContextSource().Size() );
       
  1813                 break;
       
  1814                 }
       
  1815             }
       
  1816         // Write stream
       
  1817         TPtr8 bufferPtr = buffer->Des();
       
  1818         RDesWriteStream writeStream( bufferPtr );
       
  1819         writeStream.PushL();
       
  1820         CFServiceUtils::WriteIntoStreamL( desc, writeStream );
       
  1821         writeStream.CommitL();
       
  1822         CleanupStack::PopAndDestroy( &writeStream );
       
  1823         if( desc )
       
  1824             {
       
  1825             CleanupStack::PopAndDestroy( desc );
       
  1826             desc = NULL;
       
  1827             }
       
  1828         
       
  1829         // Read stream
       
  1830         RDesReadStream readStream( bufferPtr );
       
  1831         readStream.PushL();
       
  1832         CFServiceUtils::ReadFromStreamL( desc, readStream );
       
  1833         CleanupStack::PopAndDestroy( &readStream );
       
  1834         if( desc )
       
  1835             {
       
  1836             CleanupStack::PushL( desc );
       
  1837             }
       
  1838         
       
  1839         // Check results
       
  1840         switch( i )
       
  1841             {
       
  1842             case 0:
       
  1843                 {
       
  1844                 EUNIT_ASSERT_DESC( desc, "Buffer not created!" );
       
  1845                 EUNIT_ASSERT_DESC( *desc == KContextSource, "Invalid buffer value!" );
       
  1846                 break;
       
  1847                 }
       
  1848             case 1:
       
  1849             default:
       
  1850                 {
       
  1851                 EUNIT_ASSERT_DESC( !desc, "Buffer created!" );
       
  1852                 break;
       
  1853                 }
       
  1854             }
       
  1855         
       
  1856         // Clean up
       
  1857         if( desc )
       
  1858             {
       
  1859             CleanupStack::PopAndDestroy( desc );
       
  1860             desc = NULL;
       
  1861             }
       
  1862         CleanupStack::PopAndDestroy( buffer );
       
  1863         buffer = NULL;
       
  1864         }
       
  1865     }
       
  1866 
       
  1867 //-----------------------------------------------------------------------------
       
  1868 // CCFContextDataProxy class unit test cases
       
  1869 //-----------------------------------------------------------------------------
       
  1870 //
       
  1871 void MT_CFServices::MT_CCFContextDataProxy_NewLL(  )
       
  1872     {
       
  1873     CCFContextDataProxy* obj = CCFContextDataProxy::NewL();
       
  1874     CleanupStack::PushL( obj );
       
  1875     EUNIT_ASSERT_DESC( obj, "CCFContextDataProxy instance not created!" );
       
  1876     CleanupStack::PopAndDestroy( obj );
       
  1877     }
       
  1878 
       
  1879 void MT_CFServices::MT_CCFContextDataProxy_NewLCL(  )
       
  1880     {
       
  1881     CCFContextDataProxy* obj = CCFContextDataProxy::NewLC();
       
  1882     EUNIT_ASSERT_DESC( obj, "CCFContextDataProxy instance not created!" );
       
  1883     CleanupStack::PopAndDestroy( obj );
       
  1884     }
       
  1885 
       
  1886 void MT_CFServices::MT_CCFContextDataProxy_SetContextDataUidL(  )
       
  1887     {
       
  1888     const TUid KUid1 = { 0x01234567 };
       
  1889     const TUid KUid2 = { 0x98765432 };
       
  1890     CCFContextDataProxy* obj = CCFContextDataProxy::NewLC();
       
  1891     CCFContextDataObject* objBase = static_cast<CCFContextDataObject*>( obj );
       
  1892        
       
  1893     obj->SetContextDataUid( KUid1 );
       
  1894     EUNIT_ASSERT_DESC( objBase->Uid() == KUid1, "Invalid context data object UID!" );
       
  1895 
       
  1896     obj->SetContextDataUid( KUid2 );
       
  1897     EUNIT_ASSERT_DESC( objBase->Uid() == KUid2, "Invalid context data object UID!" );
       
  1898 
       
  1899     // Clean up
       
  1900     CleanupStack::PopAndDestroy( obj );
       
  1901     }
       
  1902 
       
  1903 void MT_CFServices::MT_CCFContextDataProxy_SetContextDataL(  )
       
  1904     {
       
  1905     const TInt len1 = 128;
       
  1906     const TInt len2 = 512;
       
  1907     const TInt count = 2;
       
  1908     CCFContextDataProxy* obj = CCFContextDataProxy::NewLC();
       
  1909     CCFContextDataObject* objBase = static_cast<CCFContextDataObject*>( obj );
       
  1910 
       
  1911     TInt length = 0;
       
  1912     for( TInt i = 0; i < count; i++ )
       
  1913         {
       
  1914         switch( i )
       
  1915             {
       
  1916             case 0:
       
  1917                 {
       
  1918                 length = len1;
       
  1919                 break;
       
  1920                 }
       
  1921             case 1:
       
  1922                 {
       
  1923                 length = len2;
       
  1924                 break;
       
  1925                 }
       
  1926             default:
       
  1927                 {
       
  1928                 break;
       
  1929                 }
       
  1930             }
       
  1931             
       
  1932         HBufC8* data = HBufC8::NewLC( length );
       
  1933         TPtr8 dataPtr( data->Des() );
       
  1934         dataPtr.Fill( 'z', length );
       
  1935         obj->SetContextData( data );
       
  1936         EUNIT_ASSERT_DESC( objBase->Size() == data->Size(),
       
  1937             "Invalid context object data!" );
       
  1938         CleanupStack::Pop( data );
       
  1939         }
       
  1940 
       
  1941     // Clean up
       
  1942     CleanupStack::PopAndDestroy( obj );
       
  1943     }
       
  1944 
       
  1945 void MT_CFServices::MT_CCFContextDataProxy_ExternalizeLL(  )
       
  1946     {
       
  1947     _LIT8( KData, "Some_Data" );
       
  1948     CCFContextDataProxy* obj = CCFContextDataProxy::NewLC();
       
  1949     CCFContextDataObject* objBase = static_cast<CCFContextDataObject*>( obj );
       
  1950     
       
  1951     // First set data in data object
       
  1952     HBufC8* data = KData().AllocLC();
       
  1953     obj->SetContextData( data );
       
  1954     CleanupStack::Pop( data );
       
  1955     data = NULL;
       
  1956     
       
  1957     // Externalize object
       
  1958     data = HBufC8::NewLC( objBase->Size() );
       
  1959     TPtr8 dataPtr( data->Des() );
       
  1960     RDesWriteStream writeStream( dataPtr );
       
  1961     writeStream.PushL();
       
  1962     objBase->ExternalizeL( writeStream );
       
  1963     CleanupStack::PopAndDestroy( &writeStream );
       
  1964     
       
  1965     // Internalize object
       
  1966     CCFContextDataProxy* newObj = CCFContextDataProxy::NewLC();
       
  1967     CCFContextDataObject* newObjBase = static_cast<CCFContextDataObject*>( obj );
       
  1968     RDesReadStream readStream( dataPtr );
       
  1969     readStream.PushL();
       
  1970     newObjBase->InternalizeL( readStream );
       
  1971     CleanupStack::PopAndDestroy( &readStream );
       
  1972     
       
  1973     // Check
       
  1974     EUNIT_ASSERT_DESC( newObjBase->Size() == objBase->Size(),
       
  1975         "Invalid object size!" );
       
  1976 
       
  1977     // Clean up
       
  1978     CleanupStack::PopAndDestroy( newObj );
       
  1979     CleanupStack::PopAndDestroy( data );
       
  1980     CleanupStack::PopAndDestroy( obj );
       
  1981     }
       
  1982 
       
  1983 //  TEST TABLE
       
  1984 
       
  1985 EUNIT_BEGIN_TEST_TABLE(
       
  1986     MT_CFServices,
       
  1987     "CFServices unit test.",
       
  1988     "UNIT" )
       
  1989 
       
  1990 // CCFActionIndication class test cases
       
  1991 //
       
  1992 EUNIT_TEST(
       
  1993     "NewL - test ",
       
  1994     "CCFActionIndication",
       
  1995     "NewL",
       
  1996     "FUNCTIONALITY",
       
  1997     SetupL, MT_CCFActionIndication_NewLL, Teardown)
       
  1998 
       
  1999 EUNIT_TEST(
       
  2000     "NewLC - test ",
       
  2001     "CCFActionIndication",
       
  2002     "NewLC",
       
  2003     "FUNCTIONALITY",
       
  2004     SetupL, MT_CCFActionIndication_NewLCL, Teardown)
       
  2005 
       
  2006 // CCFActionIndicationImpl class test cases
       
  2007 //
       
  2008 EUNIT_TEST(
       
  2009     "NewL - test ",
       
  2010     "CCFActionIndicationImpl",
       
  2011     "NewL",
       
  2012     "FUNCTIONALITY",
       
  2013     SetupL, MT_CCFActionIndicationImpl_NewLL, Teardown)
       
  2014 
       
  2015 EUNIT_TEST(
       
  2016     "NewLC - test ",
       
  2017     "CCFActionIndicationImpl",
       
  2018     "NewLC",
       
  2019     "FUNCTIONALITY",
       
  2020     SetupL, MT_CCFActionIndicationImpl_NewLCL, Teardown)
       
  2021 
       
  2022 EUNIT_TEST(
       
  2023     "SetIdentifierL - test ",
       
  2024     "CCFActionIndicationImpl",
       
  2025     "SetIdentifierL",
       
  2026     "FUNCTIONALITY",
       
  2027     SetupActionIndicationL, MT_CCFActionIndicationImpl_SetIdentifierLL, Teardown)
       
  2028 
       
  2029 EUNIT_TEST(
       
  2030     "AddParameterL - test ",
       
  2031     "CCFActionIndicationImpl",
       
  2032     "AddParameterL",
       
  2033     "FUNCTIONALITY",
       
  2034     SetupActionIndicationL, MT_CCFActionIndicationImpl_AddParameterLL, Teardown)
       
  2035 
       
  2036 EUNIT_TEST(
       
  2037     "ExternalizeL - test ",
       
  2038     "CCFActionIndicationImpl",
       
  2039     "ExternalizeL",
       
  2040     "FUNCTIONALITY",
       
  2041     SetupActionIndicationL, MT_CCFActionIndicationImpl_ExternalizeLL, Teardown)
       
  2042 
       
  2043 // CCFActionSubscription class test cases
       
  2044 //
       
  2045 EUNIT_TEST(
       
  2046     "NewL - test ",
       
  2047     "CCFActionSubscription",
       
  2048     "NewL",
       
  2049     "FUNCTIONALITY",
       
  2050     SetupL, MT_CCFActionSubscription_NewLL, Teardown)
       
  2051 
       
  2052 EUNIT_TEST(
       
  2053     "NewLC - test ",
       
  2054     "CCFActionSubscription",
       
  2055     "NewLC",
       
  2056     "FUNCTIONALITY",
       
  2057     SetupL, MT_CCFActionSubscription_NewLCL, Teardown)
       
  2058 
       
  2059 EUNIT_TEST(
       
  2060     "NewL - test ",
       
  2061     "CCFActionSubscriptionImpl",
       
  2062     "NewL",
       
  2063     "FUNCTIONALITY",
       
  2064     SetupL, MT_CCFActionSubscriptionImpl_NewLL, Teardown)
       
  2065 
       
  2066 EUNIT_TEST(
       
  2067     "NewLC - test ",
       
  2068     "CCFActionSubscriptionImpl",
       
  2069     "NewLC",
       
  2070     "FUNCTIONALITY",
       
  2071     SetupL, MT_CCFActionSubscriptionImpl_NewLCL, Teardown)
       
  2072 
       
  2073 EUNIT_TEST(
       
  2074     "SetActionIdentifierL - test ",
       
  2075     "CCFActionSubscriptionImpl",
       
  2076     "SetActionIdentifierL",
       
  2077     "FUNCTIONALITY",
       
  2078     SetupL, MT_CCFActionSubscriptionImpl_SetActionIdentifierLL, Teardown)
       
  2079 
       
  2080 EUNIT_TEST(
       
  2081     "ExternalizeL - test ",
       
  2082     "CCFActionSubscriptionImpl",
       
  2083     "ExternalizeL",
       
  2084     "FUNCTIONALITY",
       
  2085     SetupL, MT_CCFActionSubscriptionImpl_ExternalizeLL, Teardown)
       
  2086 
       
  2087 EUNIT_TEST(
       
  2088     "SetListener - test ",
       
  2089     "CCFActionSubscriptionImpl",
       
  2090     "SetListener",
       
  2091     "FUNCTIONALITY",
       
  2092     SetupL, MT_CCFActionSubscriptionImpl_SetListenerL, Teardown)
       
  2093 
       
  2094 // CCFContextIndication class test cases
       
  2095 //
       
  2096 EUNIT_TEST(
       
  2097     "NewL - test ",
       
  2098     "CCFContextIndication",
       
  2099     "NewL",
       
  2100     "FUNCTIONALITY",
       
  2101     SetupL, MT_CCFContextIndication_NewLL, Teardown)
       
  2102 
       
  2103 EUNIT_TEST(
       
  2104     "NewLC - test ",
       
  2105     "CCFContextIndication",
       
  2106     "NewLC",
       
  2107     "FUNCTIONALITY",
       
  2108     SetupL, MT_CCFContextIndication_NewLCL, Teardown)
       
  2109 
       
  2110 // CCFContextIndicationImpl class test cases
       
  2111 //
       
  2112 EUNIT_TEST(
       
  2113     "NewL - test ",
       
  2114     "CCFContextIndicationImpl",
       
  2115     "NewL",
       
  2116     "FUNCTIONALITY",
       
  2117     SetupL, MT_CCFContextIndicationImpl_NewLL, Teardown)
       
  2118 
       
  2119 EUNIT_TEST(
       
  2120     "NewLC - test ",
       
  2121     "CCFContextIndicationImpl",
       
  2122     "NewLC",
       
  2123     "FUNCTIONALITY",
       
  2124     SetupL, MT_CCFContextIndicationImpl_NewLCL, Teardown)
       
  2125 
       
  2126 EUNIT_TEST(
       
  2127     "SetContextL - test ",
       
  2128     "CCFContextIndicationImpl",
       
  2129     "SetContextL",
       
  2130     "FUNCTIONALITY",
       
  2131     SetupL, MT_CCFContextIndicationImpl_SetContextLL, Teardown)
       
  2132 
       
  2133 EUNIT_TEST(
       
  2134     "ExternalizeL - test ",
       
  2135     "CCFContextIndicationImpl",
       
  2136     "ExternalizeL",
       
  2137     "FUNCTIONALITY",
       
  2138     SetupL, MT_CCFContextIndicationImpl_ExternalizeLL, Teardown)
       
  2139 
       
  2140 // CCFContextObject class test cases
       
  2141 //
       
  2142 EUNIT_TEST(
       
  2143     "NewL - test ",
       
  2144     "CCFContextObject",
       
  2145     "NewL",
       
  2146     "FUNCTIONALITY",
       
  2147     SetupL, MT_CCFContextObject_NewLL, Teardown)
       
  2148 
       
  2149 EUNIT_TEST(
       
  2150     "NewLC - test ",
       
  2151     "CCFContextObject",
       
  2152     "NewLC",
       
  2153     "FUNCTIONALITY",
       
  2154     SetupL, MT_CCFContextObject_NewLCL, Teardown)
       
  2155 
       
  2156 // CCFContextObjectImpl class test cases
       
  2157 //
       
  2158 EUNIT_TEST(
       
  2159     "NewL - test ",
       
  2160     "CCFContextObjectImpl",
       
  2161     "NewL",
       
  2162     "FUNCTIONALITY",
       
  2163     SetupL, MT_CCFContextObjectImpl_NewLL, Teardown)
       
  2164 
       
  2165 EUNIT_TEST(
       
  2166     "NewLC - test ",
       
  2167     "CCFContextObjectImpl",
       
  2168     "NewLC",
       
  2169     "FUNCTIONALITY",
       
  2170     SetupL, MT_CCFContextObjectImpl_NewLCL, Teardown)
       
  2171 
       
  2172 EUNIT_TEST(
       
  2173     "SetTypeL - test ",
       
  2174     "CCFContextObjectImpl",
       
  2175     "SetTypeL",
       
  2176     "FUNCTIONALITY",
       
  2177     SetupL, MT_CCFContextObjectImpl_SetTypeLL, Teardown)
       
  2178 
       
  2179 EUNIT_TEST(
       
  2180     "SetValueL - test ",
       
  2181     "CCFContextObjectImpl",
       
  2182     "SetValueL",
       
  2183     "FUNCTIONALITY",
       
  2184     SetupL, MT_CCFContextObjectImpl_SetValueLL, Teardown)
       
  2185 
       
  2186 EUNIT_TEST(
       
  2187     "SetSourceL - test ",
       
  2188     "CCFContextObjectImpl",
       
  2189     "SetSourceL",
       
  2190     "FUNCTIONALITY",
       
  2191     SetupL, MT_CCFContextObjectImpl_SetSourceLL, Teardown)
       
  2192 
       
  2193 EUNIT_TEST(
       
  2194     "SetConfidence - test ",
       
  2195     "CCFContextObjectImpl",
       
  2196     "SetConfidence",
       
  2197     "FUNCTIONALITY",
       
  2198     SetupL, MT_CCFContextObjectImpl_SetConfidenceL, Teardown)
       
  2199 
       
  2200 EUNIT_TEST(
       
  2201     "SetTimestampToHomeTime - test ",
       
  2202     "CCFContextObjectImpl",
       
  2203     "SetTimestampToHomeTime",
       
  2204     "FUNCTIONALITY",
       
  2205     SetupL, MT_CCFContextObjectImpl_SetTimestampToHomeTimeL, Teardown)
       
  2206 
       
  2207 EUNIT_TEST(
       
  2208     "SetTimestamp - test ",
       
  2209     "CCFContextObjectImpl",
       
  2210     "SetTimestamp",
       
  2211     "FUNCTIONALITY",
       
  2212     SetupL, MT_CCFContextObjectImpl_SetTimestampL, Teardown)
       
  2213 
       
  2214 EUNIT_TEST(
       
  2215     "CopyL - test ",
       
  2216     "CCFContextObjectImpl",
       
  2217     "CopyL",
       
  2218     "FUNCTIONALITY",
       
  2219     SetupL, MT_CCFContextObjectImpl_CopyLL, Teardown)
       
  2220 
       
  2221 EUNIT_TEST(
       
  2222     "ExternalizeL - test ",
       
  2223     "CCFContextObjectImpl",
       
  2224     "ExternalizeL",
       
  2225     "FUNCTIONALITY",
       
  2226     SetupL, MT_CCFContextObjectImpl_ExternalizeLL, Teardown)
       
  2227 
       
  2228 EUNIT_TEST(
       
  2229     "CompareValue - test ",
       
  2230     "CCFContextObjectImpl",
       
  2231     "CompareValue",
       
  2232     "FUNCTIONALITY",
       
  2233     SetupL, MT_CCFContextObjectImpl_CompareValueL, Teardown)
       
  2234 
       
  2235 EUNIT_TEST(
       
  2236     "CompareByType - test ",
       
  2237     "CCFContextObjectImpl",
       
  2238     "CompareByType",
       
  2239     "FUNCTIONALITY",
       
  2240     SetupL, MT_CCFContextObjectImpl_CompareByTypeL, Teardown)
       
  2241 
       
  2242 EUNIT_TEST(
       
  2243     "CompareByTypeAndSource - test ",
       
  2244     "CCFContextObjectImpl",
       
  2245     "CompareByTypeAndSource",
       
  2246     "FUNCTIONALITY",
       
  2247     SetupL, MT_CCFContextObjectImpl_CompareByTypeAndSourceL, Teardown)
       
  2248 
       
  2249 EUNIT_TEST(
       
  2250     "CompareByTimeDescending - test ",
       
  2251     "CCFContextObjectImpl",
       
  2252     "CompareByTimeDescending",
       
  2253     "FUNCTIONALITY",
       
  2254     SetupL, MT_CCFContextObjectImpl_CompareByTimeDescendingL, Teardown)
       
  2255 
       
  2256 EUNIT_TEST(
       
  2257     "IsSame - test ",
       
  2258     "CCFContextObjectImpl",
       
  2259     "IsSame",
       
  2260     "FUNCTIONALITY",
       
  2261     SetupL, MT_CCFContextObjectImpl_IsSameL, Teardown)
       
  2262 
       
  2263 // CCFContextQuery class test cases
       
  2264 //
       
  2265 EUNIT_TEST(
       
  2266     "NewL - test ",
       
  2267     "CCFContextQuery",
       
  2268     "NewL",
       
  2269     "FUNCTIONALITY",
       
  2270     SetupL, MT_CCFContextQuery_NewLL, Teardown)
       
  2271 
       
  2272 EUNIT_TEST(
       
  2273     "NewLC - test ",
       
  2274     "CCFContextQuery",
       
  2275     "NewLC",
       
  2276     "FUNCTIONALITY",
       
  2277     SetupL, MT_CCFContextQuery_NewLCL, Teardown)
       
  2278 
       
  2279 // CCFContextQueryImpl class test cases
       
  2280 //
       
  2281 EUNIT_TEST(
       
  2282     "NewL - test ",
       
  2283     "CCFContextQueryImpl",
       
  2284     "NewL",
       
  2285     "FUNCTIONALITY",
       
  2286     SetupL, MT_CCFContextQueryImpl_NewLL, Teardown)
       
  2287 
       
  2288 EUNIT_TEST(
       
  2289     "NewLC - test ",
       
  2290     "CCFContextQueryImpl",
       
  2291     "NewLC",
       
  2292     "FUNCTIONALITY",
       
  2293     SetupL, MT_CCFContextQueryImpl_NewLCL, Teardown)
       
  2294 
       
  2295 EUNIT_TEST(
       
  2296     "SetTypeL - test ",
       
  2297     "CCFContextQueryImpl",
       
  2298     "SetTypeL",
       
  2299     "FUNCTIONALITY",
       
  2300     SetupL, MT_CCFContextQueryImpl_SetTypeLL, Teardown)
       
  2301 
       
  2302 EUNIT_TEST(
       
  2303     "SetSourceL - test ",
       
  2304     "CCFContextQueryImpl",
       
  2305     "SetSourceL",
       
  2306     "FUNCTIONALITY",
       
  2307     SetupL, MT_CCFContextQueryImpl_SetSourceLL, Teardown)
       
  2308 
       
  2309 EUNIT_TEST(
       
  2310     "SetSubTypeMatch - test ",
       
  2311     "CCFContextQueryImpl",
       
  2312     "SetSubTypeMatch",
       
  2313     "FUNCTIONALITY",
       
  2314     SetupL, MT_CCFContextQueryImpl_SetSubTypeMatchL, Teardown)
       
  2315 
       
  2316 EUNIT_TEST(
       
  2317     "ExternalizeL - test ",
       
  2318     "CCFContextQueryImpl",
       
  2319     "ExternalizeL",
       
  2320     "FUNCTIONALITY",
       
  2321     SetupL, MT_CCFContextQueryImpl_ExternalizeLL, Teardown)
       
  2322 
       
  2323 EUNIT_TEST(
       
  2324     "Matches - test ",
       
  2325     "CCFContextQueryImpl",
       
  2326     "Matches",
       
  2327     "FUNCTIONALITY",
       
  2328     SetupL, MT_CCFContextQueryImpl_MatchesL, Teardown)
       
  2329 
       
  2330 EUNIT_TEST(
       
  2331     "MatchesQuery - test ",
       
  2332     "CCFContextQueryImpl",
       
  2333     "MatchesQuery",
       
  2334     "FUNCTIONALITY",
       
  2335     SetupL, MT_CCFContextQueryImpl_MatchesQueryL, Teardown)
       
  2336 
       
  2337 EUNIT_TEST(
       
  2338     "IsSame - test ",
       
  2339     "CCFContextQueryImpl",
       
  2340     "IsSame",
       
  2341     "FUNCTIONALITY",
       
  2342     SetupL, MT_CCFContextQueryImpl_IsSameL, Teardown)
       
  2343 
       
  2344 // CCFContextSubscription class test cases
       
  2345 //
       
  2346 EUNIT_TEST(
       
  2347     "NewL - test ",
       
  2348     "CCFContextSubscription",
       
  2349     "NewL",
       
  2350     "FUNCTIONALITY",
       
  2351     SetupL, MT_CCFContextSubscription_NewLL, Teardown)
       
  2352 
       
  2353 EUNIT_TEST(
       
  2354     "NewLC - test ",
       
  2355     "CCFContextSubscription",
       
  2356     "NewLC",
       
  2357     "FUNCTIONALITY",
       
  2358     SetupL, MT_CCFContextSubscription_NewLCL, Teardown)
       
  2359 
       
  2360 // CCFContextSubscriptionImpl class test cases
       
  2361 //
       
  2362 EUNIT_TEST(
       
  2363     "NewL - test ",
       
  2364     "CCFContextSubscriptionImpl",
       
  2365     "NewL",
       
  2366     "FUNCTIONALITY",
       
  2367     SetupL, MT_CCFContextSubscriptionImpl_NewLL, Teardown)
       
  2368 
       
  2369 EUNIT_TEST(
       
  2370     "NewLC - test ",
       
  2371     "CCFContextSubscriptionImpl",
       
  2372     "NewLC",
       
  2373     "FUNCTIONALITY",
       
  2374     SetupL, MT_CCFContextSubscriptionImpl_NewLCL, Teardown)
       
  2375 
       
  2376 EUNIT_TEST(
       
  2377     "SetContextTypeL - test ",
       
  2378     "CCFContextSubscriptionImpl",
       
  2379     "SetContextTypeL",
       
  2380     "FUNCTIONALITY",
       
  2381     SetupL, MT_CCFContextSubscriptionImpl_SetContextTypeLL, Teardown)
       
  2382 
       
  2383 EUNIT_TEST(
       
  2384     "SetContextSourceL - test ",
       
  2385     "CCFContextSubscriptionImpl",
       
  2386     "SetContextSourceL",
       
  2387     "FUNCTIONALITY",
       
  2388     SetupL, MT_CCFContextSubscriptionImpl_SetContextSourceLL, Teardown)
       
  2389 
       
  2390 EUNIT_TEST(
       
  2391     "SetSubTypeMatch - test ",
       
  2392     "CCFContextSubscriptionImpl",
       
  2393     "SetSubTypeMatch",
       
  2394     "FUNCTIONALITY",
       
  2395     SetupL, MT_CCFContextSubscriptionImpl_SetSubTypeMatchL, Teardown)
       
  2396 
       
  2397 EUNIT_TEST(
       
  2398     "SetOnlyChangesIndicated - test ",
       
  2399     "CCFContextSubscriptionImpl",
       
  2400     "SetOnlyChangesIndicated",
       
  2401     "FUNCTIONALITY",
       
  2402     SetupL, MT_CCFContextSubscriptionImpl_SetOnlyChangesIndicatedL, Teardown)
       
  2403 
       
  2404 EUNIT_TEST(
       
  2405     "SetDataObjectEnabled - test ",
       
  2406     "CCFContextSubscriptionImpl",
       
  2407     "SetDataObjectEnabled",
       
  2408     "FUNCTIONALITY",
       
  2409     SetupL, MT_CCFContextSubscriptionImpl_SetDataObjectEnabledL, Teardown)
       
  2410 
       
  2411 EUNIT_TEST(
       
  2412     "ExternalizeL - test ",
       
  2413     "CCFContextSubscriptionImpl",
       
  2414     "ExternalizeL",
       
  2415     "FUNCTIONALITY",
       
  2416     SetupL, MT_CCFContextSubscriptionImpl_ExternalizeLL, Teardown)
       
  2417 
       
  2418 EUNIT_TEST(
       
  2419     "SetSubscriptionListener - test ",
       
  2420     "CCFContextSubscriptionImpl",
       
  2421     "SetSubscriptionListener",
       
  2422     "FUNCTIONALITY",
       
  2423     SetupL, MT_CCFContextSubscriptionImpl_SetSubscriptionListenerL, Teardown)
       
  2424 
       
  2425 EUNIT_TEST(
       
  2426     "EvaluateContextChangeL - test ",
       
  2427     "CCFContextSubscriptionImpl",
       
  2428     "EvaluateContextChangeL",
       
  2429     "FUNCTIONALITY",
       
  2430     SetupL, MT_CCFContextSubscriptionImpl_EvaluateContextChangeLL, Teardown)
       
  2431 
       
  2432 EUNIT_TEST(
       
  2433     "IsSame - test ",
       
  2434     "CCFContextSubscriptionImpl",
       
  2435     "IsSame",
       
  2436     "FUNCTIONALITY",
       
  2437     SetupL, MT_CCFContextSubscriptionImpl_IsSameL, Teardown)
       
  2438 
       
  2439 EUNIT_TEST(
       
  2440     "Matches - test ",
       
  2441     "CCFContextSubscriptionImpl",
       
  2442     "Matches",
       
  2443     "FUNCTIONALITY",
       
  2444     SetupL, MT_CCFContextSubscriptionImpl_MatchesL, Teardown)
       
  2445 
       
  2446 // CCFKeyValuePair class test cases
       
  2447 //
       
  2448 EUNIT_TEST(
       
  2449     "NewL - test ",
       
  2450     "CCFKeyValuePair",
       
  2451     "NewL",
       
  2452     "FUNCTIONALITY",
       
  2453     SetupL, MT_CCFKeyValuePair_NewLL, Teardown)
       
  2454 
       
  2455 EUNIT_TEST(
       
  2456     "NewLC - test ",
       
  2457     "CCFKeyValuePair",
       
  2458     "NewLC",
       
  2459     "FUNCTIONALITY",
       
  2460     SetupL, MT_CCFKeyValuePair_NewLCL, Teardown)
       
  2461 
       
  2462 EUNIT_TEST(
       
  2463     "NewL - test ",
       
  2464     "CCFKeyValuePair",
       
  2465     "NewL",
       
  2466     "FUNCTIONALITY",
       
  2467     SetupL, MT_CCFKeyValuePair_NewL_1L, Teardown)
       
  2468 
       
  2469 EUNIT_TEST(
       
  2470     "NewLC - test ",
       
  2471     "CCFKeyValuePair",
       
  2472     "NewLC",
       
  2473     "FUNCTIONALITY",
       
  2474     SetupL, MT_CCFKeyValuePair_NewLC_1L, Teardown)
       
  2475 
       
  2476 EUNIT_TEST(
       
  2477     "Key - test ",
       
  2478     "CCFKeyValuePair",
       
  2479     "Key",
       
  2480     "FUNCTIONALITY",
       
  2481     SetupL, MT_CCFKeyValuePair_KeyL, Teardown)
       
  2482 
       
  2483 EUNIT_TEST(
       
  2484     "Value - test ",
       
  2485     "CCFKeyValuePair",
       
  2486     "Value",
       
  2487     "FUNCTIONALITY",
       
  2488     SetupL, MT_CCFKeyValuePair_ValueL, Teardown)
       
  2489 
       
  2490 // CFServiceMTils class test cases
       
  2491 //
       
  2492 EUNIT_TEST(
       
  2493     "UpdateBufferL - test ",
       
  2494     "CFServiceMTils",
       
  2495     "UpdateBufferL",
       
  2496     "FUNCTIONALITY",
       
  2497     SetupL, MT_CFServiceMTils_UpdateBufferLL, Teardown)
       
  2498 
       
  2499 EUNIT_TEST(
       
  2500     "WriteIntoStreamL - test ",
       
  2501     "CFServiceMTils",
       
  2502     "WriteIntoStreamL",
       
  2503     "FUNCTIONALITY",
       
  2504     SetupL, MT_CFServiceMTils_WriteIntoStreamLL, Teardown)
       
  2505 
       
  2506 // CCFContextDataProxy class test cases
       
  2507 //
       
  2508 EUNIT_TEST(
       
  2509     "NewL - test ",
       
  2510     "CCFContextDataProxy",
       
  2511     "NewL",
       
  2512     "FUNCTIONALITY",
       
  2513     SetupL, MT_CCFContextDataProxy_NewLL, Teardown)
       
  2514 
       
  2515 EUNIT_TEST(
       
  2516     "NewLC - test ",
       
  2517     "CCFContextDataProxy",
       
  2518     "NewLC",
       
  2519     "FUNCTIONALITY",
       
  2520     SetupL, MT_CCFContextDataProxy_NewLCL, Teardown)
       
  2521 
       
  2522 EUNIT_TEST(
       
  2523     "SetContextDataUid - test ",
       
  2524     "CCFContextDataProxy",
       
  2525     "SetContextDataUid",
       
  2526     "FUNCTIONALITY",
       
  2527     SetupL, MT_CCFContextDataProxy_SetContextDataUidL, Teardown)
       
  2528 
       
  2529 EUNIT_TEST(
       
  2530     "SetContextData - test ",
       
  2531     "CCFContextDataProxy",
       
  2532     "SetContextData",
       
  2533     "FUNCTIONALITY",
       
  2534     SetupL, MT_CCFContextDataProxy_SetContextDataL, Teardown)
       
  2535 
       
  2536 EUNIT_TEST(
       
  2537     "ExternalizeL - test ",
       
  2538     "CCFContextDataProxy",
       
  2539     "ExternalizeL",
       
  2540     "FUNCTIONALITY",
       
  2541     SetupL, MT_CCFContextDataProxy_ExternalizeLL, Teardown)
       
  2542 
       
  2543 EUNIT_END_TEST_TABLE
       
  2544 
       
  2545 //  END OF FILE