imagingandcamerafws/imagingunittest/tsu_icl_mediasvr/src/TMDATEST.H
changeset 0 40261b775718
equal deleted inserted replaced
-1:000000000000 0:40261b775718
       
     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 #ifndef __TMDATEST_H__
       
    17 #define __TMDATEST_H__
       
    18 
       
    19 #ifndef __MDA_CLIENT_RESOURCE_H__
       
    20 #include <mda/client/resource.h>
       
    21 #endif 
       
    22 #ifndef __MDA_CLIENT_VIDEO_H__
       
    23 #include <mda/client/video.h>
       
    24 #endif
       
    25 #ifndef __MDAIMAGECONVERTER_H__
       
    26 #include <mdaimageconverter.h>
       
    27 #endif
       
    28 
       
    29 class CStressTestMonitor : public CBase
       
    30 	{
       
    31 public:
       
    32 	void IncActiveCount();
       
    33 	void DecActiveCount();
       
    34 	void SetError(TInt aError);
       
    35 	TInt Error();
       
    36 private:
       
    37 	TInt iActiveCount;
       
    38 	TInt iError;
       
    39 	};
       
    40 
       
    41 
       
    42 class CStressTestActive : public CActive
       
    43 	{
       
    44 public:
       
    45 	inline CStressTestActive(CStressTestMonitor& aMonitor) : CActive(EPriorityStandard), iMonitor(&aMonitor) { aMonitor.IncActiveCount(); }
       
    46 	~CStressTestActive();
       
    47 protected:
       
    48 	// From CActive
       
    49 	TInt RunError(TInt aError);
       
    50 	void SetPending();
       
    51 
       
    52 protected:
       
    53 	CStressTestMonitor* iMonitor;
       
    54 	};
       
    55 
       
    56 
       
    57 class CImageUtil : public CStressTestActive, public MMdaImageUtilObserver
       
    58 	{
       
    59 public:
       
    60 	CImageUtil(CStressTestMonitor& aMonitor);
       
    61 private:
       
    62 	virtual void MiuoCreateComplete(TInt aError);
       
    63 	virtual void MiuoOpenComplete(TInt aError);
       
    64 	virtual void MiuoConvertComplete(TInt aError);
       
    65 	virtual void Complete(TInt aError);
       
    66 	};
       
    67 
       
    68 
       
    69 class CImageLoadUtil : public CImageUtil
       
    70 	{
       
    71 public:
       
    72 	static CImageLoadUtil* NewL(CStressTestMonitor& aMonitor,const TDesC& aFileName,const TDisplayMode aDisplayMode);
       
    73 	~CImageLoadUtil();
       
    74 private:
       
    75 	inline CImageLoadUtil(CStressTestMonitor& aMonitor) : CImageUtil(aMonitor) {};
       
    76 	void RunL();
       
    77 	void DoCancel();
       
    78 private:
       
    79 	TBuf<256> iMessage;
       
    80 	TDisplayMode iDisplayMode;
       
    81 	CFbsBitmap* iBitmap;
       
    82 	CMdaImageFileToBitmapUtility* iMdaUtil;
       
    83 	TInt iState;
       
    84 	};
       
    85 
       
    86 class CMdaStressTestThread : public CBase
       
    87 	{
       
    88 public:
       
    89 	RThread	iThread;
       
    90 	TSglQueLink iLink;
       
    91 	TInt iId;
       
    92 	};
       
    93 
       
    94 
       
    95 class TMdaStressParam
       
    96 	{
       
    97 public:
       
    98 	TInt iId;
       
    99 	TFileName iDefaultPath;
       
   100 	};
       
   101 
       
   102 class CMdaStressTest
       
   103 	{
       
   104 public:
       
   105 	CMdaStressTest();
       
   106 	virtual ~CMdaStressTest();
       
   107 	enum TTestThreadId
       
   108 		{
       
   109 		ELoadImages1,
       
   110 		ELoadImages2,
       
   111 		ENumTestThreads
       
   112 		};
       
   113 
       
   114 	virtual void DoTestL(const TDesC& aDefaultPath);
       
   115 private:
       
   116 	void StartTestThreadL(TMdaStressParam& aParam);
       
   117 	void DeleteTestThread(CMdaStressTestThread* thread);
       
   118 	inline TUint Random(TUint16 aMaxValue);
       
   119 private:
       
   120 	TInt iThreadNameCount;
       
   121 	TSglQue<CMdaStressTestThread> iThreadList;
       
   122 	TSglQueIter<CMdaStressTestThread> iThreadIter;
       
   123 	TUint iRandomSeed;
       
   124 	
       
   125 	TMdaStressParam iParam[ENumTestThreads];
       
   126 	};
       
   127 
       
   128 const TInt KRandomSeed = 69069;
       
   129 
       
   130 inline TUint CMdaStressTest::Random(TUint16 aMaxValue) 
       
   131 	{ 
       
   132 	iRandomSeed *= KRandomSeed;
       
   133 	return ((iRandomSeed>>16)*aMaxValue)>>16; 
       
   134 	}
       
   135 
       
   136 #endif // __TMDATEST_H__
       
   137