messagingapp/msgappfw/plugins/msgplugin/tsrc/inc/test_plugin.h
changeset 34 84197e66a4bd
equal deleted inserted replaced
31:ebfee66fde93 34:84197e66a4bd
       
     1 /*
       
     2 #
       
     3 # Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     4 # All rights reserved.
       
     5 # This component and the accompanying materials are made available
       
     6 # under the terms of "Eclipse Public License v1.0"
       
     7 # which accompanies this distribution, and is available
       
     8 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     9 #
       
    10 # Initial Contributors:
       
    11 # Nokia Corporation - initial contribution.
       
    12 #
       
    13 # Contributors:
       
    14 #
       
    15 # Description:   Main test class header for CS Message Plugin
       
    16 #*/
       
    17 
       
    18 #ifndef TEST_PLUGIN_H_
       
    19 #define TEST_PLUGIN_H_
       
    20 
       
    21 //  INCLUDES
       
    22 #include <badesca.h>
       
    23 #include <StifLogger.h>
       
    24 #include <TestScripterInternal.h>
       
    25 #include <StifTestModule.h>
       
    26 
       
    27 // USER INCLUDES
       
    28 #include <mcsplugineventobserver.h>
       
    29 #include <ccsmsg.h>
       
    30 #include <ccsmsghandler.h>
       
    31 #include <ccsdefs.h>
       
    32 #include <ccsconversationentry.h>
       
    33 #include <ccsmsgpluginutility.h>
       
    34 #include <smsclnt.h>
       
    35 #include <mmsclient.h>
       
    36 #include <cmsvmimeheaders.h>
       
    37 #include <mmsvattachmentmanager.h>
       
    38 #include <CAsyncWaiter.h>
       
    39 #include <mtclreg.h>
       
    40 #include <biouids.h>
       
    41 #include <msgbiouids.h>
       
    42 
       
    43 
       
    44 // Logging path
       
    45 _LIT( KTestPluginLogPath, "\\logs\\testframework\\test_plugin\\" ); 
       
    46 // Log file
       
    47 _LIT( KTestPluginTestLogFile, "test_plugin.txt" ); 
       
    48 _LIT( KTestPluginTestLogFileWithTitle, "test_plugin_[%S].txt" );
       
    49 
       
    50 // FORWARD DECLARATIONS
       
    51 class CCsMsg; 
       
    52 class CCsMsgHandler;
       
    53 class CCsMsgPluginUtility;
       
    54 class MCsMsgObserver; 
       
    55 class CCsConversationEntry;
       
    56 class CCsMsgPluginUtility;
       
    57 class CMsvSession;
       
    58 class CClientMtmRegistry;
       
    59 class CSmsClientMtm;
       
    60 class CMmsClientMtm;
       
    61 class CMsvMimeHeaders;
       
    62 class CAsyncWaiter;
       
    63 class CMmsSettings;
       
    64 
       
    65 /**
       
    66  *  Message plugin class
       
    67  **/
       
    68 
       
    69 NONSHARABLE_CLASS(Ctest_plugin) : public CScriptBase,public MCsPluginEventObserver,public MMsvSessionObserver
       
    70     {
       
    71     private:
       
    72 
       
    73             /**
       
    74             * C++ default constructor.
       
    75             */
       
    76             Ctest_plugin(CTestModuleIf& aTestModuleIf );
       
    77 
       
    78             /**
       
    79             * By default Symbian 2nd phase constructor is private.
       
    80             */
       
    81             void ConstructL();
       
    82 
       
    83             // Prohibit copy constructor if not deriving from CBase.
       
    84             // ?classname( const ?classname& );
       
    85             // Prohibit assigment operator if not deriving from CBase.
       
    86             // ?classname& operator=( const ?classname& );
       
    87 
       
    88             /**
       
    89             * Frees all resources allocated from test methods.
       
    90             * @since ?Series60_version
       
    91             */
       
    92             void Delete();
       
    93 
       
    94             /**
       
    95                     * Example test method.
       
    96                     * @since ?Series60_version
       
    97                     * @param aItem Script line containing parameters.
       
    98                     * @return Symbian OS error code.
       
    99                     */
       
   100             virtual TInt ExampleL( CStifItemParser& aItem );            
       
   101 
       
   102     public:  // Constructors and destructor
       
   103 
       
   104             /**
       
   105              * Two-phased constructor.
       
   106              */
       
   107             static Ctest_plugin* NewL( CTestModuleIf& aTestModuleIf );
       
   108 
       
   109 			/**
       
   110 			 * From CScriptBase Runs a script line.
       
   111 			 * @since ?Series60_version
       
   112 			 * @param aItem Script line containing method name and parameters
       
   113 			 * @return Symbian OS error code
       
   114 			 *         */        
       
   115             virtual TInt RunMethodL( CStifItemParser& aItem );
       
   116 			/**
       
   117 			 * Destructor.
       
   118 			 */
       
   119             virtual ~Ctest_plugin();
       
   120             
       
   121     private:    // Data
       
   122             
       
   123         	CCsMsg* iPlugin;
       
   124         
       
   125             /**
       
   126              * MsvServer session object
       
   127              */
       
   128             CMsvSession* iSession;
       
   129 
       
   130             /**
       
   131              * Mtm registry object
       
   132              */   
       
   133             CClientMtmRegistry* iMtmRegistry;
       
   134 
       
   135             /**
       
   136              * Sms Client mtm object
       
   137              */
       
   138             CSmsClientMtm* iSmsClientMtm;
       
   139             
       
   140             /**
       
   141              * MMS Client mtm object
       
   142              */
       
   143             CMmsClientMtm* iMmsClientMtm;
       
   144          
       
   145            	/**
       
   146             * List contains the CCsConversationEntry objects that needs to be 
       
   147         	* verified with the list obtained from sms plugin
       
   148         	*/    
       
   149         	RPointerArray<CCsConversationEntry> iTestConversationEntryList;
       
   150 
       
   151         	/**
       
   152         	* List obtained from sms plugin 
       
   153         	*/    
       
   154         	RPointerArray<CCsConversationEntry> iResultConversationEntryList;
       
   155        
       
   156         	
       
   157     public://Mcsplugineventobserver
       
   158             /**
       
   159              * AddConversations.
       
   160              * Handle Conversation event from Plugins
       
   161              * @param aConversationEntryLists    List of conversation entries.
       
   162              */
       
   163           void AddConversations(const RPointerArray<CCsConversationEntry>& aConversationEntryLists);
       
   164 
       
   165             /**
       
   166              * ModifyConversations.
       
   167              * Update Conversation event from Plugins
       
   168              * @param aConversationEntryLists    List of conversation entries.
       
   169              */
       
   170           void ModifyConversations(const RPointerArray<CCsConversationEntry>& aConversationEntryLists);
       
   171 
       
   172             /**
       
   173              * DeleteConversations.
       
   174              * Delete Conversation event from Plugins
       
   175              * @param aConversationEntryLists    List of conversation entries.
       
   176              */
       
   177            void DeleteConversations(const RPointerArray<CCsConversationEntry>& aConversationEntryLists);
       
   178             /**
       
   179              * CachingCompleted.
       
   180              * Caching complete event from Plugins
       
   181              */
       
   182             void CachingCompleted();
       
   183 
       
   184             /**
       
   185              * CachingError.
       
   186              * Caching error event from Plugins
       
   187              * @param aError    Caching Error infomation.
       
   188              */
       
   189             void CachingError(const TInt aError) ;
       
   190             
       
   191             /**
       
   192                      * RefreshConversations
       
   193                      * Refresh all data from this plugin.
       
   194                      */
       
   195             void RefreshConversations();
       
   196 
       
   197     public://from MmsvSessionObserver
       
   198             /**
       
   199              * Handles the MsvServer updates. Implemented for MMsvSessionObserver
       
   200              */
       
   201             void HandleSessionEventL(TMsvSessionEvent aEvent, TAny *aArg1, TAny *aArg2, TAny *aArg3);        
       
   202     	
       
   203     public: 
       
   204            
       
   205             virtual TInt CreateCCsMsgL( CStifItemParser& aItem );    	
       
   206             virtual TInt SendCcsMessageL( CStifItemParser& /*aItem*/ );
       
   207             virtual TInt CacheFromCcsPluginL( CStifItemParser& /*aItem*/ );
       
   208             virtual TInt CreateCcsPluginL( CStifItemParser& /*aItem*/ );
       
   209             virtual TInt SmsMsgPluginValidationL( CStifItemParser& aItem );
       
   210             virtual TInt MmsMsgPluginValidationL( CStifItemParser& aItem );
       
   211             virtual TInt BioMsgPluginValidationL( CStifItemParser& aItem );
       
   212             
       
   213             TInt Compare(CCsConversationEntry *aResult, CCsConversationEntry *aTest);
       
   214             /** 
       
   215                      * Cleans messages from all foldes
       
   216                      */        
       
   217              void CleanAllFoldersL();
       
   218 
       
   219              /** 
       
   220                      * Populates the messages in different folders which are used 
       
   221                      * to verify the caching logic of ccs plugin 
       
   222                      */                
       
   223              void CreateInitialCacheL();
       
   224              
       
   225              /** 
       
   226                       * Cleans messages from the specified folder
       
   227                       * @param aBoxId , folder from where messages has to be deleted
       
   228                       * @param aDeleteOne , if set only one message is deleted
       
   229                       */
       
   230             void CleanMessagesInFolderL(TMsvId aBoxId ,TBool aDeleteOne = EFalse); 
       
   231 
       
   232             /** 
       
   233              * Creates messages in the different folders and populates
       
   234              * the iTestConversationEntryList 
       
   235              * @param aFolderId , the folder in which message is to be created
       
   236              * @param aUnReadFlag , Used while creating message in inbox folder
       
   237              */
       
   238             void CreateMessageL(const TMsvId aFolderId,TBool aUnReadFlag = EFalse); 
       
   239             void CreateMmsMessageL(const TMsvId aFolderId,TBool aUnReadFlag = EFalse);
       
   240             void HandleAttachementL(CMsvStore* store,TFileName& sourceFileName );
       
   241             void CreateSmartMessageL(const TMsvId aFolderId,TBool aUnReadFlag = EFalse);
       
   242     };
       
   243 
       
   244 #endif /* TEST_PLUGIN_H_ */