telephonyserverplugins/simtsy/test/Te_Sim/Te_SimPhBkUSimAppsTest.cpp
changeset 0 3553901f7fa8
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2005-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 #include "Te_SimPhBkUSimAppsTest.h"
       
    17 
       
    18 CSimPhBkUSimAppsTest::CSimPhBkUSimAppsTest() 
       
    19 	{ 
       
    20 	SetTestStepName(_L("USimAppsTest"));
       
    21 	}
       
    22 
       
    23 TVerdict CSimPhBkUSimAppsTest::doTestStepL()
       
    24 	{
       
    25 	INFO_PRINTF1(_L("BeginPhBkUSimAppsTest"));
       
    26 
       
    27  	CreateConfigFileL(_L("c:\\config3.txt"));
       
    28  	SetTestNumberL(5);
       
    29 
       
    30 	RMobilePhone::TAID activeAID;
       
    31 	TInt count;
       
    32 	TRequestStatus aReqStatus,stat0;
       
    33 
       
    34 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
    35 	INFO_PRINTF2(_L("Result: %d"),ret);
       
    36 	TESTL(ret == KErrNone); 
       
    37 	INFO_PRINTF1(_L("Opened phone object"));
       
    38 
       
    39 	INFO_PRINTF1(_L("EnumerateUSimApplications test"));
       
    40 
       
    41 	iPhone.EnumerateUSimApplications(aReqStatus, count, activeAID);
       
    42 	User::WaitForRequest(aReqStatus);
       
    43 	TESTL(activeAID.Compare(_L8("App2"))==0);
       
    44 	TESTL(count == 3);
       
    45 	CHECKPOINTL(aReqStatus, KErrNone, CHP_APPS_CASE("G.1"));
       
    46 
       
    47 	//Test GetUSimApplicationInfo
       
    48 	RMobilePhone::TUSimApplicationInfoV2 usimAppInfo;
       
    49 	RMobilePhone::TUSimApplicationInfoV2Pckg usimAppInfoPckg(usimAppInfo);
       
    50 
       
    51 	TInt index=0;
       
    52 
       
    53 	INFO_PRINTF1(_L("GetUSimApplicationInfo test"));
       
    54 
       
    55 	iPhone.GetUSimApplicationInfo(aReqStatus, index, usimAppInfoPckg);
       
    56 	User::WaitForRequest(aReqStatus);
       
    57 	CHECKPOINTL(aReqStatus, KErrNone, CHP_APPS_CASE("G.2"));
       
    58 	TESTL(usimAppInfo.iAID.Compare(_L8("App2")) == KErrNone);
       
    59 	TESTL(usimAppInfo.iLabel.Compare(_L8("PhoneApp2")) == KErrNone);
       
    60 
       
    61 	index=5;
       
    62 	iPhone.GetUSimApplicationInfo(aReqStatus, index, usimAppInfoPckg);
       
    63 	User::WaitForRequest(aReqStatus);
       
    64 	CHECKPOINT_EXL(aReqStatus==KErrNotFound, CHP_APPS_CASE("G.3"));
       
    65 	TESTL(usimAppInfo.iAID.Compare(_L8("App2")) == KErrNone);
       
    66 	TESTL(usimAppInfo.iLabel.Compare(_L8("PhoneApp2")) == KErrNone);
       
    67 
       
    68 	INFO_PRINTF1(_L("NotifyUSimApplicationsInfoChange test"));
       
    69 	count = 0;	// Set count to some value different to that of the number of Apps.
       
    70 	iPhone.NotifyUSimApplicationsInfoChange(aReqStatus, count, activeAID);
       
    71 	User::WaitForRequest(aReqStatus);
       
    72 	CHECKPOINTL(aReqStatus, KErrNone, CHP_APPS_CASE("G.4"));
       
    73 	TESTL(activeAID.Compare(_L8("App1")) == 0);
       
    74 	TESTL(count == 3);
       
    75 
       
    76 	iPhone.EnumerateUSimApplications(aReqStatus, count, activeAID);
       
    77 	User::WaitForRequest(aReqStatus);
       
    78 	TESTL(aReqStatus.Int() == KErrNone);
       
    79 	TESTL(activeAID.Compare(_L8("App1"))==0);
       
    80 	TESTL(count == 3);
       
    81 
       
    82 	RMobilePhone::TUSimSelectionMode selectionMode;
       
    83 	INFO_PRINTF1(_L("GetUSimAppsSelectionMode test"));
       
    84 	ret = iPhone.GetUSimAppsSelectionMode(selectionMode); 
       
    85 	CHECKPOINTL(ret, KErrNone, CHP_APPS_CASE("G.8"));
       
    86 
       
    87 	TESTL(selectionMode == RMobilePhone::EUSimSelectionAutomatic);
       
    88 	
       
    89 	INFO_PRINTF1(_L("NotifyUSimAppsSelectionModeChange test"));
       
    90 	iPhone.NotifyUSimAppsSelectionModeChange(aReqStatus, selectionMode);
       
    91 	INFO_PRINTF1(_L("SetUSimAppsSelectionMode test"));
       
    92 	ret=iPhone.SetUSimAppsSelectionMode(RMobilePhone::EUSimSelectionManual);
       
    93 	CHECKPOINTL(ret, KErrNone, CHP_APPS_CASE("G.7"));
       
    94 	User::WaitForRequest(aReqStatus);
       
    95 	CHECKPOINTL(aReqStatus, KErrNone, CHP_APPS_CASE("G.11"));
       
    96 	TESTL(selectionMode == RMobilePhone::EUSimSelectionManual);
       
    97 
       
    98 	iPhone.SetUSimApplicationStatus(aReqStatus, _L8("App2"), RMobilePhone::EUSimActivate);
       
    99 	User::WaitForRequest(aReqStatus);
       
   100 	
       
   101 	iPhone.NotifyUSimApplicationsInfoChange(aReqStatus, count, activeAID);
       
   102 	iPhone.SetUSimApplicationStatus(stat0, _L8("App2"), RMobilePhone::EUSimTerminate);
       
   103 	User::WaitForRequest(aReqStatus);
       
   104 	User::WaitForRequest(stat0);
       
   105 	CHECKPOINTL(stat0, KErrNone, CHP_APPS_CASE("G.5"));
       
   106 	CHECKPOINTL(aReqStatus, KErrNone, CHP_APPS_CASE("G.4"));
       
   107 
       
   108 	iPhone.SetUSimApplicationStatus(stat0, _L8("App5"), RMobilePhone::EUSimTerminate);
       
   109 	User::WaitForRequest(stat0);
       
   110 	CHECKPOINTL(stat0, KErrNotFound, CHP_APPS_CASE("G.6"));
       
   111 	
       
   112 	iPhone.Close();
       
   113 	ASSERT(RThread().RequestCount()==0);
       
   114 
       
   115 	return TestStepResult();
       
   116 	}
       
   117