sysstatemgmt/systemstatereferenceplugins/test/tunitcustcmd/src/tcmd_step_deactivaterfforemergencycall.cpp
changeset 0 4e1aa6a622a0
child 21 ccb4f6b3db21
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 "tcmd_step_deactivaterfforemergencycall.h"
       
    23 #include "ssmcustomcmdfactory.h"
       
    24 #include "cmddeactivaterfforemergencycall.h"
       
    25 
       
    26 CCustomCmdTestDeactivateRfForEmergencyCall::~CCustomCmdTestDeactivateRfForEmergencyCall()
       
    27 	{
       
    28 	}
       
    29 
       
    30 CCustomCmdTestDeactivateRfForEmergencyCall::CCustomCmdTestDeactivateRfForEmergencyCall()
       
    31 	{
       
    32 	SetTestStepName(KTCCustomCmdTestDeactivateRfForEmergencyCall);
       
    33 	}
       
    34 /**
       
    35 Old Test CaseID 		APPFWK-CUSTCMD-0001
       
    36 New Test CaseID 		DEVSRVS-SSREFPLUGINS-CUSTCMD-0008
       
    37  */
       
    38 
       
    39 
       
    40 void CCustomCmdTestDeactivateRfForEmergencyCall::TestCustomCmdDeactivateRfForEmergencyCallL()
       
    41 	{
       
    42 	_LIT(KTESTLOG, "TestCustomCmdDeactivateRfForEmergencyCallL");
       
    43 	INFO_PRINTF1(KTESTLOG);
       
    44 
       
    45 	//Create Deactivate Rf For Emergency Call custom command
       
    46 	MSsmCustomCommand* customCmdDeactivateRfForEmergencyCall = CCustomCmdDeactivateRfForEmergencyCall::NewL();
       
    47 	CSsmCustomCommandEnv* cmdEnv = NULL;
       
    48 
       
    49 	//Initialise the command. CSsmCustomCommandEnv is not used inside the Initialize so passing
       
    50 	//null should be fine.
       
    51 	customCmdDeactivateRfForEmergencyCall->Initialize(cmdEnv);
       
    52 
       
    53 	TRequestStatus status;
       
    54 	TBufC8<1> dummy;
       
    55 
       
    56 	//Command parameter is not used inside the Execute. So passing any dummy data should be fine
       
    57 	//Execute the command
       
    58 	customCmdDeactivateRfForEmergencyCall->Execute(dummy, status);
       
    59 	TEST(KRequestPending == status.Int());
       
    60 
       
    61 	//Wait for the request to be completed
       
    62 	User::WaitForRequest(status);
       
    63 	TEST(KErrNone == status.Int());
       
    64 
       
    65 	//Execute the command once again
       
    66 	customCmdDeactivateRfForEmergencyCall->Execute(dummy, status);
       
    67 
       
    68 	//Cancel the commmand execution.
       
    69 	customCmdDeactivateRfForEmergencyCall->ExecuteCancel();
       
    70 	User::WaitForRequest(status);
       
    71 	//Refernce plugins doesnt have Cancel implementation and also by the time ExecuteCancel()
       
    72 	//is called it might have completed executing Execute() function. Thats is the reason for 
       
    73 	//checking the status to KErrNone instead of KErrCancel.
       
    74 	TEST(KErrNone == status.Int());
       
    75 
       
    76 	//Close the command
       
    77 	customCmdDeactivateRfForEmergencyCall->Close();
       
    78 
       
    79 	//Releasing the comand will delete itself.
       
    80 	customCmdDeactivateRfForEmergencyCall->Release();
       
    81 	}
       
    82 
       
    83 TVerdict CCustomCmdTestDeactivateRfForEmergencyCall::doTestStepL()
       
    84 	{
       
    85 	__UHEAP_MARK;
       
    86 	TestCustomCmdDeactivateRfForEmergencyCallL();
       
    87 	__UHEAP_MARKEND;
       
    88 	return TestStepResult();
       
    89 	}