os/ossrv/genericservices/httputils/Test/IpuTestUtils/IpuTestUtils.inl
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/genericservices/httputils/Test/IpuTestUtils/IpuTestUtils.inl	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,106 @@
     1.4 +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +inline RTest& CIpuTestHarness::Test()
    1.20 +//
    1.21 +//	Return iTest
    1.22 +	{
    1.23 +	return iTest;
    1.24 +	}
    1.25 +
    1.26 +inline void CIpuTestHarness::DoResourceLeakTest(TBool aValue)
    1.27 +//
    1.28 +// Turn on/off the resource handle leak test
    1.29 +	{
    1.30 +	iDoResourceLeakTest = aValue;
    1.31 +	}
    1.32 +
    1.33 +inline void CIpuTestHarness::SetTestMode(TTestMode aTestMode)
    1.34 +	{
    1.35 +	iTestMode = aTestMode;
    1.36 +	}
    1.37 +
    1.38 +inline void CIpuTestHarness::DefaultLogFileName(TDes& aFileName)
    1.39 +//
    1.40 +//	Sets aFilename to "KLogsDir\IpuLogsDirName\<TEST HARNESS NAME>.<PLATFORM>.<VARIANT>.log"
    1.41 +	{
    1.42 +	aFileName.Copy(RProcess().FileName());
    1.43 +	TInt start = aFileName.LocateReverse('\\');
    1.44 +	TInt end = aFileName.LocateReverse('.');
    1.45 +	aFileName = aFileName.Mid(start + 1, end - start - 1);
    1.46 +
    1.47 +	// create the log filename
    1.48 +	aFileName.Insert(0, _L("\\"));
    1.49 +	aFileName.Insert(0, KInuLogsDirName);
    1.50 +	aFileName.Insert(0, KLogsDir);
    1.51 +
    1.52 +#if defined(__WINS__)
    1.53 +	aFileName.Append(_L(".WINS."));
    1.54 +#else
    1.55 +	aFileName.Append(_L(".MARM."));
    1.56 +#endif
    1.57 +
    1.58 +#if defined(_DEBUG)
    1.59 +	aFileName.Append(_L("DEB."));
    1.60 +#else
    1.61 +	aFileName.Append(_L("REL."));
    1.62 +#endif
    1.63 +
    1.64 +	aFileName.Append(_L("LOG"));
    1.65 +	}
    1.66 +
    1.67 +inline void CIpuTestHarness::WriteComment(const TDesC& aComment)
    1.68 +//
    1.69 +//	Writes aComment to test log file, logging file and test harness
    1.70 +	{
    1.71 +	if(aComment.Length() < (KMaxFileName - 2))
    1.72 +		{
    1.73 +		iTest.Printf(_L("%S\n"), &aComment);
    1.74 +		iFlogger.Write(aComment);
    1.75 +		}
    1.76 +	}
    1.77 +
    1.78 +inline void CIpuTestHarness::CreateFlogger(const TDesC& aFileName, TInt aShowDate, TInt aShowTime)
    1.79 +//
    1.80 +//	Create log file in directory KLogsdir\KInuLogsDirName - Note: ingore Drive and Path of aFilename
    1.81 +	{
    1.82 +	iFlogger.Connect();
    1.83 +	TParse p;
    1.84 +	p.Set(aFileName, NULL, NULL);
    1.85 +	iFlogger.CreateLog(KInuLogsDirName, p.NameAndExt(), EFileLoggingModeOverwrite);
    1.86 +	iFlogger.SetDateAndTime(aShowDate, aShowTime);
    1.87 +	iFlogger.Write(KTestHeader);
    1.88 +	}
    1.89 +
    1.90 +inline TPtr CIpuTestHarness::CTestInfo::Name() const
    1.91 +//
    1.92 +//	Returns name
    1.93 +	{
    1.94 +	return iName->Des();
    1.95 +	}
    1.96 +
    1.97 +inline TInt CIpuTestHarness::CTestInfo::Number() const
    1.98 +//
    1.99 +//	Returns number
   1.100 +	{
   1.101 +	return iNumber;
   1.102 +	}
   1.103 +
   1.104 +inline TInt CIpuTestHarness::CTestInfo::ErrorCode() const
   1.105 +//
   1.106 +//	Returns errorcode
   1.107 +	{
   1.108 +	return iErrorCode;
   1.109 +	}