messagingapp/msgui/msguiutils/tsrc/unittest_msguiutils/mmstestbed/inc/mmstestbed.h
changeset 70 a15d9966050f
equal deleted inserted replaced
61:8ba0afbb4637 70:a15d9966050f
       
     1 /*
       
     2  * Copyright (c) 2009 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 #ifndef MMSTESTBED_H
       
    18 #define MMSTESTBED_H
       
    19 
       
    20 #ifdef BUILD_MMSTESTBED_DLL
       
    21 #define MMSTESTBED_EXPORT Q_DECL_EXPORT
       
    22 #else
       
    23 #define MMSTESTBED_EXPORT Q_DECL_IMPORT
       
    24 #endif
       
    25 
       
    26 #include <QObject>
       
    27 #include <QString>
       
    28 
       
    29 #include <msvids.h>  //for consts like KMsvNullIndexEntryIdValue
       
    30 #include <MSVAPI.H>
       
    31 #include <MTCLREG.H>
       
    32 #include <mmsclient.h>
       
    33 //#include <mmsservercommon.h>
       
    34 
       
    35 class CTestUiTimer;
       
    36 class CMsvSession;
       
    37 class CMmsClientMtm;
       
    38 class CMmsSettings;
       
    39 class CMmsHeaders;
       
    40 class CLogEvent;
       
    41 class CLogViewEvent;
       
    42 class CLogFilter;
       
    43 class CLogClient;
       
    44 
       
    45 class MMSTESTBED_EXPORT MmsTestBed : public QObject, public MMsvSessionObserver
       
    46     {
       
    47     Q_OBJECT
       
    48 
       
    49 public:
       
    50     /**
       
    51      *
       
    52      */
       
    53     MmsTestBed();
       
    54     ~MmsTestBed();
       
    55     void setConnectionLocal(bool value);
       
    56     void fromOutboxToMmsc();
       
    57     void fromMmscToInbox();
       
    58     /**
       
    59      * cleanup MMS service
       
    60      */
       
    61     void cleanupAndCreateNewService();
       
    62     void deleteNotifications();
       
    63     void restoreFactorySettings();
       
    64     void setFetchingState( TMmsReceivingMode aState );
       
    65     void sendFromFile();
       
    66     void sendOneByOne();
       
    67     void sendNotifications();
       
    68     void copyDrafts();
       
    69     void garbageCollection(TUint32 aReason = 0x00000001); //0x00000001 == KMmsReasonBoot
       
    70     void messageVariation();
       
    71     void cancelSendScheduling();
       
    72     void scheduledSend(TMsvId aBoxId, TInt aDelay = 5);
       
    73     void deleteSendSchedule();
       
    74     void cancelFetchScheduling();
       
    75     void fetchForced(TInt aDelay = 5);
       
    76     void deleteFetchSchedule();
       
    77     void doAFetchCycle();
       
    78     void createEntry(TMsvEntry& aNewEntry, CMsvEntry& aClientEntry);
       
    79     void cleanOutbox();
       
    80     void cleanInbox();
       
    81     void cleanSent();
       
    82     void cleanDrafts();
       
    83     void cleanAll();
       
    84     void reply();
       
    85     void replyToAll();
       
    86     void forward();
       
    87     void sendReadReport(); // send a read report
       
    88     int fromOutboxToMmscWithMemoryFailure(); // returns memory failure count
       
    89     int fromMmscToInboxWithMemoryFailure(); // returns memory failure count
       
    90     void sendViaClient();
       
    91     void scheduledFetch(TInt aDelay = 5);
       
    92     void fetchForcedImmediate();
       
    93     void getEventType();
       
    94     void addEventType();
       
    95     void deleteEventType();
       
    96     void cleanLog();
       
    97     void setOnline(bool value);
       
    98     void generateDeliveryReport( CMmsHeaders* aMmsHeaders );
       
    99     void sendDeliveryReport();
       
   100 
       
   101 signals:
       
   102     void entryCreatedInDraft(long int id);
       
   103     void entryMovedToOutbox(long int id);
       
   104     void entryMovedToSent(long int id);
       
   105     void entryCreatedInInbox(long int id);
       
   106 
       
   107 protected:
       
   108     /**
       
   109      * From MMsvSessionObserver
       
   110      */
       
   111     void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1,
       
   112             TAny* aArg2, TAny* aArg3);
       
   113 
       
   114 private:
       
   115     void findDefaultL();
       
   116     void createMmsService();
       
   117     void cleanup();
       
   118     void deleteEntry(TMsvId aEntryId, CMsvEntry& aClientEntry);
       
   119     void testFile(TFileName& aFilePath, TInt aCommand = 0, TMsvId aBox = KMsvGlobalOutBoxIndexEntryId);
       
   120     void addMMBoxDescriptions();
       
   121     void encodeMessageFromDrafts();
       
   122     TMsvId findMMSFolder();
       
   123     bool checkLogClient();
       
   124     int getLogEntries();
       
   125 
       
   126 private:
       
   127     //data
       
   128     CTestUiTimer* iTimer;
       
   129     CMsvOperationActiveSchedulerWait* iWait;
       
   130     CMsvSession* iSession;
       
   131     CClientMtmRegistry* iClientMtmRegistry;
       
   132     CMmsClientMtm* iMmsClient;
       
   133     CMmsSettings* iSettings;
       
   134     CMmsHeaders* iMmsHeaders;
       
   135     TMsvId iServiceId;
       
   136     TMsvId iDefaultServiceId;
       
   137     TMsvSessionEvent iEvent;
       
   138     RFs iFs;
       
   139     TFileName iFilename;
       
   140     TFileName iCurrentFile;
       
   141     TFileName iCurrentPath;
       
   142     TParse iParse;     // parse buffer as member to save stack space
       
   143     CBufFlat* iEncodeBuffer;
       
   144     CMsvEntrySelection* iMsvEntrySelection;
       
   145     CLogEvent* iLogEvent;
       
   146     CLogClient* iLogClient;
       
   147     CLogViewEvent* iLogView;
       
   148     CLogFilter* iLogFilter;
       
   149     };
       
   150 
       
   151 #endif // MMSTESTBED_H