os/ossrv/genericservices/httputils/Test/IpuTestUtils/IpuTestUtils.inl
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 // Copyright (c) 2001-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 inline RTest& CIpuTestHarness::Test()
    17 //
    18 //	Return iTest
    19 	{
    20 	return iTest;
    21 	}
    22 
    23 inline void CIpuTestHarness::DoResourceLeakTest(TBool aValue)
    24 //
    25 // Turn on/off the resource handle leak test
    26 	{
    27 	iDoResourceLeakTest = aValue;
    28 	}
    29 
    30 inline void CIpuTestHarness::SetTestMode(TTestMode aTestMode)
    31 	{
    32 	iTestMode = aTestMode;
    33 	}
    34 
    35 inline void CIpuTestHarness::DefaultLogFileName(TDes& aFileName)
    36 //
    37 //	Sets aFilename to "KLogsDir\IpuLogsDirName\<TEST HARNESS NAME>.<PLATFORM>.<VARIANT>.log"
    38 	{
    39 	aFileName.Copy(RProcess().FileName());
    40 	TInt start = aFileName.LocateReverse('\\');
    41 	TInt end = aFileName.LocateReverse('.');
    42 	aFileName = aFileName.Mid(start + 1, end - start - 1);
    43 
    44 	// create the log filename
    45 	aFileName.Insert(0, _L("\\"));
    46 	aFileName.Insert(0, KInuLogsDirName);
    47 	aFileName.Insert(0, KLogsDir);
    48 
    49 #if defined(__WINS__)
    50 	aFileName.Append(_L(".WINS."));
    51 #else
    52 	aFileName.Append(_L(".MARM."));
    53 #endif
    54 
    55 #if defined(_DEBUG)
    56 	aFileName.Append(_L("DEB."));
    57 #else
    58 	aFileName.Append(_L("REL."));
    59 #endif
    60 
    61 	aFileName.Append(_L("LOG"));
    62 	}
    63 
    64 inline void CIpuTestHarness::WriteComment(const TDesC& aComment)
    65 //
    66 //	Writes aComment to test log file, logging file and test harness
    67 	{
    68 	if(aComment.Length() < (KMaxFileName - 2))
    69 		{
    70 		iTest.Printf(_L("%S\n"), &aComment);
    71 		iFlogger.Write(aComment);
    72 		}
    73 	}
    74 
    75 inline void CIpuTestHarness::CreateFlogger(const TDesC& aFileName, TInt aShowDate, TInt aShowTime)
    76 //
    77 //	Create log file in directory KLogsdir\KInuLogsDirName - Note: ingore Drive and Path of aFilename
    78 	{
    79 	iFlogger.Connect();
    80 	TParse p;
    81 	p.Set(aFileName, NULL, NULL);
    82 	iFlogger.CreateLog(KInuLogsDirName, p.NameAndExt(), EFileLoggingModeOverwrite);
    83 	iFlogger.SetDateAndTime(aShowDate, aShowTime);
    84 	iFlogger.Write(KTestHeader);
    85 	}
    86 
    87 inline TPtr CIpuTestHarness::CTestInfo::Name() const
    88 //
    89 //	Returns name
    90 	{
    91 	return iName->Des();
    92 	}
    93 
    94 inline TInt CIpuTestHarness::CTestInfo::Number() const
    95 //
    96 //	Returns number
    97 	{
    98 	return iNumber;
    99 	}
   100 
   101 inline TInt CIpuTestHarness::CTestInfo::ErrorCode() const
   102 //
   103 //	Returns errorcode
   104 	{
   105 	return iErrorCode;
   106 	}