imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencecache/T_PresenceCache.h
changeset 51 61fad867f68e
equal deleted inserted replaced
-1:000000000000 51:61fad867f68e
       
     1 /*
       
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __T_MPRESENCECACHEREADER_H__
       
    20 #define __T_MPRESENCECACHEREADER_H__
       
    21 
       
    22 //  EXTERNAL INCLUDES
       
    23 #include <CEUnitTestSuiteClass.h>
       
    24 #include <EUnitDecorators.h>
       
    25 #include <presencecachereader.h>
       
    26 #include <presencecachewriter.h>
       
    27 #include <prescachereadhandler.h>
       
    28 #include <prescachewritehandler.h>
       
    29 
       
    30 #include <e32cmn.h>
       
    31 
       
    32 class MPresenceBuddyInfo;
       
    33 class MPresenceFeeder;
       
    34 
       
    35 
       
    36 //  INTERNAL INCLUDES
       
    37 
       
    38 
       
    39 //  FORWARD DECLARATIONS
       
    40 
       
    41 
       
    42 //  CLASS DEFINITION
       
    43 /**
       
    44  * TODO Auto-generated EUnit test suite
       
    45  *
       
    46  */
       
    47 NONSHARABLE_CLASS( T_PresenceCache )
       
    48 	: public CEUnitTestSuiteClass,
       
    49 	  public MPresCacheReadHandler,
       
    50 	  public MPresCacheWriteHandler
       
    51     {
       
    52     public:     // Constructors and destructors
       
    53 
       
    54         /**
       
    55          * Two phase construction
       
    56          */
       
    57         static T_PresenceCache* NewL();
       
    58         static T_PresenceCache* NewLC();
       
    59         /**
       
    60          * Destructor
       
    61          */
       
    62         ~T_PresenceCache();
       
    63         
       
    64     public:     // from handlers
       
    65         void HandlePresenceWriteL(TInt aErrorCode);    
       
    66         void HandlePresenceReadL(TInt aErrorCode,
       
    67             MPresenceBuddyInfoList* aPresenceBuddyInfoList);
       
    68         void HandlePresenceNotificationL(TInt aErrorCode,
       
    69                             MPresenceBuddyInfo* aPresenceBuddyInfo);            
       
    70             
       
    71     private:    // Constructors and destructors
       
    72 
       
    73         T_PresenceCache();
       
    74         void ConstructL();
       
    75 
       
    76     private:    // New methods
       
    77 
       
    78          void SetupL();
       
    79         
       
    80          void Teardown();
       
    81          
       
    82          void T__PresenceInfoL();
       
    83         
       
    84          void T_WriteReadPresenceAsyncL();
       
    85         
       
    86          void T_DeletingAndCancellingL();
       
    87          
       
    88          void T_PerformanceL();
       
    89          
       
    90          void T_RunAllL();
       
    91          
       
    92          void T_TestFeeder();
       
    93         
       
    94          void T_SubscribeBuddy1Response();
       
    95          
       
    96          void T_SubscribeBuddyAndUnsubscribe(); 
       
    97          
       
    98          void T_SubscribeBuddyManyResponses();
       
    99          
       
   100          void T_DeleteBeforeNotify();
       
   101          
       
   102        
       
   103     private:    // utilities
       
   104          MPresenceInfo* MakePresenceInfoLC();
       
   105          
       
   106          MPresenceBuddyInfo* MakeBuddyPresenceInfoLC(
       
   107                                          const TDesC& id, const TDesC& text);
       
   108                                          
       
   109          void T_DeleteAllCacheL();
       
   110          
       
   111          void T_MakePerformancePreconditionsL();
       
   112          
       
   113          MPresenceBuddyInfo* T_MakePerformanceBuddyLC(const TDesC& id);                  
       
   114          
       
   115          inline void WaitComplete();
       
   116         
       
   117 
       
   118     private:    // Data
       
   119 		
       
   120         MPresenceCacheReader* iMPresenceCacheReader;
       
   121         MPresenceCacheWriter* iMPresenceCacheWriter;
       
   122         
       
   123         MPresenceFeeder* iPresenceFeeder;
       
   124         
       
   125         
       
   126         MPresenceBuddyInfoList* iPresBuddyInfoList;
       
   127         
       
   128         EUNIT_DECLARE_TEST_TABLE;
       
   129         TUid iUid;
       
   130         
       
   131         TBool iCoverageTesting;
       
   132         
       
   133         // we will record the error from handler here
       
   134         TInt iErrorFromHandler;
       
   135 		
       
   136 		//OWN: Active scheduler wait and Cb received indication
       
   137         CActiveSchedulerWait iWait;
       
   138         TBool iCbReceived;
       
   139         
       
   140         // expected status of next notification
       
   141         TInt iExpectedNotifyStatus; 
       
   142         // How many notifications are waicted until test is done.
       
   143         TInt iNbrNotifys;
       
   144         // Expected content of notification
       
   145         // OWN
       
   146         MPresenceBuddyInfo* iExpectedNotifyContent;        
       
   147         
       
   148     };
       
   149     
       
   150 inline void T_PresenceCache::WaitComplete()
       
   151     {
       
   152     iCbReceived = EFalse;
       
   153     if( !iCbReceived )
       
   154         {
       
   155         iWait.Start();
       
   156         }
       
   157     }
       
   158     
       
   159 #endif      //  __T_MPRESENCECACHEREADER_H__
       
   160 
       
   161 // End of file