apploader/Src/TestAppLoaderAppStart.cpp
branchSymbian2
changeset 1 8758140453c0
child 6 c108117318cb
equal deleted inserted replaced
0:e8c1ea2c6496 1:8758140453c0
       
     1 // Copyright (c) 2006-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 the License "Symbian Foundation License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // This contains CTestAppLoaderAppStart
       
    15 // 
       
    16 //
       
    17 
       
    18 // USER includes
       
    19 #include "TestAppLoaderAppStart.h"
       
    20 
       
    21 // EPOC includes
       
    22 #include <apacmdln.h>
       
    23 #include <apgcli.h>
       
    24 
       
    25 /*@{*/
       
    26 /// Parameters
       
    27 _LIT(KProgram,					"program");
       
    28 
       
    29 /// Error messages
       
    30 _LIT(KErrCode,					"Error %d");
       
    31 _LIT(KErrMissingParameter ,		"Misssing Parameter %S");
       
    32 /*@}*/
       
    33 
       
    34 // constructor
       
    35 CTestAppLoaderAppStart::CTestAppLoaderAppStart()
       
    36 :	CTestAppLoaderBase()
       
    37 	{
       
    38 	SetTestStepName(_L("AppStart"));
       
    39 	}
       
    40 
       
    41 // Each test step must supply a implementation for doTestStepL
       
    42 enum TVerdict CTestAppLoaderAppStart::doTestStepL( void )
       
    43 	{
       
    44 	// Printing to the console and log file
       
    45 	INFO_PRINTF1(_L("TEST-> APP START"));
       
    46 
       
    47 	TPtrC	program;
       
    48 	if ( !GetStringFromConfig(ConfigSection(), KProgram, program) )
       
    49 		{
       
    50 		ERR_PRINTF2(KErrMissingParameter, &KProgram());
       
    51 		SetTestStepResult(EFail);
       
    52 		}
       
    53 	else
       
    54 		{
       
    55 		RApaLsSession		apaLsSession;
       
    56 		User::LeaveIfError(apaLsSession.Connect());
       
    57 		CleanupClosePushL(apaLsSession);
       
    58 
       
    59 		CApaCommandLine*	cmdLine=CApaCommandLine::NewLC();
       
    60 		cmdLine->SetExecutableNameL(program);
       
    61 		cmdLine->SetCommandL(EApaCommandRun);
       
    62 
       
    63 		TInt	err=apaLsSession.StartApp(*cmdLine);
       
    64 		if ( err!=KErrNone )
       
    65 			{
       
    66 			ERR_PRINTF2(KErrCode, err);
       
    67 			SetTestStepError(err);
       
    68 			}
       
    69 		CleanupStack::PopAndDestroy(2, &apaLsSession);
       
    70 		}
       
    71 
       
    72 	// test steps return a result
       
    73 	return TestStepResult();
       
    74 	}