messagingappbase/smsmtm/test/inc/t_smsdetails.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) 2004-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 __T_SMSDETAILS_H__
       
    17 #define __T_SMSDETAILS_H__
       
    18 
       
    19 #include <e32base.h>
       
    20 #include <msvapi.h>
       
    21 #include <es_sock.h>
       
    22 //#include <logwrap.h>
       
    23 
       
    24 class CSmsTestUtils;
       
    25 class CSmsClientMtm;
       
    26 class CSmsSettings;
       
    27 class CSmsHeader;
       
    28 class CTestUtilsWatcherStarter;
       
    29 class CTestDetailsBase;
       
    30 
       
    31 class MTestObserver
       
    32 	{
       
    33 public:
       
    34 
       
    35 	virtual void TestFailed() =0;
       
    36 	virtual void TestPassed() =0;
       
    37 	
       
    38 	};
       
    39 
       
    40 class CTestEngine : public CBase,
       
    41 					public MTestObserver
       
    42 					
       
    43 	{
       
    44 public:		// methods
       
    45 
       
    46 	static CTestEngine* NewL();
       
    47 	virtual ~CTestEngine();
       
    48 	void DoTestsL();
       
    49 	
       
    50 private:	// methods from MTestObserver
       
    51 
       
    52 	virtual void TestFailed();
       
    53 	virtual void TestPassed();
       
    54 	
       
    55 private:	// methods
       
    56 
       
    57 	CTestEngine();
       
    58 	void ConstructL();
       
    59 	
       
    60 	void RunTestCaseL(CTestDetailsBase& aTestCase);
       
    61 	
       
    62 	TBool WatchersAlreadyRunningL();
       
    63 	void StartWatcherL();
       
    64 
       
    65 private:	// attributes
       
    66 
       
    67 	CSmsTestUtils*				iTestUtils;
       
    68 	CTestUtilsWatcherStarter*	iWatchers;
       
    69 	RSocketServ 	iSocketServ;
       
    70 	RSocket 		iSocket;
       
    71 	
       
    72 	TInt			iTestFailCount;
       
    73 	};
       
    74 	
       
    75 class CTestDetailsBase : public CActive,
       
    76 						 public MMsvEntryObserver
       
    77 	{
       
    78 public:
       
    79 
       
    80 	virtual ~CTestDetailsBase();
       
    81 	void Start();
       
    82 	
       
    83 private:	// methods from CActive
       
    84 
       
    85 	virtual void RunL();
       
    86 	virtual void DoCancel();
       
    87 	virtual TInt RunError(TInt aError);
       
    88 	
       
    89 private:	// methods from MMsvEntryObserver
       
    90 
       
    91 	virtual void HandleEntryEventL(TMsvEntryEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3);
       
    92 
       
    93 protected:
       
    94 
       
    95 	CTestDetailsBase(CSmsTestUtils& aTestUtils, MTestObserver& aObserver);
       
    96 	void ConstructL();
       
    97 
       
    98 	void CompleteSelf();
       
    99 	void ClearFoldersL();
       
   100 	void Test(TBool aTest);
       
   101 	void CreateMessageL();
       
   102 	void SendMessageL();
       
   103 	
       
   104 	CMsvSession& Session();
       
   105 	CMsvEntry& MsvEntry();
       
   106 	CSmsClientMtm& Client();
       
   107 	CSmsSettings& ServiceSettings();
       
   108 	
       
   109 protected:
       
   110 
       
   111 	CSmsTestUtils&	iTestUtils;
       
   112 	MTestObserver&	iObserver;
       
   113 	CMsvEntry*		iEntryForObserver;
       
   114 	CMsvOperation*	iOperation;
       
   115 	TMsvId			iMessageId;
       
   116 
       
   117 private:
       
   118 
       
   119 	void ChangeServiceSettingsL();
       
   120 	void SetRecipientsL(CSmsHeader& aHeader);
       
   121 
       
   122 	virtual void CheckReceivedMessageL(TMsvId aMessageId) =0;
       
   123 	virtual const TDesC& TestName() =0;
       
   124 
       
   125 private:
       
   126 
       
   127 	enum TSendTestState
       
   128 		{
       
   129 		EClearFolders,
       
   130 		EChangeServiceSettings,
       
   131 		ECreateMessage,
       
   132 		ESendMessage,
       
   133 		EMessageSent,
       
   134 		EPendingReceivedMessage,
       
   135 		EDone
       
   136 		};			
       
   137 	
       
   138 private:
       
   139 	
       
   140 	TSendTestState	iState;
       
   141 	};
       
   142 	
       
   143 class CTestReceiveDetails_1 : public CTestDetailsBase
       
   144 	{
       
   145 public:
       
   146 
       
   147 	static CTestReceiveDetails_1* NewL(CSmsTestUtils& aTestUtils, MTestObserver& aObserver);
       
   148 	virtual ~CTestReceiveDetails_1();
       
   149 	
       
   150 private:	// methods from CTestSendBase
       
   151 
       
   152 	virtual void CheckReceivedMessageL(TMsvId aMessageId);
       
   153 	virtual const TDesC& TestName();
       
   154 
       
   155 private:
       
   156 	
       
   157 	CTestReceiveDetails_1(CSmsTestUtils& aTestUtils, MTestObserver& aObserver);
       
   158 
       
   159 	};
       
   160 	
       
   161 class CTestReceiveDetails_2 : public CTestDetailsBase
       
   162 	{
       
   163 public:
       
   164 
       
   165 	static CTestReceiveDetails_2* NewL(CSmsTestUtils& aTestUtils, MTestObserver& aObserver);
       
   166 	virtual ~CTestReceiveDetails_2();
       
   167 	
       
   168 private:	// methods from CTestSendBase
       
   169 
       
   170 	virtual void CheckReceivedMessageL(TMsvId aMessageId);
       
   171 	virtual const TDesC& TestName();
       
   172 
       
   173 private:
       
   174 	
       
   175 	CTestReceiveDetails_2(CSmsTestUtils& aTestUtils, MTestObserver& aObserver);
       
   176 	void ConstructL();
       
   177 
       
   178 	};
       
   179 	
       
   180 class CTestReceiveDetails_3 : public CTestDetailsBase
       
   181 	{
       
   182 public:
       
   183 
       
   184 	static CTestReceiveDetails_3* NewL(CSmsTestUtils& aTestUtils, MTestObserver& aObserver);
       
   185 	virtual ~CTestReceiveDetails_3();
       
   186 	
       
   187 private:	// methods from CTestSendBase
       
   188 
       
   189 	virtual void CheckReceivedMessageL(TMsvId aMessageId);
       
   190 	virtual const TDesC& TestName();
       
   191 
       
   192 private:
       
   193 	
       
   194 	CTestReceiveDetails_3(CSmsTestUtils& aTestUtils, MTestObserver& aObserver);
       
   195 	void ConstructL();
       
   196 	
       
   197 	};
       
   198 	
       
   199 #endif