diff -r 962e6306d9d2 -r 7ef16719d8cb smsprotocols/smsstack/smsprot/Test/TE_Smsprt/TE_smsprtbase.h --- a/smsprotocols/smsstack/smsprot/Test/TE_Smsprt/TE_smsprtbase.h Fri Feb 19 23:59:33 2010 +0200 +++ b/smsprotocols/smsstack/smsprot/Test/TE_Smsprt/TE_smsprtbase.h Fri Mar 12 15:49:38 2010 +0200 @@ -21,9 +21,6 @@ #define _TE_SMSPRTBASE_H_ #include -#include "Te_smsprttestcase.h" -#include "TE_smsprt_alphabet.h" -#include "smsstacktestutilities.h" #include #include #include @@ -34,230 +31,25 @@ #include #include #include -#include "smspdudb.h" -#include "smspproc.h" -#include "attributes.h" #include #include #include -#define DSTDNC_NEWCALL_FULLNAME _L("DummyNc::PotsNc::") - -_LIT(KGmsSmsConfigFileName,"setupgsmsms.txt"); -_LIT(KTSmsPrtConfigFileName, "tsmsprt_config.txt"); -_LIT(KTSmsPrtConfigExtraFileName, "tsmsprt_config_extra.txt"); -_LIT(KTSmsPrtConfigTxRxMaxMsgFileName, "tsmsprt_config_tx_rx_maxmsg.txt"); - -_LIT8(KServiceCentreAddress, "ServiceCentreAddress"); -_LIT8(KSmspEntryValidParams, "SmspEntryValidParams"); -_LIT8(KSmspEntryScTypeOfNumber, "SmspEntryScTypeOfNumber"); -_LIT8(KSmspEntryScNumberPlan, "SmspEntryScNumberPlan"); - -_LIT(KVodafoneSC,"+447785016005"); //Vodafone SC -_LIT(KRegTestNumber,"+447747065548"); //Number used with regtest -_LIT(KTestNumber,"+447747065825"); //Number used with regtest - -_LIT(KSoneraSC,"+358405202000"); //Sonera SC -_LIT(KRadiolinjaSC,"+358508771010"); //Radiolinja SC - -_LIT(KPekka,"+358408415528"); //Pekka's telephone number -_LIT(KOther,"+358408415582"); // Other test number -_LIT(KLocalNumber, "08408415528"); //Local test number to verify local/international switching -_LIT(KInternationalTestNumber, "+819021710979"); // International number to be used with a status - // report containing local version of this number - -_LIT8(KTestSendAndRecvMsgsWithDifferentTON, "SendAndRecvMsgsWithDifferentTON"); -_LIT8(KTestSendAndReceiveIndicatorMsgs, "SendAndReceiveIndicatorMsgs"); -_LIT(KConfigFileDir,"sms"); -_LIT8(KAlphabet, "Alphabet"); -_LIT8(KTypeOfNumber, "TypeOfNumber"); -_LIT8(KIndicationType, "IndicationType"); -_LIT8(KDCSBits7To4, "DCSBits7To4"); -_LIT8(KIndicationState, "IndicationState"); - -_LIT(KText, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123"); - - -const TUint KSocketMessageSlots = 16; // Override the default value of 8 +#include "smsstacktestcase.h" +#include "TE_smsprt_alphabet.h" +#include "smsstacktestutilities.h" +#include "smsstackbaseteststeps.h" +#include "smsstacktestconsts.h" +#include "smspdudb.h" +#include "smspproc.h" +#include "attributes.h" using namespace CommsDat; - -// -// Test macros -// -#define TESTCHECKL(a, b) \ - { \ - if((a)!=(b)) \ - { \ - INFO_PRINTF3(_L("Failed: Got %d while expecting %d."),a,b); \ - SetTestStepResult(EFail); \ - User::Leave(EFail); \ - } \ - } - -#define TESTCHECKCONDITIONL(a) \ - { \ - if (!(a)) \ - { \ - INFO_PRINTF1(_L("Failed: Condition was false.")); \ - SetTestStepResult(EFail); \ - User::Leave(EFail); \ - } \ - } - -#define TESTCHECKSTRL(a, b) \ - { \ - if((a)!=(b)) \ - { \ - TBuf<255> temp = a ; \ - INFO_PRINTF3(_L("Failed: Got \"%S\" while expecting \"%S\"."), &temp,&(b)); \ - SetTestStepResult(EFail); \ - User::Leave(EFail); \ - } \ - } - -#define TESTCHECK(a, b) \ - { \ - if((a)!=(b)) \ - { \ - INFO_PRINTF3(_L("Failed: Got %d while expecting %d."),a,b); \ - SetTestStepResult(EFail); \ - } \ - } - -#define TESTCHECKCONDITION(a) \ - { \ - if (!(a)) \ - { \ - INFO_PRINTF1(_L("Failed: Condition was false.")); \ - SetTestStepResult(EFail); \ - } \ - } - -#define TESTCHECKSTR(a, b) \ - { \ - if((a)!=(b)) \ - { \ - TBuf<255> temp = a ; \ - INFO_PRINTF3(_L("Failed: Got \"%S\" while expecting \"%S\"."), &temp,&(b)); \ - SetTestStepResult(EFail); \ - } \ - } - - -/** - Base class housing SMS test Steps -*/ -class CSMSTestSteps : public CTestStep -{ -public: - -// static CSMSTestSteps* NewL(); - ~CSMSTestSteps(); - - - enum TCodingScheme{ESevenBit=7, EEightBit}; - - /* Functions grabbed from SMS Stack Test Utils */ - //Socket utils - void OpenSmsSocketL(RSocketServ& aSocketServer, RSocket& aSocket, TSmsAddr& aSmsAddr); - void OpenSmsSocketL(RSocketServ& aSocketServer, RSocket& aSocket, TSmsAddrFamily aFamily); - void WaitForInitializeL(); - void SetSimTSYTestNumberL(TInt aTestNumber); - void ParseSettingsFromFileL(); - void PrepareRegTestLC(RSocketServ& aSocketServer, TInt aTestNumber); - CSmsMessage* CreateSmsMessageL(const TDesC& aDes, TSmsDataCodingScheme::TSmsAlphabet aAlphabet, CSmsPDU::TSmsPDUType aType = CSmsPDU::ESmsSubmit); - CSmsMessage* RecvSmsL(RSocket& aSocket, TInt aIoctl = KIoctlReadMessageSucceeded); - CSmsMessage* CreateSmsWithStatusReportReqL(const TDesC& aDes, TSmsDataCodingScheme::TSmsAlphabet aAlphabet); - CSmsMessage* RecvSmsFailedL(RSocket& aSocket); - CSmsMessage* CreateSmsMessageLC(CSmsPDU::TSmsPDUType aType, CSmsBuffer* aBuffer, const TDesC& aAddress); - //This method is used to create SMS message from test data - CSmsMessage* CreateSMSL(); - void SetFreeDiskSpaceL(TInt64 aNewFreeValue); - void ReleaseDiskSpaceL(); - TUint64 SetHighLowLimitsAndDiskSpaceLevelL(TUint aHighDrop, TUint aLowDrop, TUint aFreeDrop, TUint64 aMax=0x7fffffff); - void SetFreeDiskSpaceFromDropLevelL(TUint aFreeDrop); - void SetLowHighLimitsInSmsuRscL(TInt64 aLowLimit, TInt64 aHighLimit); - void RemoveLowHighLimitsFromSmsuRscL(); - void SendSmsL(const CSmsMessage* aSms, RSocket& aSocket); - void SendSmsCancelL(CSmsMessage* aSms, RSocket& aSocket1, RSocket& aSocket2); - TInt SendSmsErrorL(CSmsMessage* aSms, RSocket& aSocket); - void SendCommandSmsL(CSmsMessage* aSms, RSocket& aSocket); - void SendAndRecvTestMessageL(const TTestCase& aTestCase, RSocket& aSocket); - void SendTestMessageL(const TTestCase& aTestCase, RSocket& aSocket); - void SendSmsDontCheckReturnValueL(CSmsMessage* aSms, RSocket& aSocket); - void SendAndRecvSms7BitL(const TDesC& aDes, RSocket& aSocket); - void DoSendAndRecvSmsL(const TDesC& aDes, TSmsDataCodingScheme::TSmsAlphabet aAlphabet, RSocket& aSocket); - void PrintMessageL(const CSmsMessage* aSms); - void PrintSmsMessage(const CSmsMessage& aMessage); - TSmsStatus::TSmsStatusValue RecvStatusReportL(TSmsServiceCenterAddress& aRecipientNumber, RSocket& aSocket); - void WaitForRecvL(RSocket& aSocket); - void TestSmsContentsL(CSmsMessage* aSms, const TDesC& aDes, TBool aIgnorePrintOutput = EFalse); - void TestMessageContentsL(CSmsMessage* aSms, const TTestCase& aTestCase); - void WriteSmsToSimL(CSmsMessage& aSms, RSocket& aSocket); - void WriteSmsLeaveIfErrorL(const CSmsMessage& aSms, RSocket& aSocket); - void ReadSmsStoreL(RSocket& aSocket, RPointerArray& aMessages); - void ReadSmsStoreL(RSocket& aSocket, RPointerArray& aMessages, TRequestStatus &aStatus); - TInt DeleteSmsL(const CSmsMessage& aSms, RSocket& aSocket); - void DeleteSmsLeaveIfErrorL(const CSmsMessage& aSms, RSocket& aSocket); - void SetIndicatorL(const TTestCase& aTestCase, CSmsMessage* aSms); - void FillDes(TDes& aDes,TInt aLength); - TInt MakeReadSmsStoreRequestL(RSocket& aSocket); - TBool TimedWaitForRecvL(RSocket& aSocket, TUint aDelay); - TInt CancelWriteSmsToSimL(CSmsMessage& aSms, RSocket& aSocket, TInt aDelay); - TBool DoSingleTestCaseL( const TDesC8& aSection, TInt aCount ); - void ReadPduL( TBuf8<64> aSectionName, RPointerArray& aArray ); - void TestSendAndRecvMsgsWithDifferentTONL( const RPointerArray& aArray, - const CArrayFixFlat* aAlphabetArray, - const CArrayFixFlat* aTypeOfNumberArray ); - void TestSendAndReceiveIndicatorMsgsL( const RPointerArray& aArray, - const CArrayFixFlat* aIndicationStateArray, - const CArrayFixFlat* aDcsBits7To4Array, - const CArrayFixFlat* aIndicationTypeArray ); - RFs iFs; - RSocketServ *iSocketServer; - - TSmsServiceCenterAddress iTelephoneNumber; //Test SIM - TSmsServiceCenterAddress iServiceCenterNumber; //Radiolinja - - void WriteToSIML(RSocket& aSocket, const CSmsMessage& aMsg); - - CSmsStackTestUtils* iSmsStackTestUtils; - - virtual TVerdict doTestStepPreambleL(); - virtual TVerdict doTestStepPostambleL(); - -protected: - CSmsMessage *iSms; -}; - - -/** - Legacy base class. This was the original base class. It has a dependency with SmsStackTestUtils. - Its preamble and postamble steps create and destroy the socket server session and socket - subsession - This is limiting as it only allows one test step to execute within a session. - - The CSmsTestSteps was abstracted from this class. This has effectively removed this constraint. - The CSmsTestSteps share the socket session and subsession, which establishes re-usable test steps. -*/ -class CSmsPrtTestStep : public CSMSTestSteps -{ - -public: - virtual TVerdict doTestStepPreambleL(); - virtual TVerdict doTestStepPostambleL(); - void DoESockMemoryLeakTestL(); - -public: - CActiveScheduler* iScheduler; -}; - - /** * Test Step base case for all encoding tests. */ -class CSmsPrtEncodingTestStep : public CSmsPrtTestStep +class CSmsPrtEncodingTestStep : public CSmsBaseTestStep { public: virtual TVerdict doTestStepPreambleL();