ximpfw/tsrc/src/t_presencegrantrequestmngt/t_presencegrantrequestmngt.h
changeset 0 e6b17d312c8b
child 20 eedf17a17c27
equal deleted inserted replaced
-1:000000000000 0:e6b17d312c8b
       
     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: XIMP Framework Test Code 
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef T_PRESENCEGRANTREQUESTMANAGEMENT_H
       
    19 #define T_PRESENCEGRANTREQUESTMANAGEMENT_H
       
    20 
       
    21 #include <ceunittestsuiteclass.h>
       
    22 #include <ximpbase.h>
       
    23 #include "prfwteststatuseventlistener.h"
       
    24 #include "prfwtestmessaging.h"
       
    25 #include "ximpdatasubscriptionstateimp.h"
       
    26 #include "presencetypehelpers.h"
       
    27 
       
    28 class CXIMPTestContextWrapper;
       
    29 class CXIMPTestContextWrapperMgr;
       
    30 class CXIMPTestMessenger;
       
    31 class CPresenceGrantRequestInfoImp;
       
    32 class CPresenceGrantRequestListEventImp;
       
    33 
       
    34 /**
       
    35  * XIMP Framework Eunit tests.
       
    36  *
       
    37  * Tests for XIMP session management services.
       
    38  *
       
    39  * @since S60 v4.0
       
    40  */
       
    41 class T_PresenceGrantRequestManagement : public CEUnitTestSuiteClass
       
    42     {
       
    43 
       
    44 public:
       
    45     static T_PresenceGrantRequestManagement* NewL();
       
    46     virtual ~T_PresenceGrantRequestManagement();
       
    47 
       
    48 
       
    49 private:
       
    50     T_PresenceGrantRequestManagement();
       
    51     void ConstructL();
       
    52 
       
    53 private:    // Test case functions
       
    54 
       
    55     void Setup_L();
       
    56     void SetupMultiple_L();
       
    57     void BindL();
       
    58     void BindAllL();
       
    59     void Teardown();
       
    60     void UnbindL();
       
    61     void UnbindAllL();
       
    62     void SubscribeL();
       
    63     void UnsubscribeL();
       
    64 
       
    65     void T_SubscribeGrantRequestList_Single_L();
       
    66     void T_SubscribeGrantRequestListRefresh_Single_L();
       
    67     void T_SubscribeGrantRequestList_Multiple_L();
       
    68     void T_HandlePresenceGrantRequestList_L();
       
    69     void T_HandlePresenceGrantRequestReceivedObsoleted_L();
       
    70 
       
    71 private:    // Test helpers
       
    72 
       
    73     /**
       
    74      * Fake a server-originated (=mobile terminated) message.
       
    75      * The message appears to adaptation and framework as if
       
    76      * it came from the network. Uses only one group.
       
    77      * @param aUri The URI of group
       
    78      * @param aDispName The display name for the group
       
    79      * @param aMsgType The message type for CXIMPTestFileSrvMsg
       
    80      */
       
    81     void SendSrvMsgL(
       
    82             const TDesC& aUri, const TDesC& aDispName,
       
    83             TInt aMsgType );
       
    84 
       
    85     // version for sending just the info instead of array
       
    86     void SendSrvMsgInfoL(
       
    87             const TDesC& aUri, const TDesC& aDispName,
       
    88             TInt aMsgType );
       
    89     /**
       
    90      * Fake a server-originated message with empty content.
       
    91      * Whether to use this depends on the event you expect.
       
    92      * @see SendSrvMsgL
       
    93      */
       
    94     void SendSrvMsgL( TInt aMsgType );
       
    95 
       
    96     // @see below
       
    97     /*
       
    98     enum TTestPGRArraySpecifier //Waqas: Not used anymore, use the next one
       
    99         {
       
   100         ETestPGRNewList = 0,    // grant request list
       
   101         ETestPGRNewReq,         // new grant request
       
   102         ETestPGRPending,         // new grant request
       
   103         ETestPGRObsoleted,      // obsoleted grant request
       
   104         ETestPGREmpty,          // make an empty array for empty event
       
   105         };*/
       
   106         
       
   107     enum TTestPGROperation
       
   108         {
       
   109         ETestPGRNewReq = 0,     // new grant request i.e. new req comes
       
   110         ETestPGRPending,        // new grant request i.e. subscribe to
       
   111         ETestPGRObsoleted      // obsoleted grant request i.e. req expired                        
       
   112         };
       
   113 
       
   114     /**
       
   115      * Creates an event for newRequest, pending, or obselete presence grant
       
   116      * request list. The caller provides an identity and current presence grant
       
   117      * request listand depending on the provided operation an event is created. 
       
   118      *
       
   119      * In cleanupstack there are 4 items, FIFO:
       
   120      *   - new list
       
   121      *   - pending list
       
   122      *   - obsoleted list
       
   123      *   - event imp
       
   124      *
       
   125      * This is because this event won't take ownership to the arrays
       
   126      * when created this way.
       
   127      *
       
   128      * @param aUri Uri
       
   129      * @param aDispName Displayname
       
   130      * @param aOperation operation for which caller wants to generates event
       
   131      * @param aPendingList Current pending list provided by caller, method takes
       
   132      *         ownership of the pending list, and it is included in above 3 lists.
       
   133      *         a NULL pointer with operation ETestPGRPending causes empty event.
       
   134      * @return The suitably filled event.
       
   135      */
       
   136     CPresenceGrantRequestListEventImp* CreateGrantRequestListEventLCX(
       
   137             const TDesC& aUri,
       
   138             const TDesC& aDispName,
       
   139             MXIMPDataSubscriptionState::TSubscriptionState aSubscriptionState,
       
   140             MXIMPDataSubscriptionState::TDataState aDataState,
       
   141             TTestPGROperation aOperation,
       
   142             RPrGrntReqInfoImpArray* aPendingList = NULL
       
   143             );
       
   144 
       
   145 private: // Test data
       
   146 
       
   147     /**
       
   148      * Eunit test case table declaration.
       
   149      */
       
   150     EUNIT_DECLARE_TEST_TABLE;
       
   151 
       
   152     // owned
       
   153     CXIMPTestContextWrapperMgr* iWrapperMgr;
       
   154 
       
   155     //
       
   156     TInt iLastError;
       
   157     RXIMPObjOwningPtrArray< CPresenceGrantRequestInfoImp > iValidateArray;
       
   158     };
       
   159 
       
   160 
       
   161 #endif      //  T_PRESENCEGRANTREQUESTMANAGEMENT_H
       
   162 
       
   163 
       
   164 
       
   165 // end of file
       
   166 
       
   167 
       
   168