epoc32/include/waptestutils.inl
branchSymbian3
changeset 4 837f303aceeb
parent 3 e1b950c65cb4
equal deleted inserted replaced
3:e1b950c65cb4 4:837f303aceeb
     1 // Copyright (c) 2000-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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 inline RTest& CWapTestHarness::Test()
       
    17 //
       
    18 //	Return iTest
       
    19 	{
       
    20 	return iTest;
       
    21 	}
       
    22 
       
    23 inline void CWapTestHarness::DoResourceLeakTest(TBool aValue)
       
    24 //
       
    25 // Turn on/off the resource handle leak test
       
    26 	{
       
    27 	iDoResourceLeakTest = aValue;
       
    28 	}
       
    29 
       
    30 inline void CWapTestHarness::DefaultLogFileName(TDes& aFileName)
       
    31 //
       
    32 //	Sets aFilename to "KLogsDir\LWapLogsDirName\<TEST HARNESS NAME>.<PLATFORM>.<VARIANT>.log"
       
    33 	{
       
    34 	aFileName.Copy(RProcess().FileName());
       
    35 	TInt start = aFileName.LocateReverse('\\');
       
    36 	TInt end = aFileName.LocateReverse('.');
       
    37 	aFileName = aFileName.Mid(start + 1, end - start - 1);
       
    38 
       
    39 	// create the log filename
       
    40 	aFileName.Insert(0, _L("\\"));
       
    41 	aFileName.Insert(0, KWapLogsDirName);
       
    42 	aFileName.Insert(0, KLogsDir);
       
    43 
       
    44 #if defined(__WINS__)
       
    45 	aFileName.Append(_L(".WINS."));
       
    46 #else
       
    47 	aFileName.Append(_L(".MARM."));
       
    48 #endif
       
    49 
       
    50 #if defined(_DEBUG)
       
    51 	aFileName.Append(_L("DEB."));
       
    52 #else
       
    53 	aFileName.Append(_L("REL."));
       
    54 #endif
       
    55 
       
    56 	aFileName.Append(_L("LOG"));
       
    57 	}
       
    58 
       
    59 inline void CWapTestHarness::WriteComment(const TDesC& aComment)
       
    60 //
       
    61 //	Writes aComment to test log file, logging file and test harness
       
    62 	{
       
    63 	if(aComment.Length() < (KMaxFileName - 2))
       
    64 		{
       
    65 		iTest.Printf(_L("%S\n"), &aComment);
       
    66 		iFlogger.Write(aComment);
       
    67 		}
       
    68 
       
    69 #if defined (__LOGGING)
       
    70 	__ASSERT_DEBUG(iLogPtr,Panic(EBadCLogPtr));
       
    71 	__LOG (aComment);
       
    72 #endif
       
    73 	}
       
    74 
       
    75 inline void CWapTestHarness::CreateFlogger(const TDesC& aFileName, TInt aShowDate, TInt aShowTime)
       
    76 //
       
    77 //	Create log file in directory KLogsdir\KWapLogsDirName - Note: ingore Drive and Path of aFilename
       
    78 	{
       
    79 	iFlogger.Connect();
       
    80 	TParse p;
       
    81 	p.Set(aFileName, NULL, NULL);
       
    82 	iFlogger.CreateLog(KWapLogsDirName, p.NameAndExt(), EFileLoggingModeOverwrite);
       
    83 	iFlogger.SetDateAndTime(aShowDate, aShowTime);
       
    84 	iFlogger.Write(KTestHeader);
       
    85 	}
       
    86 
       
    87 inline TPtr CWapTestHarness::CTestInfo::Name() const
       
    88 //
       
    89 //	Returns name
       
    90 	{
       
    91 	return iName->Des();
       
    92 	}
       
    93 
       
    94 inline TInt CWapTestHarness::CTestInfo::Number() const
       
    95 //
       
    96 //	Returns number
       
    97 	{
       
    98 	return iNumber;
       
    99 	}
       
   100 
       
   101 inline TInt CWapTestHarness::CTestInfo::ErrorCode() const
       
   102 //
       
   103 //	Returns errorcode
       
   104 	{
       
   105 	return iErrorCode;
       
   106 	}