datacommsserver/esockserver/test/TE_ESockSSA/src/TestStepESockSSA.h
changeset 0 dfb7c4ff071f
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     1 // Copyright (c) 2005-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 CTestStepESockSSA class that is
       
    15 // base class for all test step classes in this test.
       
    16 // 
       
    17 //
       
    18 
       
    19 #if !defined(SYMBIAN_NETWORKING_ESOCKTEST_TESTSTEPESOCKSSA_H_)
       
    20 #define SYMBIAN_NETWORKING_ESOCKTEST_TESTSTEPESOCKSSA_H_
       
    21 
       
    22 #include <test/testexecutestepbase.h>
       
    23 
       
    24 
       
    25 // Relies upon no competing use of the thread semaphore, ie no request completions/AOs
       
    26 class RMultipleWait : public RFastLock
       
    27 	{
       
    28 public:
       
    29 	RMultipleWait(TInt aInitialCount);
       
    30 	void Close();
       
    31 	void Signal(TInt aDelta);
       
    32 	void Wait();
       
    33 
       
    34 	typedef RFastLock inherited;
       
    35 private:
       
    36 	TInt iCount;
       
    37 	RThread iOwnerThread;
       
    38 	};
       
    39 
       
    40 
       
    41 class CTestStepESockSSA : public CTestStep
       
    42 	{
       
    43 public:
       
    44 	enum { KBlockedRequestIssueDelay = 1000000, KBlockedRequestCompletionDelay = 1000000 };
       
    45 
       
    46 	CTestStepESockSSA();
       
    47 	~CTestStepESockSSA();
       
    48 	
       
    49 	virtual TVerdict doTestStepPreambleL();
       
    50 	virtual TVerdict doTestStepPostambleL();
       
    51 
       
    52 protected:
       
    53 	class TDataThreadControl
       
    54 		{
       
    55 	public:
       
    56 		TDataThreadControl(RMultipleWait& aBlockSemaphore, TInt aExpectedResult)
       
    57 		: iBlockSemaphore(aBlockSemaphore),
       
    58 		  iExpectedResult(aExpectedResult)
       
    59 			{
       
    60 			}
       
    61 	public:
       
    62 		enum TRequestType
       
    63 			{ 
       
    64 			ESocketOpen, 
       
    65 			EHostResolverOpen,
       
    66 			EHostResolverOpenMulti,
       
    67 			EServiceResolverOpen, 
       
    68 			ENetDBOpen, 
       
    69 			ENumProtocols, 
       
    70 			EGetProtocolInfo,
       
    71 			EFindProtocol
       
    72 			};
       
    73 		TRequestType iRequest;
       
    74 		RMultipleWait& iBlockSemaphore;
       
    75 		TBool iBlocked;
       
    76 		TInt iResult;
       
    77 		TInt iExpectedResult;
       
    78 		RThread iThread;
       
    79 		RSocketServ iSession;
       
    80 		};
       
    81 
       
    82 	typedef TInt (*TDataThreadEntryPt)(TDataThreadControl&);
       
    83 protected:
       
    84 	void SetDummyBlocking();
       
    85 	void ClearDummyBlocking();
       
    86 
       
    87 	TInt CreateDataThread(TDataThreadControl::TRequestType aRequest, TDataThreadControl& aControl);
       
    88 	TVerdict WaitForDataThreadsToBlock(TDataThreadControl* aThreads, TInt aNumThreads);
       
    89 	TVerdict WaitForDataThreadsToComplete(TDataThreadControl* aThreads, TInt aNumThreads);
       
    90 
       
    91 	static TInt DataThreadEntry(TDataThreadControl& aControl);
       
    92 private:
       
    93 	static void DoDataThreadL(TDataThreadControl& aControl);
       
    94 	void UnloadBlockerL();
       
    95 	void KillC32Start();
       
    96 	};
       
    97 	
       
    98 #endif /* SYMBIAN_NETWORKING_ESOCKTEST_TESTSTEPESOCKSSA_H_ */
       
    99