systemhealthmanagement/systemhealthmgr/test/tsysmon/src/tsysmon_steploadsysmon.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  @file
       
    18  @test
       
    19  @internalComponent - Internal Symbian test code
       
    20 */
       
    21 
       
    22 #include "tsysmon_steploadsysmon.h"
       
    23 
       
    24 _LIT(KTestAppLoadSysMon, "testapp_loadsysmon.exe");
       
    25 
       
    26 CStepLoadSysMon::CStepLoadSysMon()
       
    27 	{
       
    28 	SetTestStepName(KCTestCaseLoadSysMon);
       
    29 	}
       
    30 /**
       
    31 Old Test CaseID 		APPFWK-SYSMON-0057
       
    32 New Test CaseID 		DEVSRVS-SHMA-SYSMON-0057
       
    33 */
       
    34 
       
    35 
       
    36 TVerdict CStepLoadSysMon::doTestStepL()
       
    37 	{
       
    38 	INFO_PRINTF1(_L("TEST APPFWK-SYSMON-0057"));
       
    39 
       
    40 	INFO_PRINTF1(_L("Going to test app running"));
       
    41 	RProcess process;
       
    42 	CleanupClosePushL(process);
       
    43 	User::LeaveIfError(process.Create(KTestAppLoadSysMon, KNullDesC));
       
    44 
       
    45 	TRequestStatus status;
       
    46 	process.Rendezvous(status);
       
    47 	if (status == KRequestPending)
       
    48 		{
       
    49 		process.Resume();
       
    50 		}
       
    51 	else
       
    52 		{
       
    53 		process.Kill(KErrGeneral);
       
    54 		TESTEL(EFalse, status.Int());
       
    55 		}
       
    56 
       
    57 	INFO_PRINTF1(_L("Process started"));	
       
    58 	User::WaitForRequest(status);
       
    59 
       
    60 	const TInt exitReason = process.ExitReason();
       
    61 	const TExitType exitType = process.ExitType();
       
    62 	TExitCategoryName categoryName = process.ExitCategory();
       
    63 
       
    64 	TBuf<50> msg;
       
    65 	if (exitType == EExitPanic)
       
    66 		{
       
    67 		_LIT(KAppPanicInfo, "Application panic: %S %d");
       
    68 		msg.Format(KAppPanicInfo, &categoryName, exitReason);
       
    69 		}
       
    70 	else
       
    71 		{
       
    72 		_LIT(KAppExitInfo, "Application exited with code %d");
       
    73 		msg.Format(KAppExitInfo, exitReason);
       
    74 		}
       
    75 	INFO_PRINTF1(msg);
       
    76 	INFO_PRINTF2(_L("Process terminated with %d exit type"), exitType);
       
    77 
       
    78 	TEST(exitReason == KErrNone);
       
    79 	TEST(exitType == EExitKill);
       
    80 
       
    81 	CleanupStack::PopAndDestroy(&process);
       
    82 	
       
    83 	INFO_PRINTF1(_L("Test Step completed"));
       
    84 	return TestStepResult();	
       
    85 	}
       
    86 
       
    87 
       
    88 
       
    89