sysstatemgmt/systemstateplugins/test/tcmncustomcmd/src/tcmncustomcmd_step_rendezvouswithestart.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 "tcmncustomcmd_step_rendezvouswithestart.h"
       
    23 #include "ssmcmncustomcmdfactory.h"
       
    24 
       
    25 // class under test
       
    26 #include "cmdrendezvouswithestart.h"
       
    27 
       
    28 CCustomCmdTestRendezvousWithEStart::~CCustomCmdTestRendezvousWithEStart()
       
    29 	{
       
    30 	}
       
    31 
       
    32 CCustomCmdTestRendezvousWithEStart::CCustomCmdTestRendezvousWithEStart()
       
    33 	{
       
    34 	SetTestStepName(KTCCustomCmdTestRendezvousWithEStart);
       
    35 	}
       
    36 
       
    37 
       
    38 TVerdict CCustomCmdTestRendezvousWithEStart::doTestStepL()
       
    39 	{
       
    40 	INFO_PRINTF1(_L("Entering test for rendezvous with estart custom command"));
       
    41 	__UHEAP_MARK;
       
    42 	
       
    43 	TRAPD(err, doTestCreateExecuteAndDestroyL());
       
    44 	TEST(err == KErrNone);
       
    45 		
       
    46 	__UHEAP_MARKEND;
       
    47 	INFO_PRINTF1(_L("Leaving test for rendezvous with estart custom command"));
       
    48 	return TestStepResult();
       
    49 	}
       
    50 
       
    51 /**
       
    52 Old Test CaseID 		APPFWK-CUSTCMD-0025
       
    53 New Test CaseID 		DEVSRVS-SSPLUGINS-CUSTCMD-0025
       
    54  */
       
    55 
       
    56 void CCustomCmdTestRendezvousWithEStart::doTestCreateExecuteAndDestroyL()
       
    57 	{
       
    58 	INFO_PRINTF1(_L("Entering test for factory create, execute cancel and destroy"));
       
    59 	__UHEAP_MARK;
       
    60 	
       
    61 	INFO_PRINTF1(_L("Testing NewL for rendezvous with estart"));
       
    62 	MSsmCustomCommand* customCommand = SsmCmnCustomCmdFactory::CmdRendezvousWithEStartL();
       
    63 	CleanupStack::PushL(customCommand);
       
    64 	
       
    65 	INFO_PRINTF1(_L("Testing Initialize for rendezvous with estart"));
       
    66 	TInt err = customCommand->Initialize(NULL);
       
    67 	TEST(err == KErrNone);
       
    68 	
       
    69 	INFO_PRINTF1(_L("Testing Execute for rendezvous with estart"));
       
    70 	TBuf8<1> nullBuf;
       
    71 	TRequestStatus status;
       
    72 	// Subscribe to rendezvous requests
       
    73 	TRequestStatus rendezvousStatus;
       
    74 	RProcess thisProcess;
       
    75 	thisProcess.Rendezvous(rendezvousStatus);
       
    76 	TEST(rendezvousStatus == KRequestPending);
       
    77 	// Issue execute
       
    78 	customCommand->Execute(nullBuf, status);
       
    79 	TEST(status == KErrNone);
       
    80 	INFO_PRINTF1(_L("Testing rendezvous occured"));
       
    81 	TEST(rendezvousStatus == KErrNone);
       
    82 
       
    83 	INFO_PRINTF1(_L("Testing ExecuteCancel for rendezvous with estart"));
       
    84 	customCommand->ExecuteCancel();
       
    85 	TEST(status == KErrNone);
       
    86 	
       
    87 	INFO_PRINTF1(_L("Cleaning up custom command"));
       
    88 	customCommand->Close();
       
    89 	customCommand->Release();
       
    90 	CleanupStack::Pop(customCommand);
       
    91 	customCommand = NULL;
       
    92 	
       
    93 	__UHEAP_MARKEND;
       
    94 	INFO_PRINTF1(_L("Leaving test for factor create, execute cancel and destroy"));
       
    95 	}
       
    96