telephonyserverplugins/simtsy/test/Te_Sim/Te_SimPacketGPRSNotifyConfigCancelTest.cpp
changeset 0 3553901f7fa8
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 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 // Te_SimPacketGPRSNotifyConfigChangeCancelTest.cpp
       
    15 //
       
    16 
       
    17 #include "Te_SimPacketGPRSNotifyConfigCancelTest.h"
       
    18 
       
    19 CSimPacketGPRSNotifyConfigCancelTest::CSimPacketGPRSNotifyConfigCancelTest() 
       
    20 	{ 
       
    21 	SetTestStepName(_L("GPRSNotifyConfigCancelTest"));
       
    22 	}
       
    23 
       
    24 TVerdict CSimPacketGPRSNotifyConfigCancelTest::doTestStepL()
       
    25 	{
       
    26 	INFO_PRINTF1(_L("BeginPacketGPRSNotifyConfigCancelTest"));
       
    27 
       
    28  	CreateConfigFileL(_L("c:\\config3.txt"));
       
    29  	SetTestNumberL(6);
       
    30 
       
    31 	TRequestStatus gprsReqStatus;
       
    32 	TRequestStatus gprsNotifyStatus;
       
    33 	
       
    34 	// Open phone
       
    35 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
    36 	INFO_PRINTF2(_L("Result: %d"),ret);
       
    37 	TESTL(ret == KErrNone); 
       
    38 	INFO_PRINTF1(_L("Opened phone object"));
       
    39 
       
    40 	// Open GPRS packet service
       
    41 	TESTL(iGPRSPacketService.Open(iPhone)==KErrNone);
       
    42 	INFO_PRINTF1(_L("Opened Packet object"));
       
    43 
       
    44 	// Open GPRS context
       
    45 	TName gprsContextName;
       
    46 	TName gprsContextNameCompare;
       
    47 	TESTL(iGPRSPacketContext.OpenNewContext(iGPRSPacketService, gprsContextName)==KErrNone);
       
    48 	gprsContextNameCompare.Append(KSimPrimaryPacketContextName);
       
    49 	gprsContextNameCompare.AppendNum(1);
       
    50 	TESTL(gprsContextName.Compare(gprsContextNameCompare)==KErrNone);
       
    51 	INFO_PRINTF1(_L("Opened GPRS Context object"));
       
    52 
       
    53 	// Configure GPRS context.
       
    54 	RPacketContext::TContextConfigGPRS gprsContextConfig;
       
    55 	TESTL(gprsContextConfig.ExtensionId()==TPacketDataConfigBase::KConfigGPRS);
       
    56 	TPckg<RPacketContext::TContextConfigGPRS> contextConfigPckgGPRS(gprsContextConfig);
       
    57 	gprsContextConfig.iAccessPointName = DPCKTTSY_ACCESS_POINT1;
       
    58 	gprsContextConfig.iAnonymousAccessReqd = DPCKTTSY_ANONYMOUS_ACCESS1;
       
    59 	gprsContextConfig.iPdpAddress = DPCKTTSY_PDP_ADDRESS1;
       
    60 	gprsContextConfig.iPdpCompression = DPCKTTSY_COMPRESSION1;
       
    61 	gprsContextConfig.iPdpType = DPCKTTSY_PDP_TYPE1;
       
    62 	gprsContextConfig.iUseEdge = ETrue;
       
    63 	gprsContextConfig.iProtocolConfigOption.iAuthInfo.iProtocol = SIM_PACKET_CONTEXT_PROTOCOL1;
       
    64 	gprsContextConfig.iProtocolConfigOption.iAuthInfo.iUsername = SIM_PACKET_CONTEXT_USERNAME1;
       
    65 	gprsContextConfig.iProtocolConfigOption.iAuthInfo.iPassword = SIM_PACKET_CONTEXT_PASSWORD1;
       
    66 	gprsContextConfig.iProtocolConfigOption.iChallenge = SIM_PACKET_CONTEXT_CHALLENGE1;
       
    67 	gprsContextConfig.iProtocolConfigOption.iResponse = SIM_PACKET_CONTEXT_RESPONSE1;
       
    68 	gprsContextConfig.iProtocolConfigOption.iDnsAddresses.iPrimaryDns = SIM_PACKET_CONTEXT_PRIMARYSERVER1;
       
    69 	gprsContextConfig.iProtocolConfigOption.iDnsAddresses.iSecondaryDns = SIM_PACKET_CONTEXT_SECONDARYSERVER1;
       
    70 	gprsContextConfig.iProtocolConfigOption.iId = SIM_PACKET_CONTEXT_ID1;
       
    71 
       
    72 		//set up notification package objects (only on heap to avoid chkstk problems)
       
    73 
       
    74 	//first gprs notify object
       
    75 	RPacketContext::TContextConfigGPRS* gprsContextNotify = new(ELeave) RPacketContext::TContextConfigGPRS;
       
    76 	CleanupStack::PushL(gprsContextNotify);
       
    77 	TESTL(gprsContextNotify->ExtensionId()==TPacketDataConfigBase::KConfigGPRS);
       
    78 	TPckg<RPacketContext::TContextConfigGPRS> contextNotifyPckgGPRS(*gprsContextNotify);
       
    79 	
       
    80 	// Test
       
    81 
       
    82 	iGPRSPacketContext.NotifyConfigChanged(gprsNotifyStatus, contextNotifyPckgGPRS);
       
    83 			
       
    84 	//now update the GPRS config
       
    85 	iGPRSPacketContext.SetConfig(gprsReqStatus, contextConfigPckgGPRS);
       
    86 	User::WaitForRequest(gprsNotifyStatus);
       
    87 	//wait for completion
       
    88 	User::WaitForRequest(gprsReqStatus);
       
    89 
       
    90 	//Check GPRS notify package have correct parameters
       
    91 	TESTL(gprsContextNotify->iAccessPointName==DPCKTTSY_ACCESS_POINT1);
       
    92 	TESTL(gprsContextNotify->iAnonymousAccessReqd==DPCKTTSY_ANONYMOUS_ACCESS1);
       
    93 	TESTL(gprsContextNotify->iPdpAddress==DPCKTTSY_PDP_ADDRESS1);
       
    94 	TESTL(gprsContextNotify->iPdpCompression==DPCKTTSY_COMPRESSION1);
       
    95 	TESTL(gprsContextNotify->iPdpType==DPCKTTSY_PDP_TYPE1);
       
    96 
       
    97 	CleanupStack::PopAndDestroy(1); 
       
    98 	
       
    99 	// Close
       
   100 	iGPRSPacketContext.Close();
       
   101 	iGPRSPacketService.Close();
       
   102 	iPhone.Close();
       
   103 	ASSERT(RThread().RequestCount()==0);
       
   104 
       
   105 	return TestStepResult();
       
   106 	}
       
   107