sysstatemgmt/systemstatereferenceplugins/test/tunitcustcmd/src/tcmd_step_coopsysperformrfsactions.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_coopsysperformrfsactions.h"
       
    23 #include "ssmcustomcmdfactory.h"
       
    24 #include "cmdcoopsysperformrfsactions.h"
       
    25 
       
    26 CCustomCmdTestCoopSysPerformRfsActions::~CCustomCmdTestCoopSysPerformRfsActions()
       
    27 	{
       
    28 	}
       
    29 
       
    30 CCustomCmdTestCoopSysPerformRfsActions::CCustomCmdTestCoopSysPerformRfsActions()
       
    31 	{
       
    32 	SetTestStepName(KTCCustomCmdTestCoopSysPerformRfsActions);
       
    33 	}
       
    34 
       
    35 /**
       
    36 Old Test CaseID 		APPFWK-CUSTCMD-0003
       
    37 New Test CaseID 		DEVSRVS-SSREFPLUGINS-CUSTCMD-0003
       
    38  */
       
    39 
       
    40 void CCustomCmdTestCoopSysPerformRfsActions::TestCustomCmdCoopSysPerformRfsActionsL()
       
    41 	{
       
    42 	_LIT(KTESTLOG, "TestCustomCmdCoopSysPerformRfsActionsL");
       
    43 	INFO_PRINTF1(KTESTLOG);
       
    44 
       
    45 	MSsmCustomCommand* customCmdCoopSysPerformRfsActions = SsmCustomCmdFactory::CmdCcoopSysPerformRfsActionsNewL();
       
    46 	CSsmCustomCommandEnv* cmdEnv = NULL;
       
    47 	
       
    48 	//Initialise the command. CSsmCustomCommandEnv is not used inside the Initialize so passing
       
    49 	//null should be fine.
       
    50 	customCmdCoopSysPerformRfsActions->Initialize(cmdEnv);
       
    51 	TRequestStatus status;
       
    52 
       
    53 	TSsmRfsType ssmRfsType;
       
    54 	ssmRfsType = ESsmShallowRfs;
       
    55 	TPckgC<TSsmRfsType> pckgSsmRfsType(ssmRfsType);
       
    56 	
       
    57 	//Execute the command
       
    58 	customCmdCoopSysPerformRfsActions->Execute(pckgSsmRfsType, status);
       
    59 	
       
    60 	//Wait for the command to be completed
       
    61 	User::WaitForRequest(status);
       
    62 	TEST(KErrNone == status.Int());
       
    63 
       
    64 	//Execute the command once again
       
    65 	customCmdCoopSysPerformRfsActions->Execute(pckgSsmRfsType, status);
       
    66 	TEST(KRequestPending == status.Int());
       
    67 	
       
    68 	//Cancel the commmand execution.
       
    69 	customCmdCoopSysPerformRfsActions->ExecuteCancel();
       
    70 	
       
    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 	User::WaitForRequest(status);
       
    75 	TEST(KErrNone == status.Int());
       
    76 
       
    77 	
       
    78 	//Create an invalid enum value
       
    79 	TSsmRfsType ssmRfsTypeInvalid = static_cast<TSsmRfsType>(ESsmRfsTypeExtensionBase - 1);
       
    80 	
       
    81 	TPckgC<TSsmRfsType> pckgSsmRfsTypeInvalid(ssmRfsTypeInvalid);
       
    82 	customCmdCoopSysPerformRfsActions->Execute(pckgSsmRfsTypeInvalid, status);
       
    83 	TEST(KErrArgument == status.Int());
       
    84 
       
    85 	//Close the command
       
    86 	customCmdCoopSysPerformRfsActions->Close();
       
    87 	
       
    88 	//Releasing the comand will delete itself.
       
    89 	customCmdCoopSysPerformRfsActions->Release();
       
    90 	}
       
    91 
       
    92 TVerdict CCustomCmdTestCoopSysPerformRfsActions::doTestStepL()
       
    93 	{
       
    94 	__UHEAP_MARK;
       
    95 	TestCustomCmdCoopSysPerformRfsActionsL();
       
    96 	__UHEAP_MARKEND;
       
    97 	return TestStepResult();
       
    98 	}