systemhealthmanagement/systemhealthmgr/test/tsysmon/src/tsysmon_app_failcount2failwait.cpp
branchRCL_3
changeset 21 ccb4f6b3db21
parent 0 4e1aa6a622a0
child 22 8cb079868133
equal deleted inserted replaced
20:1ddbe54d0645 21:ccb4f6b3db21
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    18  @test
    18  @test
    19  @internalComponent - Internal Symbian test code   
    19  @internalComponent - Internal Symbian test code   
    20 */
    20 */
    21 
    21 
    22 #include "sysmontesthelper.h"
    22 #include "sysmontesthelper.h"
       
    23 #include <e32property.h>
    23 
    24 
       
    25 const TUint32 KRestartExeCount = 38;
    24 
    26 
    25 TInt MainL()
    27 TInt MainL()
    26 	{
    28 	{
    27 	RDebug::Print(_L("appfwk-sysmon-0038: MainL"));
    29 	RDebug::Print(_L("appfwk-sysmon-0038: MainL"));
    28 
    30 	
       
    31 	TInt err = RProperty::Define(KTestSysMon, KRestartExeCount, RProperty::EInt);
       
    32     RDebug::Printf("Defining P&S key with key %d returns with err %d", err, KRestartExeCount);
    29 	TInt runCount = 0;
    33 	TInt runCount = 0;
    30     CCommandLineArguments* args = CCommandLineArguments::NewLC();
    34     CCommandLineArguments* args = CCommandLineArguments::NewLC();
    31     runCount = CSysMonTestHelper::ReadRunCountL(args->Arg(0));
    35     runCount = CSysMonTestHelper::ReadRunCountL(args->Arg(0));
    32 	CSysMonTestHelper::IncrementRunCountL(args->Arg(0));
    36 	CSysMonTestHelper::IncrementRunCountL(args->Arg(0));
    33     CleanupStack::PopAndDestroy(args);
    37     CleanupStack::PopAndDestroy(args);
    41 			RSysMonSession sysmon;
    45 			RSysMonSession sysmon;
    42 			sysmon.OpenL();
    46 			sysmon.OpenL();
    43 			CleanupClosePushL(sysmon);
    47 			CleanupClosePushL(sysmon);
    44 			TTime time1();
    48 			TTime time1();
    45 
    49 
    46 			CStartupProperties* props = CStartupProperties::NewLC(_L("tsysmon_app_failcount2failwait_slave.exe"), _L("APPFWK-SYSMON-0038"));
    50 			CStartupProperties* props = CStartupProperties::NewLC(_L("tsysmon_app_failcount2failwait_slave.exe"), _L("38"));
    47 			props->SetMonitored(ETrue);
    51 			props->SetMonitored(ETrue);
    48 			props->SetStartupType(EStartProcess);
    52 			props->SetStartupType(EStartProcess);
    49 			props->SetStartMethod(EWaitForStart);
    53 			props->SetStartMethod(EWaitForStart);
    50 			props->SetNoOfRetries(1);
    54 			props->SetNoOfRetries(1);
    51 			props->SetTimeout(0);
    55 			props->SetTimeout(0);
    52 			props->SetRecoveryParams(EIgnoreOnFailure, 0);
    56 			props->SetRecoveryParams(EIgnoreOnFailure, 0);
    53 
    57 
    54 			RProcess slave1;
    58 			RProcess slave1;
    55 			slave1.Create(_L("tsysmon_app_failcount2failwait_slave.exe"), _L("APPFWK-SYSMON-0038"));
    59 			slave1.Create(_L("tsysmon_app_failcount2failwait_slave.exe"), _L("APPFWK-SYSMON-0038"));
    56 			CleanupClosePushL(slave1);
    60 			CleanupClosePushL(slave1);
    57 			slave1.Resume();
    61             TRequestStatus status;
       
    62             slave1.Rendezvous(status);
       
    63             slave1.Resume();
       
    64             User::WaitForRequest(status);
    58 
    65 
    59 			// Register with SysMon
    66 			// Register with SysMon
    60 			sysmon.MonitorL(*props, slave1);
    67 			sysmon.MonitorL(*props, slave1);
    61 			slave1.Terminate(KErrNone);
    68 			slave1.Terminate(KErrNone);
    62 
    69