systemhealthmanagement/systemhealthmgr/test/tsysmon/src/sysmontesthelper.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 31 Aug 2010 16:29:05 +0300
branchRCL_3
changeset 21 ccb4f6b3db21
parent 0 4e1aa6a622a0
child 22 8cb079868133
permissions -rw-r--r--
Revision: 201033 Kit: 201035

// Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
// All rights reserved.
// This component and the accompanying materials are made available
// under the terms of "Eclipse Public License v1.0"
// which accompanies this distribution, and is available
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
//
// Initial Contributors:
// Nokia Corporation - initial contribution.
//
// Contributors:
//
// Description:
//

/**
 @file
 @test
 @internalComponent - Internal Symbian test code   
*/

#ifndef __SYSMONTESTHELPER_H__
#define __SYSMONTESTHELPER_H__

#include <bacline.h> 		// Command line arguments parser
#include <sysmonclisess.h>	//SysMon Client
#include <startup.hrh>
#include <startupproperties.h>
#include <e32std.h>
#include <e32err.h>
#include <e32base.h>

#include <e32debug.h> 		// Debug output


_LIT(KFilenameDeregTimeout, "tsysmon_app_deregister.exe");
_LIT(KFilenameRegisterTwice1, "tsysmon_app_registertwice1proc.exe");
_LIT(KFilenameRegisterTwice2, "tsysmon_app_registertwice2procs.exe");
_LIT(KFilenameDoNothing, "tsysmon_app_donothing.exe");

_LIT(KResultsRoot, "C:\\testdata\\results\\");
_LIT(KResultsRootDereg, "C:\\testdata\\results\\dereg_");
_LIT(KRunCountsRoot, "C:\\testdata\\runcounts\\");
_LIT(KTxtExtension, ".txt");

_LIT(KRegisterCountFile, "C:\\Register_ResultFile.txt");
_LIT(KRestartCountFile, "C:\\Restart_ResultFile.txt");

const TInt KMaxTestIdLength = 20; // TestId is of the format APPFWK-SYSMON-00xx
const TUid KTestSysMon={0x200086A8};    // Category value to be used to define restart P&S key 

class CSysMonTestHelper : public CBase
	{
public:
	IMPORT_C static TRecoveryMethod StringToRecoveryMethodL(const TDesC& aRecoveryMethodString);
	IMPORT_C static void GetResultIntL(const TDesC& aTestId, TInt& aResult);
	IMPORT_C static void GetDeregResultIntL(const TDesC& aTestId, TInt& aResult);
	IMPORT_C static TInt ReadRunCountL(const TDesC& aProcessFilename);
	IMPORT_C static void IncrementRunCountL(const TDesC& aProcessFilename);
	IMPORT_C static TInt GetRestartCountL();
	IMPORT_C static TInt GetRegisterCount(TInt aKey);
	
	IMPORT_C static CSysMonTestHelper* NewLC();
	IMPORT_C static CSysMonTestHelper* NewL();
	IMPORT_C ~CSysMonTestHelper();
	
	IMPORT_C void GetRecoveryMethodArgsL(TRecoveryMethod& aRecoveryMethod, TInt& aRecoveryMode);
	IMPORT_C void GetTimeoutArgL(TInt& aTimeout);
	IMPORT_C void WriteResultL(const TInt& aResult);
	IMPORT_C void WriteDeregResultL(const TInt& aResult);
	IMPORT_C void GetTestId(TDes& aTestId);
	
	IMPORT_C void TestErrorcodeL(TInt& aErrorcode);
	
private:
	void ConstructL();
	CSysMonTestHelper();

private:
	TBufC<KMaxTestIdLength> iTestId; 
	CCommandLineArguments* iArgs;
	
	};
	
#endif  // __SYSMONTESTHELPER_H__