systemhealthmanagement/systemhealthmgr/test/tsysmon/src/tsysmon_step_run_count_check.cpp
changeset 0 4e1aa6a622a0
child 52 d6b9e89d80a3
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 /**
       
    17  @file
       
    18  @test
       
    19  @internalComponent - Internal Symbian test code   
       
    20 */
       
    21 
       
    22 #include "tsysmon_step_run_count_check.h"
       
    23 #include "tsysmon_server_defs.h"
       
    24 
       
    25 CRunCountCheckStep::~CRunCountCheckStep()
       
    26 	{
       
    27 	}
       
    28 
       
    29 CRunCountCheckStep::CRunCountCheckStep()
       
    30 	{
       
    31 	SetTestStepName(KRunCountCheckStep);
       
    32 	}
       
    33 
       
    34 TVerdict CRunCountCheckStep::doTestStepL()
       
    35 	{
       
    36 	TPtrC filename;
       
    37 	TInt expectedRunCount = 0;
       
    38 	TInt expectedRegisterCount = 0;
       
    39 	TInt expectedRestartCount = 0;
       
    40 	if (!GetStringFromConfig(ConfigSection(), KTSysMonServerFilename, filename) ||
       
    41 		!GetIntFromConfig(ConfigSection(), KTSysMonServerExpectedRunCount, expectedRunCount) ||
       
    42 		!GetIntFromConfig(ConfigSection(), KTSysMonServerExpectedRegisterCount, expectedRegisterCount) ||
       
    43 		!GetIntFromConfig(ConfigSection(), KTSysMonServerExpectedRestartCount, expectedRestartCount))
       
    44 		{
       
    45 		ERR_PRINTF1(_L("Error reading ini file data"));
       
    46 		User::Leave(KErrNotFound);
       
    47 		}
       
    48 
       
    49 
       
    50 	TInt actualRunCount = 0;
       
    51 	TInt actualRegisterCount = 0;
       
    52 	TInt actualRestartCount = 0;
       
    53 	actualRunCount = CSysMonTestHelper::ReadRunCountL(filename);
       
    54 	actualRegisterCount = CSysMonTestHelper::GetRegisterCountL();
       
    55 	actualRestartCount = CSysMonTestHelper::GetRestartCountL();
       
    56 
       
    57 	INFO_PRINTF2(_L("Actual run count: %d"), actualRunCount);
       
    58 	TEST(actualRunCount == expectedRunCount);
       
    59 	INFO_PRINTF2(_L("Actual register count: %d"), actualRegisterCount);
       
    60 	TEST(actualRegisterCount == expectedRegisterCount);
       
    61 	INFO_PRINTF2(_L("Actual restart count: %d"), actualRestartCount);
       
    62 	TEST(actualRestartCount == expectedRestartCount);
       
    63 	
       
    64 	return TestStepResult();
       
    65 	}