epoc32/include/waptestutils.inl
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
     1.1 --- a/epoc32/include/waptestutils.inl	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/waptestutils.inl	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,106 @@
     1.4 -waptestutils.inl
     1.5 +// Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +// All rights reserved.
     1.7 +// This component and the accompanying materials are made available
     1.8 +// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     1.9 +// which accompanies this distribution, and is available
    1.10 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.11 +//
    1.12 +// Initial Contributors:
    1.13 +// Nokia Corporation - initial contribution.
    1.14 +//
    1.15 +// Contributors:
    1.16 +//
    1.17 +// Description:
    1.18 +//
    1.19 +
    1.20 +inline RTest& CWapTestHarness::Test()
    1.21 +//
    1.22 +//	Return iTest
    1.23 +	{
    1.24 +	return iTest;
    1.25 +	}
    1.26 +
    1.27 +inline void CWapTestHarness::DoResourceLeakTest(TBool aValue)
    1.28 +//
    1.29 +// Turn on/off the resource handle leak test
    1.30 +	{
    1.31 +	iDoResourceLeakTest = aValue;
    1.32 +	}
    1.33 +
    1.34 +inline void CWapTestHarness::DefaultLogFileName(TDes& aFileName)
    1.35 +//
    1.36 +//	Sets aFilename to "KLogsDir\LWapLogsDirName\<TEST HARNESS NAME>.<PLATFORM>.<VARIANT>.log"
    1.37 +	{
    1.38 +	aFileName.Copy(RProcess().FileName());
    1.39 +	TInt start = aFileName.LocateReverse('\\');
    1.40 +	TInt end = aFileName.LocateReverse('.');
    1.41 +	aFileName = aFileName.Mid(start + 1, end - start - 1);
    1.42 +
    1.43 +	// create the log filename
    1.44 +	aFileName.Insert(0, _L("\\"));
    1.45 +	aFileName.Insert(0, KWapLogsDirName);
    1.46 +	aFileName.Insert(0, KLogsDir);
    1.47 +
    1.48 +#if defined(__WINS__)
    1.49 +	aFileName.Append(_L(".WINS."));
    1.50 +#else
    1.51 +	aFileName.Append(_L(".MARM."));
    1.52 +#endif
    1.53 +
    1.54 +#if defined(_DEBUG)
    1.55 +	aFileName.Append(_L("DEB."));
    1.56 +#else
    1.57 +	aFileName.Append(_L("REL."));
    1.58 +#endif
    1.59 +
    1.60 +	aFileName.Append(_L("LOG"));
    1.61 +	}
    1.62 +
    1.63 +inline void CWapTestHarness::WriteComment(const TDesC& aComment)
    1.64 +//
    1.65 +//	Writes aComment to test log file, logging file and test harness
    1.66 +	{
    1.67 +	if(aComment.Length() < (KMaxFileName - 2))
    1.68 +		{
    1.69 +		iTest.Printf(_L("%S\n"), &aComment);
    1.70 +		iFlogger.Write(aComment);
    1.71 +		}
    1.72 +
    1.73 +#if defined (__LOGGING)
    1.74 +	__ASSERT_DEBUG(iLogPtr,Panic(EBadCLogPtr));
    1.75 +	__LOG (aComment);
    1.76 +#endif
    1.77 +	}
    1.78 +
    1.79 +inline void CWapTestHarness::CreateFlogger(const TDesC& aFileName, TInt aShowDate, TInt aShowTime)
    1.80 +//
    1.81 +//	Create log file in directory KLogsdir\KWapLogsDirName - Note: ingore Drive and Path of aFilename
    1.82 +	{
    1.83 +	iFlogger.Connect();
    1.84 +	TParse p;
    1.85 +	p.Set(aFileName, NULL, NULL);
    1.86 +	iFlogger.CreateLog(KWapLogsDirName, p.NameAndExt(), EFileLoggingModeOverwrite);
    1.87 +	iFlogger.SetDateAndTime(aShowDate, aShowTime);
    1.88 +	iFlogger.Write(KTestHeader);
    1.89 +	}
    1.90 +
    1.91 +inline TPtr CWapTestHarness::CTestInfo::Name() const
    1.92 +//
    1.93 +//	Returns name
    1.94 +	{
    1.95 +	return iName->Des();
    1.96 +	}
    1.97 +
    1.98 +inline TInt CWapTestHarness::CTestInfo::Number() const
    1.99 +//
   1.100 +//	Returns number
   1.101 +	{
   1.102 +	return iNumber;
   1.103 +	}
   1.104 +
   1.105 +inline TInt CWapTestHarness::CTestInfo::ErrorCode() const
   1.106 +//
   1.107 +//	Returns errorcode
   1.108 +	{
   1.109 +	return iErrorCode;
   1.110 +	}