IM/inc/TestRunner.h
branchSymbian2
changeset 1 8758140453c0
child 6 c108117318cb
equal deleted inserted replaced
0:e8c1ea2c6496 1:8758140453c0
       
     1 /*
       
     2 * Copyright (c) 2002 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 the License "Symbian Foundation License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: The class handles the test case running.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef TESTRUNNER_H
       
    20 #define TESTRUNNER_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <f32file.h>
       
    24 #include <e32test.h>
       
    25 #include "IMApiMTHandlers.h"
       
    26 #include "StifTestModule.h"
       
    27 #include <StifLogger.h>
       
    28 #include <badesca.h>
       
    29 
       
    30 #include <cntdb.h>
       
    31 #include <cntfield.h>
       
    32 #include <cntfldst.h>
       
    33 #include <cntitem.h>
       
    34 #include <commdb.h>
       
    35 
       
    36 
       
    37 
       
    38 // FORWARD DECLARATIONS
       
    39 class CTestRunner;
       
    40 
       
    41 // FORWARD DECLARATIONS
       
    42 class CErrorHandler;
       
    43 class CAccessHandler;
       
    44 class CTestIdleTimer;
       
    45 class CTestTimer;
       
    46 class CPureHandler;
       
    47 
       
    48 // ENUMS
       
    49 
       
    50 enum TWhichCase
       
    51     {
       
    52     InvalidLogin = 1,
       
    53     Login,
       
    54     SendMessageValidUserId,
       
    55     SendMessageValidTwoUserId,
       
    56     SendMessageValidContact,
       
    57     SendMessageValidTwoContact,
       
    58     SendPToPContactContentType,
       
    59     SendPToPUserIDContentType,
       
    60     Logout,
       
    61     CancelLogin,
       
    62     Finish,
       
    63 	CreateImClient
       
    64     };
       
    65 
       
    66 
       
    67 // CONSTANTS
       
    68 const TInt KImpsMaxLen       = 100;
       
    69 const TInt KImpsMaxSapLen       = 100;
       
    70 const TInt KImpsMaxUserIdLen    =  50;
       
    71 const TInt KImpsMaxClientIdLen 	= 64;  // maximum Client ID, this is not sure!
       
    72 
       
    73 
       
    74 // CLASS DECLARATIONS
       
    75 
       
    76 
       
    77 class CTestRunner : public CActive
       
    78     {
       
    79     public:
       
    80         /**
       
    81         * Static factory method,
       
    82         *
       
    83         * Entry point into Symbian's 2 phase construction pattern.
       
    84         */
       
    85         static CTestRunner* NewL();
       
    86 
       
    87         /**
       
    88         * Destructor.
       
    89         */
       
    90         virtual ~CTestRunner();
       
    91 
       
    92         /**
       
    93         * Start the execution.
       
    94         */
       
    95         void StartRunL( TWhichCase aCase );
       
    96 
       
    97         CContactIdArray* GetWVContactIdsLC();
       
    98 
       
    99         /**
       
   100         * Symbian's 2 phase construction pattern.
       
   101         */
       
   102         void ConstructL( );
       
   103 
       
   104         TInt CreateInstanceL();
       
   105         TInt RegisterConnObserverL();
       
   106         TInt LoadIMInterfaceL();
       
   107         TInt IMRegisterL();
       
   108         TInt LoginL( const TDesC& aUserID );
       
   109         TInt SendPToPValidUserIDL();
       
   110         TInt SendPToPValidTwoUserIDL();
       
   111         TInt SendPToPValidContactL();
       
   112         TInt SendPToPValidTwoContactL();
       
   113         TInt SendPToPContactContentTypeL();
       
   114         TInt SendPToPUserIDContentTypeL();
       
   115         TInt QueryIMConnectionStatusL();
       
   116         TInt CancelLoginL();
       
   117 
       
   118         void GetDefaultAccessPoint();
       
   119 
       
   120         void ReadIniFileL();
       
   121         TBuf<KImpsMaxSapLen> iSapValue;
       
   122         TBuf<KImpsMaxUserIdLen> iUserIdValue;
       
   123         TBuf<KImpsMaxLen> iPassword;
       
   124         TBuf<KImpsMaxClientIdLen>  iClientId;  // 1.3 Client ID Implementation
       
   125         TBuf<KImpsMaxLen> iUserId1;
       
   126         TBuf<KImpsMaxLen> iUserId2;
       
   127         TInt iIAP;
       
   128 
       
   129     public: // Functions from base classes
       
   130 
       
   131         /**
       
   132         * Active object completion
       
   133         */
       
   134         void RunL();
       
   135         /**
       
   136         * Active object cancellation
       
   137         */
       
   138         void DoCancel();
       
   139 
       
   140     private:
       
   141 
       
   142         // By default, prohibit copy constructor
       
   143         CTestRunner( const CTestRunner& );
       
   144 
       
   145         // Prohibit assigment operator
       
   146         CTestRunner& operator= ( const CTestRunner& );
       
   147 
       
   148         /**
       
   149         * C-style constructor.
       
   150         */
       
   151         CTestRunner();
       
   152 
       
   153         // actual runner, that is leave trapped
       
   154         void DoRunL();
       
   155 
       
   156     private:    // Data
       
   157 
       
   158         TWhichCase				iCase;
       
   159         CIMApiClientHandler*     iImObserver; //earlier code
       
   160         //MImObserver*     iImObserver;
       
   161         CConnectionObserver*    iConnObserver;
       
   162         CImConnection*          iOpenApi;
       
   163         MImClient*              iImClient;
       
   164         CStifLogger*			iLog;
       
   165         CContactDatabase*       iDatabase;
       
   166     };
       
   167 
       
   168 
       
   169 
       
   170 class CTestScheduler : public CActiveScheduler
       
   171     {
       
   172     public:
       
   173         void Error ( TInt aError ) const;
       
   174     };
       
   175 
       
   176 class CTestLogger1 : public CBase
       
   177     {
       
   178     public:
       
   179         //IMPORT_C static void CTestLogger::Log(TRefByValue<const TDesC> aFmt,...);
       
   180         IMPORT_C static void Log( TRefByValue<const TDesC> aFmt, ... );
       
   181     };
       
   182 
       
   183 #endif