sysstatemgmt/systemstarter/test/tsysstart2/src/tsysstart2_procmondeferred.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 //
       
    15 
       
    16 
       
    17 #include <e32std.h>
       
    18 #include "tsysstart2_procmondeferred.h"
       
    19 #include "testprocgood.h"
       
    20 #include "testapps.h"
       
    21 
       
    22 
       
    23 CAppFwkSysStart2TestStepProcMonDeferred::CAppFwkSysStart2TestStepProcMonDeferred()
       
    24 	{
       
    25 	SetTestStepName(KCTestCaseProcMonDeferred);
       
    26 	}
       
    27 
       
    28 /**
       
    29 Old Test CaseID 		APPFWK-SYSSTART-0082
       
    30 New Test CaseID 		DEVSRVS-SYSSTART-STARTUP2-0082
       
    31  */
       
    32 
       
    33 TVerdict CAppFwkSysStart2TestStepProcMonDeferred::doTestStepL()
       
    34 	{	
       
    35 	
       
    36 	// The test process should have been started, as indicated in tsysstart2-procstart_emulator.rss
       
    37 	TFullName name;
       
    38 	RProcess process;
       
    39 	CleanupClosePushL( process );
       
    40 
       
    41 	
       
    42 	if( ProcessExists(KTestProcGood, name) && (KErrNone == process.Open(name)) )
       
    43 		{
       
    44 		INFO_PRINTF1( _L("The test-process was started successfully at startup with \n\t\t\tstart_method of EDeferredWaitForStart & EIgnoreOnFailure") );		
       
    45 		INFO_PRINTF1( _L("Now Kill() the test-process and wait for the throttle time") );
       
    46 		
       
    47 		
       
    48 		process.Kill( KSysStart2TestKillCode );
       
    49 		process.Close();
       
    50 		User::After( KThrottleTime );
       
    51 		
       
    52 		
       
    53 		if( !ProcessExists(KTestProcGood, name) )
       
    54 			{
       
    55 			INFO_PRINTF1( _L("The test-process has correctly _not been restarted") );
       
    56 			
       
    57 			SetTestStepResult( EPass );						
       
    58 			}
       
    59 		else
       
    60 			{
       
    61 			ERR_PRINTF1( _L("The test-process has INcorrectly been restarted") );	
       
    62 			
       
    63 			SetTestStepResult( EFail );
       
    64 			}
       
    65 		
       
    66 		}
       
    67 	else
       
    68 		{
       
    69 		INFO_PRINTF1(_L("The test-process was not started or a handle could not be opened on it"));	
       
    70 		
       
    71 		SetTestStepResult( EFail );
       
    72 		}
       
    73 
       
    74 	CleanupStack::PopAndDestroy( &process );
       
    75 	
       
    76 	return TestStepResult();	
       
    77 	}