messagingfw/msgtest/testutils/sms/inc/SmsTestUtils.h
changeset 0 8e480a14352b
equal deleted inserted replaced
-1:000000000000 0:8e480a14352b
       
     1 // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef SMS_TEST_H_
       
    17 #define SMS_TEST_H_
       
    18 
       
    19 #include "msvtestutils.h"
       
    20 #include <smutset.h>
       
    21 #include <etelmm.h>
       
    22 
       
    23 // System Agent header files
       
    24 #include <e32property.h>
       
    25 
       
    26 
       
    27 _LIT(KSmsServerMtmFileName, "z:\\system\\libs\\smss.dll");
       
    28 _LIT(KSmsClientMtmFileName, "z:\\system\\libs\\smsc.dll");
       
    29 // The ui data mtms are not instantiated in practice
       
    30 _LIT(KSmsUiMtmFileFileName, "z:\\system\\libs\\smum.dll");
       
    31 
       
    32 _LIT(KSmsDataComponentFileName, "c:\\system\\mtm\\sms.dat");
       
    33 
       
    34 _LIT(KSmsServiceCenterNumber, "+447785016005");  //  Not used, CJCW!  
       
    35 
       
    36 //SMS Scripting
       
    37 
       
    38 _LIT(KSmsComponent, "sms");
       
    39 
       
    40 //SMS Script Valid Script Items
       
    41 
       
    42 _LIT(KScriptItemMessage, "Message");
       
    43 
       
    44 _LIT(KScriptItemBioUid, "BioUid");
       
    45 const TInt KScriptItemBioUidDef		= 0;
       
    46 
       
    47 _LIT(KScriptItemSC, "SC");
       
    48 _LIT(KScriptItemSCDef, "+447785016005");
       
    49 
       
    50 _LIT(KScriptItemSCUseDefault, "Default");
       
    51 
       
    52 _LIT(KScriptItemMessageType, "Type");
       
    53 _LIT(KScriptItemSubmit, "Submit");
       
    54 _LIT(KScriptItemDeliver, "Deliver");
       
    55 _LIT(KScriptItemStatusReport, "SR");
       
    56 _LIT(KScriptItemCommand, "Command");
       
    57 
       
    58 _LIT(KScriptItemMessageClass, "Class");
       
    59 _LIT(KScriptItemClassDefault, "DEF");
       
    60 _LIT(KScriptItemClass0, "0");
       
    61 _LIT(KScriptItemClass1, "1");
       
    62 _LIT(KScriptItemClass2, "2");
       
    63 _LIT(KScriptItemClass3, "3");
       
    64 
       
    65 _LIT(KScriptItemRecipients, "Recipients");
       
    66 _LIT(KScriptItemRecipientsDef, "+447747065xxx");
       
    67 _LIT(KScriptItemRecipients2Def, "+447747065xxx");
       
    68 
       
    69 _LIT(KScriptItemBearer, "Bearer");
       
    70 _LIT(KScriptItemBearerDef, "NBS");
       
    71 
       
    72 _LIT(KScriptItemEncoding, "Encoding");
       
    73 const TInt KScriptItemEncodingDef	= 7;
       
    74 
       
    75 _LIT(KScriptItemDeliveryReport, "DeliveryReport");
       
    76 _LIT(KScriptItemDeliveryReportDef, "DEF");
       
    77 
       
    78 _LIT(KScriptItemFile, "File");
       
    79 
       
    80 const TUid KVCardBioUid				= {0x10005534};
       
    81 const TUid KVCalBioUid				= {0x10005533};
       
    82 
       
    83 enum TSmsTestUtilsPanic
       
    84 	{
       
    85 	KSmsTestUtilsPanicNotOnClientSide,
       
    86 	KSmsTestUtilsPanicSettingsNotConstructed,
       
    87 	KSmsTestUtilsPanicSmsTestUtilsCreationFlagCombination,
       
    88 	KSmsTestUtilsPanicSmsServiceIdNotSet,
       
    89 	KSmsTestUtilsPanicCannotCompareSameIds
       
    90 	};
       
    91 
       
    92 class CSmsHeader;
       
    93 class CSmsClientMtm;
       
    94 class CSmsSettings;
       
    95 class CParaFormatLayer;
       
    96 class CCharFormatLayer;
       
    97 class CRichText;
       
    98 class CScriptFile;
       
    99 
       
   100 class CSmsTestUtils : public CMsvTestUtils
       
   101 	{
       
   102 public:
       
   103 	IMPORT_C static CSmsTestUtils* NewL(RTest& aRTest, TUint aCreationFlags = ETuMinimalClientSide);
       
   104 	IMPORT_C static CSmsTestUtils* NewLC(RTest& aRTest, TUint aCreationFlags = ETuMinimalClientSide);
       
   105 	
       
   106 	IMPORT_C void InstallSmsMtmGroupL();
       
   107 	IMPORT_C void InstantiateSmsClientMtmL();
       
   108 	IMPORT_C void Reset();
       
   109 	IMPORT_C ~CSmsTestUtils();
       
   110 
       
   111 	IMPORT_C void CreateSmsServerMtmRegL();
       
   112 	IMPORT_C TMsvId CreateSmsServiceL();
       
   113 	IMPORT_C void InstantiateSmsServerMtmL();
       
   114 	IMPORT_C void DeleteSmsServiceL();
       
   115 	IMPORT_C TMsvId FindExistingSmsServiceL();
       
   116 
       
   117 	IMPORT_C TBool ReadScriptL(const TDesC& aFile, TMsvId aDestFolder, CMsvEntrySelection& aSelection, const TTime& aDate);
       
   118 	IMPORT_C void CreateMessageL(TMsvId aDestFolder, TMsvEntry& aEntry, CSmsHeader& aHeader, CRichText& aBody, const TTime& aDate);
       
   119 
       
   120 	IMPORT_C TMsvId CreateDummyMessageToSendL();
       
   121 	IMPORT_C TMsvId CreateDummyMessageToReceiveL();
       
   122 
       
   123 	IMPORT_C void AddRecipientL(TMsvId aId, const TDesC& aNumber);
       
   124 	IMPORT_C void AddSystemAgentConditionsL();
       
   125 
       
   126 	IMPORT_C void NotifySaPhoneOnL();
       
   127 	IMPORT_C void NotifySaPhoneOffL();
       
   128 	IMPORT_C void WaitForInitializeL();
       
   129 
       
   130 	IMPORT_C void DeleteSmsMessagesL(TMsvId aFolder);
       
   131 
       
   132 	inline void SetProgressL(CMsvOperation& iOperation);
       
   133 
       
   134 	//From CMsvTestUtils
       
   135 	void InstantiateClientMtmsL()	{InstantiateSmsClientMtmL();}
       
   136 	void InstantiateServerMtmsL()	{InstantiateSmsServerMtmL();}
       
   137 	void DeleteServicesL()			{DeleteSmsServiceL();}
       
   138 	void CreateServicesL()			{CreateSmsServiceL();}
       
   139 	IMPORT_C void FindExistingServicesL();
       
   140 	void InstallMtmGroupsL()		{InstallSmsMtmGroupL();}
       
   141 	void CreateServerMtmRegsL()		{CreateSmsServerMtmRegL();}
       
   142 
       
   143 	IMPORT_C TBool AreMessagesSameTextL(TMsvId aSentId, TMsvId aRecvId, TBool aPrintIfMismatch = EFalse);
       
   144 
       
   145 	IMPORT_C void DisplaySendingStatesL(const CMsvEntrySelection& aSelection);
       
   146 	IMPORT_C TBool SendingCompleteL(const CMsvEntrySelection& aSelection, TInt& rError);
       
   147 
       
   148 	IMPORT_C void SetCommDbServiceCenterFromScriptL(const TDesC& aScriptFile);
       
   149 
       
   150 	IMPORT_C CSmsHeader* GetHeaderLC(TMsvId aId);
       
   151 
       
   152 	IMPORT_C void SaveBodyToFileL(TMsvId aId);
       
   153 	IMPORT_C void DisplayMessagesL(const CMsvEntrySelection& aSelection);
       
   154 	IMPORT_C void DisplayMessageL(TMsvId aId);
       
   155 
       
   156 protected:
       
   157 
       
   158 	IMPORT_C CSmsTestUtils(RTest& aRTest);
       
   159 	IMPORT_C void ConstructL(TUint aCreationFlags);
       
   160 	IMPORT_C void Panic(TInt aPanic);
       
   161 	IMPORT_C void Panic (TSmsTestUtilsPanic aPanic);
       
   162 
       
   163 private:
       
   164 
       
   165 	TBool CreateMessagesL(TMsvId aDestFolder, CScriptFile& rSections, CMsvEntrySelection& rSelection, const TTime& aDate);
       
   166 
       
   167 	void DisplayLogEventData(const CLogEvent& aEvent);
       
   168 
       
   169 	TBool DoReadScriptL(const TDesC& aFile, TMsvId aDestFolder, CMsvEntrySelection& aSelection, const TTime& aDate);
       
   170 	void DisplayChildDetailsL(const TMsvEntry& aEntry);
       
   171 	CSmsHeader* DoGetHeaderLC(CMsvEntry& aEntry);
       
   172 
       
   173 public:
       
   174 
       
   175 	CSmsClientMtm*		iSmsClientMtm;			
       
   176 	TMsvId				iSmsServiceId;
       
   177 	CSmsSettings*		iServiceSettings;
       
   178 	TSmsProgress		iProgress;
       
   179 
       
   180 	CParaFormatLayer*	iParaFormat;
       
   181 	CCharFormatLayer*	iCharFormat;
       
   182 	CRichText*			iRichText;
       
   183 
       
   184 	TBool iSmokeTest; //if ETrue, then smaller number of tests will be run
       
   185 	};
       
   186 
       
   187 #define SMSTEST_PANIC _L("Sms_Test")
       
   188 
       
   189 #include <smstestutils.inl>
       
   190 
       
   191 #endif