systemhealthmanagement/systemhealthmgr/test/tstartsafe/src/tstartsafe_appstartapparcinit.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 <startupproperties.h>
       
    23 
       
    24 #include "startsafe.h"
       
    25 #include "tstartsafe_appstartapparcinit.h"
       
    26 #include "testapps.h"
       
    27 
       
    28 /**
       
    29 Old Test CaseID 		APPFWK-STARTSAFE-0012
       
    30 New Test CaseID 		DEVSRVS-SHMA-STARTSAFE-0012
       
    31  */
       
    32 
       
    33 TVerdict CAppFwkStartSafeTestStepAppStartAppArcInit::doTestStepL( void )
       
    34 	{
       
    35 	
       
    36 	CStartSafe* startSafe = CStartSafe::NewL();	
       
    37 	CleanupStack::PushL( startSafe );
       
    38 	
       
    39 	CStartupProperties* prop = CStartupProperties::NewL();
       
    40 	CleanupStack::PushL( prop );
       
    41 	
       
    42 	RProcess proc;
       
    43 	CleanupClosePushL( proc );
       
    44 	
       
    45 	prop->SetFileParamsL( KTestAppGood, KNullDesC );
       
    46 	prop->SetStartupType( EStartApp );
       
    47 	prop->SetStartMethod( EDeferredWaitForStart );
       
    48 	
       
    49 
       
    50 	TRequestStatus startupTRS;
       
    51 	TRequestStatus apparcSessionTRS;
       
    52 	
       
    53 	INFO_PRINTF1(_L("Starting the Test-App process asynchronously"));
       
    54 	
       
    55 	startSafe->StartL( *prop, proc, startupTRS );	
       
    56 
       
    57 	User::WaitForRequest( startupTRS );
       
    58 	INFO_PRINTF2( _L("Rendezvous completed with %d"), startupTRS.Int() );	
       
    59 	
       
    60 	// StartL should have left if it was unsuccessful, 
       
    61 	// but ensure that the process's name is that of the test-app.
       
    62 	TPtrC procNamePtr = proc.FileName().Right( KTestAppGood().Length() );
       
    63 	TInt nameComparison = procNamePtr.Compare( KTestAppGood() );
       
    64 	
       
    65 	if( 0 == nameComparison )
       
    66 		{
       
    67 		INFO_PRINTF2( _L("Application \"%S\" started correctly"), &procNamePtr );	
       
    68 		}
       
    69 	else
       
    70 		{
       
    71 		ERR_PRINTF1( _L("Application-start unsuccessful. Test not completed") );
       
    72 		
       
    73 		SetTestStepResult( EFail );
       
    74 		return TestStepResult();
       
    75 		}
       
    76 	
       
    77 	startSafe->InitAppArcServer( apparcSessionTRS ); // try to initiate apparc, to see if that causes any problems
       
    78 	User::WaitForRequest( apparcSessionTRS );
       
    79 	
       
    80 
       
    81 	if ( ( startupTRS == KErrNone) && ( apparcSessionTRS == KErrNone) )
       
    82 		{
       
    83 		SetTestStepResult( EPass );
       
    84 		INFO_PRINTF1( _L("Test passed") );
       
    85 		// Dispose of the test-app
       
    86 		proc.Kill( KErrNone );		
       
    87 		}
       
    88 	else
       
    89 		{
       
    90 		SetTestStepResult( EFail );
       
    91 		ERR_PRINTF3( _L("Test failed.startupTRS = %d apparcSessionTRS = %d "), startupTRS.Int(), apparcSessionTRS.Int() );				
       
    92 		}
       
    93 	
       
    94 		
       
    95 	CleanupStack::PopAndDestroy( 3, startSafe );
       
    96 
       
    97 	return TestStepResult();	
       
    98 	}
       
    99 
       
   100 
       
   101 
       
   102 CAppFwkStartSafeTestStepAppStartAppArcInit::CAppFwkStartSafeTestStepAppStartAppArcInit()
       
   103 	{
       
   104 	SetTestStepName(KCTestCaseAppStartAppArcInit);
       
   105 	}