resourcemgmt/hwresourcesmgr/test/multiclient/mctest_f/mctest_f.cpp
changeset 0 4e1aa6a622a0
child 21 ccb4f6b3db21
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 // Copyright (c) 2007-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 #include "mctest_f.h"
       
    17 #include <e32cons.h>
       
    18 
       
    19 _LIT(KLogFile,"C:\\logs\\mctest_f.log");
       
    20 _LIT8(KCrLf,"\r\n");
       
    21 _LIT8(KRTest,"RTEST:");
       
    22 
       
    23 CHwrmMcTest_F* CHwrmMcTest_F::NewL(CConsoleBase& aConsole)
       
    24 	{
       
    25 	CHwrmMcTest_F* self = NewLC(aConsole);
       
    26 	CleanupStack::Pop(self);
       
    27 	return self;
       
    28 	}
       
    29 
       
    30 CHwrmMcTest_F* CHwrmMcTest_F::NewLC(CConsoleBase& aConsole)
       
    31 	{
       
    32 	CHwrmMcTest_F* self = new (ELeave) CHwrmMcTest_F(aConsole);
       
    33 	CleanupStack::PushL(self);
       
    34 	self->ConstructL();
       
    35 	return self;
       
    36 	}
       
    37 
       
    38 CHwrmMcTest_F::CHwrmMcTest_F(CConsoleBase& aConsole)
       
    39 :	iConsole(aConsole)
       
    40 	{
       
    41 	}
       
    42 		
       
    43 void CHwrmMcTest_F::ConstructL()
       
    44 	{
       
    45 	User::LeaveIfError(iFs.Connect());
       
    46 	iLogStream.Replace(iFs,KLogFile,EFileWrite | EFileShareReadersOrWriters | EFileStreamText);
       
    47 
       
    48 	iTestController = CHwrmTestCaseController::NewL(*this);
       
    49 	}
       
    50 	
       
    51 CHwrmMcTest_F::~CHwrmMcTest_F()
       
    52 	{
       
    53 	delete iTestController;
       
    54 	iLogStream.Close();
       
    55 	iFs.Close();
       
    56 	}
       
    57 	
       
    58 void CHwrmMcTest_F::RunMulticlientTestCases()
       
    59 	{
       
    60 	iTestController->RunMulticlientTestCases();
       
    61 	}
       
    62 	
       
    63 void CHwrmMcTest_F::InfoMessage(const TDesC& aMessage)
       
    64 	{
       
    65 	iConsole.Printf(aMessage);
       
    66 	iConsole.Printf(_L("\r\n"));
       
    67 	}
       
    68 	
       
    69 void CHwrmMcTest_F::LogMessage(const TDesC& aMessage)
       
    70 	{
       
    71 	HBufC8* buf = HBufC8::NewLC(aMessage.Length());
       
    72 	buf->Des().Copy(aMessage);
       
    73 	iLogStream.WriteL(KRTest);
       
    74 	iLogStream.WriteL(*buf);
       
    75 	iLogStream.WriteL(KCrLf);
       
    76 	iLogStream.CommitL();
       
    77 	CleanupStack::PopAndDestroy(buf);
       
    78 	}
       
    79 
       
    80 void CHwrmMcTest_F::DebugMessage(const TDesC& /*aMessage*/)
       
    81 	{
       
    82 	}