sysstatemgmt/systemstatereferenceplugins/test/tunitcustcmd/src/tcmd_step_deactivaterfforemergencycall.cpp
branchRCL_3
changeset 21 ccb4f6b3db21
parent 0 4e1aa6a622a0
child 22 8cb079868133
equal deleted inserted replaced
20:1ddbe54d0645 21:ccb4f6b3db21
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    20 */
    20 */
    21 
    21 
    22 #include "tcmd_step_deactivaterfforemergencycall.h"
    22 #include "tcmd_step_deactivaterfforemergencycall.h"
    23 #include "ssmcustomcmdfactory.h"
    23 #include "ssmcustomcmdfactory.h"
    24 #include "cmddeactivaterfforemergencycall.h"
    24 #include "cmddeactivaterfforemergencycall.h"
       
    25 #include <e32property.h>
       
    26 const TUint32 KEmergencyCallRfAdaptationPluginPropertyKey = 0x2000E657;
       
    27 const TUid KPropertyCategory={0x2000D75B};
    25 
    28 
    26 CCustomCmdTestDeactivateRfForEmergencyCall::~CCustomCmdTestDeactivateRfForEmergencyCall()
    29 CCustomCmdTestDeactivateRfForEmergencyCall::~CCustomCmdTestDeactivateRfForEmergencyCall()
    27 	{
    30 	{
    28 	}
    31 	}
    29 
    32 
    39 
    42 
    40 void CCustomCmdTestDeactivateRfForEmergencyCall::TestCustomCmdDeactivateRfForEmergencyCallL()
    43 void CCustomCmdTestDeactivateRfForEmergencyCall::TestCustomCmdDeactivateRfForEmergencyCallL()
    41 	{
    44 	{
    42 	_LIT(KTESTLOG, "TestCustomCmdDeactivateRfForEmergencyCallL");
    45 	_LIT(KTESTLOG, "TestCustomCmdDeactivateRfForEmergencyCallL");
    43 	INFO_PRINTF1(KTESTLOG);
    46 	INFO_PRINTF1(KTESTLOG);
       
    47 	// Setting the P and S key will route the request to the reference plugins instead of the actual plugins
       
    48 	TInt err = RProperty::Define(KPropertyCategory, KEmergencyCallRfAdaptationPluginPropertyKey, RProperty::EInt);
       
    49 	TEST(KErrNone == err || KErrAlreadyExists == err);
       
    50     err = RProperty::Set(KPropertyCategory, KEmergencyCallRfAdaptationPluginPropertyKey, 1);
       
    51     TEST(KErrNone == err);
    44 
    52 
    45 	//Create Deactivate Rf For Emergency Call custom command
    53 	//Create Deactivate Rf For Emergency Call custom command
    46 	MSsmCustomCommand* customCmdDeactivateRfForEmergencyCall = CCustomCmdDeactivateRfForEmergencyCall::NewL();
    54 	MSsmCustomCommand* customCmdDeactivateRfForEmergencyCall = CCustomCmdDeactivateRfForEmergencyCall::NewL();
    47 	CSsmCustomCommandEnv* cmdEnv = NULL;
    55 	CSsmCustomCommandEnv* cmdEnv = NULL;
    48 
    56 
    54 	TBufC8<1> dummy;
    62 	TBufC8<1> dummy;
    55 
    63 
    56 	//Command parameter is not used inside the Execute. So passing any dummy data should be fine
    64 	//Command parameter is not used inside the Execute. So passing any dummy data should be fine
    57 	//Execute the command
    65 	//Execute the command
    58 	customCmdDeactivateRfForEmergencyCall->Execute(dummy, status);
    66 	customCmdDeactivateRfForEmergencyCall->Execute(dummy, status);
    59 	TEST(KRequestPending == status.Int());
       
    60 
    67 
       
    68 	
    61 	//Wait for the request to be completed
    69 	//Wait for the request to be completed
    62 	User::WaitForRequest(status);
    70 	User::WaitForRequest(status);
    63 	TEST(KErrNone == status.Int());
    71 	TEST(KErrNone == status.Int());
    64 
    72 	
    65 	//Execute the command once again
    73 	//Execute the command once again
    66 	customCmdDeactivateRfForEmergencyCall->Execute(dummy, status);
    74 	customCmdDeactivateRfForEmergencyCall->Execute(dummy, status);
    67 
    75 
    68 	//Cancel the commmand execution.
    76 	//Cancel the commmand execution.
    69 	customCmdDeactivateRfForEmergencyCall->ExecuteCancel();
    77 	customCmdDeactivateRfForEmergencyCall->ExecuteCancel();
    70 	User::WaitForRequest(status);
    78 	User::WaitForRequest(status);
    71 	//Refernce plugins doesnt have Cancel implementation and also by the time ExecuteCancel()
    79 	//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 
    80 	//is called it might have completed executing Execute() function. Thats is the reason for 
    73 	//checking the status to KErrNone instead of KErrCancel.
    81 	//checking the status to KErrNone instead of KErrCancel.
    74 	TEST(KErrNone == status.Int());
    82 	TEST(KErrNone == status.Int());
    75 
    83 	
    76 	//Close the command
    84 	//Close the command
    77 	customCmdDeactivateRfForEmergencyCall->Close();
    85 	customCmdDeactivateRfForEmergencyCall->Close();
    78 
    86 
    79 	//Releasing the comand will delete itself.
    87 	//Releasing the comand will delete itself.
    80 	customCmdDeactivateRfForEmergencyCall->Release();
    88 	customCmdDeactivateRfForEmergencyCall->Release();
       
    89 	err = RProperty::Delete(KPropertyCategory, KEmergencyCallRfAdaptationPluginPropertyKey);
       
    90 	TEST(KErrNone == err);
    81 	}
    91 	}
    82 
    92 
    83 TVerdict CCustomCmdTestDeactivateRfForEmergencyCall::doTestStepL()
    93 TVerdict CCustomCmdTestDeactivateRfForEmergencyCall::doTestStepL()
    84 	{
    94 	{
    85 	__UHEAP_MARK;
    95 	__UHEAP_MARK;