datacommsserver/esockserver/test/TE_IPCTest/TestStepIPC.h
changeset 0 dfb7c4ff071f
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     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 // Contains declaration of CTestStepIPC class that is
       
    15 // base class for all test step classes in this test.
       
    16 // 
       
    17 //
       
    18 
       
    19 #if (!defined __TESTSTEPIPC_H__)
       
    20 #define __TESTSTEPIPC_H__
       
    21 #include <in_sock.h>
       
    22 #include <test/testexecutestepbase.h>
       
    23 
       
    24 
       
    25 class CTestStepIPC : public CTestStep
       
    26 	{
       
    27 	public:
       
    28 		CTestStepIPC();
       
    29 		~CTestStepIPC();
       
    30 		enum TVerdict doTestStepL();
       
    31 		//	CTestSuiteIPC * iEsockSuite;// Pointer to the suite which owns this test
       
    32 	protected:
       
    33 		virtual enum TVerdict InternalDoTestStepL() = 0;
       
    34 		static TInt OptimalConnect(RSocketServ& aSrv);
       
    35 		TBufC<12> iProt;	 //Will contain protocol name: "IPC stream"
       
    36 		
       
    37 	};
       
    38 
       
    39 class CIPCTestStep_OOMCapable : public CTestStepIPC
       
    40 	{
       
    41 public:
       
    42 	~CIPCTestStep_OOMCapable()
       
    43 		{
       
    44 		iOOMSess.Close();
       
    45 		}
       
    46 		
       
    47 	void SetHeapFailNext(TInt aFailureIndex)
       
    48 		{
       
    49 		if(iOOMSess.Handle() == KNullHandle)
       
    50 			{
       
    51 			iOOMSess.Connect();
       
    52 			}
       
    53 		if(iOOMSess.Handle() != KNullHandle)
       
    54 			{
       
    55 			iOOMSess.__DbgFailNext(aFailureIndex - 1);	// want to start with 0th
       
    56 			}
       
    57 		}
       
    58 		
       
    59 	void ResetHeapFailNext()
       
    60 		{
       
    61 		if(iOOMSess.Handle() != KNullHandle)
       
    62 			{
       
    63 			iOOMSess.__DbgFailNext(-1);
       
    64 			}
       
    65 		}
       
    66 		
       
    67 	TBool CheckForHeapFailNext()
       
    68 		{
       
    69 		if(iOOMSess.Handle() != KNullHandle)
       
    70 			{
       
    71 			// If ESOCK heaps are still in FailNext mode then we try to flag the termination
       
    72 			// of the loop to TEF by setting the local heap to fail. Because this might get
       
    73 			// "eaten" inside TEF before it checks we walk a failure point here too
       
    74 			return iOOMSess.__DbgCheckFailNext();
       
    75 			}
       
    76 		return ETrue;
       
    77 		}
       
    78 	
       
    79 	virtual enum TVerdict InternalDoTestStepL() =0;
       
    80 private:
       
    81 	RSocketServ iOOMSess;
       
    82 	};
       
    83 
       
    84 
       
    85 #endif /* __TESTSTEPIPC_H__ */
       
    86