messagingappbase/smsmtm/test/inc/T_smcmsimtsytest.h
changeset 25 84d9eb65b26f
parent 23 238255e8b033
child 27 e4592d119491
child 37 518b245aa84c
child 79 2981cb3aa489
equal deleted inserted replaced
23:238255e8b033 25:84d9eb65b26f
     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 #include <smstestbase.h>
       
    17 
       
    18 class CAutoTest;
       
    19 
       
    20 class CMessageSendStates : public CBase
       
    21 	{
       
    22 	public:
       
    23 		static CMessageSendStates* NewLC(TMsvId aId);
       
    24 		static CMessageSendStates* NewL(TMsvId aId);
       
    25 		~CMessageSendStates();
       
    26 
       
    27 	private:
       
    28 		CMessageSendStates(TMsvId aId);
       
    29 		void ConstructL();
       
    30 
       
    31 	public:
       
    32 		TMsvId iId;
       
    33 		RArray<TInt> iStates;
       
    34 	};
       
    35 
       
    36 class RMessageSendStatesArray : public RPointerArray<CMessageSendStates>
       
    37 	{
       
    38 	public:
       
    39 		RMessageSendStatesArray();
       
    40 		TInt Find(TMsvId aId) const;
       
    41 		void CopyInSelectionL(const CMsvEntrySelection& aSelection);
       
    42 	};
       
    43 
       
    44 
       
    45 class CSmcmSendTest : public CActive, MMsvSessionObserver
       
    46 	{
       
    47 public:
       
    48 	static CSmcmSendTest* NewLC(CAutoTest& aAutoTest, CSmsTestUtils& aSmsTest, const TDesC& aScriptFile, TInt aExpectedError = KErrNone, TInt aPriority = EPriorityStandard);
       
    49 	~CSmcmSendTest();
       
    50 
       
    51 	void TestSendingL(TRequestStatus& aStatus);
       
    52 	void TestSchedulingL(TRequestStatus& aStatus);
       
    53 	void TestReceiveClass2L(TInt aTestNumber, TRequestStatus& aStatus);
       
    54 
       
    55 private:
       
    56 	CSmcmSendTest(CAutoTest& aAutoTest, CSmsTestUtils& aSmsTest, const TDesC& aScriptFile, TInt aExpectedError, TInt aPriority = EPriorityStandard);
       
    57 	void ConstructL();
       
    58 
       
    59 	void RunL();
       
    60 	void DoCancel();
       
    61 	
       
    62 	void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3);
       
    63 
       
    64 	void DoRunSendingL();
       
    65 	void DoRunSchedulingL();
       
    66 
       
    67 	CMsvSession& Session()	{return *iSmsTest.iMsvSession;}
       
    68 	CMsvEntry& MsvEntry()	{return *iSmsTest.iMsvEntry;}
       
    69 	CSmsClientMtm& Client()	{return *iSmsTest.iSmsClientMtm;}
       
    70 
       
    71 	void Queue(TRequestStatus& aStatus);
       
    72 	void Complete(TInt aError);
       
    73 	TInt RunError(TInt aError);
       
    74 
       
    75 	TBool CheckSendingStates(const RMessageSendStatesArray& sendStateArray);
       
    76 	void PrintSendingStates(const RMessageSendStatesArray& sendStateArray);
       
    77 
       
    78 	TBool CheckParentOfReceivedMessageL(const CMsvEntrySelection& aSelection);
       
    79 	void SetMessagesToReceiveL(TInt aTestNumber);
       
    80 
       
    81 	TBool CheckWatchersStartedL();
       
    82 
       
    83 	enum TSmsSendTestState
       
    84 		{
       
    85 		EStateWaiting,
       
    86 		EStateSending,
       
    87 		EStateScheduling,
       
    88 		EStateSchedulingThenSend,
       
    89 		EStateOther,
       
    90 		EStateTestReceiveClass2
       
    91 		} iState;
       
    92 
       
    93 	TRequestStatus* iReport;					//< A request status
       
    94 	CAutoTest& iAutoTest;						//< An auto test
       
    95 
       
    96 	CMsvOperation* iOperation;
       
    97 	CMsvEntrySelection* iSelection;
       
    98 	CTestTimer* iTimer;
       
    99 
       
   100 	TFileName iScriptFile;
       
   101 	CSmsTestUtils& iSmsTest;
       
   102 
       
   103 	RMessageSendStatesArray iCurrentMessages;
       
   104 	TInt iMessagesToReceive;
       
   105 	TInt iMessagesReceived;
       
   106 	CSmsSettings* iSmsSettings;
       
   107 	CTestUtilsWatcherStarter* iWatcherStarter;
       
   108 	TInt iExpectedError;
       
   109 	};
       
   110