systemhealthmanagement/systemhealthmgr/test/tsysmon/src/tsysmon_stepnomoncancel.cpp
changeset 0 4e1aa6a622a0
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 // tsysmon_stepselfmoncancel.cpp
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @test
       
    21  @internalComponent - Internal Symbian test code
       
    22 */
       
    23 
       
    24 #include "testprocgoodsession.h"
       
    25 #include "tsysmon_stepnomoncancel.h"
       
    26 
       
    27 
       
    28 CStepNoMonCancel::CStepNoMonCancel()
       
    29 	{
       
    30 	SetTestStepName(KCTestCaseNoMonCancel);
       
    31 	}
       
    32 
       
    33 /**
       
    34 Old Test CaseID 		APPFWK-SYSMON-0010
       
    35 New Test CaseID 		DEVSRVS-SHMA-SYSMON-0010
       
    36  */
       
    37 
       
    38 TVerdict CStepNoMonCancel::doTestStepL()
       
    39 	{
       
    40 	INFO_PRINTF1(_L("TEST APPFWK-SYSMON-0010"));
       
    41 	
       
    42 	INFO_PRINTF1(_L("Going to start a process"));
       
    43 	RProcess process;
       
    44 	CleanupClosePushL(process);
       
    45 	User::LeaveIfError(process.Create(KTestProcGood, KLaunchServerCommandLineOption));
       
    46 	ResumeL(process);
       
    47 
       
    48 	INFO_PRINTF1(_L("Without monitoring the process, we will now make a request to cancel monitoring."));
       
    49 	RTestProcGoodSession server;
       
    50 	User::LeaveIfError(server.Connect());
       
    51 	TEST(KErrNone == server.CancelMonitor());
       
    52 	server.Close();
       
    53 
       
    54 	//Killing the process will not cause sysmon to restart after KWaitTime
       
    55 	TEST(Exists(KTestProcGood));
       
    56 	process.Kill(KErrNone);
       
    57 	CleanupStack::PopAndDestroy(&process);
       
    58 	TEST(EFalse == Exists(KTestProcGood));
       
    59 	INFO_PRINTF1(_L("Killed monitored process."));
       
    60 
       
    61 	INFO_PRINTF1(_L("Going to sleep for 16 seconds."));		
       
    62 	User::After(KThrottleTime + 1000000);
       
    63 
       
    64 	INFO_PRINTF1(_L("Check that the process wasn't restarted"));		
       
    65 	TEST(EFalse == Exists(KTestProcGood));
       
    66 	
       
    67 	INFO_PRINTF1(_L("Test complete"));		
       
    68 	return TestStepResult();	
       
    69 	}