telephonyserverplugins/common_tsy/test/integration/src/cctsyintegrationtestpacketcontext.cpp
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
child 26 8767c6acf334
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 /*
       
     2 * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 /**
       
    21  * Test step definitions for the PacketContext functional unit.
       
    22  * @internalTechnology
       
    23  */
       
    24 
       
    25 #include <etelmm.h>
       
    26 #include <etelpckt.h>
       
    27 #include <pcktcs.h>
       
    28 #include "cctsyintegrationtestpacketcontext.h"
       
    29 #include "chttpdownload.h"
       
    30 
       
    31 	
       
    32 CCTSYIntegrationTestPacketContextBase::CCTSYIntegrationTestPacketContextBase(CEtelSessionMgr& aEtelSessionMgr)
       
    33 	: CCTSYIntegrationTestSuiteStepBase(aEtelSessionMgr), iPacketServiceTestHelper(*this), iNetworkTestHelper(*this)
       
    34 /**
       
    35  * Constructor
       
    36  */
       
    37 	{
       
    38 	}
       
    39 
       
    40 CCTSYIntegrationTestPacketContextBase::~CCTSYIntegrationTestPacketContextBase()
       
    41 /*
       
    42  * Destructor
       
    43  */
       
    44 	{
       
    45 	}
       
    46 
       
    47 
       
    48 void CCTSYIntegrationTestPacketContextBase::SetAttachModeToWhenPossibleAndWaitForAttachL(RPacketService& aPacketService)
       
    49 /**
       
    50  * Attaches the phone to the packet service by setting the
       
    51  * attach mode to RPacketService::EAttachWhenPossible. Requests
       
    52  * that the phone attaches to the packet service and waits for
       
    53  * attach to complete.
       
    54  * 
       
    55  * @param aPacketService Reference to packet service subsession.
       
    56  */
       
    57     {
       
    58     RPacketService::TAttachMode attachMode;
       
    59     CHECK_EQUALS_L(aPacketService.GetAttachMode(attachMode), KErrNone, _L("RPacketService::GetAttachMode returned with an error."));
       
    60 
       
    61     TExtEtelRequestStatus notifyServiceStatusChStatus(aPacketService, EPacketNotifyStatusChange);
       
    62     CleanupStack::PushL(notifyServiceStatusChStatus);
       
    63     RPacketService::TStatus packetServiceStatus;
       
    64     aPacketService.NotifyStatusChange(notifyServiceStatusChStatus, packetServiceStatus);
       
    65 
       
    66     if(attachMode != RPacketService::EAttachWhenPossible)
       
    67 		{
       
    68 		CHECK_EQUALS_L(aPacketService.SetAttachMode(RPacketService::EAttachWhenPossible), KErrNone,
       
    69 					 _L("RPacketService::SetAttachMode returned with an error."));
       
    70 		}
       
    71 
       
    72     CHECK_EQUALS_L(aPacketService.GetAttachMode(attachMode), KErrNone, _L("RPacketService::GetAttachMode returned with an error."));
       
    73     CHECK_EQUALS_L(attachMode, RPacketService::EAttachWhenPossible, _L("RPacketService::GetAttachMode did not return EAttachWhenPossible."));
       
    74 
       
    75     // Ensure phone is attached to the packet service (RPacketService::GetStatus returns EStatusAttached).
       
    76 	RPacketService::TStatus packetStatus;
       
    77 	CHECK_EQUALS_L(aPacketService.GetStatus(packetStatus), KErrNone, _L("RPacketService::GetStatus returned with an error"));
       
    78 	
       
    79 	// Wait for phone to attach to packet service if it is not attached.
       
    80 	if (packetStatus != RPacketService::EStatusAttached)
       
    81 		{
       
    82         iPacketServiceTestHelper.WaitForPacketServiceNotifyStatusChange(
       
    83 				aPacketService,
       
    84 				notifyServiceStatusChStatus,
       
    85 				packetServiceStatus, 
       
    86 				RPacketService::EStatusAttached,
       
    87 				KErrNone);
       
    88         CHECK_EQUALS_L(aPacketService.GetStatus(packetStatus), KErrNone, _L("RPacketService::GetStatus returned with an error"));
       
    89         CHECK_EQUALS_L(packetStatus, RPacketService::EStatusAttached, _L("RPacketService::GetStatus did not return EStatusAttached"));
       
    90 		}
       
    91 
       
    92     CleanupStack::PopAndDestroy(1, &notifyServiceStatusChStatus);
       
    93     }
       
    94 
       
    95 
       
    96 TInt CCTSYIntegrationTestPacketContextBase::AddPacketFilterV2ToContextL(RPacketContext& aPacketContext, TInt aId, TInt aErrCode)
       
    97 /**
       
    98  * Adds a packet filter to context.
       
    99  * 
       
   100  * @param aPacketContext Reference to packet context subsession.
       
   101  * @param aId the id of the filter to set, which is also an identifyer to one of three predefined filters
       
   102  * @param aErrCode  the error code that the AddPacketFilter should return, default KErrNone.
       
   103  * 
       
   104  * @return Request status value returned by
       
   105  *         RPacketContext::AddPacketFilter call.
       
   106  */
       
   107     {
       
   108     RPacketContext::TPacketFilterV2 packetFilterV2;
       
   109     FillPacketFilter(packetFilterV2,aId);
       
   110     
       
   111 	RPacketContext::TPacketFilterV2Pckg packetFilterV2pckg(packetFilterV2);
       
   112 	
       
   113 	TExtEtelRequestStatus addFilterStatus(aPacketContext, EPacketContextAddPacketFilter); 
       
   114     CleanupStack::PushL(addFilterStatus);
       
   115 	aPacketContext.AddPacketFilter(addFilterStatus, packetFilterV2pckg);
       
   116 	ASSERT_EQUALS(WaitForRequestWithTimeOut(addFilterStatus, ETimeShort), KErrNone,
       
   117                   _L("RPacketContext::AddPacketFilter timed out"))
       
   118     ASSERT_EQUALS(addFilterStatus.Int(), aErrCode,
       
   119                   _L("RPacketContext::AddPacketFilter did returned the expected value"))
       
   120 
       
   121     TInt ret = addFilterStatus.Int();
       
   122     CleanupStack::PopAndDestroy(&addFilterStatus);
       
   123 	return ret;
       
   124     }
       
   125 
       
   126 // Helper macro, same as ASSERT_EQUALS but also change a local parameter (ret) to EFalse if the parameters are not equal
       
   127 // One should define the variable TBool ret before calling this macro, and then one can use this variable  to know if any of the local macros failed.
       
   128 #define LOCAL_ASSERT_EQUALS(result,expected,msg)  \
       
   129     { \
       
   130     TBool tempLocalAssertEqualsRet = ((result)==(expected)); \
       
   131     ASSERT_TRUE(tempLocalAssertEqualsRet,msg); \
       
   132     if(!tempLocalAssertEqualsRet)   \
       
   133         { \
       
   134         ret=EFalse; \
       
   135         }  \
       
   136     }
       
   137 
       
   138 // Helper macro, same as ASSERT_TRUE but also change a local parameter (ret) to EFalse if the parameters are not equal
       
   139 // One should define the variable TBool ret before calling this macro, and then one can use this variable  to know if any of the local macros failed.
       
   140 #define LOCAL_ASSERT_TRUE(value,msg) LOCAL_ASSERT_EQUALS((TBool)(value),(TBool)ETrue,msg);
       
   141 
       
   142 
       
   143 TUint CCTSYIntegrationTestPacketContextBase::FindLSB(TUint aNumber)
       
   144 /**
       
   145  * Finds the least significant bit in a number
       
   146  * 
       
   147  * @param aNumber The number
       
   148  * @return The LSB of aNumber
       
   149  */
       
   150 	{
       
   151 	if(aNumber==0)
       
   152 		{
       
   153 		return 0;
       
   154 		}
       
   155 	TUint bit=1;
       
   156 	while(ETrue)
       
   157 		{
       
   158 		if((aNumber&bit)!=0)
       
   159 			{
       
   160 			return bit;
       
   161 			}
       
   162 		bit=bit*2;
       
   163 		}
       
   164 	}
       
   165 
       
   166 TUint CCTSYIntegrationTestPacketContextBase::FindMSB(TUint aNumber)
       
   167 /**
       
   168  * Finds the most significant bit in a number
       
   169  * 
       
   170  * @param aNumber The number
       
   171  * @return The MSB of aNumber
       
   172  */
       
   173 	{
       
   174 	if(aNumber==0)
       
   175 		{
       
   176 		return 0;
       
   177 		}
       
   178 	TUint bit=1;
       
   179 	while(ETrue)
       
   180 		{
       
   181 		if((aNumber&bit)!=0)
       
   182 			{
       
   183 			aNumber=(aNumber^bit);
       
   184 			if(aNumber==0)
       
   185 				{
       
   186 				return bit;
       
   187 				}
       
   188 			}
       
   189 		bit=bit*2;
       
   190 		}
       
   191 	}
       
   192 
       
   193 void CCTSYIntegrationTestPacketContextBase::FillPacketFilter(RPacketContext::TPacketFilterV2 &aFilter, TInt aId)
       
   194 /**
       
   195  * Fill a packet filter object with actual values.
       
   196  * 
       
   197  * @param aFilter Reference to the structure to fill.
       
   198  * @param aId the id of the filter to set, which is also an identifyer to one of three predefined filters
       
   199  * 
       
   200  */
       
   201     {
       
   202 	aFilter.iId = aId;
       
   203     switch(aId)
       
   204         {
       
   205         case 1:
       
   206         {
       
   207         aFilter.iEvaluationPrecedenceIndex = 0;
       
   208         aFilter.iSrcAddr[0] = 0xCF;
       
   209         aFilter.iSrcAddr[1] = 0xFF;
       
   210         aFilter.iSrcAddr[2] = 0xFF;
       
   211         aFilter.iSrcAddr[3] = 0x11;
       
   212         aFilter.iSrcAddrSubnetMask[0] = 0xC0;
       
   213         aFilter.iSrcAddrSubnetMask[1] = 0xC1;
       
   214         aFilter.iSrcAddrSubnetMask[2] = 0xF2;
       
   215         aFilter.iSrcAddrSubnetMask[3] = 0x51;
       
   216         aFilter.iProtocolNumberOrNextHeader = 6;
       
   217         aFilter.iSrcPortMin = 2;
       
   218         aFilter.iSrcPortMax = 65000;
       
   219         aFilter.iDestPortMin = 8;
       
   220         aFilter.iDestPortMax = 65100;
       
   221         aFilter.iTOSorTrafficClass = 0x3F8C;
       
   222         aFilter.iFlowLabel = 0;
       
   223         aFilter.iIPSecSPI = 0;
       
   224         break;
       
   225         }
       
   226         case 2:
       
   227         {
       
   228         aFilter.iEvaluationPrecedenceIndex = 255;
       
   229         aFilter.iSrcAddr[0] = 0x21;
       
   230         aFilter.iSrcAddr[1] = 0xD2;
       
   231         aFilter.iSrcAddr[2] = 0x3F;
       
   232         aFilter.iSrcAddr[3] = 0x1A;
       
   233         aFilter.iSrcAddrSubnetMask[0] = 0x2A;
       
   234         aFilter.iSrcAddrSubnetMask[1] = 0x2B;
       
   235         aFilter.iSrcAddrSubnetMask[2] = 0xFF;
       
   236         aFilter.iSrcAddrSubnetMask[3] = 0x3F;
       
   237         aFilter.iProtocolNumberOrNextHeader = 8;
       
   238         aFilter.iIPSecSPI = 0x0F88F000;
       
   239         aFilter.iTOSorTrafficClass = 0x2F77;
       
   240         aFilter.iDestPortMax = 0;
       
   241         aFilter.iDestPortMin = 0;
       
   242         aFilter.iFlowLabel = 0;
       
   243         aFilter.iSrcPortMax = 0;
       
   244         aFilter.iSrcPortMin = 0;        
       
   245         break;
       
   246         }
       
   247         case 3:
       
   248         {
       
   249         aFilter.iEvaluationPrecedenceIndex = 127;
       
   250         aFilter.iSrcAddr[0] = 0xEF;
       
   251         aFilter.iSrcAddr[1] = 0xAF;
       
   252         aFilter.iSrcAddr[2] = 0xBF;
       
   253         aFilter.iSrcAddr[3] = 0x21;
       
   254         aFilter.iSrcAddrSubnetMask[0] = 0x10;
       
   255         aFilter.iSrcAddrSubnetMask[1] = 0x21;
       
   256         aFilter.iSrcAddrSubnetMask[2] = 0x32;
       
   257         aFilter.iSrcAddrSubnetMask[3] = 0x41;
       
   258         aFilter.iProtocolNumberOrNextHeader = 10;
       
   259         aFilter.iSrcPortMin = 0;
       
   260         aFilter.iSrcPortMax = 0;
       
   261         aFilter.iDestPortMin = 0;
       
   262         aFilter.iDestPortMax = 0;
       
   263         aFilter.iTOSorTrafficClass = 0x4F8C;
       
   264         aFilter.iFlowLabel = 0;
       
   265         aFilter.iIPSecSPI = 0;
       
   266         }
       
   267          case 4:
       
   268         {
       
   269         aFilter.iEvaluationPrecedenceIndex = 0;
       
   270         aFilter.iSrcAddr[0] = 0xD0;
       
   271         aFilter.iSrcAddr[1] = 0xFF;
       
   272         aFilter.iSrcAddr[2] = 0xFF;
       
   273         aFilter.iSrcAddr[3] = 0x11;
       
   274         aFilter.iSrcAddrSubnetMask[0] = 0xC1;
       
   275         aFilter.iSrcAddrSubnetMask[1] = 0xC1;
       
   276         aFilter.iSrcAddrSubnetMask[2] = 0xF2;
       
   277         aFilter.iSrcAddrSubnetMask[3] = 0x51;
       
   278         aFilter.iProtocolNumberOrNextHeader = 12;
       
   279         aFilter.iSrcPortMin = 2;
       
   280         aFilter.iSrcPortMax = 65000;
       
   281         aFilter.iDestPortMin = 8;
       
   282         aFilter.iDestPortMax = 65100;
       
   283         aFilter.iTOSorTrafficClass = 0x3F8C;
       
   284         aFilter.iFlowLabel = 0;
       
   285         aFilter.iIPSecSPI = 0;
       
   286         break;
       
   287 		}
       
   288          case 5:
       
   289         {
       
   290         aFilter.iEvaluationPrecedenceIndex = 127;
       
   291         aFilter.iSrcAddr[0] = 0xD1;
       
   292         aFilter.iSrcAddr[1] = 0xFF;
       
   293         aFilter.iSrcAddr[2] = 0xFF;
       
   294         aFilter.iSrcAddr[3] = 0x11;
       
   295         aFilter.iSrcAddrSubnetMask[0] = 0xC2;
       
   296         aFilter.iSrcAddrSubnetMask[1] = 0xC1;
       
   297         aFilter.iSrcAddrSubnetMask[2] = 0xF2;
       
   298         aFilter.iSrcAddrSubnetMask[3] = 0x51;
       
   299         aFilter.iProtocolNumberOrNextHeader = 14;
       
   300         aFilter.iSrcPortMin = 2;
       
   301         aFilter.iSrcPortMax = 65000;
       
   302         aFilter.iDestPortMin = 8;
       
   303         aFilter.iDestPortMax = 65100;
       
   304         aFilter.iTOSorTrafficClass = 0x3F8C;
       
   305         aFilter.iFlowLabel = 0;
       
   306         aFilter.iIPSecSPI = 0;
       
   307         break;
       
   308         }
       
   309         case 6:
       
   310         {
       
   311         aFilter.iEvaluationPrecedenceIndex = 255;
       
   312         aFilter.iSrcAddr[0] = 0xD2;
       
   313         aFilter.iSrcAddr[1] = 0xFF;
       
   314         aFilter.iSrcAddr[2] = 0xFF;
       
   315         aFilter.iSrcAddr[3] = 0x11;
       
   316         aFilter.iSrcAddrSubnetMask[0] = 0xC3;
       
   317         aFilter.iSrcAddrSubnetMask[1] = 0xC1;
       
   318         aFilter.iSrcAddrSubnetMask[2] = 0xF2;
       
   319         aFilter.iSrcAddrSubnetMask[3] = 0x51;
       
   320         aFilter.iProtocolNumberOrNextHeader = 16;
       
   321         aFilter.iSrcPortMin = 2;
       
   322         aFilter.iSrcPortMax = 65000;
       
   323         aFilter.iDestPortMin = 8;
       
   324         aFilter.iDestPortMax = 65100;
       
   325         aFilter.iTOSorTrafficClass = 0x3F8C;
       
   326         aFilter.iFlowLabel = 0;
       
   327         aFilter.iIPSecSPI = 0;
       
   328         break;
       
   329         }
       
   330         case 7:
       
   331         {
       
   332         aFilter.iEvaluationPrecedenceIndex = 0;
       
   333         aFilter.iSrcAddr[0] = 0xD3;
       
   334         aFilter.iSrcAddr[1] = 0xFF;
       
   335         aFilter.iSrcAddr[2] = 0xFF;
       
   336         aFilter.iSrcAddr[3] = 0x11;
       
   337         aFilter.iSrcAddrSubnetMask[0] = 0xC4;
       
   338         aFilter.iSrcAddrSubnetMask[1] = 0xC1;
       
   339         aFilter.iSrcAddrSubnetMask[2] = 0xF2;
       
   340         aFilter.iSrcAddrSubnetMask[3] = 0x51;
       
   341         aFilter.iProtocolNumberOrNextHeader = 18;
       
   342         aFilter.iSrcPortMin = 2;
       
   343         aFilter.iSrcPortMax = 65000;
       
   344         aFilter.iDestPortMin = 8;
       
   345         aFilter.iDestPortMax = 65100;
       
   346         aFilter.iTOSorTrafficClass = 0x3F8C;
       
   347         aFilter.iFlowLabel = 0;
       
   348         aFilter.iIPSecSPI = 0;
       
   349         break;
       
   350         }
       
   351         case 8:
       
   352         default:
       
   353         {
       
   354         aFilter.iEvaluationPrecedenceIndex = 127;
       
   355         aFilter.iSrcAddr[0] = 0xD4;
       
   356         aFilter.iSrcAddr[1] = 0xFF;
       
   357         aFilter.iSrcAddr[2] = 0xFF;
       
   358         aFilter.iSrcAddr[3] = 0x11;
       
   359         aFilter.iSrcAddrSubnetMask[0] = 0xC5;
       
   360         aFilter.iSrcAddrSubnetMask[1] = 0xC1;
       
   361         aFilter.iSrcAddrSubnetMask[2] = 0xF2;
       
   362         aFilter.iSrcAddrSubnetMask[3] = 0x51;
       
   363         aFilter.iProtocolNumberOrNextHeader = 18;
       
   364         aFilter.iSrcPortMin = 2;
       
   365         aFilter.iSrcPortMax = 65000;
       
   366         aFilter.iDestPortMin = 8;
       
   367         aFilter.iDestPortMax = 65100;
       
   368         aFilter.iTOSorTrafficClass = 0x3F8C;
       
   369         aFilter.iFlowLabel = 0;
       
   370         aFilter.iIPSecSPI = 0;
       
   371         break;
       
   372         }
       
   373         }
       
   374     }
       
   375 
       
   376 
       
   377 TBool CCTSYIntegrationTestPacketContextBase::CompareFilters(const RPacketContext::TPacketFilterV2 &aFilterOne,
       
   378                                                             const RPacketContext::TPacketFilterV2 &aFilterTwo)
       
   379 /**
       
   380  * Compare two packet filter objects.
       
   381  * 
       
   382  * @param aFilterOne Reference to the structure with the first filter.
       
   383  * @param aFilterOne Reference to the structure with the second filter.
       
   384  *
       
   385  * @return ETrue if both filters are the same
       
   386  * 
       
   387  */
       
   388     {
       
   389     TBool ret = ETrue;
       
   390 
       
   391     LOCAL_ASSERT_EQUALS(aFilterOne.ExtensionId(), aFilterTwo.ExtensionId() ,_L("RPacketContext::GetPacketFilterInfo returned wrong iExtensionId"));
       
   392     LOCAL_ASSERT_EQUALS(aFilterOne.iId, aFilterTwo.iId ,_L("RPacketContext::GetPacketFilterInfo returned wrong iId"));
       
   393     LOCAL_ASSERT_EQUALS(aFilterOne.iEvaluationPrecedenceIndex, aFilterTwo.iEvaluationPrecedenceIndex ,_L("RPacketContext::GetPacketFilterInfo returned wrong iEvaluationPrecedenceIndex"));
       
   394     for(TInt i=0;i<RPacketContext::KIPAddressSize;++i)
       
   395         {
       
   396         LOCAL_ASSERT_EQUALS(aFilterOne.iSrcAddr[i], aFilterTwo.iSrcAddr[i] ,_L("RPacketContext::GetPacketFilterInfo returned wrong iSrcAddr"));
       
   397         LOCAL_ASSERT_EQUALS(aFilterOne.iSrcAddrSubnetMask[i], aFilterTwo.iSrcAddrSubnetMask[i] ,_L("RPacketContext::GetPacketFilterInfo returned wrong iSrcAddrSubnetMask"));
       
   398         }
       
   399     LOCAL_ASSERT_EQUALS(aFilterOne.iProtocolNumberOrNextHeader, aFilterTwo.iProtocolNumberOrNextHeader ,_L("RPacketContext::GetPacketFilterInfo returned wrong iProtocolNumberOrNextHeader"));
       
   400     LOCAL_ASSERT_EQUALS(aFilterOne.iSrcPortMin, aFilterTwo.iSrcPortMin ,_L("RPacketContext::GetPacketFilterInfo returned wrong iSrcPortMin"));
       
   401     LOCAL_ASSERT_EQUALS(aFilterOne.iSrcPortMax, aFilterTwo.iSrcPortMax ,_L("RPacketContext::GetPacketFilterInfo returned wrong iSrcPortMax"));
       
   402     LOCAL_ASSERT_EQUALS(aFilterOne.iDestPortMin, aFilterTwo.iDestPortMin ,_L("RPacketContext::GetPacketFilterInfo returned wrong iDestPortMin"));
       
   403     LOCAL_ASSERT_EQUALS(aFilterOne.iDestPortMax, aFilterTwo.iDestPortMax ,_L("RPacketContext::GetPacketFilterInfo returned wrong iDestPortMax"));
       
   404     LOCAL_ASSERT_EQUALS(aFilterOne.iIPSecSPI, aFilterTwo.iIPSecSPI ,_L("RPacketContext::GetPacketFilterInfo returned wrong iIPSecSPI"));
       
   405     LOCAL_ASSERT_EQUALS(aFilterOne.iTOSorTrafficClass, aFilterTwo.iTOSorTrafficClass ,_L("RPacketContext::GetPacketFilterInfo returned wrong iTOSorTrafficClass"));
       
   406     LOCAL_ASSERT_EQUALS(aFilterOne.iFlowLabel, aFilterTwo.iFlowLabel ,_L("RPacketContext::GetPacketFilterInfo returned wrong iFlowLabel"));
       
   407 
       
   408 
       
   409     return ret;
       
   410     }
       
   411 
       
   412 template<>
       
   413 void CCTSYIntegrationTestPacketContextBase::FillParametersFromCapabilities(RPacketQoS::TQoSGPRSRequested &aParameters,
       
   414                                                                            const RPacketQoS::TQoSCapsGPRS &aCapabilities)
       
   415 /**
       
   416  * fill a RPacketQoS::TQoSGPRSRequested object from a given RPacketQoS::TQoSCapsGPRS capabilities
       
   417  * 
       
   418  * @param aParameters Reference to the structure of the parameters to fill.
       
   419  * @param aCapabilities Reference to the structure with the capabilities to use.
       
   420  *
       
   421  */
       
   422     {
       
   423     aParameters.iMinDelay = static_cast<RPacketQoS::TQoSDelay>(FindMSB(aCapabilities.iDelay));
       
   424 	aParameters.iReqDelay = static_cast<RPacketQoS::TQoSDelay>(FindLSB(aCapabilities.iDelay));
       
   425 	aParameters.iMinMeanThroughput = static_cast<RPacketQoS::TQoSMeanThroughput>(FindMSB(aCapabilities.iMean));
       
   426 	aParameters.iReqMeanThroughput = static_cast<RPacketQoS::TQoSMeanThroughput>(FindLSB(aCapabilities.iMean));
       
   427 	aParameters.iMinPeakThroughput = static_cast<RPacketQoS::TQoSPeakThroughput>(FindMSB(aCapabilities.iPeak));
       
   428 	aParameters.iReqPeakThroughput = static_cast<RPacketQoS::TQoSPeakThroughput>(FindLSB(aCapabilities.iPeak));
       
   429 	aParameters.iMinReliability = static_cast<RPacketQoS::TQoSReliability>(FindMSB(aCapabilities.iReliability));
       
   430 	aParameters.iReqReliability = static_cast<RPacketQoS::TQoSReliability>(FindLSB(aCapabilities.iReliability));
       
   431 	aParameters.iReqPrecedence = static_cast<RPacketQoS::TQoSPrecedence>(FindMSB(aCapabilities.iPrecedence));
       
   432 	aParameters.iMinPrecedence = static_cast<RPacketQoS::TQoSPrecedence>(FindLSB(aCapabilities.iPrecedence));
       
   433     
       
   434     }
       
   435 
       
   436 
       
   437 template<>
       
   438 void CCTSYIntegrationTestPacketContextBase::FillParametersFromCapabilities(RPacketQoS::TQoSR99_R4Requested &aParameters,
       
   439                                                                            const RPacketQoS::TQoSCapsR99_R4 &aCapabilities)
       
   440 /**
       
   441  * fill a RPacketQoS::TQoSR99_R4Requested object from a given RPacketQoS::TQoSCapsR99_R4 capabilities
       
   442  * 
       
   443  * @param aParameters Reference to the structure of the parameters to fill.
       
   444  * @param aCapabilities Reference to the structure with the capabilities to use.
       
   445  *
       
   446  */
       
   447     {
       
   448     aParameters.iReqTrafficClass = static_cast<RPacketQoS::TTrafficClass>(FindLSB(aCapabilities.iTrafficClass));
       
   449     aParameters.iMinTrafficClass = static_cast<RPacketQoS::TTrafficClass>(FindMSB(aCapabilities.iTrafficClass));
       
   450     aParameters.iReqDeliveryOrderReqd = static_cast<RPacketQoS::TDeliveryOrder>(FindLSB(aCapabilities.iDeliveryOrderReqd));
       
   451     aParameters.iMinDeliveryOrderReqd = static_cast<RPacketQoS::TDeliveryOrder>(FindMSB(aCapabilities.iDeliveryOrderReqd));
       
   452     aParameters.iReqDeliverErroneousSDU = static_cast<RPacketQoS::TErroneousSDUDelivery>(FindLSB(aCapabilities.iDeliverErroneousSDU));
       
   453     aParameters.iMinDeliverErroneousSDU = static_cast<RPacketQoS::TErroneousSDUDelivery>(FindMSB(aCapabilities.iDeliverErroneousSDU));
       
   454     aParameters.iReqMaxSDUSize = 1500; //NOT SURE
       
   455     aParameters.iMinAcceptableMaxSDUSize = 100; //NOT SURE
       
   456     aParameters.iReqMaxRate.iUplinkRate = 1000; //NOT SURE
       
   457     aParameters.iReqMaxRate.iDownlinkRate  = 1000; //NOT SURE
       
   458     aParameters.iMinAcceptableMaxRate.iUplinkRate = 500; //NOT SURE
       
   459     aParameters.iMinAcceptableMaxRate.iDownlinkRate = 500; //NOT SURE
       
   460     aParameters.iReqBER = static_cast<RPacketQoS::TBitErrorRatio>(FindLSB(aCapabilities.iBER));
       
   461     aParameters.iMaxBER = static_cast<RPacketQoS::TBitErrorRatio>(FindMSB(aCapabilities.iBER));
       
   462     aParameters.iReqSDUErrorRatio = static_cast<RPacketQoS::TSDUErrorRatio>(FindLSB(aCapabilities.iSDUErrorRatio));
       
   463     aParameters.iMaxSDUErrorRatio = static_cast<RPacketQoS::TSDUErrorRatio>(FindMSB(aCapabilities.iSDUErrorRatio));
       
   464     aParameters.iReqTrafficHandlingPriority = static_cast<RPacketQoS::TTrafficHandlingPriority>(FindLSB(aCapabilities.iTrafficHandlingPriority));
       
   465     aParameters.iMinTrafficHandlingPriority = static_cast<RPacketQoS::TTrafficHandlingPriority>(FindMSB(aCapabilities.iTrafficHandlingPriority));
       
   466     aParameters.iReqTransferDelay = 1000; //NOT SURE
       
   467     aParameters.iMaxTransferDelay = 100; //NOT SURE
       
   468     aParameters.iReqGuaranteedRate.iUplinkRate = 1000; //NOT SURE
       
   469     aParameters.iReqGuaranteedRate.iDownlinkRate  = 1000; //NOT SURE
       
   470     aParameters.iMinGuaranteedRate.iUplinkRate = 500; //NOT SURE
       
   471     aParameters.iMinGuaranteedRate.iDownlinkRate  = 500; //NOT SURE
       
   472     }
       
   473 
       
   474 template<>
       
   475 void CCTSYIntegrationTestPacketContextBase::FillParametersFromCapabilities(RPacketQoS::TQoSR5Requested &aParameters,
       
   476                                                                            const RPacketQoS::TQoSCapsR5 &aCapabilities)
       
   477 /**
       
   478  * fill a RPacketQoS::TQoSR5Requested object from a given RPacketQoS::TQoSCapsR5 capabilities
       
   479  * 
       
   480  * @param aParameters Reference to the structure of the parameters to fill.
       
   481  * @param aCapabilities Reference to the structure with the capabilities to use.
       
   482  *
       
   483  */
       
   484     {
       
   485     FillParametersFromCapabilities((RPacketQoS::TQoSR99_R4Requested&)aParameters,(const RPacketQoS::TQoSCapsR99_R4 &)aCapabilities);
       
   486     aParameters.iSignallingIndication = static_cast<TBool>(aCapabilities.iSignallingIndication);
       
   487     aParameters.iSourceStatisticsDescriptor = static_cast<RPacketQoS::TSourceStatisticsDescriptor>(aCapabilities.iSourceStatisticsDescriptor);
       
   488     }
       
   489 
       
   490 
       
   491 template<class QOSCAPS>
       
   492 void CCTSYIntegrationTestPacketContextBase::GetProfileCapsL(RPacketQoS& aContextQoS, QOSCAPS& aCapabilities)
       
   493 /**
       
   494  * Get QoS profile capabilities
       
   495  * 
       
   496  * @param aContextQoS Reference RPacketQoS object.
       
   497  * @param aCapabilities Reference to QoS capabilities.
       
   498  *
       
   499  */
       
   500     {
       
   501 	TPckg<QOSCAPS> qosCapsPckg(aCapabilities);
       
   502 	TExtEtelRequestStatus reqQoSProfileCaps(aContextQoS,EPacketQoSGetProfileCaps);
       
   503 	CleanupStack::PushL(reqQoSProfileCaps);		
       
   504 	aContextQoS.GetProfileCapabilities(reqQoSProfileCaps, qosCapsPckg);	
       
   505 	ASSERT_EQUALS(WaitForRequestWithTimeOut(reqQoSProfileCaps, ETimeMedium), KErrNone, _L("RPacketQoS::GetProfileCapabilities timed out."));	
       
   506 	ASSERT_EQUALS(reqQoSProfileCaps.Int(), KErrNone, _L("RPacketQoS::GetProfileCapabilities returned with error status."));
       
   507 	CleanupStack::PopAndDestroy(1, &reqQoSProfileCaps);	
       
   508     }
       
   509 
       
   510 
       
   511 TBool CCTSYIntegrationTestPacketContextBase::ActivateSecondaryPacketContextL(RPacketContext& aSecondaryPacketContext, TPrimaryPacketContextId aPrimaryPacketContextId, TSecondaryPacketContextId aSecondaryPacketContextId)
       
   512 /**
       
   513  * Activate a secondary packet context
       
   514  *
       
   515  * @param aSecondaryPacketContext a reference to a context session to activate.
       
   516  *
       
   517  * @return ETrue if everything is OK, EFalse in any other case
       
   518  */
       
   519     {
       
   520     TBool ret = ETrue;
       
   521 
       
   522 	// Add a TPacketFilterV2 packet filter to the secondary context using RPacketContext::AddPacketFilter
       
   523 	LOCAL_ASSERT_EQUALS(AddPacketFilterV2ToContextL(aSecondaryPacketContext,1), KErrNone,
       
   524                        _L("RPacketContext::AddPacketFilter returned with error status"));
       
   525 
       
   526 	// Open a new QoS from the secondary context
       
   527 	RPacketQoS& packetQoS = iEtelSessionMgr.GetSecondaryPacketContextQoSL(
       
   528 												KMainServer,
       
   529 												KMainPhone,
       
   530 												KMainPacketService, 
       
   531 												aPrimaryPacketContextId,
       
   532 												aSecondaryPacketContextId);
       
   533 
       
   534 	// Get QoS profile capabilities with RPacketQoS::GetProfileCapabilities
       
   535 	TExtEtelRequestStatus getProfileCapStatus(packetQoS, EPacketQoSGetProfileCaps);
       
   536 	CleanupStack::PushL(getProfileCapStatus);
       
   537 	RPacketQoS::TQoSCapsGPRS qosCapGprs;
       
   538 	TPckg<RPacketQoS::TQoSCapsGPRS> qosCapsGprsPckg(qosCapGprs);
       
   539 	packetQoS.GetProfileCapabilities(getProfileCapStatus, qosCapsGprsPckg);
       
   540 	LOCAL_ASSERT_EQUALS(WaitForRequestWithTimeOut(getProfileCapStatus, ETimeMedium), KErrNone, 
       
   541                         _L("RPacketQoS::GetProfileCapabilities timed out."));
       
   542     LOCAL_ASSERT_EQUALS(getProfileCapStatus.Int(), KErrNone,
       
   543                         _L("RPacketQoS::GetProfileCapabilities returned with error status."));
       
   544 
       
   545 	// Set requested profile parameters with RPacketQoS::SetProfileParameters and TQoSGPRSRequested with parameters within range returned by RPacketQoS::GetProfileCapabilities	
       
   546     RPacketQoS::TQoSGPRSRequested qosGprsRequested;
       
   547 	TPckg<RPacketQoS::TQoSGPRSRequested> qosGprsReqPckg(qosGprsRequested);
       
   548     FillParametersFromCapabilities(qosGprsRequested,qosCapGprs);    
       
   549 	TExtEtelRequestStatus setProfileParamStatus(packetQoS, EPacketQoSSetProfileParams);
       
   550 	CleanupStack::PushL(setProfileParamStatus);
       
   551 	packetQoS.SetProfileParameters(setProfileParamStatus, qosGprsReqPckg);
       
   552 	LOCAL_ASSERT_EQUALS(WaitForRequestWithTimeOut(setProfileParamStatus, ETimeMedium), KErrNone, 
       
   553                   _L("RPacketQoS::SetProfileParameters timed out."));
       
   554 	LOCAL_ASSERT_EQUALS(setProfileParamStatus.Int(), KErrNone,
       
   555                    _L("RPacketQoS::SetProfileParameters returned with error status."));
       
   556 
       
   557 
       
   558 	// Post notification for context's status change
       
   559 	TExtEtelRequestStatus notifyContextStChStatus(aSecondaryPacketContext, EPacketContextNotifyStatusChange);
       
   560 	CleanupStack::PushL(notifyContextStChStatus);
       
   561 	RPacketContext::TContextStatus packetContextStatus;
       
   562 	aSecondaryPacketContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);
       
   563 
       
   564 	// Activate packet context with RPacketContext::Activate
       
   565 	TExtEtelRequestStatus contextActivateStatus(aSecondaryPacketContext, EPacketContextActivate);
       
   566 	CleanupStack::PushL(contextActivateStatus);
       
   567 	aSecondaryPacketContext.Activate(contextActivateStatus);
       
   568 	LOCAL_ASSERT_EQUALS(WaitForRequestWithTimeOut(contextActivateStatus, ETimeLong), KErrNone, 
       
   569                         _L("RPacketContext::Activate timed out."));
       
   570 	LOCAL_ASSERT_EQUALS(contextActivateStatus.Int(), KErrNone,
       
   571                         _L("RPacketContext::Activate returned with error status."));
       
   572 
       
   573 	// Check RPacketContext::NotifyStatusChange for the secondary context completes with EStatusActive
       
   574     RPacketContext::TContextStatus expectedPacketContextStatus = RPacketContext::EStatusActive;
       
   575     iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
   576 				aSecondaryPacketContext,
       
   577 				notifyContextStChStatus,
       
   578 				packetContextStatus, 
       
   579 				expectedPacketContextStatus,
       
   580 				KErrNone);
       
   581 
       
   582     // Check RPacketContext::GetStatus for the secondary context returns EStatusActive
       
   583 	ASSERT_EQUALS(aSecondaryPacketContext.GetStatus(packetContextStatus), KErrNone, _L("RPacketContext::GetStatus returned with an error."));
       
   584     LOCAL_ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusActive, _L("Packet Context's status expected to be EStatusActive but is not."));
       
   585 
       
   586 	// Pop:
       
   587 	//	contextActivateStatus
       
   588 	//	notifyContextStChStatus
       
   589 	//	setProfileParamStatus
       
   590 	//	getProfileCapStatus
       
   591 	CleanupStack::PopAndDestroy(4,&getProfileCapStatus);
       
   592     return ret;
       
   593     
       
   594     }
       
   595 
       
   596 CCTSYIntegrationTestPacketContext0001::CCTSYIntegrationTestPacketContext0001(CEtelSessionMgr& aEtelSessionMgr)
       
   597 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
   598 /**
       
   599  * Constructor.
       
   600  */
       
   601 	{
       
   602 	SetTestStepName(CCTSYIntegrationTestPacketContext0001::GetTestStepName());
       
   603 	}
       
   604 
       
   605 CCTSYIntegrationTestPacketContext0001::~CCTSYIntegrationTestPacketContext0001()
       
   606 /**
       
   607  * Destructor.
       
   608  */
       
   609 	{
       
   610 	}
       
   611 
       
   612 TVerdict CCTSYIntegrationTestPacketContext0001::doTestStepL()
       
   613 /**
       
   614  * @SYMTestCaseID BA-CTSY-INT-PKTC-0001
       
   615  * @SYMFssID BA/CTSY/PKTC-0001
       
   616  * @SYMTestCaseDesc Activate and deactivate a primary PDP context.
       
   617  * @SYMTestPriority High
       
   618  * @SYMTestActions RPacketContext::Activate, RPacketService::NotifyStatusChange, RPacketService::GetStatus, RPacketContext::NotifyStatusChange, RPacketContext::GetStatus, RPacketService::NotifyContextAdded, RPacketService::NotifyDynamicCapsChange, RPacketService::GetDynamicCaps, RPacketContext::GetConfig, RPacketContext::Deactivate, RPacketContext::GetDnsInfo
       
   619  * @SYMTestExpectedResults Pass - Activation and deactivation succeeds. Packet service and context statuses are correct.
       
   620  * @SYMTestType CIT
       
   621  * @SYMTestCaseDependencies live/automatic
       
   622  *
       
   623  * Reason for test: Verify packet service status, packet context statuses, dynamic caps.
       
   624  *
       
   625  * @return - TVerdict code
       
   626  */
       
   627 	{
       
   628 
       
   629 	////////////////////////////////////////////////////////////////
       
   630 	// SET UP
       
   631 	////////////////////////////////////////////////////////////////
       
   632 
       
   633     // Call TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL		
       
   634     RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
   635 	CHECK_EQUALS_L(iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(phone), KErrNone, _L("TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL returned with an error"));
       
   636 
       
   637     // Get packet service
       
   638 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, KMainPhone, KMainPacketService);
       
   639 
       
   640     // Get the attach mode so that it can be restored at the end of the test
       
   641     RPacketService::TAttachMode attachMode;
       
   642     CHECK_EQUALS_L(packetService.GetAttachMode(attachMode), KErrNone, _L("RPacketService::GetAttachMode returned with an error."));
       
   643 
       
   644     // Ensure phone is attached to the packet service
       
   645     SetAttachModeToWhenPossibleAndWaitForAttachL(packetService);
       
   646 
       
   647 	////////////////////////////////////////////////////////////////
       
   648 	// SET UP END
       
   649 	////////////////////////////////////////////////////////////////
       
   650 	
       
   651 	StartTest();
       
   652 	
       
   653 	////////////////////////////////////////////////////////////////
       
   654 	// TEST START
       
   655 	////////////////////////////////////////////////////////////////
       
   656 	
       
   657 	// Get network info from phone
       
   658 	TExtEtelRequestStatus getNetworkStatus(phone, EMobilePhoneGetCurrentNetwork);
       
   659 	CleanupStack::PushL(getNetworkStatus);
       
   660 	RMobilePhone::TMobilePhoneNetworkInfoV1 info;
       
   661 	RMobilePhone::TMobilePhoneNetworkInfoV1Pckg infopckg(info);
       
   662 	phone.GetCurrentNetwork(getNetworkStatus, infopckg);
       
   663 
       
   664 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getNetworkStatus, ETimeLong),
       
   665 				  						    KErrNone, _L("RMobilePhone::GetCurrentNetwork timed out"));
       
   666 	ASSERT_EQUALS(getNetworkStatus.Int(),
       
   667 				  KErrNone, _L("RMobilePhone::GetCurrentNetwork returned an error"));
       
   668 
       
   669 	// Currenlty there are three context configs types: TContextConfigGPRS, TContextConfigCDMA, TContextConfigR99_R4
       
   670 	// A suitable config should be chosen accoriding to the baseband's capability.
       
   671 	
       
   672 	// Get the context config using network info
       
   673 	// Using Gprs config for now...
       
   674 	RPacketContext::TContextConfigGPRS config;
       
   675 	TPtrC apn, user, pwd;
       
   676 	iPacketServiceTestHelper.GetGprsSettings(info, apn, user, pwd);
       
   677 	config.iAccessPointName.Copy(apn);
       
   678 	config.iProtocolConfigOption.iAuthInfo.iUsername.Copy(user);
       
   679 	config.iProtocolConfigOption.iAuthInfo.iPassword.Copy(pwd);
       
   680 	TPckg<RPacketContext::TContextConfigGPRS> configPk(config);
       
   681 
       
   682 	// Set the context.
       
   683 
       
   684 	// Post notification for the RPacketService::NotifyContextAdded
       
   685 	TExtEtelRequestStatus notifyContextStatus(packetService, EPacketNotifyContextAdded);
       
   686 	CleanupStack::PushL(notifyContextStatus);
       
   687 	TName contextId;
       
   688 	packetService.NotifyContextAdded(notifyContextStatus, contextId);
       
   689 	
       
   690 	RPacketContext& packetContext = iEtelSessionMgr.GetPrimaryPacketContextL(
       
   691 											KMainServer,
       
   692 											KMainPhone,
       
   693 											KMainPacketService,
       
   694 											KPrimaryPacketContext1);
       
   695 
       
   696 	TExtEtelRequestStatus setConfigStatus(packetContext, EPacketContextSetConfig);	
       
   697 	CleanupStack::PushL(setConfigStatus);
       
   698 	packetContext.SetConfig(setConfigStatus, configPk);
       
   699 	
       
   700 	ASSERT_EQUALS(WaitForRequestWithTimeOut(setConfigStatus, ETimeLong), KErrNone, 
       
   701 					_L("RPacketContext::SetConfig timed out"));
       
   702 	ASSERT_EQUALS(setConfigStatus.Int(), KErrNone,
       
   703 					_L("RPacketContext::SetConfig returned with error status."));
       
   704 
       
   705 	// Check RPacketService::NotifyContextAdded completes with a valid context name
       
   706 	ASSERT_EQUALS(WaitForRequestWithTimeOut(notifyContextStatus, ETimeMedium), KErrNone,
       
   707 				  _L("RPacketService::NotifyContextAdded did not complete."));
       
   708     ASSERT_EQUALS(notifyContextStatus.Int(), KErrNone, 
       
   709     			_L("RPacketService::NotifyContextAdded returned with error status."));
       
   710     ASSERT_TRUE(contextId.Length() > 0,
       
   711     			_L("Packet context config has zero length contextId."));
       
   712 
       
   713 	// ===  Activate packet context  ===
       
   714 	// ===  Check context and service statuses and notifications  ===
       
   715 
       
   716 	// Post notification for service's status change
       
   717 	TExtEtelRequestStatus notifyServiceStChStatus(packetService, EPacketNotifyStatusChange);
       
   718 	CleanupStack::PushL(notifyServiceStChStatus);
       
   719 	RPacketService::TStatus packetServiceStatus;
       
   720 	packetService.NotifyStatusChange(notifyServiceStChStatus, packetServiceStatus);
       
   721 
       
   722 	// Post notification for service's dynamic caps change
       
   723     RPacketService::TDynamicCapsFlags dynCaps;
       
   724 	TExtEtelRequestStatus notifyServiceDynCapsStatus(packetService, EPacketNotifyDynamicCapsChange);
       
   725 	CleanupStack::PushL(notifyServiceDynCapsStatus);
       
   726 	packetService.NotifyDynamicCapsChange(notifyServiceDynCapsStatus, dynCaps);
       
   727 
       
   728 	// Post notification for context's status change
       
   729 	TExtEtelRequestStatus notifyContextStChStatus(packetContext, EPacketContextNotifyStatusChange);
       
   730 	CleanupStack::PushL(notifyContextStChStatus);
       
   731 	RPacketContext::TContextStatus packetContextStatus;
       
   732 	packetContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);
       
   733 
       
   734 	// Activate packet context with RPacketContext::Activate
       
   735 	DEBUG_PRINTF1(_L("Activating packet context"));
       
   736 	TExtEtelRequestStatus contextActivateStatus(packetContext, EPacketContextActivate);
       
   737 	CleanupStack::PushL(contextActivateStatus);
       
   738 	packetContext.Activate(contextActivateStatus);
       
   739 
       
   740 	ASSERT_EQUALS(WaitForRequestWithTimeOut(contextActivateStatus, ETimeLong), KErrNone, 
       
   741 					_L("RPacketContext::Activate timed out."));
       
   742 	ASSERT_EQUALS(contextActivateStatus.Int(), KErrNone,
       
   743 					_L("RPacketContext::Activate returned with error status."));
       
   744 
       
   745 	// Check RPacketService::NotifyStatusChange completes with EStatusActive
       
   746 	RPacketService::TStatus expectedPacketServiceStatus = RPacketService::EStatusActive;
       
   747 	iPacketServiceTestHelper.WaitForPacketServiceNotifyStatusChange(
       
   748 				packetService,
       
   749 				notifyServiceStChStatus,
       
   750 				packetServiceStatus, 
       
   751 				expectedPacketServiceStatus,
       
   752 				KErrNone);
       
   753 
       
   754 	// Check RPacketService::GetStatus returns EStatusActive
       
   755 	RPacketService::TStatus pckSrvcStatus;
       
   756 	ASSERT_EQUALS(packetService.GetStatus(pckSrvcStatus), KErrNone, _L("RPacketService::GetStatus returned with an error."));
       
   757 	ASSERT_EQUALS(pckSrvcStatus, RPacketService::EStatusActive, _L("RPacketService::GetStatus returns incorrect status."));
       
   758 
       
   759 	// Check RPacketContext::NotifyStatusChange completes with EStatusActivating -> EStatusActive
       
   760     RPacketContext::TContextStatus expectedPacketContextStatus = RPacketContext::EStatusActivating;
       
   761 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
   762 				packetContext,
       
   763 				notifyContextStChStatus,
       
   764 				packetContextStatus, 
       
   765 				expectedPacketContextStatus,
       
   766 				KErrNone);
       
   767 
       
   768     ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusActivating, _L("Packet Context's status expected to be EStatusActivating but is not."));
       
   769     packetContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);	
       
   770 
       
   771     expectedPacketContextStatus = RPacketContext::EStatusActive;
       
   772 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
   773 				packetContext,
       
   774 				notifyContextStChStatus,
       
   775 				packetContextStatus, 
       
   776 				expectedPacketContextStatus,
       
   777 				KErrNone);
       
   778 
       
   779 	// Check RPacketContext::GetStatus returns EStatusActive
       
   780 	ASSERT_EQUALS(packetContext.GetStatus(packetContextStatus), KErrNone, _L("RPacketContext::GetStatus returned with an error."));
       
   781 	ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusActive, _L("RPacketContext::GetStatus returns incorrect status."));
       
   782 
       
   783 	// ===  Check dynamic caps ===
       
   784 	DEBUG_PRINTF1(_L("Checking Dynamic Caps"));
       
   785 	
       
   786 	// Check RPacketService::NotifyDynamicCapsChange completes with caps in set of KCapsRxCSCall | KCapsRxContextActivationReq | KCapsSMSTransfer.
       
   787 	// Check RPacketService::NotifyDynamicCapsChange completes with caps NOT in set of RPacketService::KCapsManualAttach
       
   788     TInt wantedDynCapBits = RPacketService::KCapsRxCSCall | RPacketService::KCapsRxContextActivationReq | RPacketService::KCapsSMSTransfer;
       
   789 	TInt unWantedDynCapBits = RPacketService::KCapsManualAttach;
       
   790 	ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d</font>"), 10060 );
       
   791 	iPacketServiceTestHelper.WaitForPacketServiceNotifyDynamicCapsChange( 
       
   792 				packetService,
       
   793 				notifyServiceDynCapsStatus,
       
   794 				dynCaps, 
       
   795 				wantedDynCapBits,
       
   796 				unWantedDynCapBits,
       
   797 				KErrNone);
       
   798 
       
   799 	// Check RPacketService::GetDynamicCaps returns caps in set of KCapsRxCSCall | KCapsRxContextActivationReq | KCapsSMSTransfer
       
   800 	// Check RPacketService::GetDynamicCaps returns caps NOT in set of RPacketService::KCapsManualAttach
       
   801 	ASSERT_EQUALS(packetService.GetDynamicCaps(dynCaps), KErrNone, _L("RPacketService::GetDynamicCaps returned with an error"));
       
   802 	ASSERT_BITS_SET(dynCaps, wantedDynCapBits, unWantedDynCapBits, _L("Packet service's KCapsActivate flag not set"));
       
   803 
       
   804 	// ===  Get context information ===
       
   805 
       
   806 	// Check RPacketContext::GetConfig returns same config as that set
       
   807 	DEBUG_PRINTF1(_L("Get config information"));
       
   808 	TExtEtelRequestStatus contextConfigStatus(packetContext, EPacketContextGetConfig);
       
   809 	CleanupStack::PushL(contextConfigStatus);
       
   810 	RPacketContext::TContextConfigGPRS getConfig;
       
   811 	TPckg<RPacketContext::TContextConfigGPRS> getConfigPk(getConfig);
       
   812 	packetContext.GetConfig(contextConfigStatus, getConfigPk);
       
   813 	
       
   814 	ASSERT_EQUALS(WaitForRequestWithTimeOut(contextConfigStatus, ETimeMedium), KErrNone, 
       
   815 											  _L("RPacketContext::GetConfig timed out."))
       
   816 	ASSERT_EQUALS(contextConfigStatus.Int(), KErrNone,
       
   817 					_L("RPacketContext::GetConfig returned an error."));
       
   818 
       
   819 	ASSERT_EQUALS_DES8(getConfig.iAccessPointName, config.iAccessPointName, _L("RPacketContext::GetConfig returns incorrect config data."));
       
   820 	ASSERT_EQUALS_DES8(getConfig.iProtocolConfigOption.iAuthInfo.iUsername, config.iProtocolConfigOption.iAuthInfo.iUsername, _L("RPacketContext::GetConfig returns incorrect config data."));
       
   821 	ASSERT_EQUALS_DES8(getConfig.iProtocolConfigOption.iAuthInfo.iPassword, config.iProtocolConfigOption.iAuthInfo.iPassword, _L("RPacketContext::GetConfig returns incorrect config data."));
       
   822 
       
   823 	// Check RPacketContext::GetDnsInfo returns valid primary and secondary DNS ip addresses
       
   824 	RPacketContext::TDnsInfoV2 dnsInfo;
       
   825 	RPacketContext::TTDnsInfoV2Pckg dnsInfoPkg(dnsInfo);
       
   826 	TExtEtelRequestStatus dnsInfoStatus(packetContext, EPacketContextGetDNSInfo);
       
   827 	CleanupStack::PushL(dnsInfoStatus);
       
   828 	packetContext.GetDnsInfo(dnsInfoStatus, dnsInfoPkg);
       
   829 	ASSERT_EQUALS(WaitForRequestWithTimeOut(dnsInfoStatus, ETimeMedium), KErrNone, 
       
   830 											  _L("RPacketContext::GetDnsInfo timed out."));
       
   831 
       
   832 	ASSERT_EQUALS(dnsInfoStatus.Int(), KErrNone,
       
   833 					_L("RPacketContext::GetDnsInfo returned an error."));
       
   834 	ASSERT_TRUE(dnsInfo.iPrimaryDns.Length() > 0,
       
   835 				  _L("RPacketContext::GetDnsInfo returned with zero length PrimaryDns."));
       
   836 	ASSERT_TRUE(dnsInfo.iSecondaryDns.Length() > 0,
       
   837 				  _L("RPacketContext::GetDnsInfo returned with zero length SecondaryDns."));
       
   838 
       
   839 	// ===  Check context and service statuses on Deactivating packect context ===
       
   840 
       
   841 	// Post notification for context's status change
       
   842 	packetContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);
       
   843 	
       
   844 	// Post notification for service's status change
       
   845 	packetService.NotifyStatusChange(notifyServiceStChStatus, packetServiceStatus);
       
   846 
       
   847 	// Deactivate the context with RPacketContext::Deactivate
       
   848 	TExtEtelRequestStatus contextDeactivateStatus(packetContext, EPacketContextDeactivate);
       
   849 	CleanupStack::PushL(contextDeactivateStatus);
       
   850 	packetContext.Deactivate(contextDeactivateStatus);
       
   851 
       
   852 	ASSERT_EQUALS(WaitForRequestWithTimeOut(contextDeactivateStatus, ETimeLong), KErrNone, 
       
   853 					_L("RPacketContext::Deactivate timed out."));					
       
   854 	ASSERT_EQUALS(contextDeactivateStatus.Int(), KErrNone,
       
   855 					_L("RPacketContext::Deactivate returned with error status."));
       
   856 
       
   857 	// Check RPacketContext::NotifyStatusChange completes with EStatusDeactivating -> EStatusInactive
       
   858     expectedPacketContextStatus = RPacketContext::EStatusDeactivating;
       
   859 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
   860 				packetContext,
       
   861 				notifyContextStChStatus,
       
   862 				packetContextStatus, 
       
   863 				expectedPacketContextStatus,
       
   864 				KErrNone);
       
   865 
       
   866     ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusDeactivating, _L("Packet Context's status expected to be EStatusDeactivating but is not."));
       
   867     packetContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);	
       
   868 
       
   869     expectedPacketContextStatus = RPacketContext::EStatusInactive;
       
   870 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
   871 				packetContext,
       
   872 				notifyContextStChStatus,
       
   873 				packetContextStatus, 
       
   874 				expectedPacketContextStatus,
       
   875 				KErrNone);
       
   876 	ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusInactive, _L("Packet Context's status did not return EStatusInactive."));
       
   877 	
       
   878 	// Check RPacketContext::GetStatus returns EStatusInactive
       
   879 	ASSERT_EQUALS(packetContext.GetStatus(packetContextStatus), KErrNone, _L("RPacketContext::GetStatus returned with an error."));
       
   880 	ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusInactive, _L("RPacketContext::GetStatus returns incorrect status."));
       
   881 
       
   882 	// Check RPacketService::NotifyStatusChange completes with EStatusAttached
       
   883 	expectedPacketServiceStatus = RPacketService::EStatusAttached;
       
   884 	iPacketServiceTestHelper.WaitForPacketServiceNotifyStatusChange(
       
   885 				packetService,
       
   886 				notifyServiceStChStatus,
       
   887 				packetServiceStatus, 
       
   888 				expectedPacketServiceStatus,
       
   889 				KErrNone);
       
   890 
       
   891 	// Check RPacketService::GetStatus returns EStatusAttached
       
   892 	ASSERT_EQUALS(packetService.GetStatus(pckSrvcStatus), KErrNone, _L("RPacketService::GetStatus return error."));
       
   893 	ASSERT_EQUALS(pckSrvcStatus, RPacketService::EStatusAttached, _L("RPacketService::GetStatus returns incorrect status."));
       
   894 	
       
   895 	////////////////////////////////////////////////////////////////
       
   896 	// TEST END
       
   897 	////////////////////////////////////////////////////////////////
       
   898 	
       
   899     StartCleanup();
       
   900 
       
   901     // Return packet service's attach mode to original setting
       
   902 	ASSERT_EQUALS(packetService.SetAttachMode(attachMode), KErrNone, _L("RPacketService::SetAttachMode returned with an error."));
       
   903 
       
   904 	CleanupStack::Pop(10, &getNetworkStatus);	
       
   905                             // contextDeactivateStatus
       
   906 							// dnsInfoStatus
       
   907 							// contextConfigStatus
       
   908 							// contextActivateStatus, 
       
   909 							// notifyContextStChStatus,
       
   910 							// notifyServiceDynCapsStatus
       
   911 							// notifyServiceStChStatus,
       
   912 							// setConfigStatus,
       
   913 							// notifyContextStatus,
       
   914 							// getNetworkStatus
       
   915 
       
   916 	return TestStepResult();
       
   917 	}
       
   918 
       
   919 TPtrC CCTSYIntegrationTestPacketContext0001::GetTestStepName()
       
   920 /**
       
   921  * @return The test step name.
       
   922  */
       
   923 	{
       
   924 	return _L("CCTSYIntegrationTestPacketContext0001");
       
   925 	}
       
   926 
       
   927 
       
   928 
       
   929 CCTSYIntegrationTestPacketContext0002::CCTSYIntegrationTestPacketContext0002(CEtelSessionMgr& aEtelSessionMgr)
       
   930 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
   931 /**
       
   932  * Constructor.
       
   933  */
       
   934 	{
       
   935 	SetTestStepName(CCTSYIntegrationTestPacketContext0002::GetTestStepName());
       
   936 	}
       
   937 
       
   938 CCTSYIntegrationTestPacketContext0002::~CCTSYIntegrationTestPacketContext0002()
       
   939 /**
       
   940  * Destructor.
       
   941  */
       
   942 	{
       
   943 	}
       
   944 
       
   945 TVerdict CCTSYIntegrationTestPacketContext0002::doTestStepL()
       
   946 /**
       
   947  * @SYMTestCaseID BA-CTSY-INT-PKTC-0002
       
   948  * @SYMFssID BA/CTSY/PKTC-0002
       
   949  * @SYMTestCaseDesc Activate and deactivate a primary PDP context.
       
   950  * @SYMTestPriority High
       
   951  * @SYMTestActions RPacketContext::SetConfig, RPacketContext::Activate, RPacketService::NotifyStatusChange, RPacketService::GetStatus, RPacketContext::NotifyStatusChange, RPacketContext::GetStatus, RPacketService::EnumerateNifs, RPacketService::GetContextNameInNif, RPacketService::GetNifInfo, RPacketService::EnumerateContextsInNif, RPacketContext::Deactivate
       
   952  * @SYMTestExpectedResults Pass - Activation succeeds. NIF info correct.
       
   953  * @SYMTestType CIT
       
   954  * @SYMTestCaseDependencies live/automatic
       
   955  *
       
   956  * Reason for test: Verify NIF related info from RPacketService correct.
       
   957  *
       
   958  * @return - TVerdict code
       
   959  */
       
   960 	{
       
   961 
       
   962 	////////////////////////////////////////////////////////////////
       
   963 	// SET UP
       
   964 	////////////////////////////////////////////////////////////////
       
   965 
       
   966     // Call TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL		
       
   967 	RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer,KMainPhone);
       
   968 	CHECK_EQUALS_L(iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(phone), KErrNone, _L("TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL returned with an error"));
       
   969 
       
   970     // Get packet service
       
   971 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, KMainPhone, KMainPacketService);
       
   972 
       
   973 	// Get the attach mode so that it can be restored at the end of the test
       
   974     RPacketService::TAttachMode attachMode;
       
   975     CHECK_EQUALS_L(packetService.GetAttachMode(attachMode), KErrNone, _L("RPacketService::GetAttachMode returned with an error."));
       
   976 
       
   977     // Ensure phone is attached to the packet service
       
   978     SetAttachModeToWhenPossibleAndWaitForAttachL(packetService);
       
   979 
       
   980 	// Ensure RPacketService::GetDynamicCaps returns caps in set of KCapsActivate.
       
   981 
       
   982 	// $CTSYProblem.
       
   983 	// GetDynamicCaps does not return 0x1(KCapsActivate), because KCapsActivate flag is not set yet. 
       
   984 	// CTSY sets KCapsActivate flag during context initialisation.
       
   985 
       
   986 	// Check for the CAPS being returned
       
   987 	RPacketService::TDynamicCapsFlags dynCaps;
       
   988 	CHECK_EQUALS_L(packetService.GetDynamicCaps(dynCaps), KErrNone, _L("RPacketService::GetDynamicCaps returned with an error"));
       
   989 
       
   990 	// RPacketService::TDynamicCapsFlags wantedDynCapBits = RPacketService::KCapsActivate;	
       
   991 	//CHECK_BITS_SET_L(dynCaps, wantedDynCapBits, KNoUnwantedBits, _L("Packet service's KCapsActivate flag not set"));
       
   992 	
       
   993 
       
   994 	////////////////////////////////////////////////////////////////
       
   995 	// SET UP END
       
   996 	////////////////////////////////////////////////////////////////
       
   997 
       
   998 	StartTest();
       
   999 
       
  1000 	////////////////////////////////////////////////////////////////
       
  1001 	// TEST START
       
  1002 	////////////////////////////////////////////////////////////////
       
  1003 
       
  1004 	
       
  1005 	// Get network info from phone
       
  1006 	TExtEtelRequestStatus getNetworkStatus(phone, EMobilePhoneGetCurrentNetwork);
       
  1007 	CleanupStack::PushL(getNetworkStatus);
       
  1008 	RMobilePhone::TMobilePhoneNetworkInfoV1 info;
       
  1009 	RMobilePhone::TMobilePhoneNetworkInfoV1Pckg infopckg(info);
       
  1010 	phone.GetCurrentNetwork(getNetworkStatus, infopckg);
       
  1011 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getNetworkStatus, ETimeLong), KErrNone, _L("RMobilePhone::GetCurrentNetwork timed out"));
       
  1012 	ASSERT_EQUALS(getNetworkStatus.Int(), KErrNone, _L("RMobilePhone::GetCurrentNetwork returned an error"));
       
  1013 
       
  1014 	// Get the context config using network info
       
  1015 	RPacketContext::TContextConfigGPRS config;
       
  1016 	TPtrC apn, user, pwd;
       
  1017 	iPacketServiceTestHelper.GetGprsSettings(info, apn, user, pwd);
       
  1018 	config.iAccessPointName.Copy(apn);
       
  1019 	config.iProtocolConfigOption.iAuthInfo.iUsername.Copy(user);
       
  1020 	config.iProtocolConfigOption.iAuthInfo.iPassword.Copy(pwd);
       
  1021 	TPckg<RPacketContext::TContextConfigGPRS> configPk(config);	
       
  1022 
       
  1023 	// Post notification for the RPacketService::NotifyContextAdded
       
  1024 	TExtEtelRequestStatus notifyContextStatus(packetService, EPacketNotifyContextAdded);
       
  1025 	CleanupStack::PushL(notifyContextStatus);
       
  1026 	TName contextId;
       
  1027 	packetService.NotifyContextAdded(notifyContextStatus, contextId);
       
  1028 
       
  1029 	// Open a new primary context.	
       
  1030 	RPacketContext& packetContext = iEtelSessionMgr.GetPrimaryPacketContextL(
       
  1031 												KMainServer,
       
  1032 												KMainPhone,
       
  1033 												KMainPacketService,
       
  1034 												KPrimaryPacketContext1);
       
  1035 
       
  1036 	// Set a valid context config with RPacketContext::SetConfig
       
  1037 	TExtEtelRequestStatus setConfigStatus(packetContext, EPacketContextSetConfig);	
       
  1038 	CleanupStack::PushL(setConfigStatus);
       
  1039 	packetContext.SetConfig(setConfigStatus, configPk);	
       
  1040 	ASSERT_EQUALS(WaitForRequestWithTimeOut(setConfigStatus, ETimeLong), KErrNone, _L("RPacketContext::SetConfig timed out"));
       
  1041 	ASSERT_EQUALS(setConfigStatus.Int(), KErrNone, _L("RPacketContext::SetConfig returned with error status."));
       
  1042 
       
  1043 	// Check RPacketService::NotifyContextAdded completes with a valid context name
       
  1044 	ASSERT_EQUALS(WaitForRequestWithTimeOut(notifyContextStatus, ETimeMedium), KErrNone, _L("RPacketService::NotifyContextAdded did not complete."));
       
  1045 	ASSERT_EQUALS(notifyContextStatus.Int(), KErrNone,	_L("RPacketService::NotifyContextAdded returned with error status."));
       
  1046 	ASSERT_TRUE(contextId.Length() > 0, _L("Packet context config has zero length contextId."));
       
  1047 
       
  1048 	// Post notification for context's status change
       
  1049 	TExtEtelRequestStatus notifyContextStChStatus(packetContext, EPacketContextNotifyStatusChange);
       
  1050 	CleanupStack::PushL(notifyContextStChStatus);
       
  1051 	RPacketContext::TContextStatus packetContextStatus;
       
  1052 	packetContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);
       
  1053 
       
  1054 	// Activate packet context with RPacketContext::Activate 
       
  1055 	TExtEtelRequestStatus contextActivateStatus(packetContext, EPacketContextActivate);
       
  1056 	CleanupStack::PushL(contextActivateStatus);
       
  1057 	packetContext.Activate(contextActivateStatus);
       
  1058 	ASSERT_EQUALS(WaitForRequestWithTimeOut(contextActivateStatus, ETimeLong), KErrNone, _L("RPacketContext::Activate timed out."));
       
  1059 	ASSERT_EQUALS(contextActivateStatus.Int(), KErrNone, _L("RPacketContext::Activate returned with error status."));
       
  1060 
       
  1061 	// ===  Check context and service statuses ===
       
  1062 
       
  1063 	// Check RPacketContext::NotifyStatusChange completes with EStatusActivating -> EStatusActive
       
  1064 	RPacketContext::TContextStatus expectedPacketContextStatus = RPacketContext::EStatusActivating;
       
  1065 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  1066 					packetContext,
       
  1067 					notifyContextStChStatus,
       
  1068 					packetContextStatus, 
       
  1069 					expectedPacketContextStatus,
       
  1070 					KErrNone);
       
  1071 
       
  1072 	expectedPacketContextStatus = RPacketContext::EStatusActive;
       
  1073 	packetContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);	
       
  1074 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  1075 					packetContext,
       
  1076 					notifyContextStChStatus,
       
  1077 					packetContextStatus, 
       
  1078 					expectedPacketContextStatus,
       
  1079 					KErrNone);
       
  1080 					
       
  1081 	// Check RPacketContext::GetStatus returns EStatusActive
       
  1082 	ASSERT_EQUALS(packetContext.GetStatus(packetContextStatus), KErrNone, _L("RPacketContext::GetStatus returned with an error."));
       
  1083 	ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusActive, _L("RPacketContext::GetStatus returns incorrect status."));
       
  1084 
       
  1085 	// ===  Check that there is one NIF with one primary context belonging to it ===
       
  1086 
       
  1087 	// Get context info	
       
  1088 	TExtEtelRequestStatus getContextInfo(packetService, EPacketGetContextInfo);
       
  1089 	CleanupStack::PushL(getContextInfo);
       
  1090 	RPacketService::TContextInfo contextInfo;
       
  1091 	const TInt index = 0;
       
  1092 	packetService.GetContextInfo(getContextInfo, index, contextInfo);
       
  1093 
       
  1094 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getContextInfo, ETimeLong), KErrNone, _L("RPacketService::GetContextInfo timed out"));
       
  1095 	ASSERT_TRUE(contextInfo.iName.Length() > 0, _L("RPacketService::GetContextInfo returned with zero length context name"));
       
  1096 
       
  1097 	// Check RPacketService::EnumerateNifs returns aCount = 1
       
  1098 	TExtEtelRequestStatus nifsStatus(packetService, EPacketEnumerateNifs);
       
  1099 	CleanupStack::PushL(nifsStatus);
       
  1100 	TInt nifCount = 0;
       
  1101 	const TInt wantedCount = 1;
       
  1102 	packetService.EnumerateNifs(nifsStatus, nifCount);
       
  1103 	ASSERT_EQUALS(WaitForRequestWithTimeOut(nifsStatus, ETimeLong), KErrNone, _L("RPacketService::EnumerateNifs timed out."));
       
  1104 	ASSERT_EQUALS(nifCount, wantedCount, _L("RPacketService::EnumerateNifs returned with an error."));
       
  1105 
       
  1106 	// Check RPacketService::EnumerateContextsInNif with aExistingContextName = existing context name returns aCount = 1
       
  1107 	TExtEtelRequestStatus enumerateContextsInNifStatus(packetService, EPacketEnumerateContextsInNif);
       
  1108 	CleanupStack::PushL(enumerateContextsInNifStatus);
       
  1109 	TInt contextsInNifCount;
       
  1110 	packetService.EnumerateContextsInNif(enumerateContextsInNifStatus, contextInfo.iName, contextsInNifCount);
       
  1111 
       
  1112 	ASSERT_EQUALS(WaitForRequestWithTimeOut(enumerateContextsInNifStatus, ETimeLong), KErrNone, _L("RPacketService::EnumerateContextsInNif timed out"));
       
  1113 	ASSERT_EQUALS(nifCount, wantedCount, _L("RPacketService::EnumerateContextsInNif returned wrong number of contexts sharing a NIF"));	
       
  1114 
       
  1115 	// Check RPacketService::GetContextNameInNif with aExistingContextName = existing context name and aIndex = 0 returns aContextName which is same as aExistingContextName
       
  1116 	TExtEtelRequestStatus contextNameNifsStatus(packetService, EPacketGetContextNameInNif);
       
  1117 	CleanupStack::PushL(contextNameNifsStatus);
       
  1118 	TInt iIndex = 0;
       
  1119 	TName contextName;
       
  1120 	packetService.GetContextNameInNif(contextNameNifsStatus, contextInfo.iName, iIndex, contextName );
       
  1121 
       
  1122 	ASSERT_EQUALS(WaitForRequestWithTimeOut(contextNameNifsStatus, ETimeLong), KErrNone, _L("RPacketContext::GetContextNameInNif timed out."));
       
  1123 	ASSERT_EQUALS_DES16(contextInfo.iName, contextName, _L("RPacketContext::GetContextNameInNif with aExistingContextName = existing context name returned with an error"));	
       
  1124 	ASSERT_EQUALS(iIndex, KErrNone, _L("RPacketContext::GetContextNameInNif with aIndex returned with an error"));
       
  1125 
       
  1126 	// Check RPacketService::GetNifInfo with aCount = 0 returns valid name in iContextName
       
  1127 	// Check RPacketService::GetNifInfo with aCount = 0 returns iNumberOfContexts = 1
       
  1128 	// Check RPacketService::GetNifInfo with aCount = 0 returns iNifStatus = EStatusActive
       
  1129 	// Check RPacketService::GetNifInfo with aCount = 0 returns valid address in iPdpAddress
       
  1130 	// Check RPacketService::GetNifInfo with aCount = 0 returns EInternalContext
       
  1131 
       
  1132 	TExtEtelRequestStatus nifInfoStatus(packetService, EPacketGetNifInfo);
       
  1133 	CleanupStack::PushL(nifInfoStatus);
       
  1134 	const TInt nifInfoCount = 0;
       
  1135 	RPacketService::TNifInfoV2 nifInfoV2;
       
  1136 	RPacketService::TNifInfoV2Pckg nifInfoV2Pkg(nifInfoV2);
       
  1137 	packetService.GetNifInfo(nifInfoStatus, nifInfoCount, nifInfoV2Pkg);
       
  1138 
       
  1139 	ASSERT_EQUALS(WaitForRequestWithTimeOut(nifInfoStatus, ETimeLong), KErrNone, _L("RPacketService::GetNifInfo returned an error"));
       
  1140 	ASSERT_EQUALS_DES16(nifInfoV2.iContextName, contextName, _L("RPacketService::GetNifInfo with valid name  returned with an error"));
       
  1141 	ASSERT_EQUALS(nifInfoV2.iNumberOfContexts, 1, _L("RPacketService::GetNifInfo with iNumberOfContexts returned with an error"));
       
  1142 	ASSERT_EQUALS(nifInfoV2.iNifStatus, RPacketContext::EStatusActive, _L("RPacketSerivce::GetNifInfo with iNifStatus returned with an error"));
       
  1143  	ASSERT_TRUE(nifInfoV2.iPdpAddress.Length() > 0, _L("RPacketService::GetNifInfo returned with invalid pdp address"));
       
  1144 
       
  1145  	// $CTSYProblem:RPacketService::GetNifInfo always returns EInternalContext
       
  1146  	// Changed test procedure to check for EInternalContext instead of EExternalContext
       
  1147  	ASSERT_EQUALS(nifInfoV2.iContextType, RPacketService::EInternalContext, _L("RPacketService::GetNifInfo returned wrong context type"));
       
  1148 
       
  1149 	// Post notification for context's status change
       
  1150 	packetContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);
       
  1151 
       
  1152 	// Deactivate the context with RPacketContext::Deactivate 
       
  1153 	TExtEtelRequestStatus contextDeactivateStatus(packetContext, EPacketContextDeactivate);
       
  1154 	CleanupStack::PushL(contextDeactivateStatus);
       
  1155 	packetContext.Deactivate(contextDeactivateStatus);
       
  1156 	ASSERT_EQUALS(WaitForRequestWithTimeOut(contextDeactivateStatus, ETimeLong), KErrNone, _L("RPacketContext::Deactivate timed out."));					
       
  1157 	ASSERT_EQUALS(contextDeactivateStatus.Int(), KErrNone, _L("RPacketContext::Deactivate returned with error status."));
       
  1158 
       
  1159 	// ===  Check context and service statuses ===
       
  1160 
       
  1161 	// Check RPacketContext::NotifyStatusChange completes with EStatusDeactivating -> EStatusInactive
       
  1162 	expectedPacketContextStatus = RPacketContext::EStatusDeactivating;
       
  1163 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  1164 					packetContext,
       
  1165 					notifyContextStChStatus,
       
  1166 					packetContextStatus, 
       
  1167 					expectedPacketContextStatus,
       
  1168 					KErrNone);
       
  1169 
       
  1170 	ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusDeactivating, _L("RPacketContext::GetStatus returns incorrect status."));
       
  1171 	packetContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);
       
  1172 
       
  1173 	expectedPacketContextStatus = RPacketContext::EStatusInactive;
       
  1174 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  1175 					packetContext,
       
  1176 					notifyContextStChStatus,
       
  1177 					packetContextStatus, 
       
  1178 					expectedPacketContextStatus,
       
  1179 					KErrNone);
       
  1180 				
       
  1181 	ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusInactive, _L("RPacketContext::GetStatus returns incorrect status."));
       
  1182 				
       
  1183 	// Check RPacketContext::GetStatus returns EStatusInactive
       
  1184 	ASSERT_EQUALS(packetContext.GetStatus(packetContextStatus), KErrNone, _L("RPacketContext::GetStatus returned with an error."));
       
  1185 	ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusInactive, _L("RPacketContext::GetStatus returns incorrect status."));
       
  1186 
       
  1187 	// Check RPacketService::EnumerateNifs returns aCount = 0
       
  1188 	TExtEtelRequestStatus enumerateNifsStatus(packetService, EPacketEnumerateNifs);
       
  1189 	CleanupStack::PushL(enumerateNifsStatus);
       
  1190 	nifCount = 0;
       
  1191 	const TInt wantedEnumerateNifsCount = 1;
       
  1192 	packetService.EnumerateNifs(enumerateNifsStatus, nifCount);
       
  1193 
       
  1194 	ASSERT_EQUALS(WaitForRequestWithTimeOut(enumerateNifsStatus, ETimeLong), KErrNone, _L("RPacketService::EnumerateNifs timed out"));
       
  1195 	ASSERT_EQUALS(nifCount, wantedEnumerateNifsCount, _L("RPacketService::EnumerateNifs returned wrong NIF count."));
       
  1196 	
       
  1197 	////////////////////////////////////////////////////////////////
       
  1198 	// TEST END
       
  1199 	////////////////////////////////////////////////////////////////
       
  1200 
       
  1201     StartCleanup();
       
  1202 
       
  1203 	// pop
       
  1204 	// getNetworkStatus
       
  1205 	// setConfigStatus
       
  1206 	// notifyContextStatus
       
  1207 	// contextActivateStatus
       
  1208 	// notifyContextStatus
       
  1209 	// notifyContextStChStatus
       
  1210 	// nifsStatus
       
  1211 	// ContextNifsStatus
       
  1212 	// ContextNameNifsStatus
       
  1213 	// nifInfoStatus
       
  1214 	// contextDeactivateStatus
       
  1215 	// enumerateNifsStatus
       
  1216 	CleanupStack::PopAndDestroy(12, &getNetworkStatus);
       
  1217 
       
  1218 	return TestStepResult();
       
  1219 	}
       
  1220 
       
  1221 TPtrC CCTSYIntegrationTestPacketContext0002::GetTestStepName()
       
  1222 /**
       
  1223  * @return The test step name.
       
  1224  */
       
  1225 	{
       
  1226 	return _L("CCTSYIntegrationTestPacketContext0002");
       
  1227 	}
       
  1228 
       
  1229 
       
  1230 
       
  1231 CCTSYIntegrationTestPacketContext0003::CCTSYIntegrationTestPacketContext0003(CEtelSessionMgr& aEtelSessionMgr)
       
  1232 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
  1233 /**
       
  1234  * Constructor.
       
  1235  */
       
  1236 	{
       
  1237 	SetTestStepName(CCTSYIntegrationTestPacketContext0003::GetTestStepName());
       
  1238 	}
       
  1239 
       
  1240 CCTSYIntegrationTestPacketContext0003::~CCTSYIntegrationTestPacketContext0003()
       
  1241 /**
       
  1242  * Destructor.
       
  1243  */
       
  1244 	{
       
  1245 	}
       
  1246 
       
  1247 TVerdict CCTSYIntegrationTestPacketContext0003::doTestStepL()
       
  1248 /**
       
  1249  * @SYMTestCaseID BA-CTSY-INT-PKTC-0003
       
  1250  * @SYMFssID BA/CTSY/PKTC-0003
       
  1251  * @SYMTestCaseDesc Activate and deactivate a primary context (roaming).
       
  1252  * @SYMTestPriority High
       
  1253  * @SYMTestActions RPacketContext::SetConfig, RPacketContext::Activate, RPacketService::NotifyStatusChange, RPacketService::GetStatus, RPacketContext::NotifyStatusChange, RPacketContext::GetStatus, RPacketService::NotifyContextAdded, RPacketService::NotifyDynamicCapsChange, RPacketService::GetDynamicCaps, RPacketContext::GetConfig, RPacketContext::Deactivate, RPacketContext::GetDnsInfo
       
  1254  * @SYMTestExpectedResults Pass - Primary context is activated then deactivated.
       
  1255  * @SYMTestType CIT
       
  1256  * @SYMTestCaseDependencies live/manual
       
  1257  *
       
  1258  * Reason for test: Verify packet service status, packet context statuses, dynamic caps.
       
  1259  *
       
  1260  * @return - TVerdict code
       
  1261  */
       
  1262 	{
       
  1263 
       
  1264 	////////////////////////////////////////////////////////////////
       
  1265 	// SET UP
       
  1266 	////////////////////////////////////////////////////////////////
       
  1267 
       
  1268 	
       
  1269 	// Get the registration status and ensure that the phone is camped on a valid cell. 
       
  1270 
       
  1271 	// Ensure phone is attached to packet service. 
       
  1272 
       
  1273 
       
  1274 	////////////////////////////////////////////////////////////////
       
  1275 	// SET UP END
       
  1276 	////////////////////////////////////////////////////////////////
       
  1277 	
       
  1278 	StartTest();
       
  1279 	
       
  1280 	////////////////////////////////////////////////////////////////
       
  1281 	// TEST START
       
  1282 	////////////////////////////////////////////////////////////////
       
  1283 	
       
  1284 	
       
  1285 	// Check RPacketService::GetNtwkRegStatus returns ERegisteredRoaming
       
  1286 
       
  1287 	// Set a valid context config with RPacketContext::SetConfig 
       
  1288 
       
  1289 	// Check RPacketService::NotifyContextAdded completes with a valid context name
       
  1290 
       
  1291 	// Activate packet context with RPacketContext::Activate 
       
  1292 
       
  1293 	// ===  Check context and service statuses ===
       
  1294 
       
  1295 	// Check RPacketService::NotifyStatusChange completes with EStatusActive
       
  1296 
       
  1297 	// Check RPacketService::GetStatus returns EStatusActive
       
  1298 
       
  1299 	// Check RPacketContext::NotifyStatusChange completes with EStatusActivating -> EStatusActive
       
  1300 
       
  1301 	// Check RPacketContext::GetStatus returns EStatusActive
       
  1302 
       
  1303 	// ===  Check dynamic caps ===
       
  1304 
       
  1305 	// Check RPacketService::NotifyDynamicCapsChange completes with caps in set of KCapsRxCSCall | KCapsRxContextActivationReq | KCapsSMSTransfer.
       
  1306 	// Check RPacketService::NotifyDynamicCapsChange completes with caps NOT in set of RPacketService::KCapsManualAttach
       
  1307 
       
  1308 	// Check RPacketService::GetDynamicCaps returns caps in set of KCapsRxCSCall | KCapsRxContextActivationReq | KCapsSMSTransfer
       
  1309 	// Check RPacketService::GetDynamicCaps returns caps NOT in set of RPacketService::KCapsManualAttach
       
  1310 
       
  1311 	// ===  Get context information ===
       
  1312 
       
  1313 	// Check RPacketContext::GetConfig returns same config as that set
       
  1314 
       
  1315 	// Check RPacketContext::GetDnsInfo returns valid primary and secondary DNS ip addresses
       
  1316 
       
  1317 	// Deactivate the context with RPacketContext::Deactivate 
       
  1318 
       
  1319 	// ===  Check context and service statuses ===
       
  1320 
       
  1321 	// Check RPacketContext::NotifyStatusChange completes with EStatusDeactivating -> EStatusInactive
       
  1322 
       
  1323 	// Check RPacketContext::GetStatus returns EStatusInactive
       
  1324 
       
  1325 	// Check RPacketService::NotifyStatusChange completes with EStatusAttached
       
  1326 
       
  1327 	// Check RPacketService::GetStatus returns EStatusAttached
       
  1328 
       
  1329 	
       
  1330 	////////////////////////////////////////////////////////////////
       
  1331 	// TEST END
       
  1332 	////////////////////////////////////////////////////////////////
       
  1333 
       
  1334     StartCleanup();
       
  1335 	
       
  1336 	// Put any required test clean up here, then remove this comment
       
  1337 	
       
  1338 	return TestStepResult();
       
  1339 	}
       
  1340 
       
  1341 TPtrC CCTSYIntegrationTestPacketContext0003::GetTestStepName()
       
  1342 /**
       
  1343  * @return The test step name.
       
  1344  */
       
  1345 	{
       
  1346 	return _L("CCTSYIntegrationTestPacketContext0003");
       
  1347 	}
       
  1348 
       
  1349 
       
  1350 
       
  1351 CCTSYIntegrationTestPacketContext0004::CCTSYIntegrationTestPacketContext0004(CEtelSessionMgr& aEtelSessionMgr)
       
  1352 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
  1353 /**
       
  1354  * Constructor.
       
  1355  */
       
  1356 	{
       
  1357 	SetTestStepName(CCTSYIntegrationTestPacketContext0004::GetTestStepName());
       
  1358 	}
       
  1359 
       
  1360 CCTSYIntegrationTestPacketContext0004::~CCTSYIntegrationTestPacketContext0004()
       
  1361 /**
       
  1362  * Destructor.
       
  1363  */
       
  1364 	{
       
  1365 	}
       
  1366 
       
  1367 TVerdict CCTSYIntegrationTestPacketContext0004::doTestStepL()
       
  1368 /**
       
  1369  * @SYMTestCaseID BA-CTSY-INT-PKTC-0004
       
  1370  * @SYMFssID BA/CTSY/PKTC-0004
       
  1371  * @SYMTestCaseDesc Activate and deactivate a primary context (roaming).
       
  1372  * @SYMTestPriority High
       
  1373  * @SYMTestActions RPacketContext::SetConfig, RPacketContext::Activate, RPacketService::NotifyStatusChange, RPacketService::GetStatus, RPacketContext::NotifyStatusChange, RPacketContext::GetStatus, RPacketService::EnumerateNifs, RPacketService::GetContextNameInNif, RPacketService::GetNifInfo, RPacketService::EnumerateContextsInNif, RPacketContext::Deactivate, RPacketService::EnumerateContextsInNif, RPacketContext::Deactivate
       
  1374  * @SYMTestExpectedResults Pass - Context activated and deactivated.
       
  1375  * @SYMTestType CIT
       
  1376  * @SYMTestCaseDependencies live/manual
       
  1377  *
       
  1378  * Reason for test: Verify NIF related info from RPacketService correct.
       
  1379  *
       
  1380  * @return - TVerdict code
       
  1381  */
       
  1382 	{
       
  1383 
       
  1384 	////////////////////////////////////////////////////////////////
       
  1385 	// SET UP
       
  1386 	////////////////////////////////////////////////////////////////
       
  1387 
       
  1388 	
       
  1389 
       
  1390 	////////////////////////////////////////////////////////////////
       
  1391 	// SET UP END
       
  1392 	////////////////////////////////////////////////////////////////
       
  1393 	
       
  1394 	StartTest();
       
  1395 	
       
  1396 	////////////////////////////////////////////////////////////////
       
  1397 	// TEST START
       
  1398 	////////////////////////////////////////////////////////////////
       
  1399 	
       
  1400 	
       
  1401 	// Check RPacketService::GetNtwkRegStatus returns ERegisteredRoaming
       
  1402 
       
  1403 	// Set a valid context config with RPacketContext::SetConfig 
       
  1404 
       
  1405 	// Check RPacketService::NotifyContextAdded completes with a valid context name
       
  1406 
       
  1407 	// Activate packet context with RPacketContext::Activate 
       
  1408 
       
  1409 	// ===  Check context and service statuses ===
       
  1410 
       
  1411 	// Check RPacketContext::NotifyStatusChange completes with EStatusActivating -> EStatusActive
       
  1412 
       
  1413 	// Check RPacketContext::GetStatus returns EStatusActive
       
  1414 
       
  1415 	// ===  Check that there is one NIF with one primary context belonging to it ===
       
  1416 
       
  1417 	// Check RPacketService::EnumerateNifs returns aCount = 1
       
  1418 
       
  1419 	// Check RPacketService::EnumerateContextsInNif with aExistingContextName = existing context name returns aCount = 1
       
  1420 
       
  1421 	// Check RPacketService::GetContextNameInNif with aExistingContextName = existing context name and aIndex = 0 returns aContextName which is same as aExistingContextName
       
  1422 
       
  1423 	// Check RPacketService::GetNifInfo with aCount = 0 returns valid name in iContextName
       
  1424 	// Check RPacketService::GetNifInfo with aCount = 0 returns iNumberOfContexts = 1
       
  1425 	// Check RPacketService::GetNifInfo with aCount = 0 returns iNifStatus = EStatusActive
       
  1426 	// Check RPacketService::GetNifInfo with aCount = 0 returns valid address in iPdpAddress
       
  1427 	// Check RPacketService::GetNifInfo with aCount = 0 returns EExternalContext
       
  1428 
       
  1429 	// Deactivate the context with RPacketContext::Deactivate 
       
  1430 
       
  1431 	// ===  Check context and service statuses ===
       
  1432 
       
  1433 	// Check RPacketContext::NotifyStatusChange completes with EStatusDeactivating -> EStatusInactive
       
  1434 
       
  1435 	// Check RPacketContext::GetStatus returns EStatusInactive
       
  1436 
       
  1437 	// Check RPacketService::EnumerateNifs returns aCount = 0
       
  1438 
       
  1439 	
       
  1440 	////////////////////////////////////////////////////////////////
       
  1441 	// TEST END
       
  1442 	////////////////////////////////////////////////////////////////
       
  1443 
       
  1444     StartCleanup();
       
  1445 	
       
  1446 	// Put any required test clean up here, then remove this comment
       
  1447 	
       
  1448 	return TestStepResult();
       
  1449 	}
       
  1450 
       
  1451 TPtrC CCTSYIntegrationTestPacketContext0004::GetTestStepName()
       
  1452 /**
       
  1453  * @return The test step name.
       
  1454  */
       
  1455 	{
       
  1456 	return _L("CCTSYIntegrationTestPacketContext0004");
       
  1457 	}
       
  1458 
       
  1459 
       
  1460 
       
  1461 CCTSYIntegrationTestPacketContext0005::CCTSYIntegrationTestPacketContext0005(CEtelSessionMgr& aEtelSessionMgr)
       
  1462 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
  1463 /**
       
  1464  * Constructor.
       
  1465  */
       
  1466 	{
       
  1467 	SetTestStepName(CCTSYIntegrationTestPacketContext0005::GetTestStepName());
       
  1468 	}
       
  1469 
       
  1470 CCTSYIntegrationTestPacketContext0005::~CCTSYIntegrationTestPacketContext0005()
       
  1471 /**
       
  1472  * Destructor.
       
  1473  */
       
  1474 	{
       
  1475 	}
       
  1476 
       
  1477 TVerdict CCTSYIntegrationTestPacketContext0005::doTestStepL()
       
  1478 /**
       
  1479  * @SYMTestCaseID BA-CTSY-INT-PKTC-0005
       
  1480  * @SYMFssID BA/CTSY/PKTC-0005
       
  1481  * @SYMTestCaseDesc Activate and deactivate an HSDPA context.
       
  1482  * @SYMTestPriority High
       
  1483  * @SYMTestActions RPacketContext::GetConfig, RPacketContext::Activate, RPacketContext::Deactivate, RPacketService::NotifyContextAdded, RPacketContext::GetStatus, RPacketContext::NotifyStatusChange, RPacketService::NotifyStatusChange, RPacketService::GetStatus, RPacketService::NotifyDynamicCapsChange, RPacketContext::SetConfig, RPacketContext::GetDnsInfo
       
  1484  * @SYMTestExpectedResults Pass - Context activated and deactivated.
       
  1485  * @SYMTestType CIT
       
  1486  * @SYMTestCaseDependencies simulated/manual
       
  1487  *
       
  1488  * Reason for test: Verify packet service status, packet context statuses, dynamic caps has KCapsHSDPA and static caps are correct. 
       
  1489  *
       
  1490  * @return - TVerdict code
       
  1491  */
       
  1492 	{
       
  1493 
       
  1494 	////////////////////////////////////////////////////////////////
       
  1495 	// SET UP
       
  1496 	////////////////////////////////////////////////////////////////
       
  1497 	
       
  1498 	//Check if we are  on a simulated network
       
  1499 
       
  1500 	ERR_PRINTF2(_L("<font color=Orange>$CTSYProblem: defect id = %d</font>"), 10083);
       
  1501 	User::Leave(KErrNone);		
       
  1502 	
       
  1503     RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
  1504  	iNetworkTestHelper.CheckPhoneConnectedToAniteL(phone);
       
  1505 
       
  1506 	// Call TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL		
       
  1507  	CHECK_EQUALS_L(iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(phone), KErrNone, _L("TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL returned with an error"));
       
  1508 
       
  1509     // Get packet service
       
  1510 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, KMainPhone, KMainPacketService);
       
  1511 
       
  1512 	// Ensure RPacketService::GetStaticCaps returns caps in set of KCapsHSDPASupported 
       
  1513 	TUint staticCaps = 0;
       
  1514 	TUint expectedCaps = RPacketService::KCapsHSDPASupported;
       
  1515 	CHECK_EQUALS_L(packetService.GetStaticCaps(staticCaps, RPacketContext::EPdpTypeIPv4), KErrNone, _L("RPacketService::GetStaticCaps returned an error"));
       
  1516 	CHECK_BITS_SET_L(staticCaps, expectedCaps, KNoUnwantedBits, _L("RPacketService::GetStaticCaps did not return correct static caps"));
       
  1517 			
       
  1518 	// Ensure phone is attached to the packet service in an HSDPA enabled cell. 
       
  1519     SetAttachModeToWhenPossibleAndWaitForAttachL(packetService);
       
  1520 
       
  1521 	////////////////////////////////////////////////////////////////
       
  1522 	// SET UP END
       
  1523 	////////////////////////////////////////////////////////////////
       
  1524 	
       
  1525 	StartTest();
       
  1526 	
       
  1527 	////////////////////////////////////////////////////////////////
       
  1528 	// TEST START
       
  1529 	////////////////////////////////////////////////////////////////
       
  1530 
       
  1531 
       
  1532 	// Post notification for the RPacketService::NotifyContextAdded
       
  1533 	TExtEtelRequestStatus notifyContextStatus(packetService, EPacketNotifyContextAdded);
       
  1534 	CleanupStack::PushL(notifyContextStatus);
       
  1535 	TName contextId;
       
  1536 	packetService.NotifyContextAdded(notifyContextStatus, contextId);
       
  1537 	
       
  1538 	// Open a primary context. 
       
  1539 	RPacketContext& packetContext = iEtelSessionMgr.GetPrimaryPacketContextL(
       
  1540 											KMainServer,
       
  1541 											KMainPhone,
       
  1542 											KMainPacketService,
       
  1543 											KPrimaryPacketContext1);
       
  1544 												
       
  1545 	// Check RPacketService::NotifyContextAdded completes with a valid context name
       
  1546 	ASSERT_EQUALS(WaitForRequestWithTimeOut(notifyContextStatus, ETimeMedium), KErrNone, _L("RPacketService::NotifyContextAdded did not complete."));
       
  1547 	ASSERT_EQUALS(notifyContextStatus.Int(), KErrNone,	_L("RPacketService::NotifyContextAdded returned with error status."));
       
  1548 	ASSERT_TRUE(contextId.Length() > 0, _L("Packet context config has zero length contextId."));
       
  1549 
       
  1550 	// Set a valid context config with RPacketContext::SetConfig 
       
  1551 	//Get network info from phone
       
  1552 	RMobilePhone::TMobilePhoneNetworkInfoV1 info;
       
  1553 	RMobilePhone::TMobilePhoneNetworkInfoV1Pckg infopckg(info);
       
  1554 	TExtEtelRequestStatus getNetworkStatus (phone,EMobilePhoneGetCurrentNetwork);
       
  1555 	CleanupStack::PushL(getNetworkStatus);
       
  1556 	phone.GetCurrentNetwork(getNetworkStatus, infopckg);
       
  1557 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getNetworkStatus, ETimeMedium), KErrNone, _L("MobilePhone::GetCurrentNetwork timed out"))
       
  1558 	ASSERT_EQUALS(getNetworkStatus.Int(), KErrNone, _L("MobilePhone::GetCurrentNetwork returned an error"))	
       
  1559 	
       
  1560 	// Get the context config using network info
       
  1561 	RPacketContext::TContextConfigGPRS config;
       
  1562 	TPtrC apn,user,pwd;
       
  1563 	iPacketServiceTestHelper.GetGprsSettings(info,apn,user,pwd);
       
  1564 	config.iAccessPointName.Copy(apn);
       
  1565 	config.iProtocolConfigOption.iAuthInfo.iUsername.Copy(user);
       
  1566 	config.iProtocolConfigOption.iAuthInfo.iPassword.Copy(pwd);
       
  1567 	TPckg<RPacketContext::TContextConfigGPRS> configPk(config);
       
  1568 	
       
  1569 	// set the context using network info
       
  1570 	TExtEtelRequestStatus setConfigStatus (packetContext,EPacketContextSetConfig);	
       
  1571 	CleanupStack::PushL(setConfigStatus); 
       
  1572 	packetContext.SetConfig(setConfigStatus,configPk);
       
  1573 	ASSERT_EQUALS(WaitForRequestWithTimeOut(setConfigStatus, ETimeLong), KErrNone, _L("PacketContext::SetConfig timed out"))								
       
  1574 	ASSERT_EQUALS(setConfigStatus.Int(), KErrNone, _L("PacketContext::SetConfig returned an error."))	
       
  1575 	
       
  1576 	// Post notification for service's status change
       
  1577 	TExtEtelRequestStatus notifyServiceStChStatus(packetService, EPacketNotifyStatusChange);
       
  1578 	CleanupStack::PushL(notifyServiceStChStatus);
       
  1579 	RPacketService::TStatus packetServiceStatus;
       
  1580 	packetService.NotifyStatusChange(notifyServiceStChStatus, packetServiceStatus);
       
  1581 	
       
  1582 	// Post notification for context's status change
       
  1583 	TExtEtelRequestStatus notifyContextStChStatus(packetContext, EPacketContextNotifyStatusChange);
       
  1584 	CleanupStack::PushL(notifyContextStChStatus);
       
  1585 	RPacketContext::TContextStatus packetContextStatus;
       
  1586 	packetContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);
       
  1587 	
       
  1588 	// Post notification for service's dynamic caps change
       
  1589     RPacketService::TDynamicCapsFlags dynCaps;
       
  1590 	TExtEtelRequestStatus notifyServiceDynCapsStatus(packetService, EPacketNotifyDynamicCapsChange);
       
  1591 	CleanupStack::PushL(notifyServiceDynCapsStatus);
       
  1592 	packetService.NotifyDynamicCapsChange(notifyServiceDynCapsStatus, dynCaps);
       
  1593 	
       
  1594 	// Activate packet context with RPacketContext::Activate 
       
  1595 	TExtEtelRequestStatus contextActivateStatus(packetContext, EPacketContextActivate);
       
  1596 	CleanupStack::PushL(contextActivateStatus);
       
  1597 	packetContext.Activate(contextActivateStatus);
       
  1598 	ASSERT_EQUALS(WaitForRequestWithTimeOut(contextActivateStatus, ETimeLong), KErrNone, _L("RPacketContext::Activate timed out."));
       
  1599 	ASSERT_EQUALS(contextActivateStatus.Int(), KErrNone, _L("RPacketContext::Activate returned with error status."));
       
  1600 	
       
  1601 	// ===  Check context and service statuses ===
       
  1602 
       
  1603 	// Check RPacketService::NotifyStatusChange completes with EStatusActive
       
  1604 	RPacketService::TStatus expectedPacketServiceStatus = RPacketService::EStatusActive;
       
  1605 	iPacketServiceTestHelper.WaitForPacketServiceNotifyStatusChange(
       
  1606 					packetService,
       
  1607 					notifyServiceStChStatus,
       
  1608 					packetServiceStatus, 
       
  1609 					expectedPacketServiceStatus,
       
  1610 					KErrNone);
       
  1611 					
       
  1612 	// Check RPacketService::GetStatus returns EStatusActive
       
  1613 	RPacketService::TStatus pckSrvcStatus;
       
  1614 	ASSERT_EQUALS(packetService.GetStatus(pckSrvcStatus), KErrNone, _L("RPacketService::GetStatus returned with an error."));
       
  1615 	ASSERT_EQUALS(pckSrvcStatus, RPacketService::EStatusActive, _L("RPacketService::GetStatus returns incorrect status."));
       
  1616 
       
  1617 	// Check RPacketContext::NotifyStatusChange completes with EStatusActivating -> EStatusActive
       
  1618 	RPacketContext::TContextStatus expectedPacketContextStatus = RPacketContext::EStatusActivating;
       
  1619 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  1620 					packetContext,
       
  1621 					notifyContextStChStatus,
       
  1622 					packetContextStatus, 
       
  1623 					expectedPacketContextStatus,
       
  1624 					KErrNone);
       
  1625 
       
  1626 	packetContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);
       
  1627 	expectedPacketContextStatus = RPacketContext::EStatusActive;
       
  1628 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  1629 					packetContext,
       
  1630 					notifyContextStChStatus,
       
  1631 					packetContextStatus, 
       
  1632 					expectedPacketContextStatus,
       
  1633 					KErrNone);
       
  1634 					
       
  1635 	// Check RPacketContext::GetStatus returns EStatusActive
       
  1636 	ASSERT_EQUALS(packetContext.GetStatus(packetContextStatus), KErrNone, _L("RPacketContext::GetStatus returned with an error."));
       
  1637 	ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusActive, _L("RPacketContext::GetStatus returns incorrect status."));
       
  1638 
       
  1639 	// ===  Check dynamic caps ===
       
  1640 
       
  1641 	// Check RPacketService::NotifyDynamicCapsChange completes with caps in set of KCapsRxCSCall | KCapsRxContextActivationReq | KCapsSMSTransfer | KCapsHSDPA.
       
  1642 	// Check RPacketService::NotifyDynamicCapsChange completes with caps NOT in set of RPacketService::KCapsManualAttach
       
  1643     TInt wantedDynCapBits = RPacketService::KCapsRxCSCall | RPacketService::KCapsRxContextActivationReq | RPacketService::KCapsSMSTransfer | RPacketService::KCapsHSDPA;
       
  1644 	TInt unWantedDynCapBits = RPacketService::KCapsManualAttach;
       
  1645 	iPacketServiceTestHelper.WaitForPacketServiceNotifyDynamicCapsChange( 
       
  1646 				packetService,
       
  1647 				notifyServiceDynCapsStatus,
       
  1648 				dynCaps, 
       
  1649 				wantedDynCapBits,
       
  1650 				unWantedDynCapBits,
       
  1651 				KErrNone);
       
  1652 				
       
  1653 	// Check RPacketService::GetDynamicCaps returns caps in set of KCapsRxCSCall | KCapsRxContextActivationReq | KCapsSMSTransfer | KCapsHSDPA
       
  1654 	// Check RPacketService::GetDynamicCaps returns caps NOT in set of RPacketService::KCapsManualAttach
       
  1655 	ASSERT_EQUALS(packetService.GetDynamicCaps(dynCaps), KErrNone, _L("RPacketService::GetDynamicCaps returned with an error"));
       
  1656 	ASSERT_BITS_SET(dynCaps, wantedDynCapBits, unWantedDynCapBits, _L("RPacketService::GetDynamicCaps did not return correct dynamic caps"));
       
  1657 
       
  1658 	// ===  Get context information ===
       
  1659 
       
  1660 	// Check RPacketContext::GetConfig returns same config as that set
       
  1661 	TExtEtelRequestStatus contextConfigStatus(packetContext, EPacketContextGetConfig);
       
  1662 	CleanupStack::PushL(contextConfigStatus);
       
  1663 	RPacketContext::TContextConfigGPRS getConfig;
       
  1664 	TPckg<RPacketContext::TContextConfigGPRS> getConfigPk(getConfig);
       
  1665 	packetContext.GetConfig(contextConfigStatus, getConfigPk);
       
  1666 	ASSERT_EQUALS(WaitForRequestWithTimeOut(contextConfigStatus, ETimeMedium), KErrNone, _L("RPacketContext::GetConfig timed out."))
       
  1667 	ASSERT_EQUALS(contextConfigStatus.Int(), KErrNone, _L("RPacketContext::GetConfig returned an error."));
       
  1668 	ASSERT_EQUALS_DES8(getConfig.iAccessPointName, config.iAccessPointName, _L("RPacketContext::GetConfig returns incorrect config data."));
       
  1669 	ASSERT_EQUALS_DES8(getConfig.iProtocolConfigOption.iAuthInfo.iUsername, config.iProtocolConfigOption.iAuthInfo.iUsername, _L("RPacketContext::GetConfig returns incorrect config data."));
       
  1670 	ASSERT_EQUALS_DES8(getConfig.iProtocolConfigOption.iAuthInfo.iPassword, config.iProtocolConfigOption.iAuthInfo.iPassword, _L("RPacketContext::GetConfig returns incorrect config data."));
       
  1671 
       
  1672 	// Check RPacketContext::GetDnsInfo returns valid primary and secondary DNS ip addresses
       
  1673 	RPacketContext::TDnsInfoV2 dnsInfo;
       
  1674 	RPacketContext::TTDnsInfoV2Pckg dnsInfoPkg(dnsInfo);
       
  1675 	TExtEtelRequestStatus dnsInfoStatus(packetContext, EPacketContextGetDNSInfo);
       
  1676 	CleanupStack::PushL(dnsInfoStatus);
       
  1677 	packetContext.GetDnsInfo(dnsInfoStatus, dnsInfoPkg);
       
  1678 	ASSERT_EQUALS(WaitForRequestWithTimeOut(dnsInfoStatus, ETimeMedium), KErrNone, _L("RPacketContext::GetDnsInfo timed out."));
       
  1679 	ASSERT_EQUALS(dnsInfoStatus.Int(), KErrNone, _L("RPacketContext::GetDnsInfo returned an error."));
       
  1680 	ASSERT_TRUE(dnsInfo.iPrimaryDns.Length() > 0, _L("RPacketContext::GetDnsInfo returned with zero length PrimaryDns."));
       
  1681 	ASSERT_TRUE(dnsInfo.iSecondaryDns.Length() > 0, _L("RPacketContext::GetDnsInfo returned with zero length SecondaryDns."));
       
  1682 	
       
  1683 	// Post notification for context's status change
       
  1684 	packetContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);
       
  1685 	
       
  1686 	// Post notification for service's status change
       
  1687 	packetService.NotifyStatusChange(notifyServiceStChStatus, packetServiceStatus);
       
  1688 
       
  1689 	// Deactivate the context with RPacketContext::Deactivate 
       
  1690 	TExtEtelRequestStatus contextDeactivateStatus(packetContext, EPacketContextDeactivate);
       
  1691 	CleanupStack::PushL(contextDeactivateStatus);
       
  1692 	packetContext.Deactivate(contextDeactivateStatus);
       
  1693 	ASSERT_EQUALS(WaitForRequestWithTimeOut(contextDeactivateStatus, ETimeLong), KErrNone, _L("RPacketContext::Deactivate timed out."));					
       
  1694 	ASSERT_EQUALS(contextDeactivateStatus.Int(), KErrNone, _L("RPacketContext::Deactivate returned with error status."));
       
  1695 
       
  1696 	// ===  Check context and service statuses ===
       
  1697 
       
  1698 	// Check RPacketContext::NotifyStatusChange completes with EStatusDeactivating -> EStatusInactive
       
  1699 	expectedPacketContextStatus = RPacketContext::EStatusDeactivating;
       
  1700 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  1701 					packetContext,
       
  1702 					notifyContextStChStatus,
       
  1703 					packetContextStatus, 
       
  1704 					expectedPacketContextStatus,
       
  1705 					KErrNone);
       
  1706 
       
  1707 	packetContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);
       
  1708 	expectedPacketContextStatus = RPacketContext::EStatusInactive;
       
  1709 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  1710 					packetContext,
       
  1711 					notifyContextStChStatus,
       
  1712 					packetContextStatus, 
       
  1713 					expectedPacketContextStatus,
       
  1714 					KErrNone);
       
  1715 					
       
  1716 	// Check RPacketContext::GetStatus returns EStatusInactive
       
  1717 	ASSERT_EQUALS(packetContext.GetStatus(packetContextStatus), KErrNone, _L("RPacketContext::GetStatus returned with an error."));
       
  1718 	ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusInactive, _L("RPacketContext::GetStatus returns incorrect status."));
       
  1719 
       
  1720 	// Check RPacketService::NotifyStatusChange completes with EStatusAttached
       
  1721 	expectedPacketServiceStatus = RPacketService::EStatusAttached;
       
  1722 	iPacketServiceTestHelper.WaitForPacketServiceNotifyStatusChange(
       
  1723 				packetService,
       
  1724 				notifyServiceStChStatus,
       
  1725 				packetServiceStatus, 
       
  1726 				expectedPacketServiceStatus,
       
  1727 				KErrNone);
       
  1728 				
       
  1729 	// Check RPacketService::GetStatus returns EStatusAttached
       
  1730 	ASSERT_EQUALS(packetService.GetStatus(pckSrvcStatus), KErrNone, _L("RPacketService::GetStatus return error."));
       
  1731 	ASSERT_EQUALS(pckSrvcStatus, RPacketService::EStatusAttached, _L("RPacketService::GetStatus returns incorrect status."));
       
  1732 	
       
  1733 	////////////////////////////////////////////////////////////////
       
  1734 	// TEST END
       
  1735 	////////////////////////////////////////////////////////////////
       
  1736 
       
  1737     StartCleanup();
       
  1738 	
       
  1739 	// pop
       
  1740 	// getNetworkStatus
       
  1741 	// setConfigStatus
       
  1742 	// notifyContextStatus
       
  1743 	// notifyServiceStChStatus
       
  1744 	// notifyContextStChStatus
       
  1745 	// notifyServiceDynCapsStatus
       
  1746 	// contextActivateStatus
       
  1747 	// contextConfigStatus
       
  1748 	// dnsInfoStatus
       
  1749 	// contextDeactivateStatus
       
  1750 	
       
  1751 	CleanupStack::PopAndDestroy(10, &getNetworkStatus);
       
  1752 	
       
  1753 	return TestStepResult();
       
  1754 	}
       
  1755 
       
  1756 TPtrC CCTSYIntegrationTestPacketContext0005::GetTestStepName()
       
  1757 /**
       
  1758  * @return The test step name.
       
  1759  */
       
  1760 	{
       
  1761 	return _L("CCTSYIntegrationTestPacketContext0005");
       
  1762 	}
       
  1763 
       
  1764 
       
  1765 
       
  1766 CCTSYIntegrationTestPacketContext0006::CCTSYIntegrationTestPacketContext0006(CEtelSessionMgr& aEtelSessionMgr)
       
  1767 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
  1768 /**
       
  1769  * Constructor.
       
  1770  */
       
  1771 	{
       
  1772 	SetTestStepName(CCTSYIntegrationTestPacketContext0006::GetTestStepName());
       
  1773 	}
       
  1774 
       
  1775 CCTSYIntegrationTestPacketContext0006::~CCTSYIntegrationTestPacketContext0006()
       
  1776 /**
       
  1777  * Destructor.
       
  1778  */
       
  1779 	{
       
  1780 	}
       
  1781 
       
  1782 TVerdict CCTSYIntegrationTestPacketContext0006::doTestStepL()
       
  1783 /**
       
  1784  * @SYMTestCaseID BA-CTSY-INT-PKTC-0006
       
  1785  * @SYMFssID BA/CTSY/PKTC-0006
       
  1786  * @SYMTestCaseDesc Activate and deactivate an EGPRS context.
       
  1787  * @SYMTestPriority High
       
  1788  * @SYMTestActions RPacketContext::GetConfig, RPacketContext::Activate, RPacketContext::Deactivate, RPacketService::NotifyContextAdded, RPacketContext::GetStatus, RPacketContext::NotifyStatusChange, RPacketService::NotifyStatusChange, RPacketService::GetStatus, RPacketService::NotifyDynamicCapsChange, RPacketContext::SetConfig, RPacketContext::GetDnsInfo
       
  1789  * @SYMTestExpectedResults Pass - Context activated and deactivated.
       
  1790  * @SYMTestType CIT
       
  1791  * @SYMTestCaseDependencies simulated/manual
       
  1792  *
       
  1793  * Reason for test: Verify packet service status, packet context statuses, dynamic caps.
       
  1794  *
       
  1795  * @return - TVerdict code
       
  1796  */
       
  1797 	{
       
  1798 
       
  1799 	////////////////////////////////////////////////////////////////
       
  1800 	// SET UP
       
  1801 	////////////////////////////////////////////////////////////////
       
  1802 	
       
  1803 	ERR_PRINTF2(_L("<font color=Orange>$CTSYProblem: defect id = %d</font>"), 10084);
       
  1804 	User::Leave(KErrNone);	
       
  1805 	
       
  1806 
       
  1807     //Check if we are on a simulated network to run emergency call tests
       
  1808     RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
  1809     iNetworkTestHelper.CheckPhoneConnectedToAniteL(phone);	
       
  1810 
       
  1811 	// Call TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL		
       
  1812 	CHECK_EQUALS_L(iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(phone), KErrNone, _L("TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL returned with an error"));
       
  1813 
       
  1814     // Get packet service
       
  1815 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, KMainPhone, KMainPacketService);
       
  1816 	
       
  1817  
       
  1818     // Ensure phone is attached to the packet service
       
  1819     SetAttachModeToWhenPossibleAndWaitForAttachL(packetService);
       
  1820     
       
  1821     // Ensure RPacketService::GetStaticCaps returns caps in set of KCapsEGPRSSupported 
       
  1822 	TUint staticCaps = 0;
       
  1823 	TUint expectedCaps = 	RPacketService::KCapsEGPRSSupported;
       
  1824 	CHECK_EQUALS_L(packetService.GetStaticCaps(staticCaps, RPacketContext::EPdpTypeIPv4), KErrNone, _L("RPacketService::GetStaticCaps returned an error"));
       
  1825 	CHECK_BITS_SET_L(staticCaps, expectedCaps, KNoUnwantedBits, _L("RPacketService::GetStaticCaps did not return correct static caps"));
       
  1826 			
       
  1827 
       
  1828 	////////////////////////////////////////////////////////////////
       
  1829 	// SET UP END
       
  1830 	////////////////////////////////////////////////////////////////
       
  1831 	
       
  1832 	StartTest();
       
  1833 	
       
  1834 	////////////////////////////////////////////////////////////////
       
  1835 	// TEST START
       
  1836 	////////////////////////////////////////////////////////////////
       
  1837 	
       
  1838 	// Post notification for the RPacketService::NotifyContextAdded
       
  1839 	TExtEtelRequestStatus notifyContextStatus(packetService, EPacketNotifyContextAdded);
       
  1840 	CleanupStack::PushL(notifyContextStatus);
       
  1841 	TName contextId;
       
  1842 	packetService.NotifyContextAdded(notifyContextStatus, contextId);
       
  1843 	
       
  1844 	// Open a primary context. 
       
  1845 	RPacketContext& packetContext = iEtelSessionMgr.GetPrimaryPacketContextL(
       
  1846 											KMainServer,
       
  1847 											KMainPhone,
       
  1848 											KMainPacketService,
       
  1849 											KPrimaryPacketContext1);
       
  1850 
       
  1851 	// Check RPacketService::NotifyContextAdded completes with a valid context name
       
  1852 	ASSERT_EQUALS(WaitForRequestWithTimeOut(notifyContextStatus, ETimeMedium), KErrNone, _L("RPacketService::NotifyContextAdded did not complete."));
       
  1853 	ASSERT_EQUALS(notifyContextStatus.Int(), KErrNone, _L("RPacketService::NotifyContextAdded returned with error status."));
       
  1854 	ASSERT_TRUE(contextId.Length() > 0, _L("RPacketService::NotifyContextAdded returned zero length contextId."));
       
  1855 
       
  1856 	// Set a valid context config with iUseEdge = ETrue using RPacketContext::SetConfig 
       
  1857 	//Get network info from phone
       
  1858 	RMobilePhone::TMobilePhoneNetworkInfoV1 info;
       
  1859 	RMobilePhone::TMobilePhoneNetworkInfoV1Pckg infopckg(info);
       
  1860 	TExtEtelRequestStatus getNetworkStatus (phone,EMobilePhoneGetCurrentNetwork);
       
  1861 	CleanupStack::PushL(getNetworkStatus);
       
  1862 	phone.GetCurrentNetwork(getNetworkStatus, infopckg);
       
  1863 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getNetworkStatus, ETimeMedium), KErrNone, _L("MobilePhone::GetCurrentNetwork timed out"))
       
  1864 	ASSERT_EQUALS(getNetworkStatus.Int(), KErrNone, _L("MobilePhone::GetCurrentNetwork returned an error"))	
       
  1865 	
       
  1866 	// Get the context config using network info
       
  1867 	RPacketContext::TContextConfigGPRS config;
       
  1868 	TPtrC apn,user,pwd;
       
  1869 	iPacketServiceTestHelper.GetGprsSettings(info,apn,user,pwd);
       
  1870 	config.iAccessPointName.Copy(apn);
       
  1871 	config.iProtocolConfigOption.iAuthInfo.iUsername.Copy(user);
       
  1872 	config.iProtocolConfigOption.iAuthInfo.iPassword.Copy(pwd);
       
  1873 	TBool edge = ETrue;
       
  1874 	config.iUseEdge = edge;
       
  1875 	TPckg<RPacketContext::TContextConfigGPRS> configPk(config);
       
  1876 	
       
  1877 	// set the context using network info
       
  1878 	TExtEtelRequestStatus setConfigStatus (packetContext,EPacketContextSetConfig);	
       
  1879 	CleanupStack::PushL(setConfigStatus); 
       
  1880 	packetContext.SetConfig(setConfigStatus,configPk);
       
  1881 	ASSERT_EQUALS(WaitForRequestWithTimeOut(setConfigStatus, ETimeLong), KErrNone, _L("PacketContext::SetConfig timed out"))								
       
  1882 	ASSERT_EQUALS(setConfigStatus.Int(), KErrNone, _L("PacketContext::SetConfig returned an error."))	
       
  1883 
       
  1884 	// Post notification for service's status change
       
  1885 	TExtEtelRequestStatus notifyServiceStChStatus(packetService, EPacketNotifyStatusChange);
       
  1886 	CleanupStack::PushL(notifyServiceStChStatus);
       
  1887 	RPacketService::TStatus packetServiceStatus;
       
  1888 	packetService.NotifyStatusChange(notifyServiceStChStatus, packetServiceStatus);
       
  1889 	
       
  1890 	// Post notification for context's status change
       
  1891 	TExtEtelRequestStatus notifyContextStChStatus(packetContext, EPacketContextNotifyStatusChange);
       
  1892 	CleanupStack::PushL(notifyContextStChStatus);
       
  1893 	RPacketContext::TContextStatus packetContextStatus;
       
  1894 	packetContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);
       
  1895 	
       
  1896 	// Post notification for service's dynamic caps change
       
  1897     RPacketService::TDynamicCapsFlags dynCaps;
       
  1898 	TExtEtelRequestStatus notifyServiceDynCapsStatus(packetService, EPacketNotifyDynamicCapsChange);
       
  1899 	CleanupStack::PushL(notifyServiceDynCapsStatus);
       
  1900 	packetService.NotifyDynamicCapsChange(notifyServiceDynCapsStatus, dynCaps);
       
  1901 	
       
  1902 	// Activate packet context with RPacketContext::Activate 
       
  1903 	TExtEtelRequestStatus contextActivateStatus(packetContext, EPacketContextActivate);
       
  1904 	CleanupStack::PushL(contextActivateStatus);
       
  1905 	packetContext.Activate(contextActivateStatus);
       
  1906 	ASSERT_EQUALS(WaitForRequestWithTimeOut(contextActivateStatus, ETimeLong), KErrNone, _L("RPacketContext::Activate timed out."));
       
  1907 	ASSERT_EQUALS(contextActivateStatus.Int(), KErrNone, _L("RPacketContext::Activate returned with error status."));
       
  1908 	
       
  1909 	// ===  Check context and service statuses ===
       
  1910 
       
  1911 	// Check RPacketService::NotifyStatusChange completes with EStatusActive
       
  1912 	RPacketService::TStatus expectedPacketServiceStatus = RPacketService::EStatusActive;
       
  1913 	iPacketServiceTestHelper.WaitForPacketServiceNotifyStatusChange(
       
  1914 					packetService,
       
  1915 					notifyServiceStChStatus,
       
  1916 					packetServiceStatus, 
       
  1917 					expectedPacketServiceStatus,
       
  1918 					KErrNone);
       
  1919 					
       
  1920 	// Check RPacketService::GetStatus returns EStatusActive
       
  1921 	RPacketService::TStatus pckSrvcStatus;
       
  1922 	ASSERT_EQUALS(packetService.GetStatus(pckSrvcStatus), KErrNone, _L("RPacketService::GetStatus returned with an error."));
       
  1923 	ASSERT_EQUALS(pckSrvcStatus, RPacketService::EStatusActive, _L("RPacketService::GetStatus returns incorrect status."));
       
  1924 
       
  1925 	// Check RPacketContext::NotifyStatusChange completes with EStatusActivating -> EStatusActive
       
  1926 	RPacketContext::TContextStatus expectedPacketContextStatus = RPacketContext::EStatusActivating;
       
  1927 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  1928 					packetContext,
       
  1929 					notifyContextStChStatus,
       
  1930 					packetContextStatus, 
       
  1931 					expectedPacketContextStatus,
       
  1932 					KErrNone);
       
  1933 
       
  1934 	packetContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);	
       
  1935 	expectedPacketContextStatus = RPacketContext::EStatusActive;
       
  1936 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  1937 					packetContext,
       
  1938 					notifyContextStChStatus,
       
  1939 					packetContextStatus, 
       
  1940 					expectedPacketContextStatus,
       
  1941 					KErrNone);
       
  1942 					
       
  1943 	// Check RPacketContext::GetStatus returns EStatusActive
       
  1944 	ASSERT_EQUALS(packetContext.GetStatus(packetContextStatus), KErrNone, _L("RPacketContext::GetStatus returned with an error."));
       
  1945 	ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusActive, _L("RPacketContext::GetStatus returns incorrect status."));
       
  1946 
       
  1947 	// ===  Check dynamic caps ===
       
  1948 
       
  1949 	// Check RPacketService::NotifyDynamicCapsChange completes with caps in set of KCapsRxCSCall | KCapsRxContextActivationReq | KCapsSMSTransfer | KCapsEGPRS.
       
  1950 	// Check RPacketService::NotifyDynamicCapsChange completes with caps NOT in set of RPacketService::KCapsManualAttach
       
  1951     TInt wantedDynCapBits = RPacketService::KCapsRxCSCall | RPacketService::KCapsRxContextActivationReq | RPacketService::KCapsSMSTransfer | RPacketService::KCapsEGPRS;
       
  1952 	TInt unWantedDynCapBits = RPacketService::KCapsManualAttach;
       
  1953 	iPacketServiceTestHelper.WaitForPacketServiceNotifyDynamicCapsChange( 
       
  1954 				packetService,
       
  1955 				notifyServiceDynCapsStatus,
       
  1956 				dynCaps, 
       
  1957 				wantedDynCapBits,
       
  1958 				unWantedDynCapBits,
       
  1959 				KErrNone);
       
  1960 				
       
  1961 	// Check RPacketService::GetDynamicCaps returns caps in set of KCapsRxCSCall | KCapsRxContextActivationReq | KCapsSMSTransfer | KCapsEGPRS
       
  1962 	// Check RPacketService::GetDynamicCaps returns caps NOT in set of RPacketService::KCapsManualAttach
       
  1963 	ASSERT_EQUALS(packetService.GetDynamicCaps(dynCaps), KErrNone, _L("RPacketService::GetDynamicCaps returned with an error"));
       
  1964 	ASSERT_BITS_SET(dynCaps, wantedDynCapBits, unWantedDynCapBits, _L("Packet service's KCapsActivate flag not set"));
       
  1965 
       
  1966 	// ===  Get context information ===
       
  1967 
       
  1968 	// Get context info	
       
  1969 	TExtEtelRequestStatus getContextInfo(packetService, EPacketGetContextInfo);
       
  1970 	CleanupStack::PushL(getContextInfo);
       
  1971 	RPacketService::TContextInfo contextInfo;
       
  1972 	const TInt index = 0;
       
  1973 	packetService.GetContextInfo(getContextInfo, index, contextInfo);
       
  1974 		
       
  1975 	// Check RPacketContext::GetConfig returns same config as that set
       
  1976 	TExtEtelRequestStatus contextConfigStatus(packetContext, EPacketContextGetConfig);
       
  1977 	CleanupStack::PushL(contextConfigStatus);
       
  1978 	RPacketContext::TContextConfigGPRS getConfig;
       
  1979 	TPckg<RPacketContext::TContextConfigGPRS> getConfigPk(getConfig);
       
  1980 	packetContext.GetConfig(contextConfigStatus, getConfigPk);
       
  1981 	ASSERT_EQUALS(WaitForRequestWithTimeOut(contextConfigStatus, ETimeMedium), KErrNone, _L("RPacketContext::GetConfig timed out."))
       
  1982 	ASSERT_EQUALS(contextConfigStatus.Int(), KErrNone, _L("RPacketContext::GetConfig returned an error."));
       
  1983 	ASSERT_EQUALS_DES8(getConfig.iAccessPointName, config.iAccessPointName, _L("RPacketContext::GetConfig returns incorrect config data."));
       
  1984 	ASSERT_EQUALS_DES8(getConfig.iProtocolConfigOption.iAuthInfo.iUsername, config.iProtocolConfigOption.iAuthInfo.iUsername, _L("RPacketContext::GetConfig returns incorrect config data."));
       
  1985 	ASSERT_EQUALS_DES8(getConfig.iProtocolConfigOption.iAuthInfo.iPassword, config.iProtocolConfigOption.iAuthInfo.iPassword, _L("RPacketContext::GetConfig returns incorrect config data."));
       
  1986 	ASSERT_EQUALS(getConfig.iUseEdge, config.iUseEdge, _L("RPacketContext::GetConfig returns incorrect config data."));
       
  1987 
       
  1988 	// Check RPacketContext::GetDnsInfo returns valid primary and secondary DNS ip addresses
       
  1989 	RPacketContext::TDnsInfoV2 dnsInfo;
       
  1990 	RPacketContext::TTDnsInfoV2Pckg dnsInfoPkg(dnsInfo);
       
  1991 	TExtEtelRequestStatus dnsInfoStatus(packetContext, EPacketContextGetDNSInfo);
       
  1992 	CleanupStack::PushL(dnsInfoStatus);
       
  1993 	packetContext.GetDnsInfo(dnsInfoStatus, dnsInfoPkg);
       
  1994 	ASSERT_EQUALS(WaitForRequestWithTimeOut(dnsInfoStatus, ETimeMedium), KErrNone, _L("RPacketContext::GetDnsInfo timed out."));
       
  1995 	ASSERT_EQUALS(dnsInfoStatus.Int(), KErrNone, _L("RPacketContext::GetDnsInfo returned an error."));
       
  1996 	ASSERT_TRUE(dnsInfo.iPrimaryDns.Length() > 0, _L("RPacketContext::GetDnsInfo returned with zero length PrimaryDns."));
       
  1997 	ASSERT_TRUE(dnsInfo.iSecondaryDns.Length() > 0, _L("RPacketContext::GetDnsInfo returned with zero length SecondaryDns."));
       
  1998 	
       
  1999 	// ===  Check that there is one NIF with one primary context belonging to it ===
       
  2000 
       
  2001 	// Check RPacketService::EnumerateNifs returns aCount = 1
       
  2002 	TExtEtelRequestStatus nifsStatus(packetService, EPacketEnumerateNifs);
       
  2003 	CleanupStack::PushL(nifsStatus);
       
  2004 	TInt countValue = 0;
       
  2005 	packetService.EnumerateNifs(nifsStatus, countValue);
       
  2006 	ASSERT_EQUALS(WaitForRequestWithTimeOut(nifsStatus, ETimeLong), KErrNone, _L("RPacketService::EnumerateNifs timed out."));
       
  2007 	ASSERT_EQUALS(countValue, 1, _L("RPacketContext::EnumerateNifs returned wrong aValue"));
       
  2008 	
       
  2009 	// Check RPacketService::EnumerateContextsInNif with aExistingContextName = existing context name returns aCount = 1
       
  2010 	TExtEtelRequestStatus contextNifsStatus(packetService, EPacketEnumerateContextsInNif);
       
  2011 	CleanupStack::PushL(contextNifsStatus);
       
  2012 	countValue = 0;	
       
  2013 	packetService.EnumerateContextsInNif(contextNifsStatus, contextInfo.iName, countValue);
       
  2014 	ASSERT_EQUALS(WaitForRequestWithTimeOut(contextNifsStatus, ETimeLong), KErrNone, _L("RPacketService::EnumerateContextsInNif timed out."));
       
  2015 	ASSERT_EQUALS(countValue, 1, _L("RPacketService::EnumerateContextsInNif returned with an error."));
       
  2016 
       
  2017 	// Check RPacketService::GetContextNameInNif with aExistingContextName = existing context name and aIndex = 0 returns aContextName which is same as aExistingContextName
       
  2018 	TExtEtelRequestStatus contextNameNifsStatus(packetService, EPacketGetContextNameInNif);
       
  2019 	CleanupStack::PushL(contextNameNifsStatus);
       
  2020 	TInt ind = 0;
       
  2021 	TName contextName;
       
  2022 	packetService.GetContextNameInNif(contextNameNifsStatus, contextInfo.iName, ind, contextName );
       
  2023 	ASSERT_EQUALS(WaitForRequestWithTimeOut(contextNameNifsStatus, ETimeLong), KErrNone, _L("RPacketService::GetContextNameInNif timed out."));
       
  2024 	ASSERT_EQUALS(contextNameNifsStatus.Int(), KErrNone, _L("RPacketService::GetContextNameInNif returned an error."));
       
  2025 	ASSERT_EQUALS_DES16(contextName, contextInfo.iName, _L("RPacketService::GetContextNameInNif with aExistingContextName = existing context name returned with an error"));	
       
  2026 
       
  2027 	// Check RPacketService::GetNifInfo with aCount = 0 returns valid name in iContextName
       
  2028 	// Check RPacketService::GetNifInfo with aCount = 0 returns iNumberOfContexts = 1
       
  2029 	// Check RPacketService::GetNifInfo with aCount = 0 returns iNifStatus = EStatusActive
       
  2030 	// Check RPacketService::GetNifInfo with aCount = 0 returns valid address in iPdpAddress
       
  2031 	// Check RPacketService::GetNifInfo with aCount = 0 returns EExternalContext
       
  2032 	TExtEtelRequestStatus nifInfoStatus(packetService, EPacketGetNifInfo);
       
  2033 	CleanupStack::PushL(nifInfoStatus);
       
  2034 	RPacketService::TNifInfoV2 nifInfoV2;
       
  2035 	RPacketService::TNifInfoV2Pckg nifInfoV2Pkg(nifInfoV2);
       
  2036 	packetService.GetNifInfo(nifInfoStatus, countValue, nifInfoV2Pkg);
       
  2037 	ASSERT_EQUALS(WaitForRequestWithTimeOut(nifInfoStatus, ETimeLong), KErrNone, _L("RPacketService::GetNifInfo returned an error"));
       
  2038 	ASSERT_EQUALS(nifInfoStatus.Int(), KErrNone, _L("RPacketService::GetNifInfo returned an error."));
       
  2039 	ASSERT_EQUALS_DES16(nifInfoV2.iContextName, contextName, _L("RPacketService::GetNifInfo with valid name  returned with an error"));
       
  2040 	ASSERT_EQUALS(nifInfoV2.iNumberOfContexts, 1, _L("RPacketService::GetNifInfo with iNumberOfContexts returned with an error"));
       
  2041 	ASSERT_EQUALS(nifInfoV2.iNifStatus, RPacketContext::EStatusActive, _L("RPacketService::GetNifInfo with iNifStatus returned with an error"));
       
  2042 	ASSERT_TRUE(nifInfoV2.iPdpAddress.Length() > 0, _L("RPacketService::GetNifInfo with iPdpAddress returned with an error"));
       
  2043 	ASSERT_EQUALS(nifInfoV2.iContextType, RPacketService::EExternalContext, _L("RPacketService::GetNifInfo with iContextType returned with an error"));
       
  2044 
       
  2045 	// Post notification for context's status change
       
  2046 	packetContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);
       
  2047 	
       
  2048 	// Post notification for service's status change
       
  2049 	packetService.NotifyStatusChange(notifyServiceStChStatus, packetServiceStatus);
       
  2050 	
       
  2051 	// Deactivate the context with RPacketContext::Deactivate 
       
  2052 	TExtEtelRequestStatus contextDeactivateStatus(packetContext, EPacketContextDeactivate);
       
  2053 	CleanupStack::PushL(contextDeactivateStatus);
       
  2054 	packetContext.Deactivate(contextDeactivateStatus);
       
  2055 	ASSERT_EQUALS(WaitForRequestWithTimeOut(contextDeactivateStatus, ETimeLong), KErrNone, _L("RPacketContext::Deactivate timed out."));					
       
  2056 	ASSERT_EQUALS(contextDeactivateStatus.Int(), KErrNone, _L("RPacketContext::Deactivate returned with error status."));
       
  2057 
       
  2058 	// ===  Check context and service statuses ===
       
  2059 
       
  2060 	// Check RPacketContext::NotifyStatusChange completes with EStatusDeactivating -> EStatusInactive
       
  2061 	expectedPacketContextStatus = RPacketContext::EStatusDeactivating;
       
  2062 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  2063 					packetContext,
       
  2064 					notifyContextStChStatus,
       
  2065 					packetContextStatus, 
       
  2066 					expectedPacketContextStatus,
       
  2067 					KErrNone);
       
  2068 
       
  2069 	packetContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);
       
  2070 	expectedPacketContextStatus = RPacketContext::EStatusInactive;
       
  2071 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  2072 					packetContext,
       
  2073 					notifyContextStChStatus,
       
  2074 					packetContextStatus, 
       
  2075 					expectedPacketContextStatus,
       
  2076 					KErrNone);
       
  2077 					
       
  2078 	// Check RPacketContext::GetStatus returns EStatusInactive
       
  2079 	ASSERT_EQUALS(packetContext.GetStatus(packetContextStatus), KErrNone, _L("RPacketContext::GetStatus returned with an error."));
       
  2080 	ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusInactive, _L("RPacketContext::GetStatus returns incorrect status."));
       
  2081 
       
  2082 	// Check RPacketService::NotifyStatusChange completes with EStatusAttached
       
  2083 	expectedPacketServiceStatus = RPacketService::EStatusAttached;
       
  2084 	iPacketServiceTestHelper.WaitForPacketServiceNotifyStatusChange(
       
  2085 				packetService,
       
  2086 				notifyServiceStChStatus,
       
  2087 				packetServiceStatus, 
       
  2088 				expectedPacketServiceStatus,
       
  2089 				KErrNone);
       
  2090 				
       
  2091 	// Check RPacketService::GetStatus returns EStatusAttached
       
  2092 	ASSERT_EQUALS(packetService.GetStatus(pckSrvcStatus), KErrNone, _L("RPacketService::GetStatus return error."));
       
  2093 	ASSERT_EQUALS(pckSrvcStatus, RPacketService::EStatusAttached, _L("RPacketService::GetStatus returns incorrect status."));
       
  2094 
       
  2095 	////////////////////////////////////////////////////////////////
       
  2096 	// TEST END
       
  2097 	////////////////////////////////////////////////////////////////
       
  2098 
       
  2099     StartCleanup();
       
  2100 	
       
  2101 	// pop
       
  2102 	// notifyContextStatus
       
  2103 	// getNetworkStatus
       
  2104 	// setConfigStatus
       
  2105 	// notifyServiceStChStatus
       
  2106 	// notifyContextStChStatus
       
  2107 	// notifyServiceDynCapsStatus
       
  2108 	// contextActivateStatus
       
  2109 	// getContextInfo
       
  2110 	// contextConfigStatus
       
  2111 	// dnsInfoStatus
       
  2112 	// NifsStatus
       
  2113 	// contextNifsStatus
       
  2114 	// contextNameNifsStatus
       
  2115 	// NifInfoStatus
       
  2116 	// contextDeactivateStatus
       
  2117 	CleanupStack::PopAndDestroy(15, &notifyContextStatus);
       
  2118 	
       
  2119 	return TestStepResult();
       
  2120 	}
       
  2121 
       
  2122 TPtrC CCTSYIntegrationTestPacketContext0006::GetTestStepName()
       
  2123 /**
       
  2124  * @return The test step name.
       
  2125  */
       
  2126 	{
       
  2127 	return _L("CCTSYIntegrationTestPacketContext0006");
       
  2128 	}
       
  2129 
       
  2130 
       
  2131 
       
  2132 CCTSYIntegrationTestPacketContext0007::CCTSYIntegrationTestPacketContext0007(CEtelSessionMgr& aEtelSessionMgr)
       
  2133 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
  2134 /**
       
  2135  * Constructor.
       
  2136  */
       
  2137 	{
       
  2138 	SetTestStepName(CCTSYIntegrationTestPacketContext0007::GetTestStepName());
       
  2139 	}
       
  2140 
       
  2141 CCTSYIntegrationTestPacketContext0007::~CCTSYIntegrationTestPacketContext0007()
       
  2142 /**
       
  2143  * Destructor.
       
  2144  */
       
  2145 	{
       
  2146 	}
       
  2147 
       
  2148 TVerdict CCTSYIntegrationTestPacketContext0007::doTestStepL()
       
  2149 /**
       
  2150  * @SYMTestCaseID BA-CTSY-INT-PKTC-0007
       
  2151  * @SYMFssID BA/CTSY/PKTC-0007
       
  2152  * @SYMTestCaseDesc Activate and deactivate a secondary context.
       
  2153  * @SYMTestPriority High
       
  2154  * @SYMTestActions RPacketContext::GetConfig, RPacketContext::Activate, RPacketContext::Deactivate, RPacketService::NotifyContextAdded, RPacketContext::GetStatus, RPacketContext::AddPacketFilter, RPacketContext::NotifyStatusChange, RPacketService::NotifyStatusChange, RPacketService::NotifyDynamicCapsChange, RPacketService::GetStatus, RPacketContext::SetConfig, RPacketContext::GetDnsInfo, RPacketQoS::OpenNewQoS, RPacketQoS::GetProfileCapabilities, RPacketQoS::SetProfileParameters
       
  2155  * @SYMTestExpectedResults Pass - Secondary context is activated then deactivated.
       
  2156  * @SYMTestType CIT
       
  2157  * @SYMTestCaseDependencies simulated/automatic
       
  2158  *
       
  2159  * Reason for test: Verify packet service status, packet context statuses, dynamic caps
       
  2160  *
       
  2161  * @return - TVerdict code
       
  2162  */
       
  2163 	{
       
  2164 
       
  2165 	////////////////////////////////////////////////////////////////
       
  2166 	// SET UP
       
  2167 	////////////////////////////////////////////////////////////////
       
  2168 	// wait until we are on the network
       
  2169     RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
  2170 	CHECK_EQUALS_L(iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(phone), KErrNone, _L("TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL returned with an error"));
       
  2171 
       
  2172 	//Check if we are on a simulated network 
       
  2173    iNetworkTestHelper.CheckPhoneConnectedToAniteL(phone);
       
  2174 
       
  2175     // Ensure phone is attached to the packet service. 
       
  2176 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, KMainPhone, KMainPacketService);
       
  2177     SetAttachModeToWhenPossibleAndWaitForAttachL(packetService);
       
  2178 
       
  2179 	// Post notification for the ContextAdded
       
  2180 	TExtEtelRequestStatus notifyContextStatus(packetService, EPacketNotifyContextAdded);
       
  2181 	CleanupStack::PushL(notifyContextStatus);
       
  2182 	TName contextId;
       
  2183 	packetService.NotifyContextAdded(notifyContextStatus, contextId);
       
  2184 	
       
  2185 	// Open a primary context. 
       
  2186 	RPacketContext& primaryPacketContext = iEtelSessionMgr.GetPrimaryPacketContextL(
       
  2187 											KMainServer,
       
  2188 											KMainPhone,
       
  2189 											KMainPacketService,
       
  2190 											KPrimaryPacketContext1);
       
  2191 
       
  2192 	// Open a new secondary context from primary context
       
  2193     RPacketContext& secondaryPacketContext2 = iEtelSessionMgr.GetSecondaryPacketContextL(
       
  2194 												KMainServer,
       
  2195 												KMainPhone,
       
  2196 												KMainPacketService, 
       
  2197 												KPrimaryPacketContext1,
       
  2198 												KSecondaryPacketContext1);
       
  2199 
       
  2200     ////////////////////////////////////////////////////////////////
       
  2201 	// SET UP END
       
  2202 	////////////////////////////////////////////////////////////////
       
  2203 	
       
  2204 	StartTest();
       
  2205 	
       
  2206 	////////////////////////////////////////////////////////////////
       
  2207 	// TEST START
       
  2208 	////////////////////////////////////////////////////////////////
       
  2209 
       
  2210 	// Add a TPacketFilterV2 packet filter to the secondary context using RPacketContext::AddPacketFilter
       
  2211 	ASSERT_EQUALS(AddPacketFilterV2ToContextL(secondaryPacketContext2,1), KErrNone,
       
  2212 					_L("RPacketContext::AddPacketFilter returned with error status"));
       
  2213 
       
  2214 	// ===  Add QoS ===
       
  2215 
       
  2216 	// Open a new QoS from the secondary context
       
  2217 	RPacketQoS& packetQoS = iEtelSessionMgr.GetSecondaryPacketContextQoSL(
       
  2218 												KMainServer,
       
  2219 												KMainPhone,
       
  2220 												KMainPacketService, 
       
  2221 												KPrimaryPacketContext1,
       
  2222 												KSecondaryPacketContext1);
       
  2223 
       
  2224 	// Get GPRS QoS profile capabilities with RPacketQoS::GetProfileCapabilities
       
  2225 	// Note: Using GPRS params
       
  2226 	TExtEtelRequestStatus getProfileCapStatus(packetQoS, EPacketQoSGetProfileCaps);
       
  2227 	CleanupStack::PushL(getProfileCapStatus);
       
  2228 	RPacketQoS::TQoSCapsGPRS qosCapGprs;
       
  2229 	TPckg<RPacketQoS::TQoSCapsGPRS> qosCapsGprsPckg(qosCapGprs);
       
  2230 	packetQoS.GetProfileCapabilities(getProfileCapStatus, qosCapsGprsPckg);
       
  2231 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getProfileCapStatus, ETimeMedium), KErrNone, 
       
  2232 					_L("RPacketQoS::GetProfileCapabilities timed out."))						
       
  2233 	ASSERT_EQUALS(getProfileCapStatus.Int(), KErrNone,
       
  2234 					_L("RPacketQoS::GetProfileCapabilities returned with error status."))
       
  2235 
       
  2236 	// Set requested profile parameters with RPacketQoS::SetProfileParameters and TQoSGPRSRequested with parameters within range returned by RPacketQoS::GetProfileCapabilities	
       
  2237 	RPacketQoS::TQoSGPRSRequested qosGprsRequested;
       
  2238 	TPckg<RPacketQoS::TQoSGPRSRequested> qosGprsReqPckg(qosGprsRequested);
       
  2239     FillParametersFromCapabilities(qosGprsRequested,qosCapGprs);
       
  2240 	TExtEtelRequestStatus setProfileParamStatus(packetQoS, EPacketQoSSetProfileParams);
       
  2241 	CleanupStack::PushL(setProfileParamStatus);
       
  2242 	packetQoS.SetProfileParameters(setProfileParamStatus, qosGprsReqPckg);
       
  2243 	ASSERT_EQUALS(WaitForRequestWithTimeOut(setProfileParamStatus, ETimeMedium), KErrNone, 
       
  2244 					_L("RPacketQoS::SetProfileParameters timed out."))						
       
  2245 	ASSERT_EQUALS(setProfileParamStatus.Int(), KErrNone,
       
  2246 					_L("RPacketQoS::SetProfileParameters returned with error status."))
       
  2247 					
       
  2248 											
       
  2249 	// Check RPacketService::NotifyContextAdded completes with a valid context name
       
  2250 	ASSERT_EQUALS(WaitForRequestWithTimeOut(notifyContextStatus, ETimeShort), KErrNone,
       
  2251 				  _L("RPacketService::NotifyContextAdded did not complete."));
       
  2252     ASSERT_EQUALS(notifyContextStatus.Int(), KErrNone, 
       
  2253     			_L("RPacketService::NotifyContextAdded returned with error status."));
       
  2254     ASSERT_TRUE(contextId.Length() > 0,
       
  2255     			_L("RPacketService::NotifyContextAdded Packet context config has zero length contextId."));
       
  2256 
       
  2257 	// Post notification for service's status change
       
  2258 	TExtEtelRequestStatus notifyServiceStChStatus(packetService, EPacketNotifyStatusChange);
       
  2259 	CleanupStack::PushL(notifyServiceStChStatus);
       
  2260 	RPacketService::TStatus packetServiceStatus;
       
  2261 	packetService.NotifyStatusChange(notifyServiceStChStatus, packetServiceStatus);
       
  2262 
       
  2263 	// Activate primary context with RPacketContext::Activate
       
  2264     iPacketServiceTestHelper.ActivatePrimaryPacketContextL(phone, primaryPacketContext);
       
  2265 
       
  2266 	// ===  Check context and service statuses ===
       
  2267 
       
  2268 	// Check RPacketService::NotifyStatusChange completes with EStatusActive
       
  2269 	RPacketService::TStatus expectedPacketServiceStatus = RPacketService::EStatusActive;
       
  2270 	iPacketServiceTestHelper.WaitForPacketServiceNotifyStatusChange(
       
  2271 				packetService,
       
  2272 				notifyServiceStChStatus,
       
  2273 				packetServiceStatus, 
       
  2274 				expectedPacketServiceStatus,
       
  2275 				KErrNone);
       
  2276 
       
  2277 	// Check RPacketService::GetStatus returns EStatusActive
       
  2278 	RPacketService::TStatus pckSrvcStatus;
       
  2279 	ASSERT_EQUALS(packetService.GetStatus(pckSrvcStatus), KErrNone, _L("RPacketService::GetStatus return error."));
       
  2280 	ASSERT_EQUALS(pckSrvcStatus, RPacketService::EStatusActive, _L("RPacketService::GetStatus did not return RPacketService::EStatusActive."));
       
  2281 
       
  2282 	// Check RPacketContext::GetStatus for the primary context returns EStatusActive
       
  2283 	RPacketContext::TContextStatus packetContextStatus;
       
  2284 	ASSERT_EQUALS(primaryPacketContext.GetStatus(packetContextStatus), KErrNone, _L("RPacketContext::GetStatus returned with an error."));
       
  2285 	ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusActive, _L("RPacketContext::GetStatus did not return RPacketContext::EStatusActive."));
       
  2286 
       
  2287 	// Post notification for context's status change
       
  2288 	TExtEtelRequestStatus notifySecContextStChStatus(secondaryPacketContext2, EPacketContextNotifyStatusChange);
       
  2289 	CleanupStack::PushL(notifySecContextStChStatus);
       
  2290 	RPacketContext::TContextStatus secPacketContextStatus;
       
  2291 	secondaryPacketContext2.NotifyStatusChange(notifySecContextStChStatus, secPacketContextStatus);
       
  2292 	
       
  2293 	// Post notification for for service's dynamic caps change
       
  2294 	RPacketService::TDynamicCapsFlags dynCaps;
       
  2295 	TExtEtelRequestStatus notifyServiceDynCapsStatus(packetService, EPacketNotifyDynamicCapsChange);
       
  2296 	CleanupStack::PushL(notifyServiceDynCapsStatus);
       
  2297 	packetService.NotifyDynamicCapsChange(notifyServiceDynCapsStatus, dynCaps);
       
  2298 
       
  2299 	// Activate the secondary context.
       
  2300 	TExtEtelRequestStatus secContextActivateStatus(secondaryPacketContext2, EPacketContextActivate);
       
  2301 	CleanupStack::PushL(secContextActivateStatus);
       
  2302 	secondaryPacketContext2.Activate(secContextActivateStatus);
       
  2303 	ASSERT_EQUALS(WaitForRequestWithTimeOut(secContextActivateStatus, ETimeLong), KErrNone, 
       
  2304 					_L("RPacketContext::Activate timed out."));
       
  2305 	ASSERT_EQUALS(secContextActivateStatus.Int(), KErrNone,
       
  2306 					_L("RPacketContext::Activate returned with error status."));
       
  2307 
       
  2308 	// Check RPacketContext::NotifyStatusChange for the secondary context completes with EStatusActivating -> EStatusActive
       
  2309 	RPacketContext::TContextStatus expectedSecPacketContextStatus = RPacketContext::EStatusActivating;
       
  2310 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  2311 				secondaryPacketContext2,
       
  2312 				notifySecContextStChStatus,
       
  2313 				secPacketContextStatus,
       
  2314 				expectedSecPacketContextStatus,
       
  2315 				KErrNone);
       
  2316 	secondaryPacketContext2.NotifyStatusChange(notifySecContextStChStatus, secPacketContextStatus);
       
  2317 
       
  2318     //   -> EStatusActive
       
  2319 	expectedSecPacketContextStatus = RPacketContext::EStatusActive;
       
  2320 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  2321 				secondaryPacketContext2,
       
  2322 				notifySecContextStChStatus,
       
  2323 				secPacketContextStatus,
       
  2324 				expectedSecPacketContextStatus,
       
  2325 				KErrNone);
       
  2326 				
       
  2327 	// Check RPacketContext::GetStatus for the secondary context returns EStatusActive
       
  2328 	ASSERT_EQUALS(secondaryPacketContext2.GetStatus(secPacketContextStatus), KErrNone, _L("RPacketContext::GetStatus returned with an error."));
       
  2329 	ASSERT_EQUALS(secPacketContextStatus, RPacketContext::EStatusActive, _L("RPacketContext::GetStatus did not return RPacketContext::EStatusActive."));
       
  2330 
       
  2331 	// ===  Check dynamic caps ===
       
  2332 	
       
  2333 	// Check RPacketService::NotifyDynamicCapsChange completes with caps in set of KCapsRxCSCall | KCapsRxContextActivationReq | KCapsSMSTransfer | KCapsHSDPA.
       
  2334 	// Check RPacketService::NotifyDynamicCapsChange completes with caps NOT in set of RPacketService::KCapsManualAttach
       
  2335 
       
  2336 	// $CTSYProblem.
       
  2337 	// GetDynamicCaps does not change since the LTSY dose not call the EPacketNotifyDynamicCapsChange when the context is activated 
       
  2338 	
       
  2339 	// Check RPacketService::GetDynamicCaps returns caps in set of KCapsRxCSCall | KCapsRxContextActivationReq | KCapsSMSTransfer | KCapsHSDPA
       
  2340 	// Check RPacketService::GetDynamicCaps returns caps NOT in set of RPacketService::KCapsManualAttach
       
  2341 
       
  2342 	// $CTSYProblem.
       
  2343 	// GetDynamicCaps dose not change since the LTSY dose not call the EPacketNotifyDynamicCapsChange when the context is activated 
       
  2344 	
       
  2345 	// ===  Get context information ===
       
  2346 
       
  2347    	// Get network info from phone
       
  2348 	TExtEtelRequestStatus getNetworkStatus(phone, EMobilePhoneGetCurrentNetwork);
       
  2349 	CleanupStack::PushL(getNetworkStatus);
       
  2350 	RMobilePhone::TMobilePhoneNetworkInfoV1 info;
       
  2351 	RMobilePhone::TMobilePhoneNetworkInfoV1Pckg infopckg(info);
       
  2352 	phone.GetCurrentNetwork(getNetworkStatus, infopckg);
       
  2353 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getNetworkStatus, ETimeLong), KErrNone, _L("RMobilePhone::GetCurrentNetwork timed out"));
       
  2354 	ASSERT_EQUALS(getNetworkStatus.Int(), KErrNone, _L("RMobilePhone::GetCurrentNetwork returned an error"));
       
  2355 	
       
  2356 	// Check RPacketContext::GetConfig for primary context returns same config as that set
       
  2357 	TExtEtelRequestStatus contextConfigStatus(primaryPacketContext , EPacketContextGetConfig);
       
  2358 	CleanupStack::PushL(contextConfigStatus);
       
  2359 	RPacketContext::TContextConfigGPRS getConfig;
       
  2360 	TPckg<RPacketContext::TContextConfigGPRS> getConfigPk(getConfig);
       
  2361 	primaryPacketContext.GetConfig(contextConfigStatus, getConfigPk);
       
  2362 	ASSERT_EQUALS(WaitForRequestWithTimeOut(contextConfigStatus, ETimeMedium), KErrNone, 
       
  2363 											  _L("RPacketContext::GetConfig timed out."))
       
  2364 	ASSERT_EQUALS(contextConfigStatus.Int(), KErrNone,
       
  2365 					_L("RPacketContext::GetConfig returned an error."));
       
  2366 	RPacketContext::TContextConfigGPRS config;
       
  2367 	TPtrC apn, user, pwd;
       
  2368 	iPacketServiceTestHelper.GetGprsSettings(info, apn, user, pwd);
       
  2369 	config.iAccessPointName.Copy(apn);
       
  2370 	config.iProtocolConfigOption.iAuthInfo.iUsername.Copy(user);
       
  2371 	config.iProtocolConfigOption.iAuthInfo.iPassword.Copy(pwd);
       
  2372 	ASSERT_EQUALS_DES8(getConfig.iAccessPointName,
       
  2373 				  config.iAccessPointName, _L("RPacketContext::GetConfig returns incorrect config data."));
       
  2374 	ASSERT_EQUALS_DES8(getConfig.iProtocolConfigOption.iAuthInfo.iUsername,
       
  2375 				  config.iProtocolConfigOption.iAuthInfo.iUsername, _L("RPacketContext::GetConfig returns incorrect config data."));
       
  2376 	ASSERT_EQUALS_DES8(getConfig.iProtocolConfigOption.iAuthInfo.iPassword,
       
  2377 				 config.iProtocolConfigOption.iAuthInfo.iPassword, _L("RPacketContext::GetConfig returns incorrect config data."));
       
  2378 	 
       
  2379 	// Check RPacketContext::GetDnsInfo for primary context returns valid primary and secondary DNS ip addresses
       
  2380 	RPacketContext::TDnsInfoV2 dnsInfoPrimary;
       
  2381 	RPacketContext::TTDnsInfoV2Pckg dnsInfoPrimaryPkg(dnsInfoPrimary);
       
  2382 	TExtEtelRequestStatus dnsInfoStatus(primaryPacketContext, EPacketContextGetDNSInfo);
       
  2383 	CleanupStack::PushL(dnsInfoStatus);
       
  2384 	primaryPacketContext.GetDnsInfo(dnsInfoStatus, dnsInfoPrimaryPkg);
       
  2385 	ASSERT_EQUALS(WaitForRequestWithTimeOut(dnsInfoStatus, ETimeMedium), KErrNone, _L("RPacketContext::GetDnsInfo timed out."));
       
  2386 	ASSERT_EQUALS(dnsInfoStatus.Int(), KErrNone, _L("RPacketContext::GetDnsInfo returned an error."));
       
  2387 	ASSERT_TRUE(dnsInfoPrimary.iPrimaryDns.Length() > 0, _L("RPacketContext::GetDnsInfo returned with zero length PrimaryDns."));
       
  2388 	ASSERT_TRUE(dnsInfoPrimary.iSecondaryDns.Length() > 0, _L("RPacketContext::GetDnsInfo returned with zero length SecondaryDns."));
       
  2389 	
       
  2390 	// Check RPacketContext::GetDnsInfo for secondary context returns same primary and secondary DNS ip addresses as for the primary context
       
  2391 	RPacketContext::TDnsInfoV2 dnsInfoSecondary;
       
  2392 	RPacketContext::TTDnsInfoV2Pckg dnsInfoSecondaryPkg(dnsInfoSecondary);
       
  2393 	TExtEtelRequestStatus dnsInfoStatus2(secondaryPacketContext2, EPacketContextGetDNSInfo);
       
  2394 	CleanupStack::PushL(dnsInfoStatus2);
       
  2395 	secondaryPacketContext2.GetDnsInfo(dnsInfoStatus2, dnsInfoSecondaryPkg);
       
  2396 	ASSERT_EQUALS(WaitForRequestWithTimeOut(dnsInfoStatus2, ETimeMedium), KErrNone, _L("RPacketContext::GetDnsInfo timed out."));
       
  2397 	ASSERT_EQUALS(dnsInfoStatus2.Int(), KErrNone, _L("RPacketContext::GetDnsInfo returned an error."));
       
  2398 	ASSERT_TRUE(dnsInfoSecondary.iPrimaryDns.Length() > 0, _L("RPacketContext::GetDnsInfo returned with zero length PrimaryDns."));
       
  2399 	ASSERT_TRUE(dnsInfoSecondary.iSecondaryDns.Length() > 0, _L("RPacketContext::GetDnsInfo returned with zero length SecondaryDns."));
       
  2400 	
       
  2401 	// Compare ip addresses
       
  2402 	ASSERT_EQUALS_DES8(dnsInfoPrimary.iPrimaryDns, dnsInfoSecondary.iPrimaryDns,
       
  2403 					   _L("RPacketContext::GetDnsInfo IP addresses mismatch for Primary and Secondary contexts."));
       
  2404 	ASSERT_EQUALS_DES8(dnsInfoPrimary.iSecondaryDns, dnsInfoSecondary.iSecondaryDns,
       
  2405 					   _L("RPacketContext::GetDnsInfo IP addresses mismatch for Primary and Secondary contexts."));
       
  2406 
       
  2407 	// Post notification for context's status change
       
  2408 	secondaryPacketContext2.NotifyStatusChange(notifySecContextStChStatus, secPacketContextStatus);
       
  2409 		
       
  2410 	// Deactivate the secondary context with RPacketContext::Deactivate 
       
  2411 	TExtEtelRequestStatus secCntxtDeactivateStatus(secondaryPacketContext2, EPacketContextDeactivate);
       
  2412 	CleanupStack::PushL(secCntxtDeactivateStatus);
       
  2413 	secondaryPacketContext2.Deactivate(secCntxtDeactivateStatus);
       
  2414 	ASSERT_EQUALS(WaitForRequestWithTimeOut(secCntxtDeactivateStatus, ETimeLong), KErrNone, 
       
  2415 					_L("RPacketContext::Deactivate timed out."));					
       
  2416 	ASSERT_EQUALS(secCntxtDeactivateStatus.Int(), KErrNone,
       
  2417 					_L("RPacketContext::Deactivate returned with error status."));
       
  2418 					
       
  2419 	// ===  Check context and service statuses ===
       
  2420 
       
  2421 	// Check RPacketContext::NotifyStatusChange for the secondary context completes with EStatusDeactivating -> EStatusInactive
       
  2422 	expectedSecPacketContextStatus = RPacketContext::EStatusDeactivating;
       
  2423 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  2424 				secondaryPacketContext2,
       
  2425 				notifySecContextStChStatus,
       
  2426 				secPacketContextStatus,
       
  2427 				expectedSecPacketContextStatus,
       
  2428 				KErrNone);
       
  2429     secondaryPacketContext2.NotifyStatusChange(notifySecContextStChStatus, secPacketContextStatus);
       
  2430 
       
  2431     //    -> EStatusInactive
       
  2432 	RPacketContext::TContextStatus expectedPacketContext2Status = RPacketContext::EStatusInactive;
       
  2433 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  2434 				secondaryPacketContext2,
       
  2435 				notifySecContextStChStatus,
       
  2436 				secPacketContextStatus, 
       
  2437 				expectedPacketContext2Status,
       
  2438 				KErrNone);
       
  2439 	
       
  2440 	// Check RPacketContext::GetStatus for the secondary context returns EStatusInactive
       
  2441 	ASSERT_EQUALS(secondaryPacketContext2.GetStatus(secPacketContextStatus), KErrNone, _L("RPacketContext::GetStatus returned with an error."));
       
  2442 	ASSERT_EQUALS(secPacketContextStatus, RPacketContext::EStatusInactive, _L("RPacketContext::GetStatus did not return RPacketContext::EStatusInactive."));
       
  2443 	
       
  2444 	// Check RPacketContext::GetStatus for the primary context returns EStatusActive
       
  2445 	ASSERT_EQUALS(primaryPacketContext.GetStatus(packetContextStatus), KErrNone, _L("RPacketContext::GetStatus returned with an error."));
       
  2446 	ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusActive, _L("RPacketContext::GetStatus did not return RPacketContext::EStatusActive."));
       
  2447 	
       
  2448 	
       
  2449 	////////////////////////////////////////////////////////////////
       
  2450 	// TEST END
       
  2451 	////////////////////////////////////////////////////////////////
       
  2452 
       
  2453     StartCleanup();
       
  2454 	
       
  2455 	// Pop:
       
  2456 	//	secCntxtDeactivateStatus
       
  2457 	//	dnsInfoStatus2
       
  2458 	//	dnsInfoStatus
       
  2459 	//	contextConfigStatus
       
  2460 	//	getNetworkStatus
       
  2461 	//	secContextActivateStatus
       
  2462 	//	notifyServiceDynCapsStatus
       
  2463 	//	notifySecContextStChStatus
       
  2464 	//	notifyServiceStChStatus
       
  2465 	//	setProfileParamStatus
       
  2466 	//	getProfileCapStatus
       
  2467 	//	notifyContextStatus
       
  2468 	CleanupStack::PopAndDestroy(12,&notifyContextStatus);
       
  2469 
       
  2470 	
       
  2471 	return TestStepResult();
       
  2472 	}
       
  2473 
       
  2474 TPtrC CCTSYIntegrationTestPacketContext0007::GetTestStepName()
       
  2475 /**
       
  2476  * @return The test step name.
       
  2477  */
       
  2478 	{
       
  2479 	return _L("CCTSYIntegrationTestPacketContext0007");
       
  2480 	}
       
  2481 
       
  2482 
       
  2483 
       
  2484 CCTSYIntegrationTestPacketContext0008::CCTSYIntegrationTestPacketContext0008(CEtelSessionMgr& aEtelSessionMgr)
       
  2485 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
  2486 /**
       
  2487  * Constructor.
       
  2488  */
       
  2489 	{
       
  2490 	SetTestStepName(CCTSYIntegrationTestPacketContext0008::GetTestStepName());
       
  2491 	}
       
  2492 
       
  2493 CCTSYIntegrationTestPacketContext0008::~CCTSYIntegrationTestPacketContext0008()
       
  2494 /**
       
  2495  * Destructor.
       
  2496  */
       
  2497 	{
       
  2498 	}
       
  2499 
       
  2500 TVerdict CCTSYIntegrationTestPacketContext0008::doTestStepL()
       
  2501 /**
       
  2502  * @SYMTestCaseID BA-CTSY-INT-PKTC-0008
       
  2503  * @SYMFssID BA/CTSY/PKTC-0008
       
  2504  * @SYMTestCaseDesc Activate and deactivate a secondary context.
       
  2505  * @SYMTestPriority High
       
  2506  * @SYMTestActions RPacketContext::OpenNewSecondaryContext, RPacketContext::SetConfig, RPacketContext::Activate, RPacketService::NotifyStatusChange, RPacketService::GetStatus, RPacketContext::NotifyStatusChange, RPacketContext::GetStatus, RPacketService::EnumerateNifs, RPacketService::EnumerateContextsInNif, RPacketService::GetNifInfo, RPacketService::GetContextNameInNif, RPacketQoS::OpenNewQoS, RPacketQoS::GetProfileCapabilities, RPacketQoS::SetProfileParameters
       
  2507  * @SYMTestExpectedResults Pass - Secondary context is activated then deactivated.
       
  2508  * @SYMTestType CIT
       
  2509  * @SYMTestCaseDependencies simulated/automatic
       
  2510  *
       
  2511  * Reason for test: Verify NIF info from RPacketService correct.
       
  2512  *
       
  2513  * @return - TVerdict code
       
  2514  */
       
  2515 	{
       
  2516 
       
  2517 	////////////////////////////////////////////////////////////////
       
  2518 	// SET UP
       
  2519 	////////////////////////////////////////////////////////////////
       
  2520 
       
  2521     // Call TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL		
       
  2522     RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
  2523 	CHECK_EQUALS_L(iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(phone), KErrNone, _L("TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL returned with an error"));
       
  2524 
       
  2525 	//Check if we are on a simulated network
       
  2526  	iNetworkTestHelper.CheckPhoneConnectedToAniteL(phone);
       
  2527  	
       
  2528     // Ensure phone is attached to the packet service. 
       
  2529 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, KMainPhone, KMainPacketService);
       
  2530     SetAttachModeToWhenPossibleAndWaitForAttachL(packetService);
       
  2531 
       
  2532 	// Post notification for the RPacketService::NotifyContextAdded
       
  2533 	TExtEtelRequestStatus notifyContextStatus(packetService, EPacketNotifyContextAdded);
       
  2534 	CleanupStack::PushL(notifyContextStatus);
       
  2535 	TName primaryContextId;
       
  2536 	packetService.NotifyContextAdded(notifyContextStatus, primaryContextId);
       
  2537 
       
  2538 	// Open a primary packet context
       
  2539 	RPacketContext& primaryPacketContext = iEtelSessionMgr.GetPrimaryPacketContextL(
       
  2540 											KMainServer,
       
  2541 											KMainPhone,
       
  2542 											KMainPacketService,
       
  2543 											KPrimaryPacketContext1);
       
  2544 
       
  2545 	// Check RPacketService::NotifyContextAdded completes with a valid context name
       
  2546 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(notifyContextStatus, ETimeMedium), KErrNone, _L("RPacketService::NotifyContextAdded did not complete."));
       
  2547     CHECK_EQUALS_L(notifyContextStatus.Int(), KErrNone, _L("RPacketService::NotifyContextAdded returned with error status."));
       
  2548     CHECK_TRUE_L(primaryContextId.Length() > 0,	_L("RPacketService::NotifyContextAdded returned with zero length context name."));
       
  2549 
       
  2550 	// Post notification for the RPacketService::NotifyContextAdded
       
  2551 	TName secondaryContextId;
       
  2552 	packetService.NotifyContextAdded(notifyContextStatus, secondaryContextId);
       
  2553 
       
  2554 	// Open a secondary packet context
       
  2555     RPacketContext& secondaryPacketContext = iEtelSessionMgr.GetSecondaryPacketContextL(
       
  2556 												KMainServer,
       
  2557 												KMainPhone,
       
  2558 												KMainPacketService, 
       
  2559 												KPrimaryPacketContext1,
       
  2560 												KSecondaryPacketContext1);
       
  2561 
       
  2562 	// Check RPacketService::NotifyContextAdded completes with a valid context name
       
  2563 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(notifyContextStatus, ETimeMedium), KErrNone, _L("RPacketService::NotifyContextAdded did not complete."));
       
  2564     CHECK_EQUALS_L(notifyContextStatus.Int(), KErrNone, _L("RPacketService::NotifyContextAdded returned with error status."));
       
  2565     CHECK_TRUE_L(secondaryContextId.Length() > 0, _L("RPacketService::NotifyContextAdded returned with zero length context name."));
       
  2566 
       
  2567 
       
  2568 	////////////////////////////////////////////////////////////////
       
  2569 	// SET UP END
       
  2570 	////////////////////////////////////////////////////////////////
       
  2571 	
       
  2572 	StartTest();
       
  2573 	
       
  2574 	////////////////////////////////////////////////////////////////
       
  2575 	// TEST START
       
  2576 	////////////////////////////////////////////////////////////////
       
  2577 	
       
  2578 	
       
  2579 	// Add a TPacketFilterV2 packet filter to the secondary context using RPacketContext::AddPacketFilter 
       
  2580 	ASSERT_EQUALS(AddPacketFilterV2ToContextL(secondaryPacketContext, 1), KErrNone, _L("RPacketContext::AddPacketFilter returned with error status")); 
       
  2581 
       
  2582 	// ===  Add QoS ===
       
  2583 
       
  2584 	// Open a new QoS from the secondary context 
       
  2585 	RPacketQoS& packetQoS = iEtelSessionMgr.GetSecondaryPacketContextQoSL(
       
  2586 												KMainServer,
       
  2587 												KMainPhone,
       
  2588 												KMainPacketService, 
       
  2589 												KPrimaryPacketContext1,
       
  2590 												KSecondaryPacketContext1);
       
  2591 
       
  2592 	// Get GPRS QoS profile capabilities with RPacketQoS::GetProfileCapabilities 
       
  2593 	TExtEtelRequestStatus getQoSProfileCapsStatus(packetQoS, EPacketQoSGetProfileCaps);
       
  2594 	CleanupStack::PushL(getQoSProfileCapsStatus);
       
  2595 	RPacketQoS::TQoSCapsGPRS qosCaps;
       
  2596 	TPckg<RPacketQoS::TQoSCapsGPRS> qosCapsPckg(qosCaps);
       
  2597     packetQoS.GetProfileCapabilities(getQoSProfileCapsStatus, qosCapsPckg);
       
  2598 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getQoSProfileCapsStatus, ETimeMedium), KErrNone, _L("RPacketQoS::GetProfileCapabilities timed out."))						
       
  2599 	ASSERT_EQUALS(getQoSProfileCapsStatus.Int(), KErrNone, _L("RPacketQoS::GetProfileCapabilities returned error."))
       
  2600 
       
  2601 	// Set requested profile parameters with RPacketQoS::SetProfileParameters and TQoSGPRSRequested with parameters within range returned by RPacketQoS::GetProfileCapabilities 
       
  2602 	RPacketQoS::TQoSGPRSRequested qosRequested;
       
  2603 	TPckg<RPacketQoS::TQoSGPRSRequested> qosReqPckg(qosRequested);
       
  2604     FillParametersFromCapabilities(qosRequested,qosCaps);    
       
  2605 	TExtEtelRequestStatus setProfileParamStatus(packetQoS, EPacketQoSSetProfileParams);
       
  2606 	CleanupStack::PushL(setProfileParamStatus);
       
  2607 
       
  2608 	packetQoS.SetProfileParameters(setProfileParamStatus, qosReqPckg);
       
  2609 	ASSERT_EQUALS(WaitForRequestWithTimeOut(setProfileParamStatus, ETimeMedium), KErrNone, _L("RPacketQoS::SetProfileParameters timed out."));
       
  2610 	ASSERT_EQUALS(setProfileParamStatus.Int(), KErrNone, _L("RPacketQoS::SetProfileParameters returned with error status."));
       
  2611 
       
  2612 	// Get network info from phone
       
  2613 	RMobilePhone::TMobilePhoneNetworkInfoV1 info;
       
  2614 	RMobilePhone::TMobilePhoneNetworkInfoV1Pckg infopckg(info);
       
  2615 	TExtEtelRequestStatus getNetworkStatus(phone, EMobilePhoneGetCurrentNetwork);
       
  2616 	CleanupStack::PushL(getNetworkStatus);
       
  2617 	phone.GetCurrentNetwork(getNetworkStatus, infopckg);
       
  2618 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getNetworkStatus, ETimeMedium), KErrNone, _L("RMobilePhone::GetCurrentNetwork timed out"))
       
  2619 	ASSERT_EQUALS(getNetworkStatus.Int(), KErrNone, _L("RMobilePhone::GetCurrentNetwork returned an error"))	
       
  2620 
       
  2621 	// Get the context config using network info
       
  2622 	RPacketContext::TContextConfigGPRS config;
       
  2623 	TPtrC apn, user, pwd;
       
  2624 	iPacketServiceTestHelper.GetGprsSettings(info, apn, user, pwd);
       
  2625 	config.iAccessPointName.Copy(apn);
       
  2626 	config.iProtocolConfigOption.iAuthInfo.iUsername.Copy(user);
       
  2627 	config.iProtocolConfigOption.iAuthInfo.iPassword.Copy(pwd);
       
  2628 
       
  2629 	// Set a valid context config with RPacketContext::SetConfig 
       
  2630 	TPckg<RPacketContext::TContextConfigGPRS> configPk(config);
       
  2631 	TExtEtelRequestStatus setConfigStatus (primaryPacketContext, EPacketContextSetConfig);	
       
  2632 	CleanupStack::PushL(setConfigStatus);
       
  2633 	primaryPacketContext.SetConfig(setConfigStatus,configPk);
       
  2634 	ASSERT_EQUALS(WaitForRequestWithTimeOut(setConfigStatus, ETimeLong), KErrNone, _L("RPacketContext::SetConfig timed out"))
       
  2635 	ASSERT_EQUALS(setConfigStatus.Int(), KErrNone, _L("RPacketContext::SetConfig returned an error."))	
       
  2636 
       
  2637     // Set notify for  primary context change
       
  2638     TExtEtelRequestStatus reqPriContextChangeStatus(primaryPacketContext, EPacketContextNotifyStatusChange);
       
  2639 	CleanupStack::PushL(reqPriContextChangeStatus);
       
  2640 	RPacketContext::TContextStatus primaryPacketContextStatus;
       
  2641     primaryPacketContext.NotifyStatusChange(reqPriContextChangeStatus, primaryPacketContextStatus);
       
  2642 
       
  2643     
       
  2644 	// Activate primary context with RPacketContext::Activate 
       
  2645 	TExtEtelRequestStatus contextActivateStatus(primaryPacketContext, EPacketContextActivate);
       
  2646 	CleanupStack::PushL(contextActivateStatus);
       
  2647 	primaryPacketContext.Activate(contextActivateStatus);
       
  2648 	ASSERT_EQUALS(WaitForRequestWithTimeOut(contextActivateStatus, ETimeLong), KErrNone, _L("RPacketContext::Activate timed out."));
       
  2649 	ASSERT_EQUALS(contextActivateStatus.Int(), KErrNone, _L("RPacketContext::Activate returned with error status."));
       
  2650 
       
  2651 	// Check RPacketContext::NotifyStatusChange for the primary context completes with EStatusActivating -> EStatusActive
       
  2652 	RPacketContext::TContextStatus expectedPacketContextStatus = RPacketContext::EStatusActivating;
       
  2653 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  2654             	            primaryPacketContext,
       
  2655             				reqPriContextChangeStatus,
       
  2656             				primaryPacketContextStatus, 
       
  2657             				expectedPacketContextStatus,
       
  2658             				KErrNone);
       
  2659 
       
  2660     primaryPacketContext.NotifyStatusChange(reqPriContextChangeStatus, primaryPacketContextStatus);
       
  2661 	expectedPacketContextStatus = RPacketContext::EStatusActive;
       
  2662 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  2663             	            primaryPacketContext,
       
  2664             				reqPriContextChangeStatus,
       
  2665             				primaryPacketContextStatus, 
       
  2666             				expectedPacketContextStatus,
       
  2667             				KErrNone);
       
  2668 
       
  2669 	// Check RPacketContext::GetStatus for the primary context returns EStatusActive
       
  2670 	ASSERT_EQUALS(primaryPacketContext.GetStatus(primaryPacketContextStatus), KErrNone, _L("RPacketContext::GetStatus returned error."));
       
  2671 	ASSERT_EQUALS(primaryPacketContextStatus, RPacketContext::EStatusActive, _L("RPacketContext::GetStatus did not return RPacketContext::EStatusActive as expected."));
       
  2672 
       
  2673 
       
  2674 	// Set notify for  secondary context change
       
  2675 	TExtEtelRequestStatus reqSecContextChangeStatus(secondaryPacketContext, EPacketContextActivate);
       
  2676 	CleanupStack::PushL(reqSecContextChangeStatus);
       
  2677 	RPacketContext::TContextStatus secondaryPacketContextStatus;
       
  2678     secondaryPacketContext.NotifyStatusChange(reqSecContextChangeStatus, secondaryPacketContextStatus);
       
  2679 
       
  2680 	// Activate the secondary context. 
       
  2681 	TExtEtelRequestStatus secContextActivateStatus(secondaryPacketContext, EPacketContextActivate);
       
  2682 	CleanupStack::PushL(secContextActivateStatus);
       
  2683 	secondaryPacketContext.Activate(secContextActivateStatus);
       
  2684 	ASSERT_EQUALS(WaitForRequestWithTimeOut(secContextActivateStatus, ETimeMedium), KErrNone, _L("RPacketContext::Activate timed out."));
       
  2685 	ASSERT_EQUALS(secContextActivateStatus.Int(), KErrNone, _L("RPacketContext::Activate returned with error status."));
       
  2686 
       
  2687 	// Check RPacketContext::NotifyStatusChange for the secondary context completes with EStatusActivating -> EStatusActive
       
  2688 	expectedPacketContextStatus = RPacketContext::EStatusActivating;
       
  2689 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  2690             	            secondaryPacketContext,
       
  2691             				reqSecContextChangeStatus,
       
  2692             				secondaryPacketContextStatus, 
       
  2693             				expectedPacketContextStatus,
       
  2694             				KErrNone);
       
  2695     
       
  2696     secondaryPacketContext.NotifyStatusChange(reqSecContextChangeStatus, secondaryPacketContextStatus);
       
  2697 	expectedPacketContextStatus = RPacketContext::EStatusActive;
       
  2698 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  2699             	            secondaryPacketContext,
       
  2700             				reqSecContextChangeStatus,
       
  2701             				secondaryPacketContextStatus, 
       
  2702             				expectedPacketContextStatus,
       
  2703             				KErrNone);
       
  2704 
       
  2705 	// Check RPacketContext::GetStatus for the secondary context returns EStatusActive
       
  2706 	ASSERT_EQUALS(secondaryPacketContext.GetStatus(primaryPacketContextStatus), KErrNone, _L("RPacketContext::GetStatus returned error."));
       
  2707 	ASSERT_EQUALS(secondaryPacketContextStatus, RPacketContext::EStatusActive, _L("RPacketContext::GetStatus did not return RPacketContext::EStatusActive as expected."));
       
  2708 
       
  2709 	// ===  Check that there is one NIF with one primary and one secondary context belonging to it ===
       
  2710 
       
  2711 	// Check RPacketService::EnumerateNifs returns aCount = 1
       
  2712 	TExtEtelRequestStatus reqNifStatus(packetService, EPacketEnumerateNifs);
       
  2713 	CleanupStack::PushL(reqNifStatus);
       
  2714 	TInt nifCount = 0;
       
  2715 	packetService.EnumerateNifs(reqNifStatus, nifCount);
       
  2716 	ASSERT_EQUALS(WaitForRequestWithTimeOut(reqNifStatus, ETimeLong), KErrNone, _L("RPacketService::EnumerateNifs timed out."));
       
  2717 	ASSERT_EQUALS(nifCount, 1, _L("RPacketService::EnumerateNifs did not return 1 as expected"));
       
  2718 
       
  2719 	// Check RPacketService::EnumerateContextsInNif with aExistingContextName = existing primary context name returns aCount = 2
       
  2720 	TExtEtelRequestStatus reqContextNifStatus(packetService, EPacketEnumerateContextsInNif);
       
  2721 	CleanupStack::PushL(reqContextNifStatus);
       
  2722 	packetService.EnumerateContextsInNif(reqContextNifStatus, primaryContextId, nifCount);
       
  2723 	ASSERT_EQUALS(WaitForRequestWithTimeOut(reqContextNifStatus, ETimeLong), KErrNone, _L("RPacketService::EnumerateContextsInNif timed out."));
       
  2724 	ASSERT_EQUALS(nifCount, 2, _L("RPacketService::EnumerateContextsInNif did not return 2 as expected"));
       
  2725 	
       
  2726 	// Check RPacketService::EnumerateContextsInNif with aExistingContextName = existing secondary context name returns aCount = 2
       
  2727 	nifCount = 0;
       
  2728 	packetService.EnumerateContextsInNif(reqContextNifStatus, secondaryContextId, nifCount);
       
  2729 	ASSERT_EQUALS(WaitForRequestWithTimeOut(reqContextNifStatus, ETimeLong), KErrNone, _L("RPacketService::EnumerateContextsInNif timed out."));
       
  2730 	ASSERT_EQUALS(nifCount, 2, _L("RPacketService::EnumerateContextsInNif did not return 2 as expected"));
       
  2731 
       
  2732 	// Check RPacketService::GetContextNameInNif with aExistingContextName = existing primary context name and aIndex = 0 returns valid context name in aContextName
       
  2733     TExtEtelRequestStatus contextNameNifsStatus(packetService, EPacketGetContextNameInNif);
       
  2734 	CleanupStack::PushL(contextNameNifsStatus);
       
  2735 	TInt index = 0;
       
  2736 	TName returnedContextName;
       
  2737 	packetService.GetContextNameInNif(contextNameNifsStatus, primaryContextId, index, returnedContextName );
       
  2738 	ASSERT_EQUALS(WaitForRequestWithTimeOut(contextNameNifsStatus, ETimeLong), KErrNone, _L("RPacketContext::GetContextNameInNif timed out."));
       
  2739 	ASSERT_EQUALS(contextNameNifsStatus.Int(), KErrNone, _L("RPacketService::GetContextNameInNif returned error"));
       
  2740 	ASSERT_TRUE(returnedContextName.Length() > 0, _L("RPacketService::GetContextNameInNif with aExistingContextName = existing context name returned with an error"));
       
  2741 	
       
  2742 	// Check RPacketService::GetContextNameInNif with aExistingContextName = existing primary context name and aIndex = 1 returns valid context name in aContextName
       
  2743 	index = 1;
       
  2744 	packetService.GetContextNameInNif(contextNameNifsStatus, primaryContextId, index, returnedContextName );
       
  2745 	ASSERT_EQUALS(WaitForRequestWithTimeOut(contextNameNifsStatus, ETimeLong), KErrNone, _L("RPacketContext::GetContextNameInNif timed out."));
       
  2746 	ASSERT_EQUALS(contextNameNifsStatus.Int(), KErrNone, _L("RPacketService::GetContextNameInNif returned error"));
       
  2747 	ASSERT_TRUE(returnedContextName.Length() > 0, _L("RPacketService::GetContextNameInNif with aExistingContextName = existing context name returned with an error"));
       
  2748 	
       
  2749 	// Check RPacketService::GetContextNameInNif with aExistingContextName = existing primary context name and aIndex = 2 returns an error != KErrNone
       
  2750 	index = 2;
       
  2751 	packetService.GetContextNameInNif(contextNameNifsStatus, primaryContextId, index, returnedContextName );
       
  2752 	ASSERT_EQUALS(WaitForRequestWithTimeOut(contextNameNifsStatus, ETimeLong), KErrNone, _L("RPacketContext::GetContextNameInNif timed out."));
       
  2753 	ASSERT_TRUE(contextNameNifsStatus.Int() != KErrNone, _L("RPacketService::GetContextNameInNif did not return an error as expected"));
       
  2754 
       
  2755 	// Check RPacketService::GetNifInfo with aCount = 0 returns valid name in iContextName
       
  2756 	TExtEtelRequestStatus reqNifInfoStatus(packetService, EPacketGetNifInfo);
       
  2757 	CleanupStack::PushL(reqNifInfoStatus);
       
  2758 	RPacketService::TNifInfoV2 nifInfoV2;
       
  2759 	RPacketService::TNifInfoV2Pckg nifInfoV2Pkg(nifInfoV2);
       
  2760 	index = 0;
       
  2761 	packetService.GetNifInfo(reqNifInfoStatus, index, nifInfoV2Pkg);
       
  2762 	ASSERT_EQUALS(WaitForRequestWithTimeOut(reqNifInfoStatus, ETimeLong), KErrNone, _L("RPacketService::GetNifInfo timed out"));
       
  2763 	ASSERT_EQUALS(reqNifInfoStatus.Int(), KErrNone, _L("RPacketService::GetNifInfo returned an error"));
       
  2764 	ASSERT_TRUE(nifInfoV2.iContextName.Length() > 0, _L("RPacketService::GetNifInfo with aCount = 0 returned with invalid iContextName"));
       
  2765 	
       
  2766 	// Check RPacketService::GetNifInfo with aCount = 0 returns iNumberOfContexts = 2
       
  2767 	ASSERT_EQUALS(nifInfoV2.iNumberOfContexts, 2, _L("RPacketService::GetNifInfo with iNumberOfContexts did not return 2 as expected"));
       
  2768 	
       
  2769 	// Check RPacketService::GetNifInfo with aCount = 0 returns iNifStatus = EStatusActive
       
  2770 	ASSERT_EQUALS(nifInfoV2.iNifStatus, RPacketContext::EStatusActive, _L("RPacketService::GetNifInfo did not return EStatusActive as expected"));
       
  2771 	
       
  2772 	// Check RPacketService::GetNifInfo with aCount = 0 returns valid address in iPdpAddress
       
  2773     ASSERT_TRUE(nifInfoV2.iPdpAddress.Length() > 0, _L("RPacketService::GetNifInfo with iPdpAddress returned with an error"));
       
  2774     
       
  2775 	// Check RPacketService::GetNifInfo with aCount = 0 returns EInternalContext
       
  2776 	ASSERT_EQUALS(nifInfoV2.iContextType, RPacketService::EInternalContext, _L("RPacketService::GetNifInfo did not return EInternalContext as expected"));
       
  2777 	
       
  2778 	// Deactivate the secondary context with RPacketContext::Deactivate 
       
  2779 	TExtEtelRequestStatus secContextDeactivateStatus(secondaryPacketContext, EPacketContextDeactivate);
       
  2780 	CleanupStack::PushL(secContextDeactivateStatus);
       
  2781 	secondaryPacketContext.Deactivate(secContextDeactivateStatus);
       
  2782 	ASSERT_EQUALS(WaitForRequestWithTimeOut(secContextDeactivateStatus, ETimeMedium), KErrNone, _L("RPacketContext::Deactivate timed out."));					
       
  2783 	ASSERT_EQUALS(secContextDeactivateStatus.Int(), KErrNone, _L("RPacketContext::Deactivate returned error."));
       
  2784 
       
  2785 	//Release QoS
       
  2786 	iEtelSessionMgr.ReleaseSecondaryPacketContextQoS(KMainServer,
       
  2787 											KMainPhone, 
       
  2788 											KMainPacketService, 
       
  2789 											KPrimaryPacketContext1,
       
  2790 											KSecondaryPacketContext1);
       
  2791 
       
  2792 	// Release packet contexts
       
  2793 	iEtelSessionMgr.ReleaseSecondaryPacketContext(KMainServer,
       
  2794 											KMainPhone, 
       
  2795 											KMainPacketService, 
       
  2796 											KPrimaryPacketContext1,
       
  2797 											KSecondaryPacketContext1);
       
  2798 	iEtelSessionMgr.ReleasePrimaryPacketContext(KMainServer,
       
  2799 											KMainPhone, 
       
  2800 											KMainPacketService, 
       
  2801 											KPrimaryPacketContext1);
       
  2802 
       
  2803 
       
  2804 	////////////////////////////////////////////////////////////////
       
  2805 	// TEST END
       
  2806 	////////////////////////////////////////////////////////////////
       
  2807 
       
  2808     StartCleanup();
       
  2809 	
       
  2810 	// Pop
       
  2811 	// notifyContextStatus
       
  2812 	// getQoSProfileCapsStatus
       
  2813 	// setProfileParamStatus
       
  2814 	// getNetworkStatus
       
  2815 	// setConfigStatus
       
  2816 	// reqPriContextChangeStatus
       
  2817 	// contextActivateStatus
       
  2818 	// reqSecContextChangeStatus
       
  2819 	// secContextActivateStatus
       
  2820 	// reqNifStatus
       
  2821 	// reqContextNifStatus
       
  2822 	// contextNameNifsStatus
       
  2823 	// reqNifInfoStatus
       
  2824 	// secContextDeactivateStatus
       
  2825 	CleanupStack::PopAndDestroy(14, &notifyContextStatus);
       
  2826     
       
  2827 	return TestStepResult();
       
  2828 	}
       
  2829 
       
  2830 TPtrC CCTSYIntegrationTestPacketContext0008::GetTestStepName()
       
  2831 /**
       
  2832  * @return The test step name.
       
  2833  */
       
  2834 	{
       
  2835 	return _L("CCTSYIntegrationTestPacketContext0008");
       
  2836 	}
       
  2837 
       
  2838 
       
  2839 
       
  2840 CCTSYIntegrationTestPacketContext0009::CCTSYIntegrationTestPacketContext0009(CEtelSessionMgr& aEtelSessionMgr)
       
  2841 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
  2842 /**
       
  2843  * Constructor.
       
  2844  */
       
  2845 	{
       
  2846 	SetTestStepName(CCTSYIntegrationTestPacketContext0009::GetTestStepName());
       
  2847 	}
       
  2848 
       
  2849 CCTSYIntegrationTestPacketContext0009::~CCTSYIntegrationTestPacketContext0009()
       
  2850 /**
       
  2851  * Destructor.
       
  2852  */
       
  2853 	{
       
  2854 	}
       
  2855 
       
  2856 TVerdict CCTSYIntegrationTestPacketContext0009::doTestStepL()
       
  2857 /**
       
  2858  * @SYMTestCaseID BA-CTSY-INT-PKTC-0009
       
  2859  * @SYMFssID BA/CTSY/PKTC-0009
       
  2860  * @SYMTestCaseDesc Activate and deactivate a secondary context (roaming).
       
  2861  * @SYMTestPriority High
       
  2862  * @SYMTestActions RPacketContext::GetConfig, RPacketContext::Activate, RPacketContext::Deactivate, RPacketService::NotifyContextAdded, RPacketContext::GetStatus, RPacketContext::AddPacketFilter, RPacketContext::NotifyStatusChange, RPacketService::NotifyStatusChange, RPacketService::NotifyDynamicCapsChange, RPacketService::GetStatus, RPacketContext::SetConfig, RPacketContext::GetDnsInfo, RPacketQoS::OpenNewQoS, RPacketQoS::GetProfileCapabilities, RPacketQoS::SetProfileParameters
       
  2863  * @SYMTestExpectedResults Pass - Secondary context is activated then deactivated.
       
  2864  * @SYMTestType CIT
       
  2865  * @SYMTestCaseDependencies live/manual
       
  2866  *
       
  2867  * Reason for test: Verify packet service status, packet context statuses, dynamic caps.
       
  2868  *
       
  2869  * @return - TVerdict code
       
  2870  */
       
  2871 	{
       
  2872 
       
  2873 	////////////////////////////////////////////////////////////////
       
  2874 	// SET UP
       
  2875 	////////////////////////////////////////////////////////////////
       
  2876 
       
  2877 	
       
  2878 	// Ensure phone is attached to packet service. 
       
  2879 
       
  2880 
       
  2881 	////////////////////////////////////////////////////////////////
       
  2882 	// SET UP END
       
  2883 	////////////////////////////////////////////////////////////////
       
  2884 	
       
  2885 	StartTest();
       
  2886 	
       
  2887 	////////////////////////////////////////////////////////////////
       
  2888 	// TEST START
       
  2889 	////////////////////////////////////////////////////////////////
       
  2890 	
       
  2891 	
       
  2892 	// Add a TPacketFilterV2 packet filter to the secondary context using RPacketContext::AddPacketFilter 
       
  2893 
       
  2894 	// ===  Add QoS ===
       
  2895 
       
  2896 	// Open a new QoS from the secondary context 
       
  2897 
       
  2898 	// Get GPRS QoS profile capabilities with RPacketQoS::GetProfileCapabilities 
       
  2899 
       
  2900 	// Set requested profile parameters with RPacketQoS::SetProfileParameters and TQoSGPRSRequested with parameters within range returned by RPacketQoS::GetProfileCapabilities 
       
  2901 
       
  2902 	// Set a valid context config with RPacketContext::SetConfig 
       
  2903 
       
  2904 	// Check RPacketService::NotifyContextAdded completes with a valid context name
       
  2905 
       
  2906 	// Activate primary context with RPacketContext::Activate 
       
  2907 
       
  2908 	// ===  Check context and service statuses ===
       
  2909 
       
  2910 	// Check RPacketService::NotifyStatusChange completes with EStatusActive
       
  2911 
       
  2912 	// Check RPacketService::GetStatus returns EStatusActive
       
  2913 
       
  2914 	// Check RPacketContext::NotifyStatusChange for the primary context completes with EStatusActivating -> EStatusActive
       
  2915 
       
  2916 	// Check RPacketContext::GetStatus for the primary context returns EStatusActive
       
  2917 
       
  2918 	// Open a new secondary context from primary context  
       
  2919 
       
  2920 	// Activate the secondary context. 
       
  2921 
       
  2922 	// Check RPacketContext::NotifyStatusChange for the secondary context completes with EStatusActivating -> EStatusActive
       
  2923 
       
  2924 	// Check RPacketContext::GetStatus for the secondary context returns EStatusActive
       
  2925 
       
  2926 	// ===  Check dynamic caps ===
       
  2927 
       
  2928 	// Check RPacketService::NotifyDynamicCapsChange completes with caps in set of KCapsRxCSCall | KCapsRxContextActivationReq | KCapsSMSTransfer | KCapsHSDPA.
       
  2929 	// Check RPacketService::NotifyDynamicCapsChange completes with caps NOT in set of RPacketService::KCapsManualAttach
       
  2930 
       
  2931 	// Check RPacketService::GetDynamicCaps returns caps in set of KCapsRxCSCall | KCapsRxContextActivationReq | KCapsSMSTransfer | KCapsHSDPA
       
  2932 	// Check RPacketService::GetDynamicCaps returns caps NOT in set of RPacketService::KCapsManualAttach
       
  2933 
       
  2934 	// ===  Get context information ===
       
  2935 
       
  2936 	// Check RPacketContext::GetConfig for primary context returns same config as that set
       
  2937 
       
  2938 	// Check RPacketContext::GetDnsInfo for primary context returns valid primary and secondary DNS ip addresses
       
  2939 	// Check RPacketContext::GetDnsInfo for secondary context returns same primary and secondary DNS ip addresses as for the primary context
       
  2940 
       
  2941 	// Deactivate the secondary context with RPacketContext::Deactivate 
       
  2942 
       
  2943 	// ===  Check context and service statuses ===
       
  2944 
       
  2945 	// Check RPacketContext::NotifyStatusChange for the secondary context completes with EStatusDeactivating -> EStatusInactive
       
  2946 
       
  2947 	// Check RPacketContext::GetStatus for the secondary context returns EStatusInactive
       
  2948 	// Check RPacketContext::GetStatus for the primary context returns EStatusActive
       
  2949 
       
  2950 	// Check RPacketService::GetStatus for the secondary context returns EStatusActive
       
  2951 
       
  2952 	
       
  2953 	////////////////////////////////////////////////////////////////
       
  2954 	// TEST END
       
  2955 	////////////////////////////////////////////////////////////////
       
  2956 
       
  2957     StartCleanup();
       
  2958 	
       
  2959 	// Put any required test clean up here, then remove this comment
       
  2960 	
       
  2961 	return TestStepResult();
       
  2962 	}
       
  2963 
       
  2964 TPtrC CCTSYIntegrationTestPacketContext0009::GetTestStepName()
       
  2965 /**
       
  2966  * @return The test step name.
       
  2967  */
       
  2968 	{
       
  2969 	return _L("CCTSYIntegrationTestPacketContext0009");
       
  2970 	}
       
  2971 
       
  2972 
       
  2973 
       
  2974 CCTSYIntegrationTestPacketContext0010::CCTSYIntegrationTestPacketContext0010(CEtelSessionMgr& aEtelSessionMgr)
       
  2975 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
  2976 /**
       
  2977  * Constructor.
       
  2978  */
       
  2979 	{
       
  2980 	SetTestStepName(CCTSYIntegrationTestPacketContext0010::GetTestStepName());
       
  2981 	}
       
  2982 
       
  2983 CCTSYIntegrationTestPacketContext0010::~CCTSYIntegrationTestPacketContext0010()
       
  2984 /**
       
  2985  * Destructor.
       
  2986  */
       
  2987 	{
       
  2988 	}
       
  2989 
       
  2990 TVerdict CCTSYIntegrationTestPacketContext0010::doTestStepL()
       
  2991 /**
       
  2992  * @SYMTestCaseID BA-CTSY-INT-PKTC-0010
       
  2993  * @SYMFssID BA/CTSY/PKTC-0010
       
  2994  * @SYMTestCaseDesc Activate and deactivate a secondary context (roaming).
       
  2995  * @SYMTestPriority High
       
  2996  * @SYMTestActions RPacketContext::OpenNewSecondaryContext, RPacketContext::SetConfig, RPacketContext::Activate, RPacketService::NotifyStatusChange, RPacketService::GetStatus, RPacketContext::NotifyStatusChange, RPacketContext::GetStatus, RPacketService::EnumerateNifs, RPacketService::EnumerateContextsInNif, RPacketService::GetNifInfo, RPacketService::GetContextNameInNif, RPacketQoS::OpenNewQoS, RPacketQoS::GetProfileCapabilities, RPacketQoS::SetProfileParameters
       
  2997  * @SYMTestExpectedResults Pass - Secondary context is activated then deactivated.
       
  2998  * @SYMTestType CIT
       
  2999  * @SYMTestCaseDependencies live/manual
       
  3000  *
       
  3001  * Reason for test: Verify NIF info from RPacketService correct.
       
  3002  *
       
  3003  * @return - TVerdict code
       
  3004  */
       
  3005 	{
       
  3006 
       
  3007 	////////////////////////////////////////////////////////////////
       
  3008 	// SET UP
       
  3009 	////////////////////////////////////////////////////////////////
       
  3010 
       
  3011 	
       
  3012 	// Ensure phone is attached to the packet service. 
       
  3013 
       
  3014 
       
  3015 	////////////////////////////////////////////////////////////////
       
  3016 	// SET UP END
       
  3017 	////////////////////////////////////////////////////////////////
       
  3018 	
       
  3019 	StartTest();
       
  3020 	
       
  3021 	////////////////////////////////////////////////////////////////
       
  3022 	// TEST START
       
  3023 	////////////////////////////////////////////////////////////////
       
  3024 	
       
  3025 	
       
  3026 	// Add a TPacketFilterV2 packet filter to the secondary context using RPacketContext::AddPacketFilter 
       
  3027 
       
  3028 	// ===  Add QoS ===
       
  3029 
       
  3030 	// Open a new QoS from the secondary context  
       
  3031 
       
  3032 	// Get GPRS QoS profile capabilities with RPacketQoS::GetProfileCapabilities 
       
  3033 
       
  3034 	// Set requested profile parameters with RPacketQoS::SetProfileParameters and TQoSGPRSRequested with parameters within range returned by RPacketQoS::GetProfileCapabilities 
       
  3035 
       
  3036 	// Set a valid context config with RPacketContext::SetConfig 
       
  3037 
       
  3038 	// Activate primary context with RPacketContext::Activate 
       
  3039 
       
  3040 	// Check RPacketContext::NotifyStatusChange for the primary context completes with EStatusActivating -> EStatusActive
       
  3041 
       
  3042 	// Check RPacketContext::GetStatus for the primary context returns EStatusActive
       
  3043 
       
  3044 	// Open a new secondary context from primary context  
       
  3045 
       
  3046 	// Activate the secondary context. 
       
  3047 
       
  3048 	// Check RPacketContext::NotifyStatusChange for the secondary context completes with EStatusActivating -> EStatusActive
       
  3049 
       
  3050 	// Check RPacketContext::GetStatus for the secondary context returns EStatusActive
       
  3051 
       
  3052 	// ===  Check that there is one NIF with one primary and one secondary context belonging to it ===
       
  3053 
       
  3054 	// Check RPacketService::EnumerateNifs returns aCount = 1
       
  3055 
       
  3056 	// Check RPacketService::EnumerateContextsInNif with aExistingContextName = existing primary context name returns aCount = 2
       
  3057 	// Check RPacketService::EnumerateContextsInNif with aExistingContextName = existing secondary context name returns aCount = 2
       
  3058 
       
  3059 	// Check RPacketService::GetContextNameInNif with aExistingContextName = existing primary context name and aIndex = 0 returns valid context name in aContextName
       
  3060 	// Check RPacketService::GetContextNameInNif with aExistingContextName = existing primary context name and aIndex = 1 returns valid context name in aContextName
       
  3061 	// Check RPacketService::GetContextNameInNif with aExistingContextName = existing primary context name and aIndex = 2 returns an error != KErrNone
       
  3062 
       
  3063 	// Check RPacketService::GetNifInfo with aCount = 0 returns valid name in iContextName
       
  3064 	// Check RPacketService::GetNifInfo with aCount = 0 returns iNumberOfContexts = 2
       
  3065 	// Check RPacketService::GetNifInfo with aCount = 0 returns iNifStatus = EStatusActive
       
  3066 	// Check RPacketService::GetNifInfo with aCount = 0 returns valid address in iPdpAddress
       
  3067 	// Check RPacketService::GetNifInfo with aCount = 0 returns EExternalContext
       
  3068 
       
  3069 	// Deactivate the secondary context with RPacketContext::Deactivate 
       
  3070 
       
  3071 	
       
  3072 	////////////////////////////////////////////////////////////////
       
  3073 	// TEST END
       
  3074 	////////////////////////////////////////////////////////////////
       
  3075 
       
  3076     StartCleanup();
       
  3077 	
       
  3078 	// Put any required test clean up here, then remove this comment
       
  3079 	
       
  3080 	return TestStepResult();
       
  3081 	}
       
  3082 
       
  3083 TPtrC CCTSYIntegrationTestPacketContext0010::GetTestStepName()
       
  3084 /**
       
  3085  * @return The test step name.
       
  3086  */
       
  3087 	{
       
  3088 	return _L("CCTSYIntegrationTestPacketContext0010");
       
  3089 	}
       
  3090 
       
  3091 
       
  3092 
       
  3093 CCTSYIntegrationTestPacketContext0011::CCTSYIntegrationTestPacketContext0011(CEtelSessionMgr& aEtelSessionMgr)
       
  3094 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
  3095 /**
       
  3096  * Constructor.
       
  3097  */
       
  3098 	{
       
  3099 	SetTestStepName(CCTSYIntegrationTestPacketContext0011::GetTestStepName());
       
  3100 	}
       
  3101 
       
  3102 CCTSYIntegrationTestPacketContext0011::~CCTSYIntegrationTestPacketContext0011()
       
  3103 /**
       
  3104  * Destructor.
       
  3105  */
       
  3106 	{
       
  3107 	}
       
  3108 
       
  3109 TVerdict CCTSYIntegrationTestPacketContext0011::doTestStepL()
       
  3110 /**
       
  3111  * @SYMTestCaseID BA-CTSY-INT-PKTC-0011
       
  3112  * @SYMFssID BA/CTSY/PKTC-0011
       
  3113  * @SYMTestCaseDesc Activate a context when it is already active.
       
  3114  * @SYMTestPriority High
       
  3115  * @SYMTestActions RPacketContext::Activate, RPacketContext::GetStatus
       
  3116  * @SYMTestExpectedResults Pass - Error returned on activation.
       
  3117  * @SYMTestType CIT
       
  3118  * @SYMTestCaseDependencies live/automatic
       
  3119  *
       
  3120  * Reason for test: Verify context status.
       
  3121  *
       
  3122  * @return - TVerdict code
       
  3123  */
       
  3124 	{
       
  3125 
       
  3126 	////////////////////////////////////////////////////////////////
       
  3127 	// SET UP
       
  3128 	////////////////////////////////////////////////////////////////
       
  3129 
       
  3130 	// Call TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL		
       
  3131     RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
  3132 	CHECK_EQUALS_L(iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(phone), KErrNone, _L("TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL returned with an error"));
       
  3133 
       
  3134     // Get packet service
       
  3135 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, KMainPhone, KMainPacketService);
       
  3136 
       
  3137     // Ensure phone is attached to the packet service
       
  3138     SetAttachModeToWhenPossibleAndWaitForAttachL(packetService);
       
  3139     
       
  3140     
       
  3141     // Ensure a primary PDP context is active. 
       
  3142 	RPacketContext& primaryPacketContext = iEtelSessionMgr.GetPrimaryPacketContextL(
       
  3143 											KMainServer,
       
  3144 											KMainPhone,
       
  3145 											KMainPacketService,
       
  3146 											KPrimaryPacketContext1);
       
  3147 
       
  3148     // Activate primary context.											
       
  3149 	iPacketServiceTestHelper.ActivatePrimaryPacketContextL(phone, primaryPacketContext);	
       
  3150         
       
  3151     
       
  3152 	////////////////////////////////////////////////////////////////
       
  3153 	// SET UP END
       
  3154 	////////////////////////////////////////////////////////////////
       
  3155 	
       
  3156 	StartTest();
       
  3157 	
       
  3158 	////////////////////////////////////////////////////////////////
       
  3159 	// TEST START
       
  3160 	////////////////////////////////////////////////////////////////
       
  3161 	
       
  3162 	
       
  3163 	// Activate the active context with RPacketContext::Activate. 
       
  3164 	TExtEtelRequestStatus contextActivateStatus(primaryPacketContext, EPacketContextActivate);
       
  3165 	CleanupStack::PushL(contextActivateStatus);
       
  3166 	primaryPacketContext.Activate(contextActivateStatus);
       
  3167 
       
  3168 	// Check error is returned.
       
  3169 	ASSERT_EQUALS(WaitForRequestWithTimeOut(contextActivateStatus, ETimeLong), KErrNone, _L("RPacketContext::Activate timed out."));
       
  3170 	ASSERT_TRUE(contextActivateStatus.Int() != KErrNone, _L("RPacketContext::Activate did not return error as expected."));
       
  3171 
       
  3172 	// Check RPacketContext::GetStatus returns EStatusActive
       
  3173 	RPacketContext::TContextStatus primaryPacketContextStatus;
       
  3174 	ASSERT_EQUALS(primaryPacketContext.GetStatus(primaryPacketContextStatus), KErrNone, _L("RPacketContext::GetStatus returned with an error."));
       
  3175 	ASSERT_EQUALS(primaryPacketContextStatus, RPacketContext::EStatusActive, _L("RPacketContext::GetStatus did not return RPacketContext::EStatusActive."));
       
  3176 
       
  3177 	
       
  3178 	////////////////////////////////////////////////////////////////
       
  3179 	// TEST END
       
  3180 	////////////////////////////////////////////////////////////////
       
  3181 
       
  3182     StartCleanup();
       
  3183 	
       
  3184 	// Pop
       
  3185 	// contextActivateStatus
       
  3186 	CleanupStack::PopAndDestroy(1, &contextActivateStatus);
       
  3187 	
       
  3188 	return TestStepResult();
       
  3189 	}
       
  3190 
       
  3191 TPtrC CCTSYIntegrationTestPacketContext0011::GetTestStepName()
       
  3192 /**
       
  3193  * @return The test step name.
       
  3194  */
       
  3195 	{
       
  3196 	return _L("CCTSYIntegrationTestPacketContext0011");
       
  3197 	}
       
  3198 
       
  3199 
       
  3200 
       
  3201 CCTSYIntegrationTestPacketContext0012::CCTSYIntegrationTestPacketContext0012(CEtelSessionMgr& aEtelSessionMgr)
       
  3202 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
  3203 /**
       
  3204  * Constructor.
       
  3205  */
       
  3206 	{
       
  3207 	SetTestStepName(CCTSYIntegrationTestPacketContext0012::GetTestStepName());
       
  3208 	}
       
  3209 
       
  3210 CCTSYIntegrationTestPacketContext0012::~CCTSYIntegrationTestPacketContext0012()
       
  3211 /**
       
  3212  * Destructor.
       
  3213  */
       
  3214 	{
       
  3215 	}
       
  3216 
       
  3217 TVerdict CCTSYIntegrationTestPacketContext0012::doTestStepL()
       
  3218 /**
       
  3219  * @SYMTestCaseID BA-CTSY-INT-PKTC-0012
       
  3220  * @SYMFssID BA/CTSY/PKTC-0012
       
  3221  * @SYMTestCaseDesc Re-activate a context after deactivation.
       
  3222  * @SYMTestPriority High
       
  3223  * @SYMTestActions RPacketContext::NotifyStatusChange, RPacketContext::GetStatus, RPacketService::NotifyStatusChange, RPacketService::GetStatus, RPacketService::NotifyDynamicCapsChange, RPacketService::GetDynamicCaps
       
  3224  * @SYMTestExpectedResults Pass - Context is deactivated and then reactivated.
       
  3225  * @SYMTestType CIT
       
  3226  * @SYMTestCaseDependencies live/automatic
       
  3227  *
       
  3228  * Reason for test: Verify context and packet service status, dynamic caps.
       
  3229  *
       
  3230  * @return - TVerdict code
       
  3231  */
       
  3232 	{
       
  3233 
       
  3234 	////////////////////////////////////////////////////////////////
       
  3235 	// SET UP
       
  3236 	////////////////////////////////////////////////////////////////
       
  3237 
       
  3238 	// Call TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL		
       
  3239     RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
  3240 	CHECK_EQUALS_L(iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(phone), KErrNone, _L("TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL returned with an error"));
       
  3241 
       
  3242 	// Get packet service
       
  3243 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, KMainPhone, KMainPacketService);
       
  3244 
       
  3245     // Get the attach mode so that it can be restored at the end of the test
       
  3246     RPacketService::TAttachMode attachMode;
       
  3247     CHECK_EQUALS_L(packetService.GetAttachMode(attachMode), KErrNone, _L("RPacketService::GetAttachMode returned with an error."));
       
  3248 
       
  3249     // Ensure phone is attached to the packet service
       
  3250     SetAttachModeToWhenPossibleAndWaitForAttachL(packetService);
       
  3251    	 			
       
  3252 	// Ensure a PDP context is active.
       
  3253 	RPacketContext& packetContext = iEtelSessionMgr.GetPrimaryPacketContextL(
       
  3254 											KMainServer,
       
  3255 											KMainPhone,
       
  3256 											KMainPacketService,
       
  3257 											KPrimaryPacketContext1);
       
  3258 	
       
  3259 	iPacketServiceTestHelper.ActivatePrimaryPacketContextL(phone,packetContext); 
       
  3260 												 	
       
  3261 	
       
  3262 	////////////////////////////////////////////////////////////////
       
  3263 	// SET UP END
       
  3264 	////////////////////////////////////////////////////////////////
       
  3265 	
       
  3266 	StartTest();
       
  3267 	
       
  3268 	////////////////////////////////////////////////////////////////
       
  3269 	// TEST START
       
  3270 	////////////////////////////////////////////////////////////////
       
  3271 
       
  3272 	// Post notification for context's status change
       
  3273 	TExtEtelRequestStatus notifyContextStChStatus(packetContext, EPacketContextNotifyStatusChange);
       
  3274 	CleanupStack::PushL(notifyContextStChStatus);
       
  3275 	RPacketContext::TContextStatus packetContextStatus;
       
  3276 	packetContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);
       
  3277 		
       
  3278 	// Post notification for service's status change
       
  3279 	TExtEtelRequestStatus notifyServiceStChStatus(packetService, EPacketNotifyStatusChange);
       
  3280 	CleanupStack::PushL(notifyServiceStChStatus);
       
  3281 	RPacketService::TStatus packetServiceStatus;
       
  3282 	packetService.NotifyStatusChange(notifyServiceStChStatus, packetServiceStatus);
       
  3283 	
       
  3284 	// Post notification for service's dynamic caps change
       
  3285     RPacketService::TDynamicCapsFlags dynCaps;
       
  3286 	TExtEtelRequestStatus notifyServiceDynCapsStatus(packetService, EPacketNotifyDynamicCapsChange);
       
  3287 	CleanupStack::PushL(notifyServiceDynCapsStatus);
       
  3288 	packetService.NotifyDynamicCapsChange(notifyServiceDynCapsStatus, dynCaps);
       
  3289 	
       
  3290 	// Deactivate the PDP context with RPacketContext::Deactivate 
       
  3291 	TExtEtelRequestStatus contextDeactivateStatus(packetContext, EPacketContextDeactivate);
       
  3292 	CleanupStack::PushL(contextDeactivateStatus);
       
  3293 	packetContext.Deactivate(contextDeactivateStatus);
       
  3294 	ASSERT_EQUALS(WaitForRequestWithTimeOut(contextDeactivateStatus, ETimeLong), KErrNone, _L("RPacketContext::Deactivate timed out."));					
       
  3295 	ASSERT_EQUALS(contextDeactivateStatus.Int(), KErrNone, _L("RPacketContext::Deactivate returned with error status."));
       
  3296 					
       
  3297 	// ===  Check context and service statuses ===
       
  3298 
       
  3299 	// Check RPacketContext::NotifyStatusChange completes with EStatusDeactivating -> EStatusInactive
       
  3300     RPacketContext::TContextStatus 	expectedPacketContextStatus = RPacketContext::EStatusDeactivating;
       
  3301 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  3302 					packetContext,
       
  3303 					notifyContextStChStatus,
       
  3304 					packetContextStatus, 
       
  3305 					expectedPacketContextStatus,
       
  3306 					KErrNone);
       
  3307 
       
  3308 	packetContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);
       
  3309 	expectedPacketContextStatus = RPacketContext::EStatusInactive;
       
  3310 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  3311 					packetContext,
       
  3312 					notifyContextStChStatus,
       
  3313 					packetContextStatus, 
       
  3314 					expectedPacketContextStatus,
       
  3315 					KErrNone);
       
  3316 					
       
  3317 	// Check RPacketContext::GetStatus returns EStatusInactive
       
  3318 	ASSERT_EQUALS(packetContext.GetStatus(packetContextStatus), KErrNone, _L("RPacketContext::GetStatus returned with an error."));
       
  3319 	ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusInactive, _L("RPacketContext::GetStatus returns incorrect status."));
       
  3320 	
       
  3321 	// Check RPacketService::NotifyStatusChange completes with EStatusAttached
       
  3322 	RPacketService::TStatus expectedPacketServiceStatus = RPacketService::EStatusAttached;
       
  3323 	iPacketServiceTestHelper.WaitForPacketServiceNotifyStatusChange(
       
  3324 				packetService,
       
  3325 				notifyServiceStChStatus,
       
  3326 				packetServiceStatus, 
       
  3327 				expectedPacketServiceStatus,
       
  3328 				KErrNone);
       
  3329 				
       
  3330 	// Check RPacketService::GetStatus returns EStatusAttached
       
  3331 	RPacketService::TStatus pckSrvcStatus;
       
  3332 	ASSERT_EQUALS(packetService.GetStatus(pckSrvcStatus), KErrNone, _L("RPacketService::GetStatus returned with an error."));
       
  3333 	ASSERT_EQUALS(pckSrvcStatus, RPacketService::EStatusAttached, _L("RPacketService::GetStatus returns incorrect status."));
       
  3334 	
       
  3335 	// ===  Check dynamic caps ===
       
  3336 
       
  3337 	// Check RPacketService::GetDynamicCaps returns caps in set of RPacketService::KCapsSMSTransfer | RPacketService::KCapsManualDetach  | RPacketService::KCapsRxCSCall |  RPacketService::KCapsRxContextActivationReq
       
  3338 	// Check RPacketService::GetDynamicCaps returns caps NOT in set of RPacketService::KCapsManualAttach
       
  3339   	TInt wantedDynCapBits = RPacketService::KCapsSMSTransfer | RPacketService::KCapsManualDetach |  RPacketService::KCapsRxContextActivationReq | RPacketService::KCapsRxCSCall;
       
  3340 	TInt unWantedDynCapBits = RPacketService::KCapsManualAttach;
       
  3341 	ASSERT_EQUALS(packetService.GetDynamicCaps(dynCaps), KErrNone, _L("RPacketService::GetDynamicCaps returned with an error"));
       
  3342 	ASSERT_BITS_SET(dynCaps, wantedDynCapBits, unWantedDynCapBits, _L("RPacketService::GetDynamicCaps did not return correct dynamic caps"));
       
  3343 	
       
  3344 	// Post notification for service's status change
       
  3345 	packetService.NotifyStatusChange(notifyServiceStChStatus, packetServiceStatus);
       
  3346 	
       
  3347 	// Activate a PDP context again. 
       
  3348 	// Post notification for context's status change
       
  3349 	packetContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);
       
  3350 
       
  3351 	// Activate packet context with RPacketContext::Activate
       
  3352 	TExtEtelRequestStatus contextActivateStatus(packetContext, EPacketContextActivate);
       
  3353 	CleanupStack::PushL(contextActivateStatus);
       
  3354 	ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d</font>"), 50002 );
       
  3355 	// CTSY doesn´t support context re-activation. See cmmpacketcontextgsmwcdmaext.cpp and CMmPacketContextGsmWcdmaExt::ActivateL()
       
  3356 	// Test case is made to leave because of this.
       
  3357 	CHECK_TRUE_L(EFalse, _L("This test has been made to leave intentionally - ***Send message fail, and ctsy cancel it later****"));
       
  3358 	packetContext.Activate(contextActivateStatus);
       
  3359 	ASSERT_EQUALS(WaitForRequestWithTimeOut(contextActivateStatus, ETimeLong), KErrNone, _L("RPacketContext::Activate timed out."));
       
  3360 	ASSERT_EQUALS(contextActivateStatus.Int(), KErrNone, _L("RPacketContext::Activate returned with error status."));
       
  3361 	
       
  3362 	// Check RPacketContext::NotifyStatusChange completes with EStatusActive
       
  3363     expectedPacketContextStatus = RPacketContext::EStatusActive;
       
  3364 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  3365 				packetContext,
       
  3366 				notifyContextStChStatus,
       
  3367 				packetContextStatus, 
       
  3368 				expectedPacketContextStatus,
       
  3369 				KErrNone);
       
  3370 				
       
  3371     ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusActive, _L("Packet Context's status expected to be EStatusActive but is not."));
       
  3372 
       
  3373 	// Post notification for context's status change
       
  3374 	packetContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);
       
  3375 		
       
  3376 	// ===  Check context and service statuses ===
       
  3377 
       
  3378 	// Check RPacketService::NotifyStatusChange completes with EStatusActive
       
  3379 	expectedPacketServiceStatus = RPacketService::EStatusActive;
       
  3380 	iPacketServiceTestHelper.WaitForPacketServiceNotifyStatusChange(
       
  3381 					packetService,
       
  3382 					notifyServiceStChStatus,
       
  3383 					packetServiceStatus, 
       
  3384 					expectedPacketServiceStatus,
       
  3385 					KErrNone);
       
  3386 					
       
  3387 	// Check RPacketService::GetStatus returns EStatusActive
       
  3388 	ASSERT_EQUALS(packetService.GetStatus(pckSrvcStatus), KErrNone, _L("RPacketService::GetStatus returned with an error."));
       
  3389 	ASSERT_EQUALS(pckSrvcStatus, RPacketService::EStatusActive, _L("RPacketService::GetStatus returns incorrect status."));
       
  3390 	
       
  3391 	// Check RPacketContext::NotifyStatusChange completes with EStatusActivating -> EStatusActive
       
  3392 	expectedPacketContextStatus = RPacketContext::EStatusActivating;
       
  3393 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  3394 					packetContext,
       
  3395 					notifyContextStChStatus,
       
  3396 					packetContextStatus, 
       
  3397 					expectedPacketContextStatus,
       
  3398 					KErrNone);
       
  3399 
       
  3400 	packetContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);	
       
  3401 	expectedPacketContextStatus = RPacketContext::EStatusActive;
       
  3402 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  3403 					packetContext,
       
  3404 					notifyContextStChStatus,
       
  3405 					packetContextStatus, 
       
  3406 					expectedPacketContextStatus,
       
  3407 					KErrNone);
       
  3408 					
       
  3409 	// Check RPacketContext::GetStatus returns EStatusActive
       
  3410 	ASSERT_EQUALS(packetContext.GetStatus(packetContextStatus), KErrNone, _L("RPacketContext::GetStatus returned with an error."));
       
  3411 	ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusActive, _L("RPacketContext::GetStatus returns incorrect status."));
       
  3412 	
       
  3413 	// ===  Check dynamic caps ===
       
  3414 
       
  3415 	// Check RPacketService::NotifyDynamicCapsChange completes with caps in set of KCapsRxCSCall | KCapsRxContextActivationReq | KCapsSMSTransfer.
       
  3416 	// Check RPacketService::NotifyDynamicCapsChange completes with caps NOT in set of RPacketService::KCapsManualAttach
       
  3417     wantedDynCapBits = RPacketService::KCapsRxCSCall | RPacketService::KCapsRxContextActivationReq | RPacketService::KCapsSMSTransfer;
       
  3418 	unWantedDynCapBits = RPacketService::KCapsManualAttach;
       
  3419 	iPacketServiceTestHelper.WaitForPacketServiceNotifyDynamicCapsChange( 
       
  3420 				packetService,
       
  3421 				notifyServiceDynCapsStatus,
       
  3422 				dynCaps, 
       
  3423 				wantedDynCapBits,
       
  3424 				unWantedDynCapBits,
       
  3425 				KErrNone);
       
  3426 				
       
  3427 	// Check RPacketService::GetDynamicCaps returns caps in set of KCapsRxCSCall | KCapsRxContextActivationReq | KCapsSMSTransfer
       
  3428 	// Check RPacketService::GetDynamicCaps returns caps NOT in set of RPacketService::KCapsManualAttach
       
  3429 	ASSERT_EQUALS(packetService.GetDynamicCaps(dynCaps), KErrNone, _L("RPacketService::GetDynamicCaps returned with an error"));
       
  3430 	ASSERT_BITS_SET(dynCaps, wantedDynCapBits, unWantedDynCapBits, _L("Packet service's KCapsActivate flag not set"));
       
  3431 	
       
  3432 	////////////////////////////////////////////////////////////////
       
  3433 	// TEST END
       
  3434 	////////////////////////////////////////////////////////////////
       
  3435 
       
  3436     StartCleanup();
       
  3437 	
       
  3438 	// Return packet service's attach mode to original setting
       
  3439 	packetService.SetAttachMode(attachMode);
       
  3440 
       
  3441 	// pop
       
  3442 	// notifyContextStChStatus
       
  3443 	// notifyServiceStChStatus
       
  3444 	// notifyServiceDynCapsStatus
       
  3445 	// contextDeactivateStatus
       
  3446 	// contextActivateStatus
       
  3447 	
       
  3448 	CleanupStack::PopAndDestroy(5, &notifyContextStChStatus);
       
  3449 	
       
  3450 	return TestStepResult();
       
  3451 	}
       
  3452 
       
  3453 TPtrC CCTSYIntegrationTestPacketContext0012::GetTestStepName()
       
  3454 /**
       
  3455  * @return The test step name.
       
  3456  */
       
  3457 	{
       
  3458 	return _L("CCTSYIntegrationTestPacketContext0012");
       
  3459 	}
       
  3460 
       
  3461 
       
  3462 
       
  3463 CCTSYIntegrationTestPacketContext0013::CCTSYIntegrationTestPacketContext0013(CEtelSessionMgr& aEtelSessionMgr)
       
  3464 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
  3465 /**
       
  3466  * Constructor.
       
  3467  */
       
  3468 	{
       
  3469 	SetTestStepName(CCTSYIntegrationTestPacketContext0013::GetTestStepName());
       
  3470 	}
       
  3471 
       
  3472 CCTSYIntegrationTestPacketContext0013::~CCTSYIntegrationTestPacketContext0013()
       
  3473 /**
       
  3474  * Destructor.
       
  3475  */
       
  3476 	{
       
  3477 	}
       
  3478 
       
  3479 TVerdict CCTSYIntegrationTestPacketContext0013::doTestStepL()
       
  3480 /**
       
  3481  * @SYMTestCaseID BA-CTSY-INT-PKTC-0013
       
  3482  * @SYMFssID BA/CTSY/PKTC-0013
       
  3483  * @SYMTestCaseDesc Activate and deactivate two primary contexts.
       
  3484  * @SYMTestPriority High
       
  3485  * @SYMTestActions RPacketContext::SetConfig, RPacketContext::Activate, RPacketContext::GetConfig, RPacketService::NotifyStatusChange, RPacketService::GetStatus, RPacketContext::NotifyStatusChange, RPacketContext::GetStatus, RPacketService::EnumerateContexts, RPacketService::GetContextInfo, RPacketContext::GetDnsInfo, RPacketService::EnumerateContextsInNif, RPacketService::EnumerateNifs, RPacketService::GetNifInfo, RPacketService::GetContextNameInNif, RPacketContext::Deactivate
       
  3486  * @SYMTestExpectedResults Pass - Two contexts can be simultaneously active.
       
  3487  * @SYMTestType CIT
       
  3488  * @SYMTestCaseDependencies live/automatic
       
  3489  *
       
  3490  * Reason for test: Verify it is possible to have two active primary contexts simultaneously.
       
  3491 
       
  3492 Verify context and packet service status, NIF related info, DNS and context config info.
       
  3493  *
       
  3494  * @return - TVerdict code
       
  3495  */
       
  3496 	{
       
  3497 
       
  3498 	////////////////////////////////////////////////////////////////
       
  3499 	// SET UP
       
  3500 	////////////////////////////////////////////////////////////////
       
  3501 
       
  3502 	
       
  3503 	// Attach to the packet service. 
       
  3504 	RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
  3505 	CHECK_EQUALS_L( iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL( phone ), KErrNone, 
       
  3506 			_L("Network is unavailable") );
       
  3507 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, KMainPhone, KMainPacketService);
       
  3508 	SetAttachModeToWhenPossibleAndWaitForAttachL(packetService);
       
  3509 
       
  3510 	// Activate a primary context.
       
  3511 	RPacketContext& packetContext1 = iEtelSessionMgr.GetPrimaryPacketContextL(
       
  3512 			KMainServer,
       
  3513 			KMainPhone,
       
  3514 			KMainPacketService,
       
  3515 			KPrimaryPacketContext1);
       
  3516 	iPacketServiceTestHelper.ActivatePrimaryPacketContextL(phone,packetContext1);
       
  3517 
       
  3518 
       
  3519 	////////////////////////////////////////////////////////////////
       
  3520 	// SET UP END
       
  3521 	////////////////////////////////////////////////////////////////
       
  3522 	
       
  3523 	StartTest();
       
  3524 	
       
  3525 	////////////////////////////////////////////////////////////////
       
  3526 	// TEST START
       
  3527 	////////////////////////////////////////////////////////////////
       
  3528 	
       
  3529 	
       
  3530     // Post notification for the RPacketService::NotifyContextAdded
       
  3531 	TExtEtelRequestStatus notifyContextStatus(packetService, EPacketNotifyContextAdded);
       
  3532 	CleanupStack::PushL(notifyContextStatus);
       
  3533 	TName contextId;
       
  3534 	packetService.NotifyContextAdded(notifyContextStatus, contextId);
       
  3535 	
       
  3536 	// Post notification for service's status change 
       
  3537 	TExtEtelRequestStatus notifyServiceStChStatus(packetService, EPacketNotifyStatusChange);
       
  3538 	CleanupStack::PushL(notifyServiceStChStatus);
       
  3539 	RPacketService::TStatus packetServiceStatus;
       
  3540 	packetService.NotifyStatusChange(notifyServiceStChStatus, packetServiceStatus);
       
  3541 		
       
  3542 	// Open another primary context (referred to in this test as "primary context 2") 
       
  3543    RPacketContext& packetContext2 = iEtelSessionMgr.GetPrimaryPacketContextL(
       
  3544 			KMainServer,
       
  3545 			KMainPhone,
       
  3546 			KMainPacketService,
       
  3547 			KPrimaryPacketContext2);
       
  3548     
       
  3549 	// Set a valid context config for primary context 2 using RPacketContext::SetConfig 
       
  3550    TExtEtelRequestStatus getNetworkStatus(phone, EMobilePhoneGetCurrentNetwork);
       
  3551 	CleanupStack::PushL(getNetworkStatus);
       
  3552 	RMobilePhone::TMobilePhoneNetworkInfoV1 info;
       
  3553 	RMobilePhone::TMobilePhoneNetworkInfoV1Pckg infopckg(info);
       
  3554 	phone.GetCurrentNetwork(getNetworkStatus, infopckg);
       
  3555 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getNetworkStatus, ETimeMedium),
       
  3556 			KErrNone, _L("RMobilePhone::GetCurrentNetwork timed out"));
       
  3557 	ASSERT_EQUALS(getNetworkStatus.Int(),
       
  3558 			KErrNone, _L("RMobilePhone::GetCurrentNetwork returned an error"));
       
  3559 
       
  3560 	RPacketContext::TContextConfigGPRS contextConfig;
       
  3561 	TPtrC apn, user, pwd;
       
  3562 	iPacketServiceTestHelper.GetGprsSettings(info, apn, user, pwd, 2);
       
  3563 	contextConfig.iAccessPointName.Copy(apn);
       
  3564 	contextConfig.iProtocolConfigOption.iAuthInfo.iUsername.Copy(user);
       
  3565 	contextConfig.iProtocolConfigOption.iAuthInfo.iPassword.Copy(pwd);
       
  3566 	TPckg<RPacketContext::TContextConfigGPRS> contextConfigPckg(contextConfig);
       
  3567 	TExtEtelRequestStatus setConfigStatus(packetContext2, EPacketContextSetConfig);	
       
  3568 	CleanupStack::PushL(setConfigStatus);
       
  3569     packetContext2.SetConfig(setConfigStatus, contextConfigPckg);	
       
  3570 	ASSERT_EQUALS(WaitForRequestWithTimeOut(setConfigStatus, ETimeLong), KErrNone, 
       
  3571                   _L("RPacketContext::SetConfig timed out"));
       
  3572 	ASSERT_EQUALS(setConfigStatus.Int(), KErrNone,
       
  3573                   _L("RPacketContext::SetConfig returned with error status."));
       
  3574     
       
  3575 	
       
  3576 	// Check RPacketService::NotifyContextAdded completes with a valid context name
       
  3577 	ASSERT_EQUALS(WaitForRequestWithTimeOut(notifyContextStatus, ETimeMedium), KErrNone,
       
  3578 			_L("RPacketService::NotifyContextAdded did not complete."));
       
  3579 	ASSERT_EQUALS(notifyContextStatus.Int(), KErrNone, 
       
  3580                   _L("RPacketService::NotifyContextAdded returned with error status."));
       
  3581     ASSERT_TRUE(contextId.Length() > 0,
       
  3582                 _L("Packet context config has zero length contextId."));
       
  3583 	
       
  3584 
       
  3585 	// Post notification for service's dynamic caps change
       
  3586     RPacketService::TDynamicCapsFlags dynCaps;
       
  3587 	TExtEtelRequestStatus notifyServiceDynCapsStatus(packetService, EPacketNotifyDynamicCapsChange);
       
  3588 	CleanupStack::PushL(notifyServiceDynCapsStatus);
       
  3589 	packetService.NotifyDynamicCapsChange(notifyServiceDynCapsStatus, dynCaps);
       
  3590 		
       
  3591 	// Post notification for context's status change
       
  3592 	TExtEtelRequestStatus notifyContextStChStatus(packetContext2, EPacketContextNotifyStatusChange);
       
  3593 	CleanupStack::PushL(notifyContextStChStatus);
       
  3594 	RPacketContext::TContextStatus packetContextStatus;
       
  3595 	packetContext2.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);
       
  3596 	
       
  3597 
       
  3598 	// Activate primary context 2 with RPacketContext::Activate
       
  3599 	TExtEtelRequestStatus contextActivateStatus(packetContext2, EPacketContextActivate);
       
  3600 	CleanupStack::PushL(contextActivateStatus);
       
  3601 	packetContext2.Activate(contextActivateStatus);
       
  3602 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(contextActivateStatus, ETimeLong), KErrNone, 
       
  3603 			_L("RPacketContext::Activate timed-out"));
       
  3604 	ASSERT_EQUALS(contextActivateStatus.Int(), KErrNone,
       
  3605 			_L("RPacketContext::Activate returned with error status."));
       
  3606 		
       
  3607 	// ===  Check context and service statuses ===
       
  3608 
       
  3609 	// Check RPacketService::GetStatus returns EStatusActive
       
  3610 	RPacketService::TStatus expectedPacketServiceStatus = RPacketService::EStatusActive;
       
  3611 	iPacketServiceTestHelper.WaitForPacketServiceNotifyStatusChange(
       
  3612         packetService,
       
  3613         notifyServiceStChStatus,
       
  3614         packetServiceStatus, 
       
  3615         expectedPacketServiceStatus,
       
  3616         KErrNone);
       
  3617 	
       
  3618 	// Check RPacketContext::NotifyStatusChange for primary context 2 completes with EStatusActivating -> EStatusActive
       
  3619     RPacketContext::TContextStatus expectedPacketContextStatus = RPacketContext::EStatusActivating;
       
  3620 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  3621 			packetContext2,
       
  3622 			notifyContextStChStatus,
       
  3623 			packetContextStatus, 
       
  3624 			expectedPacketContextStatus,
       
  3625 			KErrNone);
       
  3626     ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusActivating, _L("Packet Context's status expected to be EStatusActivating but is not."));
       
  3627     packetContext2.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);	
       
  3628     expectedPacketContextStatus = RPacketContext::EStatusActive;
       
  3629 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  3630 			packetContext2,
       
  3631 			notifyContextStChStatus,
       
  3632 			packetContextStatus, 
       
  3633 			expectedPacketContextStatus,
       
  3634 			KErrNone);
       
  3635 	
       
  3636 	// Check RPacketContext::GetStatus for primary context 2 returns EStatusActive
       
  3637 	ASSERT_EQUALS(packetContext2.GetStatus(packetContextStatus), KErrNone, _L("RPacketContext::GetStatus returned with an error."));
       
  3638 	ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusActive, _L("RPacketContext::GetStatus returns incorrect status."));
       
  3639 
       
  3640 
       
  3641     
       
  3642 	// ===  Check dynamic caps ===
       
  3643 
       
  3644 	// Check RPacketService::NotifyDynamicCapsChange for primary context 2 completes with caps in set of KCapsRxCSCall | KCapsRxContextActivationReq | KCapsSMSTransfer.
       
  3645 	// Check RPacketService::NotifyDynamicCapsChange for primary context 2 completes with caps NOT in set of RPacketService::KCapsManualAttach
       
  3646     TInt wantedDynCapBits = RPacketService::KCapsRxCSCall | RPacketService::KCapsRxContextActivationReq | RPacketService::KCapsSMSTransfer;
       
  3647 	TInt unWantedDynCapBits = RPacketService::KCapsManualAttach;
       
  3648 	iPacketServiceTestHelper.WaitForPacketServiceNotifyDynamicCapsChange( 
       
  3649 				packetService,
       
  3650 				notifyServiceDynCapsStatus,
       
  3651 				dynCaps, 
       
  3652 				wantedDynCapBits,
       
  3653 				unWantedDynCapBits,
       
  3654 				KErrNone);
       
  3655 	
       
  3656 	// Check RPacketService::GetDynamicCaps for primary context 2 returns caps in set of KCapsRxCSCall | KCapsRxContextActivationReq | KCapsSMSTransfer
       
  3657 	// Check RPacketService::GetDynamicCaps for primary context 2 returns caps NOT in set of RPacketService::KCapsManualAttach
       
  3658 	ASSERT_EQUALS(packetService.GetDynamicCaps(dynCaps), KErrNone, _L("RPacketService::GetDynamicCaps returned with an error"));
       
  3659 	ASSERT_BITS_SET(dynCaps, wantedDynCapBits, unWantedDynCapBits, _L("Packet service's KCapsActivate flag not set"));
       
  3660 	
       
  3661 	// ===  Get context information ===
       
  3662 
       
  3663 	// Check RPacketContext::GetConfig for primary context 2 returns same config as that set
       
  3664 	TExtEtelRequestStatus contextConfigStatus(packetContext2, EPacketContextGetConfig);
       
  3665 	CleanupStack::PushL(contextConfigStatus);
       
  3666 	RPacketContext::TContextConfigGPRS getConfig;
       
  3667 	TPckg<RPacketContext::TContextConfigGPRS> getConfigPk(getConfig);
       
  3668 		packetContext2.GetConfig(contextConfigStatus, getConfigPk);
       
  3669 		ASSERT_EQUALS(WaitForRequestWithTimeOut(contextConfigStatus, ETimeMedium), KErrNone, 
       
  3670 			_L("RPacketContext::GetConfig timed out."));
       
  3671 	ASSERT_EQUALS(contextConfigStatus.Int(), KErrNone,
       
  3672 			_L("RPacketContext::GetConfig returned an error."));
       
  3673     ASSERT_EQUALS_DES8(getConfig.iAccessPointName, contextConfig.iAccessPointName, _L("RPacketContext::GetConfig returns incorrect config data."));
       
  3674 	ASSERT_EQUALS_DES8(getConfig.iProtocolConfigOption.iAuthInfo.iUsername, contextConfig.iProtocolConfigOption.iAuthInfo.iUsername, _L("RPacketContext::GetConfig returns incorrect config data."));
       
  3675 	ASSERT_EQUALS_DES8(getConfig.iProtocolConfigOption.iAuthInfo.iPassword, contextConfig.iProtocolConfigOption.iAuthInfo.iPassword, _L("RPacketContext::GetConfig returns incorrect config data."));
       
  3676 	
       
  3677 	// Check RPacketContext::GetDnsInfo for primary context 2 returns valid primary and secondary DNS ip addresses
       
  3678 	RPacketContext::TDnsInfoV2 dnsInfo;
       
  3679 	RPacketContext::TTDnsInfoV2Pckg dnsInfoPkg(dnsInfo);
       
  3680 	TExtEtelRequestStatus dnsInfoStatus(packetContext2, EPacketContextGetDNSInfo);
       
  3681 	CleanupStack::PushL(dnsInfoStatus);
       
  3682 		packetContext2.GetDnsInfo(dnsInfoStatus, dnsInfoPkg);
       
  3683 	ASSERT_EQUALS(WaitForRequestWithTimeOut(dnsInfoStatus, ETimeMedium), KErrNone, 
       
  3684 			_L("RPacketContext::GetDnsInfo timed out."));
       
  3685 	ASSERT_EQUALS(dnsInfoStatus.Int(), KErrNone,
       
  3686 			_L("RPacketContext::GetDnsInfo returned an error."));
       
  3687     ASSERT_TRUE(dnsInfo.iPrimaryDns.Length() > 0,
       
  3688                 _L("RPacketContext::GetDnsInfo returned with zero length PrimaryDns."));
       
  3689 	ASSERT_TRUE(dnsInfo.iSecondaryDns.Length() > 0,
       
  3690                 _L("RPacketContext::GetDnsInfo returned with zero length SecondaryDns."));
       
  3691 
       
  3692 	// ===  Check that there is one NIF with one primary context belonging to it ===
       
  3693 
       
  3694 	// Check RPacketService::EnumerateContextsInNif with aExistingContextName = name of primary context 2 returns aCount = 1
       
  3695 	TExtEtelRequestStatus enumContextsInfStatus(packetService, EPacketEnumerateContextsInNif);
       
  3696 	CleanupStack::PushL(enumContextsInfStatus);
       
  3697 	TInt count=-1;
       
  3698     packetService.EnumerateContextsInNif(enumContextsInfStatus,contextId,count);
       
  3699 	ASSERT_EQUALS(WaitForRequestWithTimeOut(enumContextsInfStatus, ETimeMedium), KErrNone, 
       
  3700 			_L("RPacketService::EnumerateContextsInNif timed out."));
       
  3701 		ASSERT_EQUALS(enumContextsInfStatus.Int(), KErrNone, 
       
  3702 			_L("RPacketService::EnumerateContextsInNif failed."));
       
  3703 	ASSERT_EQUALS(count,1,_L("RPacketService::EnumerateContextsInNif did not return correct number of NIFs."));
       
  3704 
       
  3705 	// Check RPacketService::GetContextNameInNif with aExistingContextName = name of primary context 2 and aIndex = 0 returns context name which is same as the name of primary context 2
       
  3706 	TBuf<200> contextName;
       
  3707 	TExtEtelRequestStatus getContextNameInNifStatus(packetService, EPacketGetContextNameInNif);
       
  3708 	CleanupStack::PushL(getContextNameInNifStatus);
       
  3709 		packetService.GetContextNameInNif(getContextNameInNifStatus,contextId,0,contextName);
       
  3710 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getContextNameInNifStatus, ETimeMedium), KErrNone, 
       
  3711 			_L("RPacketService::GetContextNameInNif timed out."));
       
  3712 		ASSERT_EQUALS(getContextNameInNifStatus.Int(), KErrNone, 
       
  3713 			_L("RPacketService::GetContextNameInNif failed."));
       
  3714 	ASSERT_EQUALS_DES16(contextName,contextId,_L("RPacketService::GetContextNameInNif did not returned the expected value."));
       
  3715 	
       
  3716 	// Check RPacketService::EnumerateNifs returns aCount = 2
       
  3717 	TExtEtelRequestStatus enumerateNifsStatus(packetService, EPacketEnumerateNifs);
       
  3718 	CleanupStack::PushL(enumerateNifsStatus);
       
  3719 	count=-1;
       
  3720     packetService.EnumerateNifs(enumerateNifsStatus,count);
       
  3721 	ASSERT_EQUALS(WaitForRequestWithTimeOut(enumerateNifsStatus, ETimeMedium), KErrNone, 
       
  3722                   _L("RPacketService::EnumerateNifs timed out."));
       
  3723     ASSERT_EQUALS(enumerateNifsStatus.Int(), KErrNone, 
       
  3724                   _L("RPacketService::EnumerateNifs failed."));
       
  3725 	ASSERT_EQUALS(count,2,_L("RPacketService::EnumerateNifs did not return correct number of NIFs."));
       
  3726 
       
  3727 	// Check RPacketService::GetNifInfo with aCount = 0 returns valid name in iContextName
       
  3728 	TExtEtelRequestStatus getNifInfoStatus(packetService, EPacketGetNifInfo);
       
  3729 	CleanupStack::PushL(getNifInfoStatus);
       
  3730 	RPacketService::TNifInfoV2 nifInfo;
       
  3731 	RPacketService::TNifInfoV2Pckg nifInfoPckg(nifInfo);
       
  3732     packetService.GetNifInfo(getNifInfoStatus,0,nifInfoPckg);
       
  3733     ASSERT_EQUALS(WaitForRequestWithTimeOut(getNifInfoStatus, ETimeMedium), KErrNone, 
       
  3734                   _L("RPacketService::GetNifInfo timed out."));
       
  3735     ASSERT_EQUALS(getNifInfoStatus.Int(), KErrNone, 
       
  3736                   _L("RPacketService::GetNifInfo failed."));
       
  3737 	ASSERT_TRUE(nifInfo.iContextName.Length()>0,_L("RPacketService::GetNifInfo invlaid context name"));
       
  3738 	
       
  3739 	// Check RPacketService::GetNifInfo with aCount = 0 returns iNumberOfContexts = 1
       
  3740 	ASSERT_EQUALS(nifInfo.iNumberOfContexts,1,_L("RPacketService::GetNifInfo wrong number of contexts"));
       
  3741 
       
  3742 	// Check RPacketService::GetNifInfo with aCount = 0 returns iNifStatus = EStatusActive
       
  3743 	ASSERT_EQUALS(nifInfo.iNifStatus,RPacketContext::EStatusActive,_L("RPacketService::GetNifInfo wrong status"));
       
  3744 	
       
  3745 	// Check RPacketService::GetNifInfo with aCount = 0 returns valid address in iPdpAddress
       
  3746 	ASSERT_TRUE(nifInfo.iPdpAddress.Length()>0,_L("RPacketService::GetNifInfo invlaid PDP address"));
       
  3747 	
       
  3748 	// Check RPacketService::GetNifInfo with aCount = 0 returns EInternalContext
       
  3749 	ASSERT_EQUALS(nifInfo.iContextType, RPacketService::EInternalContext,_L("RPacketService::GetNifInfo wrong type"));
       
  3750 	
       
  3751 	// Check RPacketService::GetNifInfo with aCount = 1 returns valid name in iContextName
       
  3752 	packetService.GetNifInfo(getNifInfoStatus,1,nifInfoPckg);
       
  3753 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getNifInfoStatus, ETimeMedium), KErrNone, 
       
  3754 			_L("RPacketService::GetNifInfo timed out."));
       
  3755 	ASSERT_EQUALS(getNifInfoStatus.Int(), KErrNone, 
       
  3756 			_L("RPacketService::GetNifInfo failed."));
       
  3757 	ASSERT_TRUE(nifInfo.iContextName.Length()>0,_L("RPacketService::GetNifInfo invlaid context name"));
       
  3758 
       
  3759 	// Check RPacketService::GetNifInfo with aCount = 1 returns iNumberOfContexts = 1
       
  3760 	ASSERT_EQUALS(nifInfo.iNumberOfContexts,1,_L("RPacketService::GetNifInfo wrong number of contexts"));
       
  3761 
       
  3762 	// Check RPacketService::GetNifInfo with aCount = 1 returns iNifStatus = EStatusActive
       
  3763 	ASSERT_EQUALS(nifInfo.iNifStatus,RPacketContext::EStatusActive,_L("RPacketService::GetNifInfo wrong status"));
       
  3764 
       
  3765 	// Check RPacketService::GetNifInfo with aCount = 1 returns valid address in iPdpAddress
       
  3766 	ASSERT_TRUE(nifInfo.iPdpAddress.Length()>0,_L("RPacketService::GetNifInfo invlaid PDP address"));
       
  3767 
       
  3768 	// Check RPacketService::GetNifInfo with aCount = 1 returns EExternalContext
       
  3769 	ASSERT_EQUALS(nifInfo.iContextType, RPacketService::EInternalContext,_L("RPacketService::GetNifInfo wrong type"));
       
  3770 
       
  3771 	// Post notification for context's status change
       
  3772 	packetContext2.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);	
       
  3773 
       
  3774 	// Deactivate primary context 2 with RPacketContext::Deactivate 
       
  3775 	TExtEtelRequestStatus contextDeactivateStatus(packetContext2, EPacketContextDeactivate);
       
  3776 	CleanupStack::PushL(contextDeactivateStatus);
       
  3777 	packetContext2.Deactivate(contextDeactivateStatus);
       
  3778 	ASSERT_EQUALS(WaitForRequestWithTimeOut(contextDeactivateStatus, ETimeLong), KErrNone, 
       
  3779 					_L("RPacketContext::Deactivate timed out."));					
       
  3780 	ASSERT_EQUALS(contextDeactivateStatus.Int(), KErrNone,
       
  3781 					_L("RPacketContext::Deactivate returned with error status."));
       
  3782 
       
  3783 	// ===  Check context and service statuses ===
       
  3784 
       
  3785 	// Check RPacketContext::NotifyStatusChange for primary context 2 completes with EStatusDeactivating -> EStatusInactive
       
  3786     expectedPacketContextStatus = RPacketContext::EStatusDeactivating;
       
  3787 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  3788 				packetContext2,
       
  3789 				notifyContextStChStatus,
       
  3790 				packetContextStatus, 
       
  3791 				expectedPacketContextStatus,
       
  3792 				KErrNone);
       
  3793     ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusDeactivating, _L("Packet Context's status expected to be EStatusActivating but is not."));
       
  3794     packetContext2.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);	
       
  3795     expectedPacketContextStatus = RPacketContext::EStatusInactive;
       
  3796 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  3797 				packetContext2,
       
  3798 				notifyContextStChStatus,
       
  3799 				packetContextStatus, 
       
  3800 				expectedPacketContextStatus,
       
  3801 				KErrNone);
       
  3802     ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusInactive, _L("Packet Context's status expected to be EStatusActivating but is not."));
       
  3803 
       
  3804 	// Check RPacketContext::GetStatus returns for primary context 2 EStatusInactive
       
  3805 	ASSERT_EQUALS(packetContext2.GetStatus(packetContextStatus), KErrNone, _L("RPacketContext::GetStatus returned with an error."));
       
  3806 	ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusInactive, _L("RPacketContext::GetStatus returns incorrect status."));
       
  3807 
       
  3808 	// Check RPacketService::GetStatus returns EStatusActive
       
  3809 	ASSERT_EQUALS(packetService.GetStatus(packetServiceStatus), KErrNone, _L("RPacketService::GetStatus return error."));
       
  3810 	ASSERT_EQUALS(packetServiceStatus, RPacketService::EStatusActive, _L("RPacketService::GetStatus returns incorrect status."));
       
  3811 
       
  3812 	// Check RPacketService::GetDynamicCaps returns caps in set of RPacketService::KCapsManualAttach | RPacketService::KCapsRxCSCall
       
  3813 	// Check RPacketService::GetDynamicCaps returns caps NOT in set of RPacketService::KCapsSMSTransfer | RPacketService::KCapsManualDetach |  RPacketService::KCapsRxContextActivationReq
       
  3814 	wantedDynCapBits=RPacketService::KCapsManualAttach | RPacketService::KCapsRxCSCall;
       
  3815 	unWantedDynCapBits=RPacketService::KCapsSMSTransfer | RPacketService::KCapsManualDetach |  RPacketService::KCapsRxContextActivationReq;
       
  3816 	ASSERT_EQUALS(packetService.GetDynamicCaps(dynCaps), KErrNone, _L("RPacketService::GetDynamicCaps returned with an error"));
       
  3817 	//ASSERT_BITS_SET(dynCaps, wantedDynCapBits, unWantedDynCapBits, _L("Packet service's KCapsActivate flag not set"));
       
  3818 
       
  3819 	
       
  3820 	////////////////////////////////////////////////////////////////
       
  3821 	// TEST END
       
  3822 	////////////////////////////////////////////////////////////////
       
  3823 
       
  3824     StartCleanup();
       
  3825 	
       
  3826 	// Pop:
       
  3827 	//	contextDeactivateStatus
       
  3828 	//	getNifInfoStatus
       
  3829 	//	enumerateNifsStatus
       
  3830 	//	getContextNameInNifStatus
       
  3831 	//	enumContextsInfStatus
       
  3832 	//	dnsInfoStatus
       
  3833 	//	contextConfigStatus
       
  3834 	//	contextActivateStatus
       
  3835 	//	notifyContextStChStatus
       
  3836 	//	notifyServiceDynCapsStatus
       
  3837 	//	notifyServiceStChStatus
       
  3838 	//	setConfigStatus
       
  3839 	//	getNetworkStatus
       
  3840 	//	notifyContextStatus
       
  3841 	CleanupStack::PopAndDestroy(14,&notifyContextStatus);
       
  3842 	
       
  3843 	return TestStepResult();
       
  3844 	}
       
  3845 
       
  3846 TPtrC CCTSYIntegrationTestPacketContext0013::GetTestStepName()
       
  3847 /**
       
  3848  * @return The test step name.
       
  3849  */
       
  3850 	{
       
  3851 	return _L("CCTSYIntegrationTestPacketContext0013");
       
  3852 	}
       
  3853 
       
  3854 
       
  3855 
       
  3856 CCTSYIntegrationTestPacketContext0014::CCTSYIntegrationTestPacketContext0014(CEtelSessionMgr& aEtelSessionMgr)
       
  3857 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
  3858 /**
       
  3859  * Constructor.
       
  3860  */
       
  3861 	{
       
  3862 	SetTestStepName(CCTSYIntegrationTestPacketContext0014::GetTestStepName());
       
  3863 	}
       
  3864 
       
  3865 CCTSYIntegrationTestPacketContext0014::~CCTSYIntegrationTestPacketContext0014()
       
  3866 /**
       
  3867  * Destructor.
       
  3868  */
       
  3869 	{
       
  3870 	}
       
  3871 
       
  3872 TVerdict CCTSYIntegrationTestPacketContext0014::doTestStepL()
       
  3873 /**
       
  3874  * @SYMTestCaseID BA-CTSY-INT-PKTC-0014
       
  3875  * @SYMFssID BA/CTSY/PKTC-0014
       
  3876  * @SYMTestCaseDesc Deactivate a primary context when there is a secondary context active.
       
  3877  * @SYMTestPriority High
       
  3878  * @SYMTestActions RPacketService::GetStatus, RPacketContext::NotifyStatusChange, RPacketContext::GetStatus, RPacketService::NotifyDynamicCapsChange, RPacketService::GetDynamicCaps, RPacketService::EnumerateNifs, RPacketContext::Deactivate
       
  3879  * @SYMTestExpectedResults Pass - Primary and secondary contexts deactivated.
       
  3880  * @SYMTestType CIT
       
  3881  * @SYMTestCaseDependencies simulated/automatic
       
  3882  *
       
  3883  * Reason for test: Verify secondary is also deactivated.
       
  3884 
       
  3885 Verify packet service status, packet context status, context info, NIF info correct.
       
  3886  *
       
  3887  * @return - TVerdict code
       
  3888  */
       
  3889 	{
       
  3890 
       
  3891 	////////////////////////////////////////////////////////////////
       
  3892 	// SET UP
       
  3893 	////////////////////////////////////////////////////////////////
       
  3894     
       
  3895 	// Call TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL		
       
  3896     RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
  3897 	CHECK_EQUALS_L(iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(phone), KErrNone, _L("TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL returned with an error"));
       
  3898 
       
  3899     //Check if we are on a simulated network
       
  3900     iNetworkTestHelper.CheckPhoneConnectedToAniteL(phone);
       
  3901 
       
  3902     // Get packet service
       
  3903 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, KMainPhone, KMainPacketService);
       
  3904 
       
  3905    	// Set the attach mode to EAttachWhenPossible. 
       
  3906     SetAttachModeToWhenPossibleAndWaitForAttachL(packetService);
       
  3907 	
       
  3908 	// Ensure there is a primary context active and a secondary context active. 	
       
  3909 	RPacketContext& primaryPacketContext = iEtelSessionMgr.GetPrimaryPacketContextL(
       
  3910 											KMainServer,
       
  3911 											KMainPhone,
       
  3912 											KMainPacketService,
       
  3913 											KPrimaryPacketContext1);
       
  3914 
       
  3915     RPacketContext& secondaryPacketContext2 = iEtelSessionMgr.GetSecondaryPacketContextL(
       
  3916 												KMainServer,
       
  3917 												KMainPhone,
       
  3918 												KMainPacketService, 
       
  3919 												KPrimaryPacketContext1,
       
  3920 												KSecondaryPacketContext1);
       
  3921 	// Activate primary context.											
       
  3922 	iPacketServiceTestHelper.ActivatePrimaryPacketContextL(phone,primaryPacketContext);	
       
  3923 	
       
  3924 	// Activate the secondary context.
       
  3925 	ActivateSecondaryPacketContextL(secondaryPacketContext2);
       
  3926 
       
  3927 	////////////////////////////////////////////////////////////////
       
  3928 	// SET UP END
       
  3929 	////////////////////////////////////////////////////////////////
       
  3930 	
       
  3931 	StartTest();
       
  3932 	
       
  3933 	////////////////////////////////////////////////////////////////
       
  3934 	// TEST START
       
  3935 	////////////////////////////////////////////////////////////////
       
  3936 		
       
  3937 	
       
  3938 	
       
  3939 	
       
  3940 	
       
  3941 	// Post notification for primary context status change
       
  3942 	TExtEtelRequestStatus notifyContextStChStatus(primaryPacketContext, EPacketContextNotifyStatusChange);
       
  3943 	CleanupStack::PushL(notifyContextStChStatus);
       
  3944 	RPacketContext::TContextStatus packetContextStatus;
       
  3945 	primaryPacketContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);
       
  3946 	
       
  3947 	// Post notification for secondary context status change
       
  3948 	TExtEtelRequestStatus notifyContext2StChStatus(secondaryPacketContext2, EPacketContextNotifyStatusChange);
       
  3949 	CleanupStack::PushL(notifyContext2StChStatus);
       
  3950 	RPacketContext::TContextStatus packetContextStatus2;
       
  3951 	secondaryPacketContext2.NotifyStatusChange(notifyContextStChStatus, packetContextStatus2);
       
  3952 
       
  3953 	// Post notification for service's status change
       
  3954 	TExtEtelRequestStatus notifyServiceStChStatus(packetService, EPacketNotifyStatusChange);
       
  3955 	CleanupStack::PushL(notifyServiceStChStatus);
       
  3956 	RPacketService::TStatus packetServiceStatus;
       
  3957 	packetService.NotifyStatusChange(notifyServiceStChStatus, packetServiceStatus);
       
  3958 	
       
  3959 	// Post notification for service's dynamic caps change
       
  3960     RPacketService::TDynamicCapsFlags dynCaps;
       
  3961 	TExtEtelRequestStatus notifyServiceDynCapsStatus(packetService, EPacketNotifyDynamicCapsChange);
       
  3962 	CleanupStack::PushL(notifyServiceDynCapsStatus);
       
  3963 	packetService.NotifyDynamicCapsChange(notifyServiceDynCapsStatus, dynCaps);
       
  3964 
       
  3965 	// Deactivate the primary context. 
       
  3966 	TExtEtelRequestStatus contextDeactivateStatus(primaryPacketContext, EPacketContextDeactivate);
       
  3967 	CleanupStack::PushL(contextDeactivateStatus);
       
  3968 	primaryPacketContext.Deactivate(contextDeactivateStatus);
       
  3969 
       
  3970 	ASSERT_EQUALS(WaitForRequestWithTimeOut(contextDeactivateStatus, ETimeLong), KErrNone, 
       
  3971 					_L("RPacketContext::Deactivate timed out."));					
       
  3972 	ASSERT_EQUALS(contextDeactivateStatus.Int(), KErrNone,
       
  3973 					_L("RPacketContext::Deactivate returned with error status."));
       
  3974 
       
  3975 	// ===  Check context and service statuses ===
       
  3976 
       
  3977 	// Check RPacketContext::NotifyStatusChange for primary context completes with EStatusDeactivating -> EStatusInactive
       
  3978 	RPacketContext::TContextStatus expectedPacketContextStatus = RPacketContext::EStatusDeactivating;
       
  3979 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  3980 				primaryPacketContext,
       
  3981 				notifyContextStChStatus,
       
  3982 				packetContextStatus, 
       
  3983 				expectedPacketContextStatus,
       
  3984 				KErrNone);
       
  3985 				
       
  3986 	primaryPacketContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);
       
  3987 	expectedPacketContextStatus = RPacketContext::EStatusInactive;	
       
  3988 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  3989 				primaryPacketContext,
       
  3990 				notifyContextStChStatus,
       
  3991 				packetContextStatus, 
       
  3992 				expectedPacketContextStatus,
       
  3993 				KErrNone);
       
  3994 
       
  3995 	// Check RPacketContext::GetStatus for primary context returns EStatusInactive
       
  3996 	ASSERT_EQUALS(primaryPacketContext.GetStatus(packetContextStatus), KErrNone, _L("RPacketContext::GetStatus for primary context returned with an error."));
       
  3997 	ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusInactive, _L("RPacketContext::GetStatus returns incorrect status."));
       
  3998 
       
  3999 	// Check RPacketContext::NotifyStatusChange for secondary context completes with EStatusDeactivating -> EStatusInactive
       
  4000 	expectedPacketContextStatus = RPacketContext::EStatusDeactivating;
       
  4001 	ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d</font>"), 10061 );
       
  4002    	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  4003 				secondaryPacketContext2,
       
  4004 				notifyContext2StChStatus,
       
  4005 				packetContextStatus2, 
       
  4006 				expectedPacketContextStatus,
       
  4007 				KErrNone);
       
  4008 	ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d</font>"), 10062 );
       
  4009 	// Leaving since the cancellation did not work, so ETEL will panic if another notification will be send
       
  4010 	CHECK_TRUE_L(EFalse, _L("This test has been made to leave intentionally - CTSY doesn't have support for Cancelation of NotifyStatusChange")); 
       
  4011 	secondaryPacketContext2.NotifyStatusChange(notifyContext2StChStatus, packetContextStatus);
       
  4012 	expectedPacketContextStatus = RPacketContext::EStatusInactive;	
       
  4013 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  4014 				secondaryPacketContext2,
       
  4015 				notifyContext2StChStatus,
       
  4016 				packetContextStatus2, 
       
  4017 				expectedPacketContextStatus,
       
  4018 				KErrNone);
       
  4019 
       
  4020 	// Check RPacketContext::GetStatus for secondary context returns EStatusInactive
       
  4021 	ASSERT_EQUALS(secondaryPacketContext2.GetStatus(packetContextStatus), KErrNone, _L("RPacketContext::GetStatus for secondary context returned with an error."));
       
  4022 	ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusInactive, _L("RPacketContext::GetStatus returns incorrect status."));
       
  4023 
       
  4024 	// Check RPacketService::NotifyStatusChange for primary context completes with EStatusAttached
       
  4025 	RPacketService::TStatus expectedPacketStatus = RPacketService::EStatusAttached;
       
  4026 	
       
  4027 	iPacketServiceTestHelper.WaitForPacketServiceNotifyStatusChange( 
       
  4028 				packetService,
       
  4029 				notifyServiceStChStatus,
       
  4030 				packetServiceStatus, 
       
  4031 				expectedPacketStatus,
       
  4032 				KErrNone );
       
  4033 
       
  4034 	// Check RPacketService::GetStatus for primary context returns EStatusAttached	
       
  4035 	
       
  4036 	ASSERT_EQUALS(packetService.GetStatus(packetServiceStatus), KErrNone, _L("RPacketService::GetStatus return error."));
       
  4037 	ASSERT_EQUALS(packetServiceStatus, RPacketService::EStatusAttached, _L("RPacketService::GetStatus returns incorrect status."));
       
  4038 
       
  4039 	// Check RPacketService::NotifyDynamicCapsChange returns caps in set of RPacketService::KCapsSMSTransfer  | RPacketService::KCapsManualDetach | RPacketService::KCapsRxContextActivationReq
       
  4040 	// Check RPacketService::NotifyDynamicCapsChange returns caps NOT in set of RPacketService::KCapsManualAttach | RPacketService::KCapsRxCSCall
       
  4041   	TInt wantedDynCapBits = RPacketService::KCapsSMSTransfer  | RPacketService::KCapsManualDetach | RPacketService::KCapsRxContextActivationReq;
       
  4042 	TInt unWantedDynCapBits = RPacketService::KCapsManualAttach | RPacketService::KCapsRxCSCall;
       
  4043 	
       
  4044 	iPacketServiceTestHelper.WaitForPacketServiceNotifyDynamicCapsChange( 
       
  4045 				packetService,
       
  4046 				notifyServiceDynCapsStatus,
       
  4047 				dynCaps, 
       
  4048 				wantedDynCapBits,
       
  4049 				unWantedDynCapBits,
       
  4050 				KErrNone);
       
  4051 				
       
  4052 	// Check RPacketService::GetDynamicCaps returns caps NOT in set of RPacketService::KCapsManualAttach | RPacketService::KCapsRxCSCall
       
  4053 	// Check RPacketService::GetDynamicCaps returns caps in set of RPacketService::KCapsSMSTransfer | RPacketService::KCapsManualDetach |  RPacketService::KCapsRxContextActivationReq
       
  4054 	ASSERT_EQUALS(packetService.GetDynamicCaps(dynCaps), KErrNone, _L("RPacketService::GetDynamicCaps returned with an error"));
       
  4055 	ASSERT_BITS_SET(dynCaps, wantedDynCapBits, unWantedDynCapBits, _L("RPacketService::GetDynamicCaps did not return correct dynamic caps"));
       
  4056 
       
  4057 	
       
  4058 	// Check RPacketService::EnumerateNifs returns aCount = 0
       
  4059 	TExtEtelRequestStatus enumerateNifsStatus(packetService, EPacketEnumerateNifs);
       
  4060 	CleanupStack::PushL(enumerateNifsStatus);
       
  4061 	TInt nifCount = 0;
       
  4062 	const TInt wantedCount = 0;
       
  4063 	packetService.EnumerateNifs(enumerateNifsStatus, nifCount);
       
  4064 
       
  4065 	ASSERT_EQUALS(WaitForRequestWithTimeOut(enumerateNifsStatus, ETimeLong), KErrNone, _L("RPacketService::EnumerateNifs timed out"));
       
  4066 	ASSERT_EQUALS(nifCount, wantedCount, _L("RPacketService::EnumerateNifs returned wrong NIF count."));
       
  4067 	
       
  4068 	////////////////////////////////////////////////////////////////
       
  4069 	// TEST END
       
  4070 	////////////////////////////////////////////////////////////////
       
  4071 
       
  4072     StartCleanup();
       
  4073 	
       
  4074 	// PopAndDestroy
       
  4075 	// notifyContextStChStatus
       
  4076 	// notifyContext2StChStatus
       
  4077 	// notifyServiceStChStatus
       
  4078 	// notifyServiceDynCapsStatus
       
  4079 	// contextDeactivateStatus
       
  4080 	// enumerateNifsStatus
       
  4081 	CleanupStack::PopAndDestroy(6, &notifyContextStChStatus);
       
  4082 	
       
  4083 	return TestStepResult();
       
  4084 	}
       
  4085 
       
  4086 TPtrC CCTSYIntegrationTestPacketContext0014::GetTestStepName()
       
  4087 /**
       
  4088  * @return The test step name.
       
  4089  */
       
  4090 	{
       
  4091 	return _L("CCTSYIntegrationTestPacketContext0014");
       
  4092 	}
       
  4093 
       
  4094 
       
  4095 
       
  4096 CCTSYIntegrationTestPacketContext0015::CCTSYIntegrationTestPacketContext0015(CEtelSessionMgr& aEtelSessionMgr)
       
  4097 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
  4098 /**
       
  4099  * Constructor.
       
  4100  */
       
  4101 	{
       
  4102 	SetTestStepName(CCTSYIntegrationTestPacketContext0015::GetTestStepName());
       
  4103 	}
       
  4104 
       
  4105 CCTSYIntegrationTestPacketContext0015::~CCTSYIntegrationTestPacketContext0015()
       
  4106 /**
       
  4107  * Destructor.
       
  4108  */
       
  4109 	{
       
  4110 	}
       
  4111 
       
  4112 TVerdict CCTSYIntegrationTestPacketContext0015::doTestStepL()
       
  4113 /**
       
  4114  * @SYMTestCaseID BA-CTSY-INT-PKTC-0015
       
  4115  * @SYMFssID BA/CTSY/PKTC-0015
       
  4116  * @SYMTestCaseDesc Deactivate a secondary context and check that primary context is kept active.
       
  4117  * @SYMTestPriority High
       
  4118  * @SYMTestActions RPacketService::NotifyStatusChange, RPacketService::GetStatus, RPacketContext::NotifyStatusChange, RPacketContext::GetStatus, RPacketService::GetContextInfo, RPacketService::EnumerateContexts
       
  4119  * @SYMTestExpectedResults Pass - First context remains active. Second context is deactivated.
       
  4120  * @SYMTestType CIT
       
  4121  * @SYMTestCaseDependencies simulated/automatic
       
  4122  *
       
  4123  * Reason for test: Verify packet service status, packet context status, context info, NIF info correct.
       
  4124  *
       
  4125  * @return - TVerdict code
       
  4126  */
       
  4127 	{
       
  4128 
       
  4129 	////////////////////////////////////////////////////////////////
       
  4130 	// SET UP
       
  4131 	////////////////////////////////////////////////////////////////
       
  4132 	
       
  4133 	
       
  4134 	// Call TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL	
       
  4135     RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
  4136 	CHECK_EQUALS_L(iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(phone), KErrNone, _L("TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL returned with an error"));
       
  4137 
       
  4138     // Check if we are on a simulated network
       
  4139     iNetworkTestHelper.CheckPhoneConnectedToAniteL(phone);
       
  4140 
       
  4141     // Get packet service
       
  4142 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, KMainPhone, KMainPacketService);
       
  4143 
       
  4144 	// Set the attach mode to EAttachWhenPossible. 
       
  4145     SetAttachModeToWhenPossibleAndWaitForAttachL(packetService);
       
  4146 	
       
  4147 	TExtEtelRequestStatus notifyContextAddedStatus(packetService, EPacketNotifyContextAdded);
       
  4148 	CleanupStack::PushL(notifyContextAddedStatus);
       
  4149 	TName primaryCntxtId;
       
  4150 	
       
  4151 	//post notifier for RPacketService::NotifyContextAdded
       
  4152 	packetService.NotifyContextAdded(notifyContextAddedStatus, primaryCntxtId);
       
  4153 	
       
  4154 	// Ensure there is a primary context active and a secondary context active. 
       
  4155 	RPacketContext& primaryPacketContext = iEtelSessionMgr.GetPrimaryPacketContextL(
       
  4156 											KMainServer,
       
  4157 											KMainPhone,
       
  4158 											KMainPacketService,
       
  4159 											KPrimaryPacketContext1);
       
  4160 
       
  4161 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(notifyContextAddedStatus, ETimeMedium), KErrNone, _L("RPacketService::NotifyContextAdded timed out"));
       
  4162 	CHECK_EQUALS_L(notifyContextAddedStatus.Int(),KErrNone, _L("RPacketService::NotifyContextAdded returned an error"));
       
  4163 	
       
  4164 	TName secondaryCntxtId;
       
  4165 	
       
  4166 	//post notifier for RPacketService::NotifyContextAdded
       
  4167 	packetService.NotifyContextAdded(notifyContextAddedStatus, secondaryCntxtId);
       
  4168     RPacketContext& secondaryPacketContext = iEtelSessionMgr.GetSecondaryPacketContextL(
       
  4169 												KMainServer,
       
  4170 												KMainPhone,
       
  4171 												KMainPacketService, 
       
  4172 												KPrimaryPacketContext1,
       
  4173 												KSecondaryPacketContext1);
       
  4174 												
       
  4175 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(notifyContextAddedStatus, ETimeMedium), KErrNone, _L("RPacketService::NotifyContextAdded timed out"));
       
  4176 	CHECK_EQUALS_L(notifyContextAddedStatus.Int(),KErrNone, _L("RPacketService::NotifyContextAdded returned an error"));
       
  4177 	
       
  4178 	// Activate primary context.
       
  4179 	iPacketServiceTestHelper.ActivatePrimaryPacketContextL(phone,primaryPacketContext);	
       
  4180 	
       
  4181 	// Activate the secondary context.
       
  4182 	ActivateSecondaryPacketContextL(secondaryPacketContext);
       
  4183 	
       
  4184 	
       
  4185 	////////////////////////////////////////////////////////////////
       
  4186 	// SET UP END
       
  4187 	////////////////////////////////////////////////////////////////
       
  4188 	
       
  4189 	StartTest();
       
  4190 	
       
  4191 	////////////////////////////////////////////////////////////////
       
  4192 	// TEST START
       
  4193 	////////////////////////////////////////////////////////////////
       
  4194 
       
  4195 
       
  4196 	// Post notification for secondary context status change
       
  4197 	TExtEtelRequestStatus notifyContextStChStatus(secondaryPacketContext, EPacketContextNotifyStatusChange);
       
  4198 	CleanupStack::PushL(notifyContextStChStatus);
       
  4199 	RPacketContext::TContextStatus secondaryPacketContextStatus;
       
  4200 	secondaryPacketContext.NotifyStatusChange(notifyContextStChStatus, secondaryPacketContextStatus);
       
  4201 	
       
  4202 	// Deactivate the secondary context. 
       
  4203 	TExtEtelRequestStatus contextDeactivateStatus(secondaryPacketContext, EPacketContextDeactivate);
       
  4204 	CleanupStack::PushL(contextDeactivateStatus);
       
  4205 	secondaryPacketContext.Deactivate(contextDeactivateStatus);
       
  4206 
       
  4207 	ASSERT_EQUALS(WaitForRequestWithTimeOut(contextDeactivateStatus, ETimeLong), KErrNone, 
       
  4208 					_L("RPacketContext::Deactivate timed out."));					
       
  4209 	ASSERT_EQUALS(contextDeactivateStatus.Int(), KErrNone,
       
  4210 					_L("RPacketContext::Deactivate returned with error status."));
       
  4211 					
       
  4212 	// ===  Check context and service statuses ===
       
  4213 
       
  4214 	// Check RPacketContext::NotifyStatusChange for secondary context completes with EStatusDeactivating -> EStatusInactive
       
  4215 	RPacketContext::TContextStatus expectedPacketContextStatus = RPacketContext::EStatusDeactivating;
       
  4216    	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  4217 				secondaryPacketContext,
       
  4218 				notifyContextStChStatus,
       
  4219 				secondaryPacketContextStatus, 
       
  4220 				expectedPacketContextStatus,
       
  4221 				KErrNone);
       
  4222 	
       
  4223 	//repost notifier			
       
  4224 	secondaryPacketContext.NotifyStatusChange(contextDeactivateStatus, secondaryPacketContextStatus);
       
  4225 	
       
  4226 	expectedPacketContextStatus = RPacketContext::EStatusInactive;	
       
  4227 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  4228 				secondaryPacketContext,
       
  4229 				notifyContextStChStatus,
       
  4230 				secondaryPacketContextStatus, 
       
  4231 				expectedPacketContextStatus,
       
  4232 				KErrNone);
       
  4233 
       
  4234 	// Check RPacketContext::GetStatus for secondary context returns EStatusInactive
       
  4235 	RPacketContext::TContextStatus getPacketContextStatus;
       
  4236 	CHECK_EQUALS_L(secondaryPacketContext.GetStatus(getPacketContextStatus), KErrNone, _L("RPacketContext::GetStatus returned with an error."));
       
  4237 	CHECK_EQUALS_L(getPacketContextStatus, RPacketContext::EStatusInactive, _L("RPacketContext::GetStatus did not return RPacketContext::EStatusInactive."));
       
  4238 
       
  4239 	// Check RPacketService::GetStatus for primary context returns EStatusActive
       
  4240 	RPacketService::TStatus packetServiceStatus;		
       
  4241 	ASSERT_EQUALS(packetService.GetStatus(packetServiceStatus), KErrNone, _L("RPacketService::GetStatus return error."));
       
  4242 	ASSERT_EQUALS(packetServiceStatus, RPacketService::EStatusActive, _L("RPacketService::GetStatus returns incorrect status."));
       
  4243 
       
  4244 	// Check RPacketService::EnumerateContexts returns aCount = 2
       
  4245 	TExtEtelRequestStatus enumContextsStatus(packetService, EPacketEnumerateContexts);
       
  4246 	CleanupStack::PushL(enumContextsStatus);
       
  4247 	TInt count = 0;
       
  4248     TInt max = 0;
       
  4249     const TInt wantedCount = 2;
       
  4250     packetService.EnumerateContexts(enumContextsStatus, count, max);
       
  4251     
       
  4252 	ASSERT_EQUALS(WaitForRequestWithTimeOut(enumContextsStatus, ETimeMedium), KErrNone, 
       
  4253 			_L("RPacketService::EnumerateContexts timed out."));
       
  4254     ASSERT_EQUALS(enumContextsStatus.Int(), KErrNone, 
       
  4255 			_L("RPacketService::EnumerateContexts returned with an error."));
       
  4256 	ASSERT_EQUALS(count, wantedCount,_L("RPacketService::EnumerateContexts did not return correct number of open contexts."));
       
  4257 
       
  4258 	// Check RPacketService::GetContextInfo for aIndex = 0 and 1 return the correct context name and status for the primary and secondary context.
       
  4259 	TExtEtelRequestStatus getContextsInfoStatus(packetService, EPacketGetContextInfo);
       
  4260 	CleanupStack::PushL(getContextsInfoStatus);
       
  4261 	RPacketService::TContextInfo primaryContextInfo;
       
  4262 	RPacketService::TContextInfo secondaryContextInfo;
       
  4263 	packetService.GetContextInfo(getContextsInfoStatus, 0, primaryContextInfo);
       
  4264 	
       
  4265 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getContextsInfoStatus, ETimeMedium), KErrNone, _L("RPacketService::GetContextInfo timed out."));
       
  4266     ASSERT_EQUALS(getContextsInfoStatus.Int(), KErrNone, _L("RPacketService::GetContextInfo returned with an error."));
       
  4267     
       
  4268 	ASSERT_EQUALS_DES16(primaryContextInfo.iName, primaryCntxtId, _L("RPacketService::GetContextInfo did not return correct iName"));
       
  4269 	ASSERT_EQUALS(primaryContextInfo.iStatus, RPacketContext::EStatusActive, _L("RPacketService::GetContextInfo did not return iStatus EStatusActive"));
       
  4270 	
       
  4271 	packetService.GetContextInfo(getContextsInfoStatus, 1, secondaryContextInfo);
       
  4272 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getContextsInfoStatus, ETimeMedium), KErrNone, _L("RPacketService::GetContextInfo timed out."));
       
  4273     ASSERT_EQUALS(getContextsInfoStatus.Int(), KErrNone, _L("RPacketService::GetContextInfo returned with an error."));
       
  4274     
       
  4275 	ASSERT_EQUALS_DES16(secondaryContextInfo.iName, secondaryCntxtId, _L("RPacketService::GetContextInfo did not return correct iName"));
       
  4276 	ASSERT_EQUALS(secondaryContextInfo.iStatus, RPacketContext::EStatusInactive, _L("RPacketService::GetContextInfo did not return iStatus EStatusInactive"));
       
  4277 
       
  4278 	
       
  4279 	////////////////////////////////////////////////////////////////
       
  4280 	// TEST END
       
  4281 	////////////////////////////////////////////////////////////////
       
  4282 
       
  4283     StartCleanup();
       
  4284 	
       
  4285 	//--PopAndDestroy--
       
  4286 	//notifyContextAddedStatus
       
  4287 	//notifyContextStChStatus
       
  4288 	//contextDeactivateStatus
       
  4289 	//enumContextsStatus
       
  4290 	//getContextsInfoStatus
       
  4291 	CleanupStack::PopAndDestroy(5, &notifyContextAddedStatus);
       
  4292 	
       
  4293 	return TestStepResult();
       
  4294 	}
       
  4295 
       
  4296 TPtrC CCTSYIntegrationTestPacketContext0015::GetTestStepName()
       
  4297 /**
       
  4298  * @return The test step name.
       
  4299  */
       
  4300 	{
       
  4301 	return _L("CCTSYIntegrationTestPacketContext0015");
       
  4302 	}
       
  4303 
       
  4304 
       
  4305 
       
  4306 CCTSYIntegrationTestPacketContext0016::CCTSYIntegrationTestPacketContext0016(CEtelSessionMgr& aEtelSessionMgr)
       
  4307 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
  4308 /**
       
  4309  * Constructor.
       
  4310  */
       
  4311 	{
       
  4312 	SetTestStepName(CCTSYIntegrationTestPacketContext0016::GetTestStepName());
       
  4313 	}
       
  4314 
       
  4315 CCTSYIntegrationTestPacketContext0016::~CCTSYIntegrationTestPacketContext0016()
       
  4316 /**
       
  4317  * Destructor.
       
  4318  */
       
  4319 	{
       
  4320 	}
       
  4321 
       
  4322 TVerdict CCTSYIntegrationTestPacketContext0016::doTestStepL()
       
  4323 /**
       
  4324  * @SYMTestCaseID BA-CTSY-INT-PKTC-0016
       
  4325  * @SYMFssID BA/CTSY/PKTC-0016
       
  4326  * @SYMTestCaseDesc Handle network initiated deactivation.
       
  4327  * @SYMTestPriority High
       
  4328  * @SYMTestActions RPacketContext::GetStatus, RPacketService::NotifyStatusChange, RPacketService::GetStatus, RPacketService::GetContextInfo, RPacketService::EnumerateContexts
       
  4329  * @SYMTestExpectedResults Pass - Context 1 is deactivated. Other context is unaffected.
       
  4330  * @SYMTestType CIT
       
  4331  * @SYMTestCaseDependencies simulated/manual
       
  4332  *
       
  4333  * Reason for test: Verify packet service status, packet context status and context info.
       
  4334  *
       
  4335  * @return - TVerdict code
       
  4336  */
       
  4337 	{
       
  4338 
       
  4339 	////////////////////////////////////////////////////////////////
       
  4340 	// SET UP
       
  4341 	////////////////////////////////////////////////////////////////
       
  4342 
       
  4343 	
       
  4344 	// == Ensure there are two PDP contexts active. ==
       
  4345 	
       
  4346     //Check if we are on a simulated network
       
  4347     RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
  4348 	CHECK_EQUALS_L(iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL( phone ), KErrNone, _L("Network is unavailable"));
       
  4349 	iNetworkTestHelper.CheckPhoneConnectedToAniteL(phone);
       
  4350 
       
  4351     // Ensure phone is attached to the packet service. 
       
  4352 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, KMainPhone, KMainPacketService);
       
  4353     SetAttachModeToWhenPossibleAndWaitForAttachL(packetService);
       
  4354 	
       
  4355 	//post notifier for RPacketService::NotifyContextAdded
       
  4356     TExtEtelRequestStatus notifyContextAddedStatus(packetService, EPacketNotifyContextAdded);
       
  4357 	CleanupStack::PushL(notifyContextAddedStatus);
       
  4358 	TName contextId1;
       
  4359 	packetService.NotifyContextAdded(notifyContextAddedStatus, contextId1);
       
  4360 
       
  4361     // Open primary context 1
       
  4362     RPacketContext& primaryPacketContext1 = iEtelSessionMgr.GetPrimaryPacketContextL(
       
  4363 											KMainServer,
       
  4364 											KMainPhone,
       
  4365 											KMainPacketService,
       
  4366 											KPrimaryPacketContext1);
       
  4367 	
       
  4368 	// Check RPacketService::NotifyContextAdded completes
       
  4369 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(notifyContextAddedStatus, ETimeMedium), KErrNone, _L("RPacketService::NotifyContextAdded timed out"));
       
  4370 	CHECK_EQUALS_L(notifyContextAddedStatus.Int(),KErrNone, _L("RPacketService::NotifyContextAdded returned an error"));
       
  4371 
       
  4372     // Activate primary packet context 1
       
  4373     iPacketServiceTestHelper.ActivatePrimaryPacketContextL(phone, primaryPacketContext1);
       
  4374 	TName contextId2;
       
  4375 	
       
  4376 	//post notifier for RPacketService::NotifyContextAdded
       
  4377 	packetService.NotifyContextAdded(notifyContextAddedStatus, contextId2);
       
  4378 
       
  4379     // Open primary context 2
       
  4380     RPacketContext& primaryPacketContext2 = iEtelSessionMgr.GetPrimaryPacketContextL(
       
  4381 											KMainServer,
       
  4382 											KMainPhone,
       
  4383 											KMainPacketService,
       
  4384 											KPrimaryPacketContext2);
       
  4385 											
       
  4386 	// Check RPacketService::NotifyContextAdded completes
       
  4387 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(notifyContextAddedStatus, ETimeMedium), KErrNone, _L("RPacketService::NotifyContextAdded timed out"));
       
  4388 	CHECK_EQUALS_L(notifyContextAddedStatus.Int(),KErrNone, _L("RPacketService::NotifyContextAdded returned an error"));
       
  4389 
       
  4390     // Activate primary packet context 2
       
  4391     iPacketServiceTestHelper.ActivatePrimaryPacketContextL(phone, primaryPacketContext2,2);
       
  4392 
       
  4393     // Check that both primary contexts are active
       
  4394 	RPacketContext::TContextStatus packetContextStatus;
       
  4395     CHECK_EQUALS_L(primaryPacketContext1.GetStatus(packetContextStatus), KErrNone, _L("RPacketContext::GetStatus returned with an error."));
       
  4396     CHECK_EQUALS_L(packetContextStatus, RPacketContext::EStatusActive, _L("RPacketContext::GetStatus returns incorrect status."));
       
  4397     CHECK_EQUALS_L(primaryPacketContext2.GetStatus(packetContextStatus), KErrNone, _L("RPacketContext::GetStatus returned with an error."));
       
  4398     CHECK_EQUALS_L(packetContextStatus, RPacketContext::EStatusActive, _L("RPacketContext::GetStatus returns incorrect status."));
       
  4399     
       
  4400 
       
  4401 	////////////////////////////////////////////////////////////////
       
  4402 	// SET UP END
       
  4403 	////////////////////////////////////////////////////////////////
       
  4404 	
       
  4405 	StartTest();
       
  4406 	
       
  4407 	////////////////////////////////////////////////////////////////
       
  4408 	// TEST START
       
  4409 	////////////////////////////////////////////////////////////////
       
  4410 	
       
  4411 	// Post notification for the first context's status change
       
  4412 	TExtEtelRequestStatus notifyContextStChStatus(primaryPacketContext1, EPacketContextNotifyStatusChange);
       
  4413 	CleanupStack::PushL(notifyContextStChStatus);
       
  4414 	primaryPacketContext1.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);
       
  4415 	
       
  4416 	// The simulator sends a PDP context deactivation message saying that context 1 has been deactivated.
       
  4417 	DisplayUserInteractionPromptL(_L("Please send me a deactivation of a packet context request."), ETimeMedium);
       
  4418 	
       
  4419 	// ===  Check context and service statuses ===
       
  4420 
       
  4421 	// Check RPacketContext::NotifyStatusChange for context 1 completes with EStatusDeactivating
       
  4422 	ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d</font>"), 10067 );
       
  4423     RPacketContext::TContextStatus expectedPacketContextStatus = RPacketContext::EStatusDeactivating;
       
  4424 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  4425 			primaryPacketContext1,
       
  4426 				notifyContextStChStatus,
       
  4427 				packetContextStatus, 
       
  4428 				expectedPacketContextStatus,
       
  4429 				KErrNone);
       
  4430     ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusDeactivating, _L("RPacketContext::NotifyStatusChange did not return EStatusDeactivating"));
       
  4431 
       
  4432     //                  -> EStatusInactive
       
  4433 	ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d</font>"), 10067 );
       
  4434     primaryPacketContext1.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);
       
  4435     expectedPacketContextStatus = RPacketContext::EStatusInactive;
       
  4436 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  4437 			primaryPacketContext1,
       
  4438 				notifyContextStChStatus,
       
  4439 				packetContextStatus, 
       
  4440 				expectedPacketContextStatus,
       
  4441 				KErrNone);
       
  4442 	ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusInactive, _L("RPacketContext::NotifyStatusChange did not return EStatusInactive"));
       
  4443 
       
  4444 	// Check RPacketContext::GetStatus for context 1 returns EStatusInactive
       
  4445 	ASSERT_EQUALS(primaryPacketContext1.GetStatus(packetContextStatus), KErrNone, _L("RPacketContext::GetStatus returned with an error."));
       
  4446 	ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusInactive, _L("RPacketContext::GetStatus returns incorrect status."));
       
  4447 
       
  4448 	// Check RPacketContext::GetStatus for context 2 returns EStatusActive
       
  4449 	ASSERT_EQUALS(primaryPacketContext2.GetStatus(packetContextStatus), KErrNone, _L("RPacketContext::GetStatus returned with an error."));
       
  4450 	ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusActive, _L("RPacketContext::GetStatus returns incorrect status."));
       
  4451 
       
  4452 	// Check RPacketService::GetStatus returns EStatusActive
       
  4453 	RPacketService::TStatus pckSrvcStatus;
       
  4454 	ASSERT_EQUALS(packetService.GetStatus(pckSrvcStatus), KErrNone, _L("RPacketService::GetStatus return error."));
       
  4455 	ASSERT_EQUALS(pckSrvcStatus, RPacketService::EStatusActive, _L("RPacketService::GetStatus returns incorrect status."));
       
  4456 
       
  4457 	// Check RPacketService::EnumerateContexts returns aCount = 2
       
  4458 	TExtEtelRequestStatus enumContextsStatus(packetService, EPacketEnumerateContexts);
       
  4459 	CleanupStack::PushL(enumContextsStatus);
       
  4460 	TInt count=-1;
       
  4461     TInt max=-1;
       
  4462     packetService.EnumerateContexts(enumContextsStatus,count,max);
       
  4463 	ASSERT_EQUALS(WaitForRequestWithTimeOut(enumContextsStatus, ETimeMedium), KErrNone, 
       
  4464 			_L("RPacketService::EnumerateContexts timed out."));
       
  4465     ASSERT_EQUALS(enumContextsStatus.Int(), KErrNone, 
       
  4466 			_L("RPacketService::EnumerateContexts failed."));
       
  4467 	ASSERT_EQUALS(count,2,_L("RPacketService::EnumerateContexts returned with an error"));
       
  4468 
       
  4469 	// Check RPacketService::GetContextInfo for aIndex = 0 and 1 return the correct context name and status for the two contexts.
       
  4470     RPacketService::TContextInfo contextInfo;
       
  4471 	TExtEtelRequestStatus getContextInfoStatus(packetService, EPacketGetContextInfo);
       
  4472 	CleanupStack::PushL(enumContextsStatus);
       
  4473     packetService.GetContextInfo(getContextInfoStatus,0,contextInfo);
       
  4474 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getContextInfoStatus, ETimeMedium), KErrNone, 
       
  4475 			_L("RPacketService::GetContextInfo timed out."));
       
  4476     ASSERT_EQUALS(getContextInfoStatus.Int(), KErrNone, 
       
  4477 			_L("RPacketService::GetContextInfo returned with an error"));
       
  4478     ASSERT_EQUALS_DES16(contextInfo.iName,contextId1,_L("RPacketService::GetContextInfo return wrong value in iName"));
       
  4479     ASSERT_EQUALS(contextInfo.iStatus,RPacketContext::EStatusInactive,_L("RPacketService::GetContextInfo return wrong value in iStatus"));
       
  4480     packetService.GetContextInfo(getContextInfoStatus,1,contextInfo);
       
  4481 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getContextInfoStatus, ETimeMedium), KErrNone, 
       
  4482 			_L("RPacketService::GetContextInfo timed out."));
       
  4483     ASSERT_EQUALS(getContextInfoStatus.Int(), KErrNone, 
       
  4484 			_L("RPacketService::GetContextInfo returned with an error."));
       
  4485     ASSERT_EQUALS_DES16(contextInfo.iName,contextId2,_L("RPacketService::GetContextInfo return wrong value in iName"));
       
  4486     ASSERT_EQUALS(contextInfo.iStatus,RPacketContext::EStatusActive,_L("RPacketService::GetContextInfo return wrong value in iStatus"));
       
  4487 	
       
  4488 	////////////////////////////////////////////////////////////////
       
  4489 	// TEST END
       
  4490 	////////////////////////////////////////////////////////////////
       
  4491 
       
  4492     StartCleanup();
       
  4493 	
       
  4494 	// Pop:
       
  4495 	//	enumContextsStatus
       
  4496 	//	enumContextsStatus
       
  4497 	//	notifyContextStChStatus
       
  4498 	//	notifyContextAddedStatus
       
  4499 	CleanupStack::PopAndDestroy(4,&notifyContextAddedStatus);
       
  4500 	
       
  4501 	
       
  4502 	return TestStepResult();
       
  4503 	}
       
  4504 
       
  4505 TPtrC CCTSYIntegrationTestPacketContext0016::GetTestStepName()
       
  4506 /**
       
  4507  * @return The test step name.
       
  4508  */
       
  4509 	{
       
  4510 	return _L("CCTSYIntegrationTestPacketContext0016");
       
  4511 	}
       
  4512 
       
  4513 
       
  4514 
       
  4515 CCTSYIntegrationTestPacketContext0017::CCTSYIntegrationTestPacketContext0017(CEtelSessionMgr& aEtelSessionMgr)
       
  4516 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
  4517 /**
       
  4518  * Constructor.
       
  4519  */
       
  4520 	{
       
  4521 	SetTestStepName(CCTSYIntegrationTestPacketContext0017::GetTestStepName());
       
  4522 	}
       
  4523 
       
  4524 CCTSYIntegrationTestPacketContext0017::~CCTSYIntegrationTestPacketContext0017()
       
  4525 /**
       
  4526  * Destructor.
       
  4527  */
       
  4528 	{
       
  4529 	}
       
  4530 
       
  4531 TVerdict CCTSYIntegrationTestPacketContext0017::doTestStepL()
       
  4532 /**
       
  4533  * @SYMTestCaseID BA-CTSY-INT-PKTC-0017
       
  4534  * @SYMFssID BA/CTSY/PKTC-0017
       
  4535  * @SYMTestCaseDesc Deactivate a packet context when it is already inactive.
       
  4536  * @SYMTestPriority High
       
  4537  * @SYMTestActions RPacketContext::GetStatus, RPacketService::GetStatus
       
  4538  * @SYMTestExpectedResults Pass - Error returned on deactivation.
       
  4539  * @SYMTestType CIT
       
  4540  * @SYMTestCaseDependencies live/automatic
       
  4541  *
       
  4542  * Reason for test: Verfiy error is returned and context stays inactive.
       
  4543  *
       
  4544  * @return - TVerdict code
       
  4545  */
       
  4546 	{
       
  4547 
       
  4548 	////////////////////////////////////////////////////////////////
       
  4549 	// SET UP
       
  4550 	////////////////////////////////////////////////////////////////
       
  4551 
       
  4552 	
       
  4553 	// Call TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL		
       
  4554     RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
  4555 	CHECK_EQUALS_L(iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(phone), KErrNone, _L("TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL returned with an error"));
       
  4556 
       
  4557     // Get packet service
       
  4558 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, KMainPhone, KMainPacketService);
       
  4559 
       
  4560     // Get the attach mode so that it can be restored at the end of the test
       
  4561     RPacketService::TAttachMode attachMode;
       
  4562     CHECK_EQUALS_L(packetService.GetAttachMode(attachMode), KErrNone, _L("RPacketService::GetAttachMode returned with an error."));
       
  4563 
       
  4564     // Ensure phone is attached to the packet service
       
  4565     SetAttachModeToWhenPossibleAndWaitForAttachL(packetService);
       
  4566 	
       
  4567 
       
  4568 	////////////////////////////////////////////////////////////////
       
  4569 	// SET UP END
       
  4570 	////////////////////////////////////////////////////////////////
       
  4571 	
       
  4572 	StartTest();
       
  4573 	
       
  4574 	////////////////////////////////////////////////////////////////
       
  4575 	// TEST START
       
  4576 	////////////////////////////////////////////////////////////////
       
  4577 	
       
  4578 	
       
  4579 	// Open a new context.	
       
  4580 	RPacketContext& primaryPacketContext = iEtelSessionMgr.GetPrimaryPacketContextL(
       
  4581 											KMainServer,
       
  4582 											KMainPhone,
       
  4583 											KMainPacketService,
       
  4584 											KPrimaryPacketContext1);
       
  4585 											 
       
  4586 	// Activate primary context.											
       
  4587 	iPacketServiceTestHelper.ActivatePrimaryPacketContextL(phone,primaryPacketContext);	
       
  4588 	
       
  4589 	// Post notification for primary context status change
       
  4590 	TExtEtelRequestStatus notifyContextStChStatus(primaryPacketContext, EPacketContextNotifyStatusChange);
       
  4591 	CleanupStack::PushL(notifyContextStChStatus);
       
  4592 	RPacketContext::TContextStatus packetContextStatus;
       
  4593 	primaryPacketContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);
       
  4594 	
       
  4595 	// Deactivate the primary context. 
       
  4596 	TExtEtelRequestStatus contextDeactivateStatus(primaryPacketContext, EPacketContextDeactivate);
       
  4597 	CleanupStack::PushL(contextDeactivateStatus);
       
  4598 	primaryPacketContext.Deactivate(contextDeactivateStatus);
       
  4599 
       
  4600 	ASSERT_EQUALS(WaitForRequestWithTimeOut(contextDeactivateStatus, ETimeLong), KErrNone, 
       
  4601 					_L("RPacketContext::Deactivate timed out."));					
       
  4602 	ASSERT_EQUALS(contextDeactivateStatus.Int(), KErrNone,
       
  4603 					_L("RPacketContext::Deactivate returned with error status."));
       
  4604 	
       
  4605 	// ===  Check context status===
       
  4606 	RPacketContext::TContextStatus expectedPacketContextStatus = RPacketContext::EStatusInactive;
       
  4607    
       
  4608 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  4609 				primaryPacketContext,
       
  4610 				notifyContextStChStatus,
       
  4611 				packetContextStatus, 
       
  4612 				expectedPacketContextStatus,
       
  4613 				KErrNone);
       
  4614 				
       
  4615 	// Check RPacketContext::GetStatus returns EStatusInactive
       
  4616 	ASSERT_EQUALS(primaryPacketContext.GetStatus(packetContextStatus), KErrNone, _L("RPacketContext::GetStatus for primary context returned with an error."));
       
  4617 	ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusInactive, _L("RPacketContext::GetStatus returns incorrect status."));
       
  4618 
       
  4619 	// Deactivate the context.	
       
  4620  	primaryPacketContext.Deactivate(contextDeactivateStatus);
       
  4621  	ASSERT_EQUALS(WaitForRequestWithTimeOut(contextDeactivateStatus, ETimeLong), KErrNone, 
       
  4622 					_L("RPacketContext::Deactivate timed out."));
       
  4623 					
       
  4624 	ASSERT_EQUALS(contextDeactivateStatus.Int(), KErrNone, _L("RPacketContext::Deactivate returned with error status."));
       
  4625 				
       
  4626 	// Check RPacketContext::GetStatus returns EStatusInactive
       
  4627 	ASSERT_EQUALS(primaryPacketContext.GetStatus(packetContextStatus), KErrNone, _L("RPacketContext::GetStatus for primary context returned with an error."));
       
  4628 	ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusInactive, _L("RPacketContext::GetStatus returns incorrect status."));
       
  4629 
       
  4630 	
       
  4631 	////////////////////////////////////////////////////////////////
       
  4632 	// TEST END
       
  4633 	////////////////////////////////////////////////////////////////
       
  4634 
       
  4635     StartCleanup();
       
  4636 	
       
  4637 	// Pop
       
  4638 	// notifyContextStChStatus
       
  4639 	// contextDeactivateStatus
       
  4640 	CleanupStack::PopAndDestroy(2,&notifyContextStChStatus);
       
  4641 	
       
  4642 	return TestStepResult();
       
  4643 	}
       
  4644 
       
  4645 
       
  4646 TPtrC CCTSYIntegrationTestPacketContext0017::GetTestStepName()
       
  4647 /**
       
  4648  * @return The test step name.
       
  4649  */
       
  4650 	{
       
  4651 	return _L("CCTSYIntegrationTestPacketContext0017");
       
  4652 	}
       
  4653 
       
  4654 
       
  4655 
       
  4656 CCTSYIntegrationTestPacketContext0018::CCTSYIntegrationTestPacketContext0018(CEtelSessionMgr& aEtelSessionMgr)
       
  4657 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
  4658 /**
       
  4659  * Constructor.
       
  4660  */
       
  4661 	{
       
  4662 	SetTestStepName(CCTSYIntegrationTestPacketContext0018::GetTestStepName());
       
  4663 	}
       
  4664 
       
  4665 CCTSYIntegrationTestPacketContext0018::~CCTSYIntegrationTestPacketContext0018()
       
  4666 /**
       
  4667  * Destructor.
       
  4668  */
       
  4669 	{
       
  4670 	}
       
  4671 
       
  4672 TVerdict CCTSYIntegrationTestPacketContext0018::doTestStepL()
       
  4673 /**
       
  4674  * @SYMTestCaseID BA-CTSY-INT-PKTC-0018
       
  4675  * @SYMFssID BA/CTSY/PKTC-0018
       
  4676  * @SYMTestCaseDesc Activate a PDP context with an unknown APN.
       
  4677  * @SYMTestPriority High
       
  4678  * @SYMTestActions RPacketContext::SetConfig, RPacketContext::Activate, RPacketContext::NotifyStatusChange, RPacketContext::GetStatus, RPacketContext::GetLastErrorCause, RPacketService::GetStatus
       
  4679  * @SYMTestExpectedResults Pass - It is not possible to activate a context with an incorrect APN.
       
  4680  * @SYMTestType CIT
       
  4681  * @SYMTestCaseDependencies live/automatic
       
  4682  *
       
  4683  * Reason for test: Verify activation fails and  last error cause returned correctly.
       
  4684  *
       
  4685  * @return - TVerdict code
       
  4686  */
       
  4687 	{
       
  4688 
       
  4689 	////////////////////////////////////////////////////////////////
       
  4690 	// SET UP
       
  4691 	////////////////////////////////////////////////////////////////
       
  4692     RMobilePhone &phone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
  4693 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, KMainPhone, KMainPacketService);
       
  4694 	CHECK_EQUALS_L(iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(phone), KErrNone, _L("TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL returned with an error"));
       
  4695 	
       
  4696 	// Set attach mode to 'when possible'. 
       
  4697 	TExtEtelRequestStatus setAttachModeStatus(packetService, EPacketSetAttachMode);
       
  4698 	CleanupStack::PushL(setAttachModeStatus);
       
  4699 	packetService.SetAttachMode(setAttachModeStatus, RPacketService::EAttachWhenPossible);
       
  4700 				
       
  4701 	// Ensure automatic attach completes successfully.
       
  4702 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(setAttachModeStatus, ETimeLong), KErrNone,
       
  4703 		_L("RPacketService::SetAttachMode timed-out"));
       
  4704 	CHECK_EQUALS_L(setAttachModeStatus.Int(), KErrNone,
       
  4705 		_L("RPacketService::SetAttachMode returned with an error"));
       
  4706 		
       
  4707 	//Ensure RPacketService::GetDynamicCaps returns caps in set of KCapsActivate.
       
  4708 	
       
  4709 	//$CTSYProblem.
       
  4710 	//GetDynamicCaps does not return 0x1(KCapsActivate), because KCapsActivate flag is not set yet. 
       
  4711 	//CTSY sets KCapsActivate flag during context initialisation.
       
  4712 	
       
  4713 	//Check for the CAPS being returned
       
  4714 	RPacketService::TDynamicCapsFlags dynCaps;
       
  4715 	CHECK_EQUALS_L(packetService.GetDynamicCaps(dynCaps), KErrNone, _L("RPacketService::GetDynamicCaps returned with an error"));
       
  4716 	
       
  4717 	//RPacketService::TDynamicCapsFlags wantedDynCapBits = RPacketService::KCapsActivate;	
       
  4718 	//CHECK_BITS_SET_L(dynCaps, wantedDynCapBits, KNoUnwantedBits, _L("Packet service's KCapsActivate flag not set"));
       
  4719 
       
  4720 	
       
  4721 
       
  4722 	////////////////////////////////////////////////////////////////
       
  4723 	// SET UP END
       
  4724 	////////////////////////////////////////////////////////////////
       
  4725 	
       
  4726 	StartTest();
       
  4727 	
       
  4728 	////////////////////////////////////////////////////////////////
       
  4729 	// TEST START
       
  4730 	////////////////////////////////////////////////////////////////
       
  4731 		
       
  4732 	// Open a new primary context. 
       
  4733 	RPacketContext& primaryPacketContext = iEtelSessionMgr.GetPrimaryPacketContextL(
       
  4734 											KMainServer,
       
  4735 											KMainPhone,
       
  4736 											KMainPacketService,
       
  4737 											KPrimaryPacketContext1);
       
  4738 
       
  4739 	// Post notification for context's status change
       
  4740 	TExtEtelRequestStatus notifyContextStChStatus(primaryPacketContext, EPacketContextNotifyStatusChange);
       
  4741 	CleanupStack::PushL(notifyContextStChStatus);
       
  4742 	RPacketContext::TContextStatus packetContextStatus;
       
  4743 	RPacketService::TStatus pckSrvcStatus;
       
  4744 	primaryPacketContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);
       
  4745 
       
  4746 	// Set an incorrect APN when setting the config with RPacketContext::SetConfig
       
  4747 	RMobilePhone::TMobilePhoneNetworkInfoV1 info;
       
  4748 	RPacketContext::TContextConfigGPRS config;
       
  4749 	TPtrC apn, user, pwd;
       
  4750 	iPacketServiceTestHelper.GetGprsSettings(info, apn, user, pwd);
       
  4751 	_LIT(KFaultApnName, "IncorrectAPNname");
       
  4752 	config.iAccessPointName.Copy(KFaultApnName);
       
  4753 	config.iProtocolConfigOption.iAuthInfo.iUsername.Copy(user);
       
  4754 	config.iProtocolConfigOption.iAuthInfo.iPassword.Copy(pwd);	
       
  4755 	TPckg<RPacketContext::TContextConfigGPRS> configPk(config);	
       
  4756 	
       
  4757 	TExtEtelRequestStatus setConfigStatus (primaryPacketContext,EPacketContextSetConfig);	
       
  4758 	CleanupStack::PushL(setConfigStatus); 
       
  4759 	primaryPacketContext.SetConfig(setConfigStatus,configPk);
       
  4760 	
       
  4761 	ASSERT_EQUALS(WaitForRequestWithTimeOut(setConfigStatus, ETimeLong), KErrNone, _L("PacketContext::SetConfig timed out"));								
       
  4762 	ASSERT_EQUALS(setConfigStatus.Int(), KErrNone, _L("PacketContext::SetConfig returned an error."));	
       
  4763 
       
  4764 	// Activate the context 
       
  4765 	TExtEtelRequestStatus contextActivateStatus(primaryPacketContext, EPacketContextActivate);
       
  4766 	CleanupStack::PushL(contextActivateStatus);
       
  4767 	primaryPacketContext.Activate(contextActivateStatus);
       
  4768 		
       
  4769 	ASSERT_EQUALS(WaitForRequestWithTimeOut(contextActivateStatus, ETimeLong), KErrNone, _L("PacketContext::Activate timed out"));
       
  4770 	ASSERT_EQUALS(contextActivateStatus.Int(), KErrNone, _L("PacketContext::Activate did not return KErrNone"))
       
  4771 	
       
  4772 	// Check RPacketContext::NotifyStatusChange completes with EStatusActivating -> EStatusInactive.	
       
  4773 	RPacketContext::TContextStatus expectedPacketContextStatus = RPacketContext::EStatusActivating;
       
  4774 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  4775 				primaryPacketContext,
       
  4776 				notifyContextStChStatus,
       
  4777 				packetContextStatus, 
       
  4778 				expectedPacketContextStatus,
       
  4779 				KErrNone);
       
  4780 
       
  4781     primaryPacketContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);	
       
  4782     expectedPacketContextStatus = RPacketContext::EStatusInactive;
       
  4783 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  4784 				primaryPacketContext,
       
  4785 				notifyContextStChStatus,
       
  4786 				packetContextStatus, 
       
  4787 				expectedPacketContextStatus,
       
  4788 				KErrNone);
       
  4789 
       
  4790 
       
  4791 	// === Check the status of context is EStatusInactive and that a valid error is returned === 
       
  4792 	
       
  4793 	// Check RPacketContext::GetLastErrorCause returns error != KErrNone
       
  4794 	TInt error;
       
  4795 	ASSERT_EQUALS(primaryPacketContext.GetLastErrorCause(error), KErrNone, _L("RPacketContext::GetLastErrorCause returned with an error."));
       
  4796 	ASSERT_TRUE(error != KErrNone, _L("RPacketContext::GetLastErrorCause returns incorrectly KErrNone."));
       
  4797 
       
  4798 	// Check RPacketContext::GetStatus returns EStatusInactive.
       
  4799 	ASSERT_EQUALS(primaryPacketContext.GetStatus(packetContextStatus), KErrNone, _L("RPacketContext::GetStatus returned with an error."));
       
  4800 	ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusInactive, _L("RPacketContext::GetStatus returns incorrect status."));
       
  4801 
       
  4802 	// Check RPacketService::GetStatus returns EStatusAttached.
       
  4803 	ASSERT_EQUALS(packetService.GetStatus(pckSrvcStatus), KErrNone, _L("RPacketService::GetStatus returned with an error."));
       
  4804 	ASSERT_EQUALS(pckSrvcStatus, RPacketService::EStatusAttached, _L("RPacketService::GetStatus returns incorrect status."));
       
  4805 
       
  4806 	
       
  4807 	////////////////////////////////////////////////////////////////
       
  4808 	// TEST END
       
  4809 	////////////////////////////////////////////////////////////////
       
  4810 
       
  4811     StartCleanup();
       
  4812 	
       
  4813 	// setAttachModeStatus
       
  4814 	// notifyContextStChStatus
       
  4815 	// setConfigStatus
       
  4816 	// contextActivateStatus
       
  4817     CleanupStack::PopAndDestroy(4, &setAttachModeStatus);
       
  4818     
       
  4819 	return TestStepResult();
       
  4820 	}
       
  4821 
       
  4822 TPtrC CCTSYIntegrationTestPacketContext0018::GetTestStepName()
       
  4823 /**
       
  4824  * @return The test step name.
       
  4825  */
       
  4826 	{
       
  4827 	return _L("CCTSYIntegrationTestPacketContext0018");
       
  4828 	}
       
  4829 
       
  4830 
       
  4831 
       
  4832 CCTSYIntegrationTestPacketContext0019::CCTSYIntegrationTestPacketContext0019(CEtelSessionMgr& aEtelSessionMgr)
       
  4833 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
  4834 /**
       
  4835  * Constructor.
       
  4836  */
       
  4837 	{
       
  4838 	SetTestStepName(CCTSYIntegrationTestPacketContext0019::GetTestStepName());
       
  4839 	}
       
  4840 
       
  4841 CCTSYIntegrationTestPacketContext0019::~CCTSYIntegrationTestPacketContext0019()
       
  4842 /**
       
  4843  * Destructor.
       
  4844  */
       
  4845 	{
       
  4846 	}
       
  4847 
       
  4848 TVerdict CCTSYIntegrationTestPacketContext0019::doTestStepL()
       
  4849 /**
       
  4850  * @SYMTestCaseID BA-CTSY-INT-PKTC-0019
       
  4851  * @SYMFssID BA/CTSY/PKTC-0019
       
  4852  * @SYMTestCaseDesc Activate a PDP context with an incorrect password.
       
  4853  * @SYMTestPriority High
       
  4854  * @SYMTestActions RPacketContext::SetConfig, RPacketContext::Activate, RPacketContext::NotifyStatusChange, RPacketContext::GetStatus, RPacketContext::GetLastErrorCause, RPacketService::GetStatus
       
  4855  * @SYMTestExpectedResults Pass - Activation fails and error returned.
       
  4856  * @SYMTestType CIT
       
  4857  * @SYMTestCaseDependencies live/automatic
       
  4858  *
       
  4859  * Reason for test: Verify activation fails and  last error cause returned correctly.
       
  4860  *
       
  4861  * @return - TVerdict code
       
  4862  */
       
  4863 	{
       
  4864 
       
  4865 	////////////////////////////////////////////////////////////////
       
  4866 	// SET UP
       
  4867 	////////////////////////////////////////////////////////////////
       
  4868 	
       
  4869 	// Call TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL
       
  4870 	RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
  4871 	CHECK_EQUALS_L(iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(phone), KErrNone,
       
  4872 			_L("TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL returned with an error"));
       
  4873     
       
  4874 	// Get packet service
       
  4875 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, KMainPhone, KMainPacketService);
       
  4876 		
       
  4877 	// Set attach mode to 'when possible'. 
       
  4878 	TExtEtelRequestStatus setAttachModeStatus(packetService, EPacketSetAttachMode);
       
  4879 	CleanupStack::PushL(setAttachModeStatus);
       
  4880 	packetService.SetAttachMode(setAttachModeStatus, RPacketService::EAttachWhenPossible);
       
  4881 				
       
  4882 	// Ensure automatic attach completes successfully.
       
  4883 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(setAttachModeStatus, ETimeLong), KErrNone,
       
  4884 		_L("RPacketService::SetAttachMode timed-out"));
       
  4885 	CHECK_EQUALS_L(setAttachModeStatus.Int(), KErrNone,
       
  4886 		_L("RPacketService::SetAttachMode returned with an error"));
       
  4887 		
       
  4888 	// Ensure phone has KCapsActivate capability. 
       
  4889 
       
  4890 	//Check for the CAPS being returned
       
  4891 	RPacketService::TDynamicCapsFlags dynCaps;
       
  4892 	CHECK_EQUALS_L(packetService.GetDynamicCaps(dynCaps), KErrNone, _L("RPacketService::GetDynamicCaps returned with an error"));
       
  4893 	
       
  4894 	//$CTSYProblem.
       
  4895 	//GetDynamicCaps does not return 0x1(KCapsActivate) as it should, because KCapsActivate flag is not set yet. 
       
  4896 	//CTSY sets KCapsActivate flag during context initialisation.
       
  4897 	RPacketService::TDynamicCapsFlags wantedDynCapBits = 0x00000000;
       
  4898 	CHECK_BITS_SET_L(dynCaps, wantedDynCapBits, KNoUnwantedBits, _L("Packet service's KCapsActivate flag not set"));
       
  4899 
       
  4900 
       
  4901 	////////////////////////////////////////////////////////////////
       
  4902 	// SET UP END
       
  4903 	////////////////////////////////////////////////////////////////
       
  4904 	
       
  4905 	StartTest();
       
  4906 	
       
  4907 	////////////////////////////////////////////////////////////////
       
  4908 	// TEST START
       
  4909 	////////////////////////////////////////////////////////////////
       
  4910 	
       
  4911 	// Open a new primary context. 
       
  4912 	RPacketContext& primaryPacketContext = iEtelSessionMgr.GetPrimaryPacketContextL(
       
  4913 											KMainServer,
       
  4914 											KMainPhone,
       
  4915 											KMainPacketService,
       
  4916 											KPrimaryPacketContext1);
       
  4917 
       
  4918 	// Set an incorrect password when setting the config with RPacketContext::SetConfig
       
  4919 	RPacketContext::TContextConfigGPRS config;
       
  4920 	_LIT(KFaultPwd, "IncorrectPwd");
       
  4921 	config.iProtocolConfigOption.iAuthInfo.iPassword.Copy(KFaultPwd);
       
  4922 	TPckg<RPacketContext::TContextConfigGPRS> configPk(config);
       
  4923 	TExtEtelRequestStatus setConfigStatus(primaryPacketContext, EPacketContextSetConfig);	
       
  4924 	CleanupStack::PushL(setConfigStatus);
       
  4925 	primaryPacketContext.SetConfig(setConfigStatus, configPk);
       
  4926 	ASSERT_EQUALS(WaitForRequestWithTimeOut(setConfigStatus, ETimeLong), KErrNone, 
       
  4927 					_L("RPacketContext::SetConfig timed out"));
       
  4928 	ASSERT_EQUALS(setConfigStatus.Int(), KErrNone,
       
  4929 					_L("RPacketContext::SetConfig returned with error status."));
       
  4930 	
       
  4931 	// Post notification for context's status change
       
  4932 	TExtEtelRequestStatus notifyContextStChStatus(primaryPacketContext, EPacketContextNotifyStatusChange);
       
  4933 	CleanupStack::PushL(notifyContextStChStatus);
       
  4934 	RPacketContext::TContextStatus packetContextStatus;
       
  4935 	RPacketService::TStatus pckSrvcStatus;
       
  4936 	primaryPacketContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);
       
  4937 
       
  4938 	// Activate the context 
       
  4939 	TExtEtelRequestStatus contextActivateStatus(primaryPacketContext, EPacketContextActivate);
       
  4940 	CleanupStack::PushL(contextActivateStatus);
       
  4941 	primaryPacketContext.Activate(contextActivateStatus);
       
  4942 	ASSERT_EQUALS(WaitForRequestWithTimeOut(contextActivateStatus, ETimeLong), KErrNone, _L("PacketContext::Activate timed out"));
       
  4943 	ASSERT_EQUALS(contextActivateStatus.Int(), KErrNone, _L("PacketContext::Activate did not return KErrNone"));
       
  4944 
       
  4945 	// Check RPacketContext::NotifyStatusChange completes wtih EStatusActivating -> EStatusInactive.
       
  4946 	RPacketContext::TContextStatus expectedPacketContextStatus = RPacketContext::EStatusActivating;
       
  4947 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  4948 				primaryPacketContext,
       
  4949 				notifyContextStChStatus,
       
  4950 				packetContextStatus, 
       
  4951 				expectedPacketContextStatus,
       
  4952 				KErrNone);
       
  4953 	
       
  4954 	primaryPacketContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);
       
  4955 	expectedPacketContextStatus = RPacketContext::EStatusInactive;
       
  4956 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  4957 				primaryPacketContext,
       
  4958 				notifyContextStChStatus,
       
  4959 				packetContextStatus, 
       
  4960 				expectedPacketContextStatus,
       
  4961 				KErrNone);
       
  4962 	
       
  4963 	// Check that the activation fails and error is returned. 
       
  4964 	// Check RPacketContext::GetLastErrorCause returns error != KErrNone
       
  4965 	TInt error;
       
  4966 	ASSERT_EQUALS(primaryPacketContext.GetLastErrorCause(error), KErrNone, _L("RPacketContext::GetLastErrorCause returned with an error."));
       
  4967 	ASSERT_TRUE(error != KErrNone, _L("RPacketContext::GetLastErrorCause returns incorrectly KErrNone."));
       
  4968 
       
  4969 	// Check RPacketContext::GetStatus returns EStatusInactive.
       
  4970 	ASSERT_EQUALS(primaryPacketContext.GetStatus(packetContextStatus), KErrNone, _L("RPacketContext::GetStatus returned with an error."));
       
  4971 	ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusInactive, _L("RPacketContext::GetStatus returns incorrect status."));
       
  4972 
       
  4973 	// Check RPacketService::GetStatus returns EStatusAttached.
       
  4974 	ASSERT_EQUALS(packetService.GetStatus(pckSrvcStatus), KErrNone, _L("RPacketService::GetStatus returned with an error."));
       
  4975 	ASSERT_EQUALS(pckSrvcStatus, RPacketService::EStatusAttached, _L("RPacketService::GetStatus returns incorrect status."));
       
  4976 	
       
  4977 	////////////////////////////////////////////////////////////////
       
  4978 	// TEST END
       
  4979 	////////////////////////////////////////////////////////////////
       
  4980 
       
  4981     StartCleanup();
       
  4982 	
       
  4983 	// Pop
       
  4984 	// setAttachModeStatus
       
  4985 	// setConfigStatus
       
  4986 	// notifyContextStChStatus
       
  4987 	// contextActivateStatus
       
  4988     CleanupStack::PopAndDestroy(4, &setAttachModeStatus);
       
  4989     
       
  4990 	return TestStepResult();
       
  4991 	}
       
  4992 
       
  4993 TPtrC CCTSYIntegrationTestPacketContext0019::GetTestStepName()
       
  4994 /**
       
  4995  * @return The test step name.
       
  4996  */
       
  4997 	{
       
  4998 	return _L("CCTSYIntegrationTestPacketContext0019");
       
  4999 	}
       
  5000 
       
  5001 
       
  5002 
       
  5003 CCTSYIntegrationTestPacketContext0020::CCTSYIntegrationTestPacketContext0020(CEtelSessionMgr& aEtelSessionMgr)
       
  5004 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
  5005 /**
       
  5006  * Constructor.
       
  5007  */
       
  5008 	{
       
  5009 	SetTestStepName(CCTSYIntegrationTestPacketContext0020::GetTestStepName());
       
  5010 	}
       
  5011 
       
  5012 CCTSYIntegrationTestPacketContext0020::~CCTSYIntegrationTestPacketContext0020()
       
  5013 /**
       
  5014  * Destructor.
       
  5015  */
       
  5016 	{
       
  5017 	}
       
  5018 
       
  5019 TVerdict CCTSYIntegrationTestPacketContext0020::doTestStepL()
       
  5020 /**
       
  5021  * @SYMTestCaseID BA-CTSY-INT-PKTC-0020
       
  5022  * @SYMFssID BA/CTSY/PKTC-0020
       
  5023  * @SYMTestCaseDesc Activate a context when phone is in class C operation and preferred bearer is RPacketService::EBearerPacketSwitched
       
  5024  * @SYMTestPriority High
       
  5025  * @SYMTestActions RPacketService::GetPreferredBearer, RPacketContext::OpenNewContext, RPacketContext::SetConfig, RPacketContext::Activate, RPacketContext::Deactivate, RPacketContext::NotifyStatusChange, RPacketContext::GetStatus, RPacketService::NotifyStatusChange, RPacketService::GetStatus, RPacketContext::GetStatus, RPacketService::NotifyStatusChange, RPacketService::GetStatus
       
  5026  * @SYMTestExpectedResults Pass - Context activated and deactivated.
       
  5027  * @SYMTestType CIT
       
  5028  * @SYMTestCaseDependencies live/automatic
       
  5029  *
       
  5030  * Reason for test: Verify context status and packet service status.
       
  5031  *
       
  5032  * @return - TVerdict code
       
  5033  */
       
  5034 	{
       
  5035 
       
  5036 	////////////////////////////////////////////////////////////////
       
  5037 	// SET UP
       
  5038 	////////////////////////////////////////////////////////////////
       
  5039 
       
  5040 	
       
  5041 	// Ensure attach mode to RPacketService::EAttachWhenPossible. 
       
  5042 
       
  5043 	// Ensure MS class is class RPacketService::EMSClassAlternateMode. 
       
  5044 
       
  5045 	// Ensure preferred bearer to  
       
  5046 
       
  5047 	// RPacketService::EBearerPacketSwitched 
       
  5048 
       
  5049 
       
  5050 	////////////////////////////////////////////////////////////////
       
  5051 	// SET UP END
       
  5052 	////////////////////////////////////////////////////////////////
       
  5053 	
       
  5054 	StartTest();
       
  5055 	
       
  5056 	////////////////////////////////////////////////////////////////
       
  5057 	// TEST START
       
  5058 	////////////////////////////////////////////////////////////////
       
  5059 	
       
  5060 	
       
  5061 	// Check RPacketService::GetPreferredBearer returns RPacketService::EBearerPacketSwitched
       
  5062 
       
  5063 	// Set a valid context config using RPacketContext::SetConfig 
       
  5064 
       
  5065 	// Activate packet context with RPacketContext::Activate 
       
  5066 
       
  5067 	// ===  Check context and service statuses ===
       
  5068 
       
  5069 	// Check RPacketService::NotifyStatusChange completes with EStatusActive
       
  5070 
       
  5071 	// Check RPacketService::GetStatus returns EStatusActive
       
  5072 
       
  5073 	// Check RPacketContext::NotifyStatusChange completes with EStatusActivating -> EStatusActive
       
  5074 
       
  5075 	// Check RPacketContext::GetStatus returns EStatusActive
       
  5076 
       
  5077 	// Deactivate the context 
       
  5078 
       
  5079 	// ===  Check context and service statuses ===
       
  5080 
       
  5081 	// Check RPacketContext::NotifyStatusChange completes with EStatusDeactivating -> EStatusInactive
       
  5082 
       
  5083 	// Check RPacketContext::GetStatus returns EStatusInactive
       
  5084 
       
  5085 	// Check RPacketService::NotifyStatusChange completes with EStatusAttached
       
  5086 
       
  5087 	// Check RPacketService::GetStatus returns EStatusAttached
       
  5088 
       
  5089 	
       
  5090 	////////////////////////////////////////////////////////////////
       
  5091 	// TEST END
       
  5092 	////////////////////////////////////////////////////////////////
       
  5093 
       
  5094     StartCleanup();
       
  5095 	
       
  5096 	// Put any required test clean up here, then remove this comment
       
  5097 	
       
  5098 	return TestStepResult();
       
  5099 	}
       
  5100 
       
  5101 TPtrC CCTSYIntegrationTestPacketContext0020::GetTestStepName()
       
  5102 /**
       
  5103  * @return The test step name.
       
  5104  */
       
  5105 	{
       
  5106 	return _L("CCTSYIntegrationTestPacketContext0020");
       
  5107 	}
       
  5108 
       
  5109 
       
  5110 
       
  5111 CCTSYIntegrationTestPacketContext0021::CCTSYIntegrationTestPacketContext0021(CEtelSessionMgr& aEtelSessionMgr)
       
  5112 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
  5113 /**
       
  5114  * Constructor.
       
  5115  */
       
  5116 	{
       
  5117 	SetTestStepName(CCTSYIntegrationTestPacketContext0021::GetTestStepName());
       
  5118 	}
       
  5119 
       
  5120 CCTSYIntegrationTestPacketContext0021::~CCTSYIntegrationTestPacketContext0021()
       
  5121 /**
       
  5122  * Destructor.
       
  5123  */
       
  5124 	{
       
  5125 	}
       
  5126 
       
  5127 TVerdict CCTSYIntegrationTestPacketContext0021::doTestStepL()
       
  5128 /**
       
  5129  * @SYMTestCaseID BA-CTSY-INT-PKTC-0021
       
  5130  * @SYMFssID BA/CTSY/PKTC-0021
       
  5131  * @SYMTestCaseDesc Cancel activation before activation is complete.
       
  5132  * @SYMTestPriority High
       
  5133  * @SYMTestActions RPacketContext::SetConfig, RPacketContext::Activate, RPacketContext::NotifyStatusChange, RPacketContext::GetStatus
       
  5134  * @SYMTestExpectedResults Pass - Activation cancelled.
       
  5135  * @SYMTestType CIT
       
  5136  * @SYMTestCaseDependencies live/automatic
       
  5137  *
       
  5138  * Reason for test: Verify context is not activated and activation cancelled successfully.
       
  5139 
       
  5140 Verify subsequent attempt to activate succeeds and therefore roll back from cancelling worked correctly.
       
  5141  *
       
  5142  * @return - TVerdict code
       
  5143  */
       
  5144 	{
       
  5145 
       
  5146 	////////////////////////////////////////////////////////////////
       
  5147 	// SET UP
       
  5148 	////////////////////////////////////////////////////////////////
       
  5149 	
       
  5150     // Call TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL		
       
  5151     RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
  5152 	CHECK_EQUALS_L(iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(phone), KErrNone, _L("TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL returned with an error"));
       
  5153 
       
  5154     // Get packet service
       
  5155 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, KMainPhone, KMainPacketService);
       
  5156 
       
  5157     // Ensure phone is attached to the packet service
       
  5158     SetAttachModeToWhenPossibleAndWaitForAttachL(packetService);
       
  5159 
       
  5160 	////////////////////////////////////////////////////////////////
       
  5161 	// SET UP END
       
  5162 	////////////////////////////////////////////////////////////////
       
  5163 	
       
  5164 	StartTest();
       
  5165 	
       
  5166 	////////////////////////////////////////////////////////////////
       
  5167 	// TEST START
       
  5168 	////////////////////////////////////////////////////////////////
       
  5169 	
       
  5170 	
       
  5171 	// Get network info from phone
       
  5172 	TExtEtelRequestStatus getNetworkStatus(phone, EMobilePhoneGetCurrentNetwork);
       
  5173 	CleanupStack::PushL(getNetworkStatus);
       
  5174 	RMobilePhone::TMobilePhoneNetworkInfoV1 info;
       
  5175 	RMobilePhone::TMobilePhoneNetworkInfoV1Pckg infopckg(info);
       
  5176 	phone.GetCurrentNetwork(getNetworkStatus, infopckg);
       
  5177 	
       
  5178 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getNetworkStatus, ETimeLong), KErrNone, _L("RMobilePhone::GetCurrentNetwork timed out"));
       
  5179 	ASSERT_EQUALS(getNetworkStatus.Int(), KErrNone, _L("RMobilePhone::GetCurrentNetwork returned an error"));
       
  5180 		
       
  5181 	// Get the context config using network info
       
  5182 	RPacketContext::TContextConfigGPRS config;
       
  5183 	TPtrC apn, user, pwd;
       
  5184 	iPacketServiceTestHelper.GetGprsSettings(info, apn, user, pwd);
       
  5185 	config.iAccessPointName.Copy(apn);
       
  5186 	config.iProtocolConfigOption.iAuthInfo.iUsername.Copy(user);
       
  5187 	config.iProtocolConfigOption.iAuthInfo.iPassword.Copy(pwd);
       
  5188 	TPckg<RPacketContext::TContextConfigGPRS> configPk(config);	
       
  5189 	
       
  5190 	// Post notification for the RPacketService::NotifyContextAdded
       
  5191 	TExtEtelRequestStatus notifyContextStatus(packetService, EPacketNotifyContextAdded);
       
  5192 	CleanupStack::PushL(notifyContextStatus);
       
  5193 	TName contextId;
       
  5194 	packetService.NotifyContextAdded(notifyContextStatus, contextId);
       
  5195 	
       
  5196 	// Open a new context	
       
  5197 	RPacketContext& packetContext = iEtelSessionMgr.GetPrimaryPacketContextL(
       
  5198 												KMainServer,
       
  5199 												KMainPhone,
       
  5200 												KMainPacketService,
       
  5201 												KPrimaryPacketContext1);
       
  5202 												
       
  5203 	// Set a valid context config using RPacketContext::SetConfig
       
  5204 	TExtEtelRequestStatus setConfigStatus(packetContext, EPacketContextSetConfig);	
       
  5205 	CleanupStack::PushL(setConfigStatus);
       
  5206 	packetContext.SetConfig(setConfigStatus, configPk);	
       
  5207 	
       
  5208 	ASSERT_EQUALS(WaitForRequestWithTimeOut(setConfigStatus, ETimeLong), KErrNone, _L("RPacketContext::SetConfig timed out"));
       
  5209 	ASSERT_EQUALS(setConfigStatus.Int(), KErrNone, _L("RPacketContext::SetConfig returned with error status."));
       
  5210 
       
  5211 	// Check RPacketService::NotifyContextAdded completes with a valid context name
       
  5212 	ASSERT_EQUALS(WaitForRequestWithTimeOut(notifyContextStatus, ETimeMedium), KErrNone, _L("RPacketService::NotifyContextAdded did not complete."));
       
  5213 	ASSERT_EQUALS(notifyContextStatus.Int(), KErrNone,	_L("RPacketService::NotifyContextAdded returned with error status."));
       
  5214 	ASSERT_TRUE(contextId.Length() > 0, _L("RPacketService::NotifyContextAdded completed with invalid context name."));
       
  5215 		
       
  5216 	// Post notification for service's status change
       
  5217 	TExtEtelRequestStatus notifyServiceStChStatus(packetService, EPacketNotifyStatusChange);
       
  5218 	CleanupStack::PushL(notifyServiceStChStatus);
       
  5219 	RPacketService::TStatus packetServiceStatus;
       
  5220 	packetService.NotifyStatusChange(notifyServiceStChStatus, packetServiceStatus);
       
  5221 
       
  5222 	// Activate a context (don't wait for completion) 		
       
  5223 	TExtEtelRequestStatus contextActivateStatus(packetContext, EPacketContextActivate);
       
  5224 	CleanupStack::PushL(contextActivateStatus);
       
  5225 	packetContext.Activate(contextActivateStatus);
       
  5226 	ASSERT_EQUALS(WaitForRequestWithTimeOut(contextActivateStatus, ETimeLong), KErrNone, _L("RPacketContext::Activate timed out."));
       
  5227 	ASSERT_EQUALS(contextActivateStatus.Int(), KErrNone, _L("RPacketContext::Activate returned with error status."));
       
  5228 					
       
  5229 	// Cancel activate with RTelSubSessionBase::CancelAsyncRequest(EPacketContextActivate)
       
  5230 	ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d</font>"), 50003 );
       
  5231 	// When packet context is requested to be activated, there is nothing CTSY can do to cancel activation,
       
  5232 	// because activation has already been sent to the network.
       
  5233 	// CancelAsyncRequest(EPacketContextActivate) returns faulty with KErrNone instead of KErrNotSupported.
       
  5234 	packetContext.CancelAsyncRequest(EPacketContextActivate);
       
  5235 
       
  5236 	// Check RTelSubSessionBase::CancelAsyncRequest(EPacketContextActivate) returns with KErrNotSupported
       
  5237 	TInt error;
       
  5238 	ASSERT_EQUALS(packetContext.GetLastErrorCause(error), KErrNone, _L("RPacketContext::GetLastErrorCause returned with an error."));
       
  5239 	ASSERT_EQUALS(error, KErrNotSupported, _L("RPacketContext::GetLastErrorCause does not return KErrNotSupported."));
       
  5240 
       
  5241     // Check RPacketService::NotifyStatusChange completes with EStatusActivating -> EStatusActive 	
       
  5242 	RPacketService::TStatus expectedPacketServiceStatus = RPacketService::EStatusActive;
       
  5243 	iPacketServiceTestHelper.WaitForPacketServiceNotifyStatusChange(
       
  5244 				packetService,
       
  5245 				notifyServiceStChStatus,
       
  5246 				packetServiceStatus, 
       
  5247 				expectedPacketServiceStatus,
       
  5248 				KErrNone);
       
  5249 					
       
  5250 	// Check RPacketService::GetStatus returns EStatusActive
       
  5251     RPacketService::TStatus pckSrvcStatus;
       
  5252 	ASSERT_EQUALS(packetService.GetStatus(pckSrvcStatus), KErrNone, _L("RPacketService::GetStatus returned with an error."));
       
  5253 	ASSERT_EQUALS(pckSrvcStatus, RPacketService::EStatusActive, _L("RPacketService::GetStatus returns incorrect status."));
       
  5254 
       
  5255 
       
  5256 	////////////////////////////////////////////////////////////////
       
  5257 	// TEST END
       
  5258 	////////////////////////////////////////////////////////////////
       
  5259     
       
  5260     StartCleanup();
       
  5261     
       
  5262     // pop
       
  5263 	// getNetworkStatus
       
  5264 	// notifyContextStatus
       
  5265 	// setConfigStatus
       
  5266 	// notifyServicetStChStatus
       
  5267 	// contextActivateStatus
       
  5268 	CleanupStack::PopAndDestroy(5, &getNetworkStatus);
       
  5269 	
       
  5270 	return TestStepResult();
       
  5271 	}
       
  5272 
       
  5273 TPtrC CCTSYIntegrationTestPacketContext0021::GetTestStepName()
       
  5274 /**
       
  5275  * @return The test step name.
       
  5276  */
       
  5277 	{
       
  5278 	return _L("CCTSYIntegrationTestPacketContext0021");
       
  5279 	}
       
  5280 
       
  5281 
       
  5282 
       
  5283 CCTSYIntegrationTestPacketContext0022::CCTSYIntegrationTestPacketContext0022(CEtelSessionMgr& aEtelSessionMgr)
       
  5284 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
  5285 /**
       
  5286  * Constructor.
       
  5287  */
       
  5288 	{
       
  5289 	SetTestStepName(CCTSYIntegrationTestPacketContext0022::GetTestStepName());
       
  5290 	}
       
  5291 
       
  5292 CCTSYIntegrationTestPacketContext0022::~CCTSYIntegrationTestPacketContext0022()
       
  5293 /**
       
  5294  * Destructor.
       
  5295  */
       
  5296 	{
       
  5297 	}
       
  5298 
       
  5299 TVerdict CCTSYIntegrationTestPacketContext0022::doTestStepL()
       
  5300 /**
       
  5301  * @SYMTestCaseID BA-CTSY-INT-PKTC-0022
       
  5302  * @SYMFssID BA/CTSY/PKTC-0022
       
  5303  * @SYMTestCaseDesc Activate context when request received from network.
       
  5304  * @SYMTestPriority High
       
  5305  * @SYMTestActions RPacketContext::SetConfig, RPacketService::NotifyContextAdded, RPacketService::EnumerateContexts, RPacketContext::Activate, RPacketService::NotifyStatusChange, RPacketService::GetStatus, RPacketService::NotifyDynamicCapsChange, RPacketService::GetDynamicCaps
       
  5306  * @SYMTestExpectedResults Pass - Context activated on request from network.
       
  5307  * @SYMTestType CIT
       
  5308  * @SYMTestCaseDependencies simulated/manual
       
  5309  *
       
  5310  * Reason for test: Verify context parameters in TPacketDataConfigBase derived class received correctly.
       
  5311 
       
  5312 Verify context added notification produced, number of contexts, dynamic caps, packet service status are all correct.
       
  5313  *
       
  5314  * @return - TVerdict code
       
  5315  */
       
  5316 	{
       
  5317 
       
  5318 	////////////////////////////////////////////////////////////////
       
  5319 	// SET UP
       
  5320 	////////////////////////////////////////////////////////////////
       
  5321 
       
  5322 	
       
  5323 	// Ensure phone is attached to the packet service. 
       
  5324     RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
  5325 	CHECK_EQUALS_L(iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(phone), KErrNone, _L("TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL returned with an error"));
       
  5326  	iNetworkTestHelper.CheckPhoneConnectedToAniteL(phone);
       
  5327 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, KMainPhone, KMainPacketService);
       
  5328     SetAttachModeToWhenPossibleAndWaitForAttachL(packetService);
       
  5329 
       
  5330 	// Ensure RPacketService::GetDynamicCaps returns caps in set of KCapsRxContextActivationReq 
       
  5331     RPacketService::TDynamicCapsFlags dynCaps;
       
  5332     RPacketService::TDynamicCapsFlags wantedDynCapBits = RPacketService::KCapsRxContextActivationReq;
       
  5333 	CHECK_EQUALS_L(packetService.GetDynamicCaps(dynCaps), KErrNone, _L("RPacketService::GetDynamicCaps returned with an error"));
       
  5334 	CHECK_BITS_SET_L(dynCaps, wantedDynCapBits , KNoUnwantedBits, _L("RPacketService::GetDynamicCaps KCapsRxContextActivationReq flag not set"));
       
  5335 
       
  5336 
       
  5337 	////////////////////////////////////////////////////////////////
       
  5338 	// SET UP END
       
  5339 	////////////////////////////////////////////////////////////////
       
  5340 	
       
  5341 	StartTest();
       
  5342 	
       
  5343 	////////////////////////////////////////////////////////////////
       
  5344 	// TEST START
       
  5345 	////////////////////////////////////////////////////////////////
       
  5346 
       
  5347     // Post notifications for the RPacketService::NotifyContextActivationRequested
       
  5348     TExtEtelRequestStatus notifyContextActivationRequestedStatus(packetService, EPacketNotifyContextActivationRequested);
       
  5349     CleanupStack::PushL(notifyContextActivationRequestedStatus);
       
  5350 	RPacketContext::TContextConfigGPRS requestedConfig;
       
  5351 	TPckg<RPacketContext::TContextConfigGPRS> requestedConfigPckg(requestedConfig);
       
  5352     packetService.NotifyContextActivationRequested(notifyContextActivationRequestedStatus,requestedConfigPckg);
       
  5353 
       
  5354 	// Post notification for the RPacketService::NotifyContextAdded
       
  5355 	TExtEtelRequestStatus notifyContextStatus(packetService, EPacketNotifyContextAdded);
       
  5356 	CleanupStack::PushL(notifyContextStatus);
       
  5357 	TName contextId;
       
  5358 	packetService.NotifyContextAdded(notifyContextStatus, contextId);
       
  5359 
       
  5360 	// Post notification for service's status change
       
  5361 	TExtEtelRequestStatus notifyServiceStChStatus(packetService, EPacketNotifyStatusChange);
       
  5362 	CleanupStack::PushL(notifyServiceStChStatus);
       
  5363 	RPacketService::TStatus packetServiceStatus;
       
  5364 	packetService.NotifyStatusChange(notifyServiceStChStatus, packetServiceStatus);
       
  5365 
       
  5366 	// Post notification for service's dynamic caps change
       
  5367 	TExtEtelRequestStatus notifyServiceDynCapsStatus(packetService, EPacketNotifyDynamicCapsChange);
       
  5368 	CleanupStack::PushL(notifyServiceDynCapsStatus);
       
  5369 	packetService.NotifyDynamicCapsChange(notifyServiceDynCapsStatus, dynCaps);
       
  5370     
       
  5371 	// Get network info from phone
       
  5372 	TExtEtelRequestStatus getNetworkStatus(phone, EMobilePhoneGetCurrentNetwork);
       
  5373 	CleanupStack::PushL(getNetworkStatus);
       
  5374 	RMobilePhone::TMobilePhoneNetworkInfoV1 info;
       
  5375 	RMobilePhone::TMobilePhoneNetworkInfoV1Pckg infopckg(info);
       
  5376 	phone.GetCurrentNetwork(getNetworkStatus, infopckg);
       
  5377 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getNetworkStatus, ETimeLong),
       
  5378 				  						    KErrNone, _L("RMobilePhone::GetCurrentNetwork timed out"));
       
  5379 	ASSERT_EQUALS(getNetworkStatus.Int(),
       
  5380 				  KErrNone, _L("RMobilePhone::GetCurrentNetwork returned an error"));
       
  5381 
       
  5382 	// Simulator sends a context activation request to the phone.
       
  5383 	RPacketContext::TContextConfigGPRS config;
       
  5384 	TPtrC apn, user, pwd;
       
  5385 	iPacketServiceTestHelper.GetGprsSettings(info, apn, user, pwd);
       
  5386 	config.iAccessPointName.Copy(apn);
       
  5387 	config.iProtocolConfigOption.iAuthInfo.iUsername.Copy(user);
       
  5388 	config.iProtocolConfigOption.iAuthInfo.iPassword.Copy(pwd);
       
  5389     DisplayUserInteractionPromptL(_L("Please send me a context activation request."), ETimeLong);
       
  5390 	 
       
  5391 	 
       
  5392 	// $CTSYProblem The LTSY does nothing with the context activation request.
       
  5393 	ERR_PRINTF1(_L("<font color=Cyan>$CTSYProblem: The LTSY does nothing with the context activation request.<font color=Black>"));    
       
  5394 	// Check RPacketService::NotifyContextActivationRequested completes.
       
  5395 	ASSERT_EQUALS(WaitForRequestWithTimeOut(notifyContextActivationRequestedStatus, ETimeLong), KErrNone,
       
  5396 				  _L("RPacketService::NotifyContextActivationRequested did not complete."));
       
  5397     ASSERT_EQUALS(notifyContextActivationRequestedStatus.Int(), KErrNone, 
       
  5398     			_L("RPacketService::NotifyContextActivationRequested returned with error status."));
       
  5399 
       
  5400 	// Open a primary context. 
       
  5401 	RPacketContext& packetContext = iEtelSessionMgr.GetPrimaryPacketContextL(
       
  5402 			KMainServer,
       
  5403 			KMainPhone,
       
  5404 			KMainPacketService,
       
  5405 			KPrimaryPacketContext1);
       
  5406     
       
  5407 	// Post notification for context's status change
       
  5408 	TExtEtelRequestStatus notifyContextStChStatus(packetContext, EPacketContextNotifyStatusChange);
       
  5409 	CleanupStack::PushL(notifyContextStChStatus);
       
  5410 	RPacketContext::TContextStatus packetContextStatus;
       
  5411 	packetContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);
       
  5412 
       
  5413 	// Extract the context parameters received and check they are the same as that sent by the simulator.
       
  5414 	ASSERT_EQUALS_DES8(requestedConfig.iAccessPointName, config.iAccessPointName, _L("RPacketService::NotifyContextActivationRequested gave incorrect config data."));
       
  5415 	ASSERT_EQUALS_DES8(requestedConfig.iProtocolConfigOption.iAuthInfo.iUsername, config.iProtocolConfigOption.iAuthInfo.iUsername, _L("RPacketService::NotifyContextActivationRequested gave incorrect config data."));
       
  5416 	ASSERT_EQUALS_DES8(requestedConfig.iProtocolConfigOption.iAuthInfo.iPassword, config.iProtocolConfigOption.iAuthInfo.iPassword, _L("RPacketService::NotifyContextActivationRequested gave incorrect config data."));
       
  5417 
       
  5418 	// Use them to set a context config with RPacketContext::SetConfig 
       
  5419 	TPckg<RPacketContext::TContextConfigGPRS> configPckg(requestedConfig);
       
  5420 	TExtEtelRequestStatus setConfigStatus(packetContext, EPacketContextSetConfig);	
       
  5421 	CleanupStack::PushL(setConfigStatus);
       
  5422 	packetContext.SetConfig(setConfigStatus, configPckg);
       
  5423 	ASSERT_EQUALS(WaitForRequestWithTimeOut(setConfigStatus, ETimeLong), KErrNone, 
       
  5424 					_L("RPacketContext::SetConfig timed out"));
       
  5425 	ASSERT_EQUALS(setConfigStatus.Int(), KErrNone,
       
  5426 					_L("RPacketContext::SetConfig returned with error status."));
       
  5427 
       
  5428 	// Check RPacketService::NotifyContextAdded completes with a valid context name
       
  5429 	ASSERT_EQUALS(WaitForRequestWithTimeOut(notifyContextStatus, ETimeMedium), KErrNone,
       
  5430 				  _L("RPacketService::NotifyContextAdded did not complete."));
       
  5431     ASSERT_EQUALS(notifyContextStatus.Int(), KErrNone, 
       
  5432     			_L("RPacketService::NotifyContextAdded returned with error status."));
       
  5433     ASSERT_TRUE(contextId.Length() > 0,
       
  5434     			_L("Packet context config has zero length contextId."));
       
  5435 
       
  5436 	// Activate packet context with RPacketContext::Activate 
       
  5437 	TExtEtelRequestStatus contextActivateStatus(packetContext, EPacketContextActivate);
       
  5438 	CleanupStack::PushL(contextActivateStatus);
       
  5439 	packetContext.Activate(contextActivateStatus);
       
  5440 	ASSERT_EQUALS(WaitForRequestWithTimeOut(contextActivateStatus, ETimeLong), KErrNone, 
       
  5441 					_L("RPacketContext::Activate timed out."));
       
  5442 	ASSERT_EQUALS(contextActivateStatus.Int(), KErrNone,
       
  5443 					_L("RPacketContext::Activate returned with error status."));
       
  5444 
       
  5445 	// ===  Check context and service statuses ===
       
  5446 
       
  5447 	// Check RPacketService::NotifyStatusChange completes with EStatusActive
       
  5448 	RPacketService::TStatus expectedPacketServiceStatus = RPacketService::EStatusActive;
       
  5449 	iPacketServiceTestHelper.WaitForPacketServiceNotifyStatusChange(
       
  5450 				packetService,
       
  5451 				notifyServiceStChStatus,
       
  5452 				packetServiceStatus, 
       
  5453 				expectedPacketServiceStatus,
       
  5454 				KErrNone);
       
  5455 
       
  5456 	// Check RPacketService::GetStatus returns EStatusActive
       
  5457 	RPacketService::TStatus pckSrvcStatus;
       
  5458 	ASSERT_EQUALS(packetService.GetStatus(pckSrvcStatus), KErrNone, _L("RPacketService::GetStatus returned with an error."));
       
  5459 	ASSERT_EQUALS(pckSrvcStatus, RPacketService::EStatusActive, _L("RPacketService::GetStatus returns incorrect status."));
       
  5460 
       
  5461 	// Check RPacketContext::NotifyStatusChange completes with EStatusActivating -> EStatusActive
       
  5462     RPacketContext::TContextStatus expectedPacketContextStatus = RPacketContext::EStatusActivating;
       
  5463 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  5464 				packetContext,
       
  5465 				notifyContextStChStatus,
       
  5466 				packetContextStatus, 
       
  5467 				expectedPacketContextStatus,
       
  5468 				KErrNone);
       
  5469     ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusActivating, _L("Packet Context's status expected to be EStatusActivating but is not."));
       
  5470     
       
  5471     //   -> EStatusActive
       
  5472 	packetContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);
       
  5473     expectedPacketContextStatus = RPacketContext::EStatusActive;
       
  5474 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  5475 			packetContext,
       
  5476 			notifyContextStChStatus,
       
  5477 			packetContextStatus, 
       
  5478 			expectedPacketContextStatus,
       
  5479 			KErrNone);
       
  5480 	
       
  5481 	// Check RPacketContext::GetStatus returns EStatusActive
       
  5482 	ASSERT_EQUALS(packetContext.GetStatus(packetContextStatus), KErrNone, _L("RPacketContext::GetStatus returned with an error."));
       
  5483 	ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusActive, _L("RPacketContext::GetStatus returns incorrect status."));
       
  5484 
       
  5485 	// ===  Check dynamic caps ===
       
  5486 
       
  5487 	// Check RPacketService::NotifyDynamicCapsChange completes with caps in set of KCapsRxCSCall | KCapsRxContextActivationReq | KCapsSMSTransfer.
       
  5488 	// Check RPacketService::NotifyDynamicCapsChange completes with caps NOT in set of RPacketService::KCapsManualAttach
       
  5489     wantedDynCapBits = RPacketService::KCapsRxCSCall | RPacketService::KCapsRxContextActivationReq | RPacketService::KCapsSMSTransfer;
       
  5490 	TInt unWantedDynCapBits = RPacketService::KCapsManualAttach;
       
  5491 	iPacketServiceTestHelper.WaitForPacketServiceNotifyDynamicCapsChange( 
       
  5492 				packetService,
       
  5493 				notifyServiceDynCapsStatus,
       
  5494 				dynCaps, 
       
  5495 				wantedDynCapBits,
       
  5496 				unWantedDynCapBits,
       
  5497 				KErrNone);
       
  5498 
       
  5499 	// Check RPacketService::GetDynamicCaps returns caps in set of KCapsRxCSCall | KCapsRxContextActivationReq | KCapsSMSTransfer
       
  5500 	// Check RPacketService::GetDynamicCaps returns caps NOT in set of RPacketService::KCapsManualAttach
       
  5501 	ASSERT_EQUALS(packetService.GetDynamicCaps(dynCaps), KErrNone, _L("RPacketService::GetDynamicCaps returned with an error"));
       
  5502 	ASSERT_BITS_SET(dynCaps, wantedDynCapBits, unWantedDynCapBits, _L("RPacketService::GetDynamicCaps Packet service's KCapsActivate flag not set"));
       
  5503 
       
  5504 	// Check RPacketService::EnumerateContexts returns 1.
       
  5505 	TExtEtelRequestStatus enumContextsStatus(packetService, EPacketEnumerateContexts);
       
  5506 	CleanupStack::PushL(enumContextsStatus);
       
  5507 	TInt count=-1;
       
  5508     TInt max=-1;
       
  5509     packetService.EnumerateContexts(enumContextsStatus,count,max);
       
  5510 	ASSERT_EQUALS(WaitForRequestWithTimeOut(enumContextsStatus, ETimeMedium), KErrNone, 
       
  5511 			_L("RPacketService::EnumerateContexts timed out."));
       
  5512     ASSERT_EQUALS(enumContextsStatus.Int(), KErrNone, 
       
  5513 			_L("RPacketService::EnumerateContexts failed."));
       
  5514 	ASSERT_EQUALS(count,1,_L("RPacketService::EnumerateContexts did not returned one."));
       
  5515 
       
  5516 	
       
  5517 	////////////////////////////////////////////////////////////////
       
  5518 	// TEST END
       
  5519 	////////////////////////////////////////////////////////////////
       
  5520 
       
  5521     StartCleanup();
       
  5522 	
       
  5523 	// Pop:
       
  5524 	//	enumContextsStatus
       
  5525 	//	contextActivateStatus
       
  5526 	//	setConfigStatus
       
  5527 	//	notifyContextStChStatus
       
  5528 	//	getNetworkStatus
       
  5529 	//	notifyServiceDynCapsStatus
       
  5530 	//	notifyServiceStChStatus
       
  5531 	//	notifyContextStatus
       
  5532 	//	notifyContextActivationRequestedStatus
       
  5533 	CleanupStack::PopAndDestroy(9,&notifyContextActivationRequestedStatus);
       
  5534 	
       
  5535 	return TestStepResult();
       
  5536 	}
       
  5537 
       
  5538 TPtrC CCTSYIntegrationTestPacketContext0022::GetTestStepName()
       
  5539 /**
       
  5540  * @return The test step name.
       
  5541  */
       
  5542 	{
       
  5543 	return _L("CCTSYIntegrationTestPacketContext0022");
       
  5544 	}
       
  5545 
       
  5546 
       
  5547 
       
  5548 CCTSYIntegrationTestPacketContext0023::CCTSYIntegrationTestPacketContext0023(CEtelSessionMgr& aEtelSessionMgr)
       
  5549 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
  5550 /**
       
  5551  * Constructor.
       
  5552  */
       
  5553 	{
       
  5554 	SetTestStepName(CCTSYIntegrationTestPacketContext0023::GetTestStepName());
       
  5555 	}
       
  5556 
       
  5557 CCTSYIntegrationTestPacketContext0023::~CCTSYIntegrationTestPacketContext0023()
       
  5558 /**
       
  5559  * Destructor.
       
  5560  */
       
  5561 	{
       
  5562 	}
       
  5563 
       
  5564 TVerdict CCTSYIntegrationTestPacketContext0023::doTestStepL()
       
  5565 /**
       
  5566  * @SYMTestCaseID BA-CTSY-INT-PKTC-0023
       
  5567  * @SYMFssID BA/CTSY/PKTC-0023
       
  5568  * @SYMTestCaseDesc Activate context when request received from network.
       
  5569  * @SYMTestPriority High
       
  5570  * @SYMTestActions RPacketContext::Activate, RPacketService::NotifyContextAdded, RPacketContext::GetStatus, RPacketService::GetNifInfo, RPacketService::GetContextNameInNif, RPacketService::EnumerateNifs, RPacketContext::NotifyStatusChange, RPacketContext::SetConfig, RPacketService::EnumerateContextsInNif, RPacketService::NotifyContextActivationRequested, RPacketContext::GetDnsInfo
       
  5571  * @SYMTestExpectedResults Pass - Context activated on request from network.
       
  5572  * @SYMTestType CIT
       
  5573  * @SYMTestCaseDependencies simulated/manual
       
  5574  *
       
  5575  * Reason for test: Verify NIF related info correct.
       
  5576  *
       
  5577  * @return - TVerdict code
       
  5578  */
       
  5579 	{
       
  5580 
       
  5581 	////////////////////////////////////////////////////////////////
       
  5582 	// SET UP
       
  5583 	////////////////////////////////////////////////////////////////
       
  5584 
       
  5585 	ERR_PRINTF2(_L("<font color=Orange>$CTSYProblem: defect id = %d</font>"), 10085);
       
  5586 	User::Leave(KErrNone);	
       
  5587 	
       
  5588     // Ensure phone is attached to the packet service. 
       
  5589 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, KMainPhone, KMainPacketService);
       
  5590     SetAttachModeToWhenPossibleAndWaitForAttachL(packetService);
       
  5591 
       
  5592 	// Ensure RPacketService::GetDynamicCaps returns caps in set of KCapsRxContextActivationReq 
       
  5593 	RPacketService::TDynamicCapsFlags dynCaps;
       
  5594 	CHECK_EQUALS_L(packetService.GetDynamicCaps(dynCaps), KErrNone, _L("RPacketService::GetDynamicCaps returned with an error"));
       
  5595 	CHECK_BITS_SET_L(dynCaps, RPacketService::KCapsRxContextActivationReq, KNoUnwantedBits, _L("RPacketService::GetStaticCaps did not return correct dynamic caps"));
       
  5596 
       
  5597 	////////////////////////////////////////////////////////////////
       
  5598 	// SET UP END
       
  5599 	////////////////////////////////////////////////////////////////
       
  5600 	
       
  5601 	StartTest();
       
  5602 	
       
  5603 	////////////////////////////////////////////////////////////////
       
  5604 	// TEST START
       
  5605 	////////////////////////////////////////////////////////////////
       
  5606 
       
  5607 	// post notifier for RPacketService::NotifyContextActivationRequested
       
  5608 	RPacketContext::TContextConfigGPRS configGPRS;
       
  5609 	TPckg<RPacketContext::TContextConfigGPRS> configPkg(configGPRS);
       
  5610 	TExtEtelRequestStatus notifyContextActivationRequested(packetService , EPacketNotifyContextActivationRequestedCancel);
       
  5611 	CleanupStack::PushL(notifyContextActivationRequested);
       
  5612 	packetService.NotifyContextActivationRequested(notifyContextActivationRequested, configPkg);
       
  5613 
       
  5614     // Ask the simulator to send a context activation request
       
  5615 	RPacketContext::TContextConfigGPRS configSimulator;
       
  5616 	TPckg<RPacketContext::TContextConfigGPRS> configSimulatorPkg(configSimulator);
       
  5617     DisplayUserInteractionPromptL(_L("Simulator needs to send context activation request to this phone."), ETimeMedium);
       
  5618 
       
  5619 	// Check RPacketService::NotifyContextActivationRequested completes with valid context configuration.
       
  5620 	ASSERT_EQUALS(WaitForRequestWithTimeOut(notifyContextActivationRequested, ETimeLong), KErrNone, _L("RPacketService::NotifyContextActivationRequested timed out."));
       
  5621 	ASSERT_EQUALS(notifyContextActivationRequested.Int(), KErrNone, _L("RPacketService::NotifyContextActivationRequested returned with error status."));
       
  5622 	ASSERT_TRUE(configGPRS.iAccessPointName.Length() > 0,_L("RPacketService::NotifyContextActivationRequested returned from Simulator with incorrect or zero length iAccessPointName."));
       
  5623 	ASSERT_TRUE(configGPRS.iProtocolConfigOption.iAuthInfo.iUsername.Length() > 0, _L("RPacketService::NotifyContextActivationRequested returned from Simulator with incorrect or zero length iUsername."));
       
  5624 	ASSERT_TRUE(configGPRS.iProtocolConfigOption.iAuthInfo.iPassword.Length() > 0, _L("RPacketService::NotifyContextActivationRequested returned from Simulator with incorrect or zero length iPassword."));
       
  5625 
       
  5626 	// Post notification for the RPacketService::NotifyContextAdded
       
  5627 	TExtEtelRequestStatus notifyContextStatus(packetService, EPacketNotifyContextAdded);
       
  5628 	CleanupStack::PushL(notifyContextStatus);
       
  5629 	TName contextId;
       
  5630 	packetService.NotifyContextAdded(notifyContextStatus, contextId);
       
  5631 
       
  5632 	// Open a primary context. 
       
  5633 	RPacketContext& primaryPacketContext = iEtelSessionMgr.GetPrimaryPacketContextL(
       
  5634 											KMainServer,
       
  5635 											KMainPhone,
       
  5636 											KMainPacketService,
       
  5637 											KPrimaryPacketContext1);
       
  5638 
       
  5639 	// Extract the context parameters received and check they are the same as that sent by the simulator. 
       
  5640 	// ETEL PACKET API says that nw may send PDP type requested, PDP address, Access Point Name (APN)
       
  5641 	ASSERT_EQUALS_DES8(configSimulator.iAccessPointName, configGPRS.iAccessPointName, _L("RPacketContext::GetConfig returns incorrect config data."));
       
  5642 	ASSERT_EQUALS(configSimulator.iPdpType, configGPRS.iPdpType, _L("RPacketContext::GetConfig returns incorrect config data."));
       
  5643 	ASSERT_EQUALS_DES8(configSimulator.iPdpAddress, configGPRS.iPdpAddress, _L("RPacketContext::GetConfig returns incorrect config data."));
       
  5644 	 
       
  5645 
       
  5646 	// Use them to set a context config with RPacketContext::SetConfig 
       
  5647 	TExtEtelRequestStatus setConfigStatus(primaryPacketContext, EPacketContextSetConfig);	
       
  5648 	CleanupStack::PushL(setConfigStatus);
       
  5649 	primaryPacketContext.SetConfig(setConfigStatus, configPkg);
       
  5650 	
       
  5651 	ASSERT_EQUALS(WaitForRequestWithTimeOut(setConfigStatus, ETimeLong), KErrNone, _L("RPacketContext::SetConfig timed out"));
       
  5652 	ASSERT_EQUALS(setConfigStatus.Int(), KErrNone, _L("RPacketContext::SetConfig returned with error status."));
       
  5653 
       
  5654 	// Check RPacketService::NotifyContextAdded completes with a valid context name
       
  5655 	ASSERT_EQUALS(WaitForRequestWithTimeOut(notifyContextStatus, ETimeMedium), KErrNone, _L("RPacketService::NotifyContextAdded did not complete."));
       
  5656     ASSERT_EQUALS(notifyContextStatus.Int(), KErrNone, _L("RPacketService::NotifyContextAdded returned with error status."));
       
  5657     ASSERT_TRUE(contextId.Length() > 0, _L("RPacketService::NotifyContextAdded completed with invalid context name"));
       
  5658 
       
  5659 	// Post notification for context's status change
       
  5660 	TExtEtelRequestStatus notifyContextStChStatus(primaryPacketContext, EPacketContextNotifyStatusChange);
       
  5661 	CleanupStack::PushL(notifyContextStChStatus);
       
  5662 	RPacketContext::TContextStatus packetContextStatus;
       
  5663 	primaryPacketContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);
       
  5664 
       
  5665 	// Activate packet context with RPacketContext::Activate
       
  5666 	TExtEtelRequestStatus contextActivateStatus(primaryPacketContext, EPacketContextActivate);
       
  5667 	CleanupStack::PushL(contextActivateStatus);
       
  5668 	primaryPacketContext.Activate(contextActivateStatus);
       
  5669 
       
  5670 	ASSERT_EQUALS(WaitForRequestWithTimeOut(contextActivateStatus, ETimeLong), KErrNone, _L("RPacketContext::Activate timed out."));
       
  5671 	ASSERT_EQUALS(contextActivateStatus.Int(), KErrNone, _L("RPacketContext::Activate returned with error status."));
       
  5672 
       
  5673 	// ===  Check context statuses ===
       
  5674 
       
  5675 	// Check RPacketContext::NotifyStatusChange completes with EStatusActivating -> EStatusActive
       
  5676     RPacketContext::TContextStatus expectedPacketContextStatus = RPacketContext::EStatusActivating;
       
  5677 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  5678 				primaryPacketContext,
       
  5679 				notifyContextStChStatus,
       
  5680 				packetContextStatus, 
       
  5681 				expectedPacketContextStatus,
       
  5682 				KErrNone);
       
  5683 
       
  5684     ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusActivating, _L("Packet Context's status expected to be EStatusActivating but is not."));
       
  5685     primaryPacketContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);	
       
  5686 
       
  5687     expectedPacketContextStatus = RPacketContext::EStatusActive;
       
  5688 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  5689 				primaryPacketContext,
       
  5690 				notifyContextStChStatus,
       
  5691 				packetContextStatus, 
       
  5692 				expectedPacketContextStatus,
       
  5693 				KErrNone);
       
  5694 
       
  5695 	// Check RPacketContext::GetStatus returns EStatusActive
       
  5696 	ASSERT_EQUALS(primaryPacketContext.GetStatus(packetContextStatus), KErrNone, _L("RPacketContext::GetStatus returned with an error."));
       
  5697 	ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusActive, _L("RPacketContext::GetStatus returns incorrect status."));
       
  5698 
       
  5699 	// ===  Get context information ===
       
  5700 
       
  5701 	// Check RPacketContext::GetConfig returns same config as that set
       
  5702 	TExtEtelRequestStatus contextGetConfigStatus(primaryPacketContext, EPacketContextGetConfig);
       
  5703 	CleanupStack::PushL(contextGetConfigStatus);
       
  5704 	RPacketContext::TContextConfigGPRS getConfig;
       
  5705 	TPckg<RPacketContext::TContextConfigGPRS> getConfigPkg(getConfig);
       
  5706 	primaryPacketContext.GetConfig(contextGetConfigStatus, getConfigPkg);
       
  5707 	
       
  5708 	ASSERT_EQUALS(WaitForRequestWithTimeOut(contextGetConfigStatus, ETimeMedium), KErrNone, _L("RPacketContext::GetConfig timed out."))
       
  5709 	ASSERT_EQUALS(contextGetConfigStatus.Int(), KErrNone, _L("RPacketContext::GetConfig returned an error."));
       
  5710 
       
  5711 	ASSERT_EQUALS_DES8(getConfig.iAccessPointName, configGPRS.iAccessPointName, _L("RPacketContext::GetConfig returns incorrect config data."));
       
  5712 	ASSERT_EQUALS_DES8(getConfig.iProtocolConfigOption.iAuthInfo.iUsername, configGPRS.iProtocolConfigOption.iAuthInfo.iUsername, _L("RPacketContext::GetConfig returns incorrect config data."));
       
  5713 	ASSERT_EQUALS_DES8(getConfig.iProtocolConfigOption.iAuthInfo.iPassword, configGPRS.iProtocolConfigOption.iAuthInfo.iPassword, _L("RPacketContext::GetConfig returns incorrect config data."));
       
  5714 
       
  5715 	// Check RPacketContext::GetDnsInfo returns valid primary and secondary DNS ip addresses
       
  5716 	RPacketContext::TDnsInfoV2 dnsInfo;
       
  5717 	RPacketContext::TTDnsInfoV2Pckg dnsInfoPkg(dnsInfo);
       
  5718 	TExtEtelRequestStatus dnsInfoStatus(primaryPacketContext, EPacketContextGetDNSInfo);
       
  5719 	CleanupStack::PushL(dnsInfoStatus);
       
  5720 	primaryPacketContext.GetDnsInfo(dnsInfoStatus, dnsInfoPkg);
       
  5721 	ASSERT_EQUALS(WaitForRequestWithTimeOut(dnsInfoStatus, ETimeMedium), KErrNone, _L("RPacketContext::GetDnsInfo timed out."));
       
  5722 
       
  5723 	ASSERT_EQUALS(dnsInfoStatus.Int(), KErrNone, _L("RPacketContext::GetDnsInfo returned an error."));
       
  5724 	ASSERT_TRUE(dnsInfo.iPrimaryDns.Length() > 0, _L("RPacketContext::GetDnsInfo returned with zero length PrimaryDns."));
       
  5725 	ASSERT_TRUE(dnsInfo.iSecondaryDns.Length() > 0, _L("RPacketContext::GetDnsInfo returned with zero length SecondaryDns."));
       
  5726 
       
  5727 	// ===  Check that there is one NIF with one primary context belonging to it ===
       
  5728 
       
  5729 	// Check RPacketService::EnumerateNifs returns aCount = 1
       
  5730 
       
  5731 	TExtEtelRequestStatus enumerateNifsStatus(packetService, EPacketEnumerateNifs);
       
  5732 	CleanupStack::PushL(enumerateNifsStatus);
       
  5733 	TInt nifCount;
       
  5734 	const TInt wantedCount = 1;
       
  5735 	packetService.EnumerateNifs(enumerateNifsStatus, nifCount);
       
  5736 
       
  5737 	ASSERT_EQUALS(WaitForRequestWithTimeOut(enumerateNifsStatus, ETimeLong), KErrNone, _L("RPacketService::EnumerateNifs timed out"));
       
  5738 	ASSERT_EQUALS(nifCount, wantedCount, _L("RPacketService::EnumerateNifs returned wrong NIF count."));
       
  5739 
       
  5740 
       
  5741 	// Get context info	
       
  5742 	TExtEtelRequestStatus getContextInfo(packetService, EPacketGetContextInfo);
       
  5743 	CleanupStack::PushL(getContextInfo);
       
  5744 	RPacketService::TContextInfo contextInfo;
       
  5745 	const TInt index = 0;
       
  5746 	packetService.GetContextInfo(getContextInfo, index, contextInfo);
       
  5747 
       
  5748 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getContextInfo, ETimeLong), KErrNone, _L("RPacketService::GetContextInfo timed out"));
       
  5749 	ASSERT_TRUE(contextInfo.iName.Length() > 0, _L("RPacketService::GetContextInfo returned with zero length context name"));
       
  5750 
       
  5751 	// Check RPacketService::EnumerateContextsInNif with aExistingContextName = existing context name returns aCount = 1
       
  5752 	TExtEtelRequestStatus enumerateContextsInNifStatus(packetService, EPacketEnumerateContextsInNif);
       
  5753 	CleanupStack::PushL(enumerateContextsInNifStatus);
       
  5754 	TInt contextsInNifCount;
       
  5755 	packetService.EnumerateContextsInNif(enumerateContextsInNifStatus, contextInfo.iName, contextsInNifCount);
       
  5756 
       
  5757 	ASSERT_EQUALS(WaitForRequestWithTimeOut(enumerateContextsInNifStatus, ETimeLong), KErrNone, _L("RPacketService::EnumerateContextsInNif timed out"));
       
  5758 	ASSERT_EQUALS(nifCount, wantedCount, _L("RPacketService::EnumerateContextsInNif returned wrong number of contexts sharing a NIF"));
       
  5759 
       
  5760 	// Check RPacketService::GetContextNameInNif with aExistingContextName = existing context name and aIndex = 0 returns aContextName which is same as aExistingContextName
       
  5761 	TExtEtelRequestStatus getContextNameInNifStatus(packetService, EPacketGetContextNameInNif);
       
  5762 	CleanupStack::PushL(getContextNameInNifStatus);
       
  5763 	TName contextName;
       
  5764 	packetService.GetContextNameInNif(getContextNameInNifStatus, contextInfo.iName, index, contextName);
       
  5765 
       
  5766 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getContextNameInNifStatus, ETimeLong), KErrNone, _L("RPacketService::GetContextNameInNif timed out"));
       
  5767 	ASSERT_EQUALS_DES16(contextInfo.iName, contextName, _L("RPacketService::GetContextNameInNif returned context name which doesn't match with the existing context name"));
       
  5768 
       
  5769 	// Check RPacketService::GetNifInfo with aCount = 0 returns valid name in iContextName
       
  5770 	TExtEtelRequestStatus getNifInfoStatus(packetService, EPacketGetNifInfo);
       
  5771 	CleanupStack::PushL(getNifInfoStatus);
       
  5772 	const TInt nifInfoCount = 0;
       
  5773 	RPacketService::TNifInfoV2 nifInfo;
       
  5774 	RPacketService::TNifInfoV2Pckg nifInfoPkg(nifInfo);
       
  5775 	packetService.GetNifInfo(getNifInfoStatus, nifInfoCount, nifInfoPkg);
       
  5776 
       
  5777 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getNifInfoStatus, ETimeLong), KErrNone, _L("RPacketService::GetNifInfo timed out"));
       
  5778 	ASSERT_TRUE(nifInfo.iContextName.Length() > 0, _L("RPacketService::GetNifInfo returned with invalid context name"));
       
  5779 
       
  5780 	// Check RPacketService::GetNifInfo with aCount = 0 returns iNumberOfContexts = 1
       
  5781 	ASSERT_EQUALS(nifInfo.iNumberOfContexts, wantedCount, _L("RPacketService::GetNifInfo returned wrong count of contexts"));
       
  5782 	
       
  5783 	// Check RPacketService::GetNifInfo with aCount = 0 returns iNifStatus = EStatusActive
       
  5784 	ASSERT_EQUALS(nifInfo.iNifStatus, RPacketContext::EStatusActive, _L("RPacketService::GetNifInfo returned wrong NIF status"));
       
  5785 	
       
  5786 	// Check RPacketService::GetNifInfo with aCount = 0 returns valid address in iPdpAddress
       
  5787 	ASSERT_TRUE(nifInfo.iPdpAddress.Length() > 0, _L("RPacketService::GetNifInfo returned with invalid pdp address"));
       
  5788 
       
  5789 	// Check RPacketService::GetNifInfo with aCount = 0 returns EExternalContext in iContextType
       
  5790 	ASSERT_EQUALS(nifInfo.iContextType, RPacketService::EExternalContext, _L("RPacketService::GetNifInfo returned wrong context type"));
       
  5791 
       
  5792 
       
  5793 	////////////////////////////////////////////////////////////////
       
  5794 	// TEST END
       
  5795 	////////////////////////////////////////////////////////////////
       
  5796 
       
  5797     StartCleanup();
       
  5798 	
       
  5799 	// Pop
       
  5800 	// notifyContextActivationRequested
       
  5801 	// setConfigStatus
       
  5802 	// notifyContextStatus
       
  5803 	// notifyContextStChStatus
       
  5804 	// contextActivateStatus
       
  5805 	// contextGetConfigStatus
       
  5806 	// dnsInfoStatus
       
  5807 	// enumerateNifStatus
       
  5808 	// getContextInfo
       
  5809 	// enumerateContextsInNifStatus
       
  5810 	// getContextNameInNifStatus
       
  5811 	// getNifInfoStatus
       
  5812 
       
  5813 	CleanupStack::PopAndDestroy(12, &notifyContextActivationRequested);
       
  5814 	
       
  5815 	return TestStepResult();
       
  5816 	}
       
  5817 
       
  5818 TPtrC CCTSYIntegrationTestPacketContext0023::GetTestStepName()
       
  5819 /**
       
  5820  * @return The test step name.
       
  5821  */
       
  5822 	{
       
  5823 	return _L("CCTSYIntegrationTestPacketContext0023");
       
  5824 	}
       
  5825 
       
  5826 
       
  5827 
       
  5828 CCTSYIntegrationTestPacketContext0024::CCTSYIntegrationTestPacketContext0024(CEtelSessionMgr& aEtelSessionMgr)
       
  5829 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
  5830 /**
       
  5831  * Constructor.
       
  5832  */
       
  5833 	{
       
  5834 	SetTestStepName(CCTSYIntegrationTestPacketContext0024::GetTestStepName());
       
  5835 	}
       
  5836 
       
  5837 CCTSYIntegrationTestPacketContext0024::~CCTSYIntegrationTestPacketContext0024()
       
  5838 /**
       
  5839  * Destructor.
       
  5840  */
       
  5841 	{
       
  5842 	}
       
  5843 
       
  5844 TVerdict CCTSYIntegrationTestPacketContext0024::doTestStepL()
       
  5845 /**
       
  5846  * @SYMTestCaseID BA-CTSY-INT-PKTC-0024
       
  5847  * @SYMFssID BA/CTSY/PKTC-0024
       
  5848  * @SYMTestCaseDesc Reject network requested context activation.
       
  5849  * @SYMTestPriority High
       
  5850  * @SYMTestActions RPacketService::RejectActivationRequest, RPacketService::EnumerateContexts
       
  5851  * @SYMTestExpectedResults Pass - Context activation request rejected.
       
  5852  * @SYMTestType CIT
       
  5853  * @SYMTestCaseDependencies simulated/manual
       
  5854  *
       
  5855  * Reason for test: Verify context parameters in TPacketDataConfigBase derive class received correctly.  Verify when network repeated requests for a context activation (up to 5 times), it can be rejected.
       
  5856  *
       
  5857  * @return - TVerdict code
       
  5858  */
       
  5859 	{
       
  5860 
       
  5861 	////////////////////////////////////////////////////////////////
       
  5862 	// SET UP
       
  5863 	////////////////////////////////////////////////////////////////
       
  5864 	
       
  5865 	ERR_PRINTF2(_L("<font color=Orange>$CTSYProblem: defect id = %d</font>"), 10086);
       
  5866 	User::Leave(KErrNone);
       
  5867 
       
  5868     // Check that the phone is registered with the network simulator. 
       
  5869     RMobilePhone &mobilePhone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
  5870     iNetworkTestHelper.CheckPhoneConnectedToAniteL(mobilePhone);
       
  5871 
       
  5872 	// Ensure phone is attached to the packet service. 
       
  5873 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, KMainPhone, KMainPacketService);
       
  5874     SetAttachModeToWhenPossibleAndWaitForAttachL(packetService);
       
  5875 
       
  5876 	// Ensure RPacketService::GetDynamicCaps returns caps in set of KCapsRxContextActivationReq 
       
  5877 	RPacketService::TDynamicCapsFlags dynCaps;
       
  5878 	CHECK_EQUALS_L(packetService.GetDynamicCaps(dynCaps), KErrNone, _L("RPacketService::GetDynamicCaps returned with an error"));
       
  5879 	CHECK_BITS_SET_L(dynCaps, RPacketService::KCapsRxContextActivationReq, KNoUnwantedBits, _L("RPacketService::GetDynamicCaps returned with incorrect caps"));
       
  5880 
       
  5881 
       
  5882 	////////////////////////////////////////////////////////////////
       
  5883 	// SET UP END
       
  5884 	////////////////////////////////////////////////////////////////
       
  5885 	
       
  5886 	StartTest();
       
  5887 	
       
  5888 	////////////////////////////////////////////////////////////////
       
  5889 	// TEST START
       
  5890 	////////////////////////////////////////////////////////////////
       
  5891 	
       
  5892 	
       
  5893 	// post notifier for RPacketService::NotifyContextActivationRequested
       
  5894 	RPacketContext::TContextConfigGPRS configGPRS;
       
  5895 	TPckg<RPacketContext::TContextConfigGPRS> configPkg(configGPRS);
       
  5896 	TExtEtelRequestStatus notifyContextActivationRequested(packetService , EPacketNotifyContextActivationRequested);
       
  5897 	CleanupStack::PushL(notifyContextActivationRequested);
       
  5898 	packetService.NotifyContextActivationRequested(notifyContextActivationRequested, configPkg);
       
  5899 
       
  5900     // Ask the simulator to send a context activation request
       
  5901     DisplayUserInteractionPromptL(_L("Simulator needs to send context activation request to this phone."), ETimeMedium);
       
  5902 	
       
  5903 	// Check RPacketService::NotifyContextActivationRequested completes with valid context configuration.
       
  5904 	iPacketServiceTestHelper.WaitForPacketServiceNotifyContextActivationRequested( 
       
  5905 													packetService,
       
  5906 													notifyContextActivationRequested,
       
  5907 													configPkg,
       
  5908 													KErrNone );
       
  5909 
       
  5910 	ASSERT_EQUALS(notifyContextActivationRequested.Int(), KErrNone, _L("RPacketService::NotifyContextActivationRequested returned with error status."));
       
  5911 	ASSERT_TRUE(configGPRS.iAccessPointName.Length() > 0,_L("RPacketService::NotifyContextActivationRequested returned from Simulator with incorrect or zero length iAccessPointName."));
       
  5912 	ASSERT_TRUE(configGPRS.iProtocolConfigOption.iAuthInfo.iUsername.Length() > 0, _L("RPacketService::NotifyContextActivationRequested returned from Simulator with incorrect or zero length iUsername."));
       
  5913 	ASSERT_TRUE(configGPRS.iProtocolConfigOption.iAuthInfo.iPassword.Length() > 0, _L("RPacketService::NotifyContextActivationRequested returned from Simulator with incorrect or zero length iPassword."));
       
  5914 	
       
  5915 	// Check RPacketService::RejectActivationRequest completes with KErrNone
       
  5916 	TExtEtelRequestStatus rejectActivationRequestStatus(packetService, EPacketRejectActivationRequest);	
       
  5917 	CleanupStack::PushL(rejectActivationRequestStatus);
       
  5918 	packetService.RejectActivationRequest(rejectActivationRequestStatus);
       
  5919 	
       
  5920 	ASSERT_EQUALS(WaitForRequestWithTimeOut(rejectActivationRequestStatus, ETimeLong), KErrNone, _L("RPacketService::RejectActivationRequest timed out"));
       
  5921 	ASSERT_EQUALS(rejectActivationRequestStatus.Int(), KErrNone, _L("RPacketService::RejectActivationRequest returned with error status."));
       
  5922 
       
  5923 	// Check RPacketService::EnumerateContexts returns 0
       
  5924 	TExtEtelRequestStatus enumerateContextsStatus(packetService, EPacketEnumerateContexts);	
       
  5925 	CleanupStack::PushL(enumerateContextsStatus);
       
  5926 	TInt count(0);
       
  5927 	TInt maxAllowed(0);
       
  5928 	const TInt wantedCount = 0;
       
  5929 	packetService.EnumerateContexts(enumerateContextsStatus, count, maxAllowed);
       
  5930 	ASSERT_EQUALS(WaitForRequestWithTimeOut(enumerateContextsStatus, ETimeLong), KErrNone, _L("RPacketService::EnumerateContexts timed out"));
       
  5931 	ASSERT_EQUALS(enumerateContextsStatus.Int(), KErrNone, _L("RPacketService::EnumerateContexts returned with error status."));
       
  5932 	ASSERT_EQUALS(count, wantedCount, _L("RPacketService::EnumerateContexts did not return context count 0 as expected"));
       
  5933 
       
  5934 
       
  5935 	////////////////////////////////////////////////////////////////
       
  5936 	// TEST END
       
  5937 	////////////////////////////////////////////////////////////////
       
  5938 
       
  5939     StartCleanup();
       
  5940 	
       
  5941 	// Pop
       
  5942 	// notifyContextActivationRequested
       
  5943 	// rejectActivationRequestStatus
       
  5944 	// enumerateContextsStatus
       
  5945 	CleanupStack::PopAndDestroy(3, &notifyContextActivationRequested);
       
  5946 	
       
  5947 	return TestStepResult();
       
  5948 	}
       
  5949 
       
  5950 TPtrC CCTSYIntegrationTestPacketContext0024::GetTestStepName()
       
  5951 /**
       
  5952  * @return The test step name.
       
  5953  */
       
  5954 	{
       
  5955 	return _L("CCTSYIntegrationTestPacketContext0024");
       
  5956 	}
       
  5957 
       
  5958 
       
  5959 
       
  5960 CCTSYIntegrationTestPacketContext0025::CCTSYIntegrationTestPacketContext0025(CEtelSessionMgr& aEtelSessionMgr)
       
  5961 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
  5962 /**
       
  5963  * Constructor.
       
  5964  */
       
  5965 	{
       
  5966 	SetTestStepName(CCTSYIntegrationTestPacketContext0025::GetTestStepName());
       
  5967 	}
       
  5968 
       
  5969 CCTSYIntegrationTestPacketContext0025::~CCTSYIntegrationTestPacketContext0025()
       
  5970 /**
       
  5971  * Destructor.
       
  5972  */
       
  5973 	{
       
  5974 	}
       
  5975 
       
  5976 TVerdict CCTSYIntegrationTestPacketContext0025::doTestStepL()
       
  5977 /**
       
  5978  * @SYMTestCaseID BA-CTSY-INT-PKTC-0025
       
  5979  * @SYMFssID BA/CTSY/PKTC-0025
       
  5980  * @SYMTestCaseDesc Delete a context when it is active.
       
  5981  * @SYMTestPriority High
       
  5982  * @SYMTestActions RPacketContext::Delete, RPacketService::NotifyStatusChange, RPacketService::GetStatus, RPacketContext::NotifyStatusChange, RPacketContext::GetStatus
       
  5983  * @SYMTestExpectedResults Pass - Context is deleted and the status of the contexts reflects this status..
       
  5984  * @SYMTestType CIT
       
  5985  * @SYMTestCaseDependencies live/automatic
       
  5986  *
       
  5987  * Reason for test: Verify context status is correct.
       
  5988  *
       
  5989  * @return - TVerdict code
       
  5990  */
       
  5991 	{
       
  5992 
       
  5993 	////////////////////////////////////////////////////////////////
       
  5994 	// SET UP
       
  5995 	////////////////////////////////////////////////////////////////
       
  5996 
       
  5997 	// Call TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL		
       
  5998     RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
  5999 	CHECK_EQUALS_L(iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(phone), KErrNone, _L("TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL returned with an error"));
       
  6000 
       
  6001 	// === Ensure there is an active PDP context. ===
       
  6002     
       
  6003     // Get packet service
       
  6004 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, KMainPhone, KMainPacketService);
       
  6005     
       
  6006     // Ensure phone is attached to the packet service. 
       
  6007     SetAttachModeToWhenPossibleAndWaitForAttachL(packetService);
       
  6008 
       
  6009 	// Open a new context.	
       
  6010 	RPacketContext& primaryPacketContext = iEtelSessionMgr.GetPrimaryPacketContextL(
       
  6011 											KMainServer,
       
  6012 											KMainPhone,
       
  6013 											KMainPacketService,
       
  6014 											KPrimaryPacketContext1);
       
  6015 
       
  6016 	// Activate primary context.											
       
  6017 	iPacketServiceTestHelper.ActivatePrimaryPacketContextL(phone, primaryPacketContext);
       
  6018 
       
  6019 	////////////////////////////////////////////////////////////////
       
  6020 	// SET UP END
       
  6021 	////////////////////////////////////////////////////////////////
       
  6022 	
       
  6023 	StartTest();
       
  6024 	
       
  6025 	////////////////////////////////////////////////////////////////
       
  6026 	// TEST START
       
  6027 	////////////////////////////////////////////////////////////////
       
  6028 	
       
  6029 	
       
  6030 	// Delete the context with RPacketContext::Delete 
       
  6031 	TExtEtelRequestStatus deleteStatus(packetService, EPacketContextDelete);
       
  6032 	CleanupStack::PushL(deleteStatus);
       
  6033 	primaryPacketContext.Delete(deleteStatus);
       
  6034 	ASSERT_EQUALS(WaitForRequestWithTimeOut(deleteStatus, ETimeLong), KErrNone, _L("RPacketContext::Delete timed out"));
       
  6035 
       
  6036 	// Check an error is returned.
       
  6037 	// $CTSYProblem Adaptation deletes context always if it's status is else than RPacketContext::EStatusUnknown.
       
  6038 	// Checking is changed from NOT KErrNone to KErrNone and GetStatus() checking is changed from EStatusActive to EStatusDeleted
       
  6039 	ASSERT_EQUALS(deleteStatus.Int(), KErrNone, _L("RPacketContext::Delete returned with an error"));
       
  6040 
       
  6041 	// Check RPacketContext::GetStatus returns EStatusDeleted
       
  6042 	RPacketContext::TContextStatus packetContextStatus;
       
  6043 	ASSERT_EQUALS(primaryPacketContext.GetStatus(packetContextStatus), KErrNone, _L("RPacketContext::GetStatus returned with an error."));
       
  6044 	ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusDeleted, _L("RPacketContext::GetStatus returns incorrect status."));
       
  6045 
       
  6046 	
       
  6047 	////////////////////////////////////////////////////////////////
       
  6048 	// TEST END
       
  6049 	////////////////////////////////////////////////////////////////
       
  6050 
       
  6051     StartCleanup();
       
  6052 	
       
  6053 	// Pop
       
  6054 	// deleteStatus
       
  6055 	CleanupStack::PopAndDestroy(1, &deleteStatus);
       
  6056 	
       
  6057 	return TestStepResult();
       
  6058 	}
       
  6059 
       
  6060 TPtrC CCTSYIntegrationTestPacketContext0025::GetTestStepName()
       
  6061 /**
       
  6062  * @return The test step name.
       
  6063  */
       
  6064 	{
       
  6065 	return _L("CCTSYIntegrationTestPacketContext0025");
       
  6066 	}
       
  6067 
       
  6068 
       
  6069 
       
  6070 CCTSYIntegrationTestPacketContext0026::CCTSYIntegrationTestPacketContext0026(CEtelSessionMgr& aEtelSessionMgr)
       
  6071 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
  6072 /**
       
  6073  * Constructor.
       
  6074  */
       
  6075 	{
       
  6076 	SetTestStepName(CCTSYIntegrationTestPacketContext0026::GetTestStepName());
       
  6077 	}
       
  6078 
       
  6079 CCTSYIntegrationTestPacketContext0026::~CCTSYIntegrationTestPacketContext0026()
       
  6080 /**
       
  6081  * Destructor.
       
  6082  */
       
  6083 	{
       
  6084 	}
       
  6085 
       
  6086 TVerdict CCTSYIntegrationTestPacketContext0026::doTestStepL()
       
  6087 /**
       
  6088  * @SYMTestCaseID BA-CTSY-INT-PKTC-0026
       
  6089  * @SYMFssID BA/CTSY/PKTC-0026
       
  6090  * @SYMTestCaseDesc Delete a context when it has been deactivated.
       
  6091  * @SYMTestPriority High
       
  6092  * @SYMTestActions RPacketContext::NotifyStatusChange, RPacketContext::GetStatus, RPacketContext::Delete
       
  6093  * @SYMTestExpectedResults Pass - Context deleted.
       
  6094  * @SYMTestType CIT
       
  6095  * @SYMTestCaseDependencies live/automatic
       
  6096  *
       
  6097  * Reason for test: Verify context status is deleted.
       
  6098  *
       
  6099  * @return - TVerdict code
       
  6100  */
       
  6101 	{
       
  6102 
       
  6103 	////////////////////////////////////////////////////////////////
       
  6104 	// SET UP
       
  6105 	////////////////////////////////////////////////////////////////
       
  6106 	
       
  6107 	
       
  6108 	// Ensure there is an active PDP context. 
       
  6109 
       
  6110 	// Call TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL		
       
  6111     RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
  6112 	CHECK_EQUALS_L(iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(phone), KErrNone, _L("TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL returned with an error"));
       
  6113 
       
  6114     // Get packet service
       
  6115 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, KMainPhone, KMainPacketService);
       
  6116 
       
  6117     // Ensure phone is attached to the packet service
       
  6118     SetAttachModeToWhenPossibleAndWaitForAttachL(packetService);
       
  6119 
       
  6120 	// Open a new context.	
       
  6121 	RPacketContext& primaryPacketContext = iEtelSessionMgr.GetPrimaryPacketContextL(
       
  6122 											KMainServer,
       
  6123 											KMainPhone,
       
  6124 											KMainPacketService,
       
  6125 											KPrimaryPacketContext1);
       
  6126 											 
       
  6127 	// Activate primary context											
       
  6128 	iPacketServiceTestHelper.ActivatePrimaryPacketContextL(phone,primaryPacketContext);	
       
  6129 	
       
  6130 	// Check RPacketContext::GetStatus returns EStatusActive
       
  6131 	RPacketContext::TContextStatus packetContextStatus;
       
  6132 	CHECK_EQUALS_L(primaryPacketContext.GetStatus(packetContextStatus), KErrNone, _L("RPacketContext::GetStatus for primary context returned with an error."));
       
  6133 	CHECK_EQUALS_L(packetContextStatus, RPacketContext::EStatusActive, _L("RPacketContext::GetStatus returns incorrect status."));
       
  6134 
       
  6135 	////////////////////////////////////////////////////////////////
       
  6136 	// SET UP END
       
  6137 	////////////////////////////////////////////////////////////////
       
  6138 	
       
  6139 	StartTest();
       
  6140 	
       
  6141 	////////////////////////////////////////////////////////////////
       
  6142 	// TEST START
       
  6143 	////////////////////////////////////////////////////////////////	
       
  6144 	
       
  6145 	
       
  6146 	//Post notifier for packet context status change
       
  6147 	TExtEtelRequestStatus notifyContextStChStatus(primaryPacketContext, EPacketContextNotifyStatusChange);
       
  6148 	CleanupStack::PushL(notifyContextStChStatus);
       
  6149 	primaryPacketContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);
       
  6150 	
       
  6151 	// Deactivate the context. 
       
  6152 	TExtEtelRequestStatus contextDeactivateStatus(primaryPacketContext, EPacketContextDeactivate);
       
  6153 	CleanupStack::PushL(contextDeactivateStatus);
       
  6154 	primaryPacketContext.Deactivate(contextDeactivateStatus);
       
  6155 
       
  6156 	ASSERT_EQUALS(WaitForRequestWithTimeOut(contextDeactivateStatus, ETimeLong), KErrNone, 
       
  6157 					_L("RPacketContext::Deactivate timed out."));					
       
  6158 	ASSERT_EQUALS(contextDeactivateStatus.Int(), KErrNone,
       
  6159 					_L("RPacketContext::Deactivate returned with error status."));
       
  6160 	
       
  6161 	// Check RPacketContext::NotifyStatusChange completes with EStatusDeactivating -> EStatusInactive				
       
  6162 	RPacketContext::TContextStatus expectedPacketContextStatus = RPacketContext::EStatusDeactivating;  
       
  6163 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  6164 				primaryPacketContext,
       
  6165 				notifyContextStChStatus,
       
  6166 				packetContextStatus, 
       
  6167 				expectedPacketContextStatus,
       
  6168 				KErrNone);
       
  6169 
       
  6170 	primaryPacketContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);	
       
  6171     expectedPacketContextStatus = RPacketContext::EStatusInactive;
       
  6172 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  6173 				primaryPacketContext,
       
  6174 				notifyContextStChStatus,
       
  6175 				packetContextStatus, 
       
  6176 				expectedPacketContextStatus,
       
  6177 				KErrNone);
       
  6178 
       
  6179 	// Check RPacketContext::GetStatus returns EStatusInactive
       
  6180 	ASSERT_EQUALS(primaryPacketContext.GetStatus(packetContextStatus), KErrNone, _L("RPacketContext::GetStatus returned with an error."));
       
  6181 	ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusInactive, _L("RPacketContext::GetStatus returns incorrect status."));
       
  6182 
       
  6183 	// Delete the context with RPacketContext::Delete 	
       
  6184 	primaryPacketContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);	
       
  6185 	TExtEtelRequestStatus contextDeleteStatus(primaryPacketContext, EPacketContextDelete);
       
  6186 	CleanupStack::PushL(contextDeleteStatus);
       
  6187 	primaryPacketContext.Delete(contextDeleteStatus);	
       
  6188 	ASSERT_EQUALS(WaitForRequestWithTimeOut(contextDeleteStatus, ETimeLong), KErrNone, _L("RPacketContext::Delete timed out"));
       
  6189 	ASSERT_EQUALS(contextDeleteStatus.Int(), KErrNone, _L("RPacketContext::Delete returned an error"));
       
  6190 	
       
  6191 	// Check RPacketContext::NotifyStatusChange completes with EStatusDeleted
       
  6192 	expectedPacketContextStatus = RPacketContext::EStatusDeleted;
       
  6193 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  6194 				primaryPacketContext,
       
  6195 				notifyContextStChStatus,
       
  6196 				packetContextStatus, 
       
  6197 				expectedPacketContextStatus,
       
  6198 				KErrNone);
       
  6199 
       
  6200 	// Check RPacketContext::GetStatus returns EStatusDeleted
       
  6201 	ASSERT_EQUALS(primaryPacketContext.GetStatus(packetContextStatus), KErrNone, _L("RPacketContext::GetStatus returned with an error."));
       
  6202 	ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusDeleted, _L("RPacketContext::GetStatus returns incorrect status."));
       
  6203 
       
  6204 	
       
  6205 	////////////////////////////////////////////////////////////////
       
  6206 	// TEST END
       
  6207 	////////////////////////////////////////////////////////////////
       
  6208 
       
  6209     StartCleanup();
       
  6210 	
       
  6211 	// Pop
       
  6212 	// notifyContextStChStatus
       
  6213 	// contextDeactivateStatus
       
  6214 	// contextDeleteStatus
       
  6215 	CleanupStack::PopAndDestroy(3, &notifyContextStChStatus);	
       
  6216 	
       
  6217 	return TestStepResult();
       
  6218 	}
       
  6219 
       
  6220 TPtrC CCTSYIntegrationTestPacketContext0026::GetTestStepName()
       
  6221 /**
       
  6222  * @return The test step name.
       
  6223  */
       
  6224 	{
       
  6225 	return _L("CCTSYIntegrationTestPacketContext0026");
       
  6226 	}
       
  6227 
       
  6228 
       
  6229 
       
  6230 CCTSYIntegrationTestPacketContext0027::CCTSYIntegrationTestPacketContext0027(CEtelSessionMgr& aEtelSessionMgr)
       
  6231 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
  6232 /**
       
  6233  * Constructor.
       
  6234  */
       
  6235 	{
       
  6236 	SetTestStepName(CCTSYIntegrationTestPacketContext0027::GetTestStepName());
       
  6237 	}
       
  6238 
       
  6239 CCTSYIntegrationTestPacketContext0027::~CCTSYIntegrationTestPacketContext0027()
       
  6240 /**
       
  6241  * Destructor.
       
  6242  */
       
  6243 	{
       
  6244 	}
       
  6245 
       
  6246 TVerdict CCTSYIntegrationTestPacketContext0027::doTestStepL()
       
  6247 /**
       
  6248  * @SYMTestCaseID BA-CTSY-INT-PKTC-0027
       
  6249  * @SYMFssID BA/CTSY/PKTC-0027
       
  6250  * @SYMTestCaseDesc Dial a voice call while context is active in class B operation.
       
  6251  * @SYMTestPriority High
       
  6252  * @SYMTestActions RPacketContext::NotifyStatusChange, RPacketContext::GetStatus, RCall::Dial, RCall::HangUp, RCall::GetStatus, RCall::NotifyStatusChange, RPacketService::NotifyStatusChange, RPacketService::GetStatus
       
  6253  * @SYMTestExpectedResults Pass - Packet service suspends when CS call is made.
       
  6254  * @SYMTestType CIT
       
  6255  * @SYMTestCaseDependencies live/automatic
       
  6256  *
       
  6257  * Reason for test: Verify context and packet service are suspended when voice call is initiated whilst context is activated
       
  6258  *
       
  6259  * @return - TVerdict code
       
  6260  */
       
  6261 	{
       
  6262 
       
  6263 	////////////////////////////////////////////////////////////////
       
  6264 	// SET UP
       
  6265 	////////////////////////////////////////////////////////////////
       
  6266 
       
  6267 	
       
  6268 	// Ensure MS class is EMSClassSuspensionRequired 
       
  6269 
       
  6270 	// Ensure there is an active PDP context. 
       
  6271 
       
  6272 
       
  6273 	////////////////////////////////////////////////////////////////
       
  6274 	// SET UP END
       
  6275 	////////////////////////////////////////////////////////////////
       
  6276 	
       
  6277 	StartTest();
       
  6278 	
       
  6279 	////////////////////////////////////////////////////////////////
       
  6280 	// TEST START
       
  6281 	////////////////////////////////////////////////////////////////
       
  6282 	
       
  6283 	
       
  6284 	// Check RPacketService::GetMSClass returns EMSClassSuspensionRequired
       
  6285 
       
  6286 	// Dial a number that answers. 
       
  6287 
       
  6288 	// ===  Check call status ===
       
  6289 
       
  6290 	// Check RCall::NotifyStatusChange completes with EStatusConnected.
       
  6291 
       
  6292 	// Check RCall::GetStatus returns EStatusConnected.
       
  6293 
       
  6294 	// ===  Check context and service statuses ===
       
  6295 
       
  6296 	// Check RPacketService::NotifyStatusChange completes with EStatusSuspended
       
  6297 
       
  6298 	// Check RPacketService::GetStatus returns EStatusSuspended
       
  6299 
       
  6300 	// Check RPacketContext::NotifyStatusChange completes with EStatusSuspended
       
  6301 
       
  6302 	// Check RPacketContext::GetStatus returns EStatusSuspended
       
  6303 
       
  6304 	// Hang up call. 
       
  6305 
       
  6306 	// Check RCall::NotifyStatusChange completes with EStatusHangingUp -> EStatusIdle.
       
  6307 
       
  6308 	// Check RCall::GetStatus returns EStatusIdle.
       
  6309 
       
  6310 	// ===  Check context and service statuses ===
       
  6311 
       
  6312 	// Check RPacketService::NotifyStatusChange completes with EStatusActive
       
  6313 
       
  6314 	// Check RPacketService::GetStatus returns EStatusActive
       
  6315 
       
  6316 	// Check RPacketContext::NotifyStatusChange completes with EStatusActive
       
  6317 
       
  6318 	// Check RPacketContext::GetStatus returns EStatusActive
       
  6319 
       
  6320 	
       
  6321 	////////////////////////////////////////////////////////////////
       
  6322 	// TEST END
       
  6323 	////////////////////////////////////////////////////////////////
       
  6324 
       
  6325     StartCleanup();
       
  6326 	
       
  6327 	// Put any required test clean up here, then remove this comment
       
  6328 	
       
  6329 	return TestStepResult();
       
  6330 	}
       
  6331 
       
  6332 TPtrC CCTSYIntegrationTestPacketContext0027::GetTestStepName()
       
  6333 /**
       
  6334  * @return The test step name.
       
  6335  */
       
  6336 	{
       
  6337 	return _L("CCTSYIntegrationTestPacketContext0027");
       
  6338 	}
       
  6339 
       
  6340 
       
  6341 
       
  6342 CCTSYIntegrationTestPacketContext0028::CCTSYIntegrationTestPacketContext0028(CEtelSessionMgr& aEtelSessionMgr)
       
  6343 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
  6344 /**
       
  6345  * Constructor.
       
  6346  */
       
  6347 	{
       
  6348 	SetTestStepName(CCTSYIntegrationTestPacketContext0028::GetTestStepName());
       
  6349 	}
       
  6350 
       
  6351 CCTSYIntegrationTestPacketContext0028::~CCTSYIntegrationTestPacketContext0028()
       
  6352 /**
       
  6353  * Destructor.
       
  6354  */
       
  6355 	{
       
  6356 	}
       
  6357 
       
  6358 TVerdict CCTSYIntegrationTestPacketContext0028::doTestStepL()
       
  6359 /**
       
  6360  * @SYMTestCaseID BA-CTSY-INT-PKTC-0028
       
  6361  * @SYMFssID BA/CTSY/PKTC-0028
       
  6362  * @SYMTestCaseDesc Get default context params.
       
  6363  * @SYMTestPriority High
       
  6364  * @SYMTestActions RPacketService::NotifyStatusChange, RPacketService::GetStatus, RPacketContext::Activate, RPacketContext::NotifyStatusChange, RPacketContext::GetStatus, RPacketContext::GetConfig, RPacketService::SetDefaultContextParams, RPacketService::GetContextInfo
       
  6365  * @SYMTestExpectedResults Pass - Context activated with default params.
       
  6366  * @SYMTestType CIT
       
  6367  * @SYMTestCaseDependencies live/automatic
       
  6368  *
       
  6369  * Reason for test: Verify context activated without specific config has default context params.
       
  6370  *
       
  6371  * @return - TVerdict code
       
  6372  */
       
  6373 	{
       
  6374 
       
  6375 	////////////////////////////////////////////////////////////////
       
  6376 	// SET UP
       
  6377 	////////////////////////////////////////////////////////////////
       
  6378 
       
  6379     // Call TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL		
       
  6380     RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
  6381 	CHECK_EQUALS_L(iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(phone), KErrNone, _L("TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL returned with an error"));
       
  6382 
       
  6383     // Get packet service
       
  6384 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, KMainPhone, KMainPacketService);
       
  6385 
       
  6386     // Ensure phone is attached to the packet service
       
  6387     SetAttachModeToWhenPossibleAndWaitForAttachL(packetService);
       
  6388 	
       
  6389 
       
  6390 	////////////////////////////////////////////////////////////////
       
  6391 	// SET UP END
       
  6392 	////////////////////////////////////////////////////////////////
       
  6393 	
       
  6394 	StartTest();
       
  6395 	
       
  6396 	////////////////////////////////////////////////////////////////
       
  6397 	// TEST START
       
  6398 	////////////////////////////////////////////////////////////////
       
  6399 
       
  6400 	const TInt gprs = 1;
       
  6401 	const TInt r99 = 2;
       
  6402 	const TInt r5 = 3;
       
  6403 
       
  6404    	// Get network info from phone
       
  6405 	TExtEtelRequestStatus getNetworkStatus(phone, EMobilePhoneGetCurrentNetwork);
       
  6406 	CleanupStack::PushL(getNetworkStatus);
       
  6407 	RMobilePhone::TMobilePhoneNetworkInfoV1 info;
       
  6408 	RMobilePhone::TMobilePhoneNetworkInfoV1Pckg infopckg(info);
       
  6409 	phone.GetCurrentNetwork(getNetworkStatus, infopckg);
       
  6410 
       
  6411 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getNetworkStatus, ETimeLong), KErrNone, _L("RMobilePhone::GetCurrentNetwork timed out"));
       
  6412 	ASSERT_EQUALS(getNetworkStatus.Int(), KErrNone, _L("RMobilePhone::GetCurrentNetwork returned an error"));
       
  6413 
       
  6414 	TPtrC apn, user, pwd;
       
  6415 	iPacketServiceTestHelper.GetGprsSettings(info, apn, user, pwd);
       
  6416 
       
  6417 	// Activate context using RPacketContext::TContextConfigGPRS
       
  6418 	DoTest0028L(packetService, apn, user, pwd, gprs);
       
  6419 
       
  6420 	// Repeat test with RPacketContext::TContextConfigR99_R4
       
  6421 	DoTest0028L(packetService, apn, user, pwd, r99);
       
  6422 
       
  6423 	ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d</font>"), 50004 );
       
  6424 	// Test case is made to leave because CTSY doesn't have support for TContextConfig_R5.
       
  6425 	CHECK_TRUE_L(EFalse, _L("This test has been made to leave intentionally - CTSY doesn't have support for TContextConfig_R5")); 
       
  6426 
       
  6427 	// Repeat test with RPacketContext::TContextConfig_R5
       
  6428 	DoTest0028L(packetService, apn, user, pwd, r5);
       
  6429 
       
  6430 	////////////////////////////////////////////////////////////////
       
  6431 	// TEST END
       
  6432 	////////////////////////////////////////////////////////////////
       
  6433 
       
  6434     StartCleanup();
       
  6435 	
       
  6436 	// Pop
       
  6437 	// getNetworkStatus
       
  6438 	CleanupStack::PopAndDestroy(1, &getNetworkStatus);
       
  6439 	
       
  6440 	return TestStepResult();
       
  6441 	}
       
  6442 
       
  6443 
       
  6444 void CCTSYIntegrationTestPacketContext0028::DoTest0028L(RPacketService& aPacketService, TPtrC aApn, TPtrC aUser, TPtrC aPwd, TInt aNWType)
       
  6445 /**
       
  6446  * Activates primary packet context with default context parameters.
       
  6447  * @param aPacketService Reference to packet service.
       
  6448  * @param aNWType Gprs / R99_R4 / R5.
       
  6449  */
       
  6450 	{
       
  6451 	TExtEtelRequestStatus reqSetDefaultContextParams(aPacketService, EPacketSetDefaultContextParams);	
       
  6452 	CleanupStack::PushL(reqSetDefaultContextParams);
       
  6453 	RPacketContext::TContextConfigGPRS setConfigGprs;
       
  6454 	TPckg<RPacketContext::TContextConfigGPRS> setConfigPkgGprs(setConfigGprs);
       
  6455 	RPacketContext::TContextConfigR99_R4 setConfigR99;
       
  6456 	TPckg<RPacketContext::TContextConfigR99_R4> setConfigPkgR99(setConfigR99);
       
  6457 	RPacketContext::TContextConfig_R5 setConfigR5;
       
  6458 	TPckg<RPacketContext::TContextConfig_R5> setConfigPkgR5(setConfigR5);
       
  6459 
       
  6460 	switch(aNWType)
       
  6461 		{
       
  6462 		case 1: // GPRS
       
  6463 			// Set valid context params with RPacketService::SetDefaultContextParams and using RPacketContext::TContextConfigGPRS
       
  6464 			setConfigGprs.iAccessPointName.Copy(aApn);
       
  6465 			setConfigGprs.iProtocolConfigOption.iAuthInfo.iUsername.Copy(aUser);
       
  6466 			setConfigGprs.iProtocolConfigOption.iAuthInfo.iPassword.Copy(aPwd);
       
  6467 			aPacketService.SetDefaultContextParams(reqSetDefaultContextParams, setConfigPkgGprs);
       
  6468 			break;
       
  6469 		
       
  6470 		case 2: // R99_R4
       
  6471 			// Set valid context params with RPacketService::SetDefaultContextParams and using RPacketContext::TContextConfigR99_R4
       
  6472 			setConfigR99.iAccessPointName.Copy(aApn);
       
  6473 			setConfigR99.iProtocolConfigOption.iAuthInfo.iUsername.Copy(aUser);
       
  6474 			setConfigR99.iProtocolConfigOption.iAuthInfo.iPassword.Copy(aPwd);
       
  6475 			aPacketService.SetDefaultContextParams(reqSetDefaultContextParams, setConfigPkgR99);
       
  6476 			break;
       
  6477 
       
  6478 		case 3: // R5
       
  6479 			// Set valid context params with RPacketService::SetDefaultContextParams and using RPacketContext::TContextConfig_R5
       
  6480 			setConfigR5.iAccessPointName.Copy(aApn);
       
  6481 			setConfigR5.iProtocolConfigOption.iAuthInfo.iUsername.Copy(aUser);
       
  6482 			setConfigR5.iProtocolConfigOption.iAuthInfo.iPassword.Copy(aPwd);
       
  6483 			aPacketService.SetDefaultContextParams(reqSetDefaultContextParams, setConfigPkgR5);
       
  6484 			break;
       
  6485 		}
       
  6486 		
       
  6487 	ASSERT_EQUALS(WaitForRequestWithTimeOut(reqSetDefaultContextParams, ETimeLong), KErrNone, _L("RPacketService::SetDefaultContextParams timed out"));
       
  6488 	ASSERT_EQUALS(reqSetDefaultContextParams.Int(), KErrNone, _L("RPacketService::SetDefaultContextParams returned with an error"));
       
  6489 
       
  6490 	// Check RPacketService::GetDefaultContextParams returns same params as that set
       
  6491 	TExtEtelRequestStatus reqGetDefaultContextParams(aPacketService, EPacketGetDefaultContextParams);	
       
  6492 	CleanupStack::PushL(reqGetDefaultContextParams);
       
  6493 	RPacketContext::TContextConfigGPRS getConfigGprs;
       
  6494 	TPckg<RPacketContext::TContextConfigGPRS> getConfigPkgGprs(getConfigGprs);
       
  6495 	RPacketContext::TContextConfigR99_R4 getConfigR99;
       
  6496 	TPckg<RPacketContext::TContextConfigR99_R4> getConfigPkgR99(getConfigR99);
       
  6497 	RPacketContext::TContextConfig_R5 getConfigR5;
       
  6498 	TPckg<RPacketContext::TContextConfig_R5> getConfigPkgR5(getConfigR5);
       
  6499 
       
  6500 	switch(aNWType)
       
  6501 		{
       
  6502 		case 1: // GPRS
       
  6503 			aPacketService.GetDefaultContextParams(reqGetDefaultContextParams, getConfigPkgGprs);
       
  6504 			break;
       
  6505 		
       
  6506 		case 2: // R99_R4
       
  6507 			aPacketService.GetDefaultContextParams(reqGetDefaultContextParams, getConfigPkgR99);
       
  6508 			break;
       
  6509 
       
  6510 		case 3: // R5
       
  6511 			aPacketService.GetDefaultContextParams(reqGetDefaultContextParams, getConfigPkgR5);
       
  6512 			break;
       
  6513 		}
       
  6514 
       
  6515 	ASSERT_EQUALS(WaitForRequestWithTimeOut(reqGetDefaultContextParams, ETimeLong), KErrNone, _L("RPacketService::GetDefaultContextParams timed out"));
       
  6516 	ASSERT_EQUALS(reqGetDefaultContextParams.Int(), KErrNone, _L("RPacketService::GetDefaultContextParams returned with an error"));
       
  6517 
       
  6518 	TCmpRPacketContextTContextConfigGPRS contextConfigGPRSCmp(getConfigGprs, setConfigGprs, *this);
       
  6519 	TCmpRPacketContextTContextConfigR99_R4 contextConfigR99Cmp(getConfigR99, setConfigR99, *this);
       
  6520 	TCmpRPacketContextTContextConfig_R5 contextConfigR5Cmp(getConfigR5, setConfigR5, *this);
       
  6521 
       
  6522 	switch(aNWType)
       
  6523 		{
       
  6524 		case 1: // GPRS
       
  6525 			ASSERT_TRUE(contextConfigGPRSCmp.IsEqual(ELogError), _L("RPacketService.GetDefaultContextParams did not return same params as that set"));	
       
  6526 			break;
       
  6527 
       
  6528 		case 2: // R99_R4
       
  6529 			ASSERT_TRUE(contextConfigR99Cmp.IsEqual(ELogError), _L("RPacketService.GetDefaultContextParams did not return same params as that set"));	
       
  6530 			break;
       
  6531 
       
  6532 		case 3: // R5
       
  6533 			ASSERT_TRUE(contextConfigR5Cmp.IsEqual(ELogError), _L("RPacketService.GetDefaultContextParams did not return same params as that set"));	
       
  6534 			break;
       
  6535 		}
       
  6536 
       
  6537 	// Open a new context.	
       
  6538 	RPacketContext& primaryPacketContext = iEtelSessionMgr.GetPrimaryPacketContextL(
       
  6539 											KMainServer,
       
  6540 											KMainPhone,
       
  6541 											KMainPacketService,
       
  6542 											KPrimaryPacketContext1);
       
  6543 
       
  6544 	// Post notification for service's status change
       
  6545 	TExtEtelRequestStatus notifyServiceStChStatus(aPacketService, EPacketNotifyStatusChange);
       
  6546 	CleanupStack::PushL(notifyServiceStChStatus);
       
  6547 	RPacketService::TStatus packetServiceStatus;
       
  6548 	aPacketService.NotifyStatusChange(notifyServiceStChStatus, packetServiceStatus);
       
  6549 
       
  6550 	// Post notification for primary context status change
       
  6551 	TExtEtelRequestStatus notifyContextStChStatus(primaryPacketContext, EPacketContextNotifyStatusChange);
       
  6552 	CleanupStack::PushL(notifyContextStChStatus);
       
  6553 	RPacketContext::TContextStatus packetContextStatus;
       
  6554 	primaryPacketContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);
       
  6555 
       
  6556 	// Activate a context with RPacketContext::Activate 
       
  6557 	//$CTSYProblem SetConfig is required before activation of the context. 
       
  6558 	//If SetConfig is not called, Activate returns KErrTimedOut(-33). 
       
  6559 	//SetDefaultContextParams sends context parameters common to all contexts to adaptation/LTSY layer.
       
  6560 	//However,for some reason, adaptation does not use these params when Activate is called 
       
  6561 	//and requires setting of context specific parameters with SetConfig     
       
  6562 	TExtEtelRequestStatus setConfigStatus(primaryPacketContext, EPacketContextSetConfig);	
       
  6563 	CleanupStack::PushL(setConfigStatus);
       
  6564 	switch(aNWType)
       
  6565 		{
       
  6566 		case 1: // GPRS
       
  6567 			primaryPacketContext.SetConfig(setConfigStatus, setConfigPkgGprs);
       
  6568 			break;
       
  6569 
       
  6570 		case 2: // R99_R4
       
  6571 			primaryPacketContext.SetConfig(setConfigStatus, setConfigPkgR99);
       
  6572 			break;
       
  6573 
       
  6574 		case 3: // R5
       
  6575 			primaryPacketContext.SetConfig(setConfigStatus, setConfigPkgR5);
       
  6576 			break;
       
  6577 		}
       
  6578 	
       
  6579 	ASSERT_EQUALS(WaitForRequestWithTimeOut(setConfigStatus, ETimeLong), KErrNone, _L("RPacketContext::SetConfig timed out"));
       
  6580 	ASSERT_EQUALS(setConfigStatus.Int(), KErrNone, _L("RPacketContext::SetConfig returned with error status."));
       
  6581 
       
  6582 	TExtEtelRequestStatus contextActivateStatus(primaryPacketContext, EPacketContextActivate);
       
  6583 	CleanupStack::PushL(contextActivateStatus);
       
  6584 	primaryPacketContext.Activate(contextActivateStatus);
       
  6585 
       
  6586 	ASSERT_EQUALS(WaitForRequestWithTimeOut(contextActivateStatus, ETimeLong), KErrNone, _L("RPacketContext::Activate timed out."));
       
  6587 	ASSERT_EQUALS(contextActivateStatus.Int(), KErrNone, _L("RPacketContext::Activate returned with error status."));
       
  6588 
       
  6589 	// ===  Check context and service statuses ===
       
  6590 
       
  6591 	// Check RPacketService::NotifyStatusChange completes with EStatusActive
       
  6592 	RPacketService::TStatus expectedPacketServiceStatus = RPacketService::EStatusActive;
       
  6593 	iPacketServiceTestHelper.WaitForPacketServiceNotifyStatusChange(
       
  6594 				aPacketService,
       
  6595 				notifyServiceStChStatus,
       
  6596 				packetServiceStatus, 
       
  6597 				expectedPacketServiceStatus,
       
  6598 				KErrNone);
       
  6599 
       
  6600 	// Check RPacketService::GetStatus returns EStatusActive
       
  6601 	RPacketService::TStatus pckSrvcStatus;
       
  6602 	ASSERT_EQUALS(aPacketService.GetStatus(pckSrvcStatus), KErrNone, _L("RPacketService::GetStatus returned with an error."));
       
  6603 	ASSERT_EQUALS(pckSrvcStatus, RPacketService::EStatusActive, _L("RPacketService::GetStatus returns incorrect status."));
       
  6604 
       
  6605 	// Check RPacketContext::NotifyStatusChange completes with EStatusActivating -> EStatusActive
       
  6606 	RPacketContext::TContextStatus expectedPacketContextStatus = RPacketContext::EStatusActivating;
       
  6607 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  6608 				primaryPacketContext,
       
  6609 				notifyContextStChStatus,
       
  6610 				packetContextStatus, 
       
  6611 				expectedPacketContextStatus,
       
  6612 				KErrNone);
       
  6613 
       
  6614 	primaryPacketContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);
       
  6615 	expectedPacketContextStatus = RPacketContext::EStatusActive;
       
  6616 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  6617 				primaryPacketContext,
       
  6618 				notifyContextStChStatus,
       
  6619 				packetContextStatus, 
       
  6620 				expectedPacketContextStatus,
       
  6621 				KErrNone);
       
  6622 
       
  6623 	// Check RPacketContext::GetStatus returns EStatusActive
       
  6624 	ASSERT_EQUALS(primaryPacketContext.GetStatus(packetContextStatus), KErrNone, _L("RPacketContext::GetStatus returned with an error."));
       
  6625 	ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusActive, _L("RPacketContext::GetStatus returns incorrect status."));
       
  6626 
       
  6627 	// ===  Get context information ===
       
  6628 
       
  6629 	// Check RPacketContext::GetConfig returns same config as the default set in RPacketService::SetDefaultContextParams
       
  6630 	TExtEtelRequestStatus contextConfigStatus(primaryPacketContext, EPacketContextGetConfig);
       
  6631 	CleanupStack::PushL(contextConfigStatus);
       
  6632 
       
  6633 	switch(aNWType)
       
  6634 		{
       
  6635 		case 1: // GPRS
       
  6636 			primaryPacketContext.GetConfig(contextConfigStatus, getConfigPkgGprs);
       
  6637 			break;
       
  6638 		
       
  6639 		case 2: // R99_R4
       
  6640 			primaryPacketContext.GetConfig(contextConfigStatus, getConfigPkgR99);
       
  6641 			break;
       
  6642 
       
  6643 		case 3: // R5
       
  6644 			primaryPacketContext.GetConfig(contextConfigStatus, getConfigPkgR5);
       
  6645 			break;
       
  6646 		}
       
  6647 
       
  6648 	ASSERT_EQUALS(WaitForRequestWithTimeOut(contextConfigStatus, ETimeMedium), KErrNone, _L("RPacketContext::GetConfig timed out."))
       
  6649 	ASSERT_EQUALS(contextConfigStatus.Int(), KErrNone, _L("RPacketContext::GetConfig returned an error."));
       
  6650 	
       
  6651 	TCmpRPacketContextTContextConfigGPRS contextConfigGPRSCmp2(getConfigGprs, setConfigGprs, *this);
       
  6652 	TCmpRPacketContextTContextConfigR99_R4 contextConfigR99Cmp2(getConfigR99, setConfigR99, *this);
       
  6653 	TCmpRPacketContextTContextConfig_R5 contextConfigR5Cmp2(getConfigR5, setConfigR5, *this);
       
  6654 
       
  6655 	switch(aNWType)
       
  6656 		{
       
  6657 		case 1: // GPRS
       
  6658 			ASSERT_TRUE(contextConfigGPRSCmp2.IsEqual(ELogError), _L("RPacketService.GetConfig did not return same params as the default set in RPacketService::SetDefaultContextParams"));
       
  6659 			break;
       
  6660 
       
  6661 		case 2: // R99_R4
       
  6662 			ASSERT_TRUE(contextConfigR99Cmp2.IsEqual(ELogError), _L("RPacketService.GetConfig did not return same params as the default set in RPacketService::SetDefaultContextParams"));
       
  6663 			break;
       
  6664 
       
  6665 		case 3: // R5
       
  6666 			ASSERT_TRUE(contextConfigR5Cmp2.IsEqual(ELogError), _L("RPacketService.GetConfig did not return same params as the default set in RPacketService::SetDefaultContextParams"));
       
  6667 			break;
       
  6668 		}
       
  6669 
       
  6670 	// Check RPacketService::EnumerateContexts returns 1.
       
  6671 	TExtEtelRequestStatus enumerateContextsStatus(aPacketService, EPacketEnumerateContexts);	
       
  6672 	CleanupStack::PushL(enumerateContextsStatus);
       
  6673 	TInt count(0);
       
  6674 	TInt maxAllowed(0);
       
  6675 	const TInt wantedCount = 1;
       
  6676 	aPacketService.EnumerateContexts(enumerateContextsStatus, count, maxAllowed);
       
  6677 	ASSERT_EQUALS(WaitForRequestWithTimeOut(enumerateContextsStatus, ETimeLong), KErrNone, _L("RPacketService::EnumerateContexts timed out"));
       
  6678 	ASSERT_EQUALS(enumerateContextsStatus.Int(), KErrNone, _L("RPacketService::EnumerateContexts returned with error status."));
       
  6679 	ASSERT_EQUALS(count, wantedCount, _L("RPacketService::EnumerateContexts did not return context count 1 as expected"));
       
  6680 
       
  6681 	// Check RPacketService::GetContextInfo with aIndex = 0 returns correct name in iName
       
  6682 	TExtEtelRequestStatus getContextInfo(aPacketService, EPacketGetContextInfo);
       
  6683 	CleanupStack::PushL(getContextInfo);
       
  6684 	RPacketService::TContextInfo contextInfo;
       
  6685 	const TInt index = 0;
       
  6686 	aPacketService.GetContextInfo(getContextInfo, index, contextInfo);
       
  6687 	
       
  6688 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getContextInfo, ETimeLong), KErrNone, _L("RPacketService::GetContextInfo timed out"));
       
  6689 	ASSERT_TRUE(contextInfo.iName.Length() > 0, _L("RPacketService::GetContextInfo returned with zero length context name"));
       
  6690 
       
  6691 	// Check RPacketService::GetContextInfo with aIndex = 0 returns EStatusActive in iStatus
       
  6692 	ASSERT_EQUALS(contextInfo.iStatus, RPacketContext::EStatusActive, _L("RPacketService::GetContextInfo did not return iStatus RPacketContext::EStatusActive as expected"));
       
  6693 
       
  6694 	// Release packet context
       
  6695 	iEtelSessionMgr.ReleasePrimaryPacketContext(KMainServer,
       
  6696 											KMainPhone, 
       
  6697 											KMainPacketService, 
       
  6698 											KPrimaryPacketContext1);
       
  6699 
       
  6700 	// Pop
       
  6701 	// reqSetDefaultContextParams
       
  6702 	// reqGetDefaultContextParams
       
  6703 	// notifyServiceStChStatus
       
  6704 	// notifyContextStChStatus
       
  6705 	// setConfigStatus
       
  6706 	// contextActivateStatus
       
  6707 	// contextConfigStatus
       
  6708 	// enumerateContextsStatus
       
  6709 	// getContextInfo
       
  6710 	CleanupStack::PopAndDestroy(9, &reqSetDefaultContextParams);
       
  6711 
       
  6712 	}
       
  6713 
       
  6714 
       
  6715 TPtrC CCTSYIntegrationTestPacketContext0028::GetTestStepName()
       
  6716 /**
       
  6717  * @return The test step name.
       
  6718  */
       
  6719 	{
       
  6720 	return _L("CCTSYIntegrationTestPacketContext0028");
       
  6721 	}
       
  6722 
       
  6723 
       
  6724 
       
  6725 CCTSYIntegrationTestPacketContext0029::CCTSYIntegrationTestPacketContext0029(CEtelSessionMgr& aEtelSessionMgr)
       
  6726 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
  6727 /**
       
  6728  * Constructor.
       
  6729  */
       
  6730 	{
       
  6731 	SetTestStepName(CCTSYIntegrationTestPacketContext0029::GetTestStepName());
       
  6732 	}
       
  6733 
       
  6734 CCTSYIntegrationTestPacketContext0029::~CCTSYIntegrationTestPacketContext0029()
       
  6735 /**
       
  6736  * Destructor.
       
  6737  */
       
  6738 	{
       
  6739 	}
       
  6740 
       
  6741 TVerdict CCTSYIntegrationTestPacketContext0029::doTestStepL()
       
  6742 /**
       
  6743  * @SYMTestCaseID BA-CTSY-INT-PKTC-0029
       
  6744  * @SYMFssID BA/CTSY/PKTC-0029
       
  6745  * @SYMTestCaseDesc Set default context params to unsupported type.
       
  6746  * @SYMTestPriority High
       
  6747  * @SYMTestActions RPacketService::SetDefaultContextParams, RPacketService::NotifyStatusChange, RPacketService::GetStatus, RPacketContext::Activate, RPacketContext::NotifyStatusChange, RPacketContext::GetStatus, RPacketContext::GetConfig, RPacketService::SetDefaultContextParams, RPacketService::Open
       
  6748  * @SYMTestExpectedResults Pass - Context activated with original default params.
       
  6749  * @SYMTestType CIT
       
  6750  * @SYMTestCaseDependencies live/automatic
       
  6751  *
       
  6752  * Reason for test: Verify context activated without specific config has original default context params (not ones set).
       
  6753  *
       
  6754  * @return - TVerdict code
       
  6755  */
       
  6756 	{
       
  6757 
       
  6758 	////////////////////////////////////////////////////////////////
       
  6759 	// SET UP
       
  6760 	////////////////////////////////////////////////////////////////
       
  6761 
       
  6762     // Call TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL		
       
  6763     RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
  6764 	CHECK_EQUALS_L(iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(phone), KErrNone, _L("TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL returned with an error"));
       
  6765 
       
  6766     // Get packet service
       
  6767 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, KMainPhone, KMainPacketService);
       
  6768 	
       
  6769     // Ensure phone is attached to the packet service
       
  6770     SetAttachModeToWhenPossibleAndWaitForAttachL(packetService);
       
  6771     
       
  6772 	////////////////////////////////////////////////////////////////
       
  6773 	// SET UP END
       
  6774 	////////////////////////////////////////////////////////////////
       
  6775 	
       
  6776 	StartTest();
       
  6777 	
       
  6778 	////////////////////////////////////////////////////////////////
       
  6779 	// TEST START
       
  6780 	////////////////////////////////////////////////////////////////
       
  6781 	
       
  6782 	// Get the default context params with RPacketService::GetDefaultContextParams 	
       
  6783 	RPacketContext::TContextConfigGPRS dummyConfig;
       
  6784 	TPckg<RPacketContext::TContextConfigGPRS> dummyConfigPkgGprs(dummyConfig);
       
  6785 	
       
  6786 	TExtEtelRequestStatus reqGetDummyContextParams(packetService, EPacketGetDefaultContextParams);	
       
  6787 	CleanupStack::PushL(reqGetDummyContextParams);
       
  6788 	packetService.GetDefaultContextParams(reqGetDummyContextParams, dummyConfigPkgGprs);
       
  6789 	
       
  6790 	//Check RPacketService::GetDefaultContextParams returns with KErrNotReady
       
  6791 	ASSERT_EQUALS(WaitForRequestWithTimeOut(reqGetDummyContextParams, ETimeLong), KErrNone, _L("RPacketService::GetDefaultContextParams timed out"));
       
  6792 	ASSERT_EQUALS(reqGetDummyContextParams.Int(), KErrNotReady, _L("RPacketService::GetDefaultContextParams did not return KErrNotReady"));
       
  6793 		
       
  6794 	// Get network info from phone	 
       
  6795 	TExtEtelRequestStatus getNetworkStatus(phone, EMobilePhoneGetCurrentNetwork);
       
  6796 	CleanupStack::PushL(getNetworkStatus);
       
  6797 	RMobilePhone::TMobilePhoneNetworkInfoV1 info;
       
  6798 	RMobilePhone::TMobilePhoneNetworkInfoV1Pckg infopckg(info);
       
  6799 	phone.GetCurrentNetwork(getNetworkStatus, infopckg);
       
  6800 
       
  6801 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getNetworkStatus, ETimeLong),
       
  6802 				  						    KErrNone, _L("RMobilePhone::GetCurrentNetwork timed out"));
       
  6803 	ASSERT_EQUALS(getNetworkStatus.Int(),
       
  6804 				  KErrNone, _L("RMobilePhone::GetCurrentNetwork returned an error"));
       
  6805 	
       
  6806 	// Get the context config using network info
       
  6807 	RPacketContext::TContextConfigGPRS defaultConfig;
       
  6808 	TPtrC apn, user, pwd;
       
  6809 	iPacketServiceTestHelper.GetGprsSettings(info, apn, user, pwd);
       
  6810 	defaultConfig.iAccessPointName.Copy(apn);
       
  6811 	defaultConfig.iProtocolConfigOption.iAuthInfo.iUsername.Copy(user);
       
  6812 	defaultConfig.iProtocolConfigOption.iAuthInfo.iPassword.Copy(pwd);
       
  6813 	TPckg<RPacketContext::TContextConfigGPRS> defaultConfigPkgGprs(defaultConfig);
       
  6814 
       
  6815 	// Set the default context params with RPacketService::SetDefaultContextParams 	
       
  6816 	DEBUG_PRINTF1(_L("Setting Default Context Params"));
       
  6817 	TExtEtelRequestStatus regSetInitParams(packetService,EPacketSetDefaultContextParams);
       
  6818 	CleanupStack::PushL(regSetInitParams);		
       
  6819 	packetService.SetDefaultContextParams(regSetInitParams, defaultConfigPkgGprs);
       
  6820 	
       
  6821 	ASSERT_EQUALS(WaitForRequestWithTimeOut(regSetInitParams, ETimeLong), KErrNone, _L("RPacketService::SetDefaultContextParams timed out"));
       
  6822 	ASSERT_EQUALS(regSetInitParams.Int(), KErrNone, _L("RPacketService::SetDefaultContextParams returned with an error"));
       
  6823 	
       
  6824 	// Get the default context params with RPacketService::GetDefaultContextParams check they are the same as what was set
       
  6825 	DEBUG_PRINTF1(_L("Getting Default Context Params"));
       
  6826 	RPacketContext::TContextConfigGPRS getConfig;
       
  6827 	TPckg<RPacketContext::TContextConfigGPRS> getConfigPkgGprs(getConfig);
       
  6828 	 	
       
  6829 	TExtEtelRequestStatus reqGetDefaultContextParams(packetService, EPacketGetDefaultContextParams);	
       
  6830 	CleanupStack::PushL(reqGetDefaultContextParams);
       
  6831 	packetService.GetDefaultContextParams(reqGetDefaultContextParams, getConfigPkgGprs);
       
  6832 	
       
  6833 	ASSERT_EQUALS(WaitForRequestWithTimeOut(reqGetDefaultContextParams, ETimeLong), KErrNone, _L("RPacketService::GetDefaultContextParams timed out"));
       
  6834 	ASSERT_EQUALS(reqGetDefaultContextParams.Int(), KErrNone, _L("RPacketService::GetDefaultContextParams returned with an error"));
       
  6835 
       
  6836 	DEBUG_PRINTF1(_L("Comparing default Context Params"));
       
  6837 	TCmpRPacketContextTContextConfigGPRS contextParamsComparator(defaultConfig, getConfig, *this);
       
  6838 	ASSERT_TRUE(contextParamsComparator.IsEqual(ELogError), _L("RPacketService::GetDefaultContextParams did not return set parameters"));
       
  6839 		
       
  6840 	// Set invalid context parameters using RPacketService::SetDefaultContextParams and using RPacketContext::TContextConfigGPRS 
       
  6841 	RPacketContext::TContextConfigGPRS invalidConfig;
       
  6842 	invalidConfig.iProtocolConfigOption.iAuthInfo.iUsername.Copy(user);
       
  6843 	invalidConfig.iProtocolConfigOption.iAuthInfo.iPassword.Copy(pwd);
       
  6844 	_LIT(KFaultyAPN, "Incorrect APN name");
       
  6845 	invalidConfig.iAccessPointName.Copy(KFaultyAPN);
       
  6846 	TPckg<RPacketContext::TContextConfigGPRS> invalidConfigPkgGprs(invalidConfig);
       
  6847 	
       
  6848 	TExtEtelRequestStatus reqSetDefaultContextParams(packetService, EPacketSetDefaultContextParams);	
       
  6849 	CleanupStack::PushL(reqSetDefaultContextParams);
       
  6850 	packetService.SetDefaultContextParams(reqSetDefaultContextParams, invalidConfigPkgGprs);
       
  6851 	
       
  6852 	ASSERT_EQUALS(WaitForRequestWithTimeOut(reqSetDefaultContextParams, ETimeLong), KErrNone, _L("RPacketService::SetDefaultContextParams timed out"));
       
  6853 	ASSERT_EQUALS(reqSetDefaultContextParams.Int(), KErrNone, _L("RPacketService::SetDefaultContextParams returned with an error"));
       
  6854 
       
  6855 
       
  6856 	// Open a new context. 	
       
  6857 	RPacketContext& primaryPacketContext = iEtelSessionMgr.GetPrimaryPacketContextL(
       
  6858 											KMainServer,
       
  6859 											KMainPhone,
       
  6860 											KMainPacketService,
       
  6861 											KPrimaryPacketContext1);		
       
  6862 
       
  6863 	// Post notification for service's status change
       
  6864 	TExtEtelRequestStatus notifyServiceStChStatus(packetService, EPacketNotifyStatusChange);
       
  6865 	CleanupStack::PushL(notifyServiceStChStatus);
       
  6866 	RPacketService::TStatus packetServiceStatus;
       
  6867 	packetService.NotifyStatusChange(notifyServiceStChStatus, packetServiceStatus);
       
  6868 
       
  6869 	// Post notification for primary context status change
       
  6870 	TExtEtelRequestStatus notifyContextStChStatus(primaryPacketContext, EPacketContextNotifyStatusChange);
       
  6871 	CleanupStack::PushL(notifyContextStChStatus);
       
  6872 	RPacketContext::TContextStatus packetContextStatus;
       
  6873 	primaryPacketContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);
       
  6874 	
       
  6875 	//$CTSYProblem
       
  6876 	//SetConfig is required before activation of the context. 
       
  6877 	//If SetConfig is not called, Activate returns KErrTimedOut(-33).
       
  6878 	//SetDefaultContextParams sends context parameters common to all contexts to adaptation/LTSY layer.
       
  6879 	//However,for some reason, adaptation does not use these params when Activate is called 
       
  6880 	//and requires setting of context specific parameters with SetConfig     
       
  6881 
       
  6882 	TExtEtelRequestStatus setConfigStatus(primaryPacketContext, EPacketContextSetConfig);	
       
  6883 	CleanupStack::PushL(setConfigStatus);
       
  6884 	primaryPacketContext.SetConfig(setConfigStatus, defaultConfigPkgGprs);
       
  6885 	
       
  6886 	ASSERT_EQUALS(WaitForRequestWithTimeOut(setConfigStatus, ETimeLong), KErrNone, 
       
  6887 					_L("RPacketContext::SetConfig timed out"));
       
  6888 	ASSERT_EQUALS(setConfigStatus.Int(), KErrNone,
       
  6889 					_L("RPacketContext::SetConfig returned with error status."));
       
  6890 
       
  6891 	// Activate packet context with RPacketContext::Activate	
       
  6892 	TExtEtelRequestStatus contextActivateStatus(primaryPacketContext, EPacketContextActivate);
       
  6893 	CleanupStack::PushL(contextActivateStatus);
       
  6894 	primaryPacketContext.Activate(contextActivateStatus);
       
  6895 
       
  6896 	ASSERT_EQUALS(WaitForRequestWithTimeOut(contextActivateStatus, ETimeLong), KErrNone, 
       
  6897 					_L("RPacketContext::Activate timed out."));
       
  6898 	ASSERT_EQUALS(contextActivateStatus.Int(), KErrNone,
       
  6899 					_L("RPacketContext::Activate returned with error status."));
       
  6900 
       
  6901 	// ===  Check context and service statuses ===
       
  6902 
       
  6903 	// Check RPacketService::NotifyStatusChange completes with EStatusActive
       
  6904 	RPacketService::TStatus expectedPacketServiceStatus = RPacketService::EStatusActive;
       
  6905 	iPacketServiceTestHelper.WaitForPacketServiceNotifyStatusChange(
       
  6906 				packetService,
       
  6907 				notifyServiceStChStatus,
       
  6908 				packetServiceStatus, 
       
  6909 				expectedPacketServiceStatus,
       
  6910 				KErrNone);
       
  6911 
       
  6912 	// Check RPacketService::GetStatus returns EStatusActive
       
  6913 	RPacketService::TStatus pckSrvcStatus;
       
  6914 	ASSERT_EQUALS(packetService.GetStatus(pckSrvcStatus), KErrNone, _L("RPacketService::GetStatus returned with an error."));
       
  6915 	ASSERT_EQUALS(pckSrvcStatus, RPacketService::EStatusActive, _L("RPacketService::GetStatus returns incorrect status."));
       
  6916 
       
  6917 	// Check RPacketContext::NotifyStatusChange completes with EStatusActivating -> EStatusActive
       
  6918 	RPacketContext::TContextStatus expectedPacketContextStatus = RPacketContext::EStatusActivating;
       
  6919 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  6920 				primaryPacketContext,
       
  6921 				notifyContextStChStatus,
       
  6922 				packetContextStatus, 
       
  6923 				expectedPacketContextStatus,
       
  6924 				KErrNone);
       
  6925 		
       
  6926 	primaryPacketContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);
       
  6927 	
       
  6928 	expectedPacketContextStatus = RPacketContext::EStatusActive;
       
  6929 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  6930 				primaryPacketContext,
       
  6931 				notifyContextStChStatus,
       
  6932 				packetContextStatus, 
       
  6933 				expectedPacketContextStatus,
       
  6934 				KErrNone);
       
  6935 				
       
  6936 	ASSERT_EQUALS(primaryPacketContext.GetStatus(packetContextStatus), KErrNone, _L("RPacketContext::GetStatus returned with an error."));
       
  6937 	ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusActive, _L("RPacketContext::GetStatus returns incorrect status."));
       
  6938 
       
  6939 	// Check RPacketContext::GetConfig returns same config as the default returned by RPacketService::GetDefaultContextParams
       
  6940 	TExtEtelRequestStatus contextConfigStatus(primaryPacketContext, EPacketContextGetConfig);
       
  6941 	CleanupStack::PushL(contextConfigStatus);
       
  6942 	
       
  6943 	RPacketContext::TContextConfigGPRS getConfigGprs2;
       
  6944 	TPckg<RPacketContext::TContextConfigGPRS> getConfigPkgGprs2(getConfigGprs2);
       
  6945 	primaryPacketContext.GetConfig(contextConfigStatus, getConfigPkgGprs2);
       
  6946 	
       
  6947 	ASSERT_EQUALS(WaitForRequestWithTimeOut(contextConfigStatus, ETimeMedium), KErrNone, _L("RPacketContext::GetConfig timed out."));
       
  6948 	
       
  6949 	TCmpRPacketContextTContextConfigGPRS contextParamsComparatorNumberTwo(defaultConfig, getConfigGprs2, *this);
       
  6950 	ASSERT_TRUE(contextParamsComparatorNumberTwo.IsEqual(ELogError), _L("RPacketService::GetConfig did not return same config as the default returned by RPacketService::GetDefaultContextParams"));
       
  6951 
       
  6952 	
       
  6953 			
       
  6954 	////////////////////////////////////////////////////////////////
       
  6955 	// TEST END
       
  6956 	////////////////////////////////////////////////////////////////
       
  6957 
       
  6958     StartCleanup();
       
  6959 	
       
  6960 	// Pop
       
  6961 	// reqGetDummyContextParams
       
  6962 	// getNetworkStatus
       
  6963 	// regSetInitParams
       
  6964 	// reqGetDefaultContextParams
       
  6965 	// reqSetDefaultContextParams
       
  6966 	// notifyServiceStChStatus
       
  6967 	// notifyContextStChStatus
       
  6968 	// setConfigStatus
       
  6969 	// contextActivateStatus
       
  6970 	// contextConfigStatus
       
  6971 	CleanupStack::PopAndDestroy(10,&reqGetDummyContextParams);
       
  6972 		
       
  6973 	return TestStepResult();
       
  6974 	}
       
  6975 
       
  6976 TPtrC CCTSYIntegrationTestPacketContext0029::GetTestStepName()
       
  6977 /**
       
  6978  * @return The test step name.
       
  6979  */
       
  6980 	{
       
  6981 	return _L("CCTSYIntegrationTestPacketContext0029");
       
  6982 	}
       
  6983 
       
  6984 
       
  6985 
       
  6986 CCTSYIntegrationTestPacketContext0030::CCTSYIntegrationTestPacketContext0030(CEtelSessionMgr& aEtelSessionMgr)
       
  6987 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
  6988 /**
       
  6989  * Constructor.
       
  6990  */
       
  6991 	{
       
  6992 	SetTestStepName(CCTSYIntegrationTestPacketContext0030::GetTestStepName());
       
  6993 	}
       
  6994 
       
  6995 CCTSYIntegrationTestPacketContext0030::~CCTSYIntegrationTestPacketContext0030()
       
  6996 /**
       
  6997  * Destructor.
       
  6998  */
       
  6999 	{
       
  7000 	}
       
  7001 
       
  7002 TVerdict CCTSYIntegrationTestPacketContext0030::doTestStepL()
       
  7003 /**
       
  7004  * @SYMTestCaseID BA-CTSY-INT-PKTC-0030
       
  7005  * @SYMFssID BA/CTSY/PKTC-0030
       
  7006  * @SYMTestCaseDesc Deactivate NIF when there is only one NIF.
       
  7007  * @SYMTestPriority High
       
  7008  * @SYMTestActions RPacketService::GetStatus, RPacketService::EnumerateContextsInNif, RPacketService::EnumerateContexts, RPacketContext::NotifyStatusChange, RPacketContext::GetStatus, RPacketService::DeactivateNIF, RPacketService::GetNifInfo, RPacketService::DeactivateNIF, RPacketService::GetNifInfo, RPacketService::DeactivateNIF
       
  7009  * @SYMTestExpectedResults Pass - All contexts in NIF deactivated.
       
  7010  * @SYMTestType CIT
       
  7011  * @SYMTestCaseDependencies simulated/automatic
       
  7012  *
       
  7013  * Reason for test: Verify primary and secondary contexts in NIF are deactivated when primary context name specified.
       
  7014  *
       
  7015  * @return - TVerdict code
       
  7016  */
       
  7017 	{
       
  7018 
       
  7019 	////////////////////////////////////////////////////////////////
       
  7020 	// SET UP
       
  7021 	////////////////////////////////////////////////////////////////
       
  7022 
       
  7023 	
       
  7024 	// Ensure there is an active primary and secondary context. 
       
  7025     RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
  7026 	
       
  7027     // Check if we are on a simulated network
       
  7028 	CHECK_EQUALS_L( iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL( phone ), KErrNone, 
       
  7029 			_L("Network is unavailable") );
       
  7030     iNetworkTestHelper.CheckPhoneConnectedToAniteL(phone);
       
  7031 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, KMainPhone, KMainPacketService);
       
  7032     SetAttachModeToWhenPossibleAndWaitForAttachL(packetService);
       
  7033     TExtEtelRequestStatus notifyContextStatus(packetService, EPacketNotifyContextAdded);
       
  7034 	CleanupStack::PushL(notifyContextStatus);
       
  7035 	TName contextId;
       
  7036 	packetService.NotifyContextAdded(notifyContextStatus, contextId);
       
  7037     RPacketContext& primaryPacketContext = iEtelSessionMgr.GetPrimaryPacketContextL(
       
  7038 											KMainServer,
       
  7039 											KMainPhone,
       
  7040 											KMainPacketService,
       
  7041 											KPrimaryPacketContext1);
       
  7042     iPacketServiceTestHelper.ActivatePrimaryPacketContextL(phone, primaryPacketContext);
       
  7043 	TName secondaryContextId;
       
  7044 	packetService.NotifyContextAdded(notifyContextStatus, secondaryContextId);
       
  7045 	RPacketContext& secondaryPacketContext = iEtelSessionMgr.GetSecondaryPacketContextL(
       
  7046 												KMainServer,
       
  7047 												KMainPhone,
       
  7048 												KMainPacketService, 
       
  7049 												KPrimaryPacketContext1,
       
  7050 												KSecondaryPacketContext1);
       
  7051     CHECK_TRUE_L(ActivateSecondaryPacketContextL(secondaryPacketContext),_L("Can't activate the secondary context"));
       
  7052 
       
  7053 	////////////////////////////////////////////////////////////////
       
  7054 	// SET UP END
       
  7055 	////////////////////////////////////////////////////////////////
       
  7056 	
       
  7057 	StartTest();
       
  7058 	
       
  7059 	////////////////////////////////////////////////////////////////
       
  7060 	// TEST START
       
  7061 	////////////////////////////////////////////////////////////////
       
  7062 	
       
  7063 	
       
  7064 	// Check RPacketService::EnumerateNifs returns aCount = 1
       
  7065 	TExtEtelRequestStatus enumerateNifsStatus(packetService, EPacketEnumerateNifs);
       
  7066 	CleanupStack::PushL(enumerateNifsStatus);
       
  7067 	TInt count=-1;
       
  7068 	packetService.EnumerateNifs(enumerateNifsStatus,count);
       
  7069 	ASSERT_EQUALS(WaitForRequestWithTimeOut(enumerateNifsStatus, ETimeMedium), KErrNone, 
       
  7070 			_L("RPacketService::EnumerateNifs timed out."));
       
  7071 	ASSERT_EQUALS(enumerateNifsStatus.Int(), KErrNone, 
       
  7072 			_L("RPacketService::EnumerateNifs failed."));
       
  7073 	ASSERT_EQUALS(count,1,_L("RPacketService::EnumerateNifs did not return correct number of NIFs."));
       
  7074 
       
  7075 	// Check RPacketService::GetNifInfo with aCount = 0 returns valid name in iContextName
       
  7076 	TExtEtelRequestStatus getNifInfoStatus(packetService, EPacketGetNifInfo);
       
  7077 	CleanupStack::PushL(getNifInfoStatus);
       
  7078 	RPacketService::TNifInfoV2 nifInfo;
       
  7079 	RPacketService::TNifInfoV2Pckg nifInfoPckg(nifInfo);
       
  7080 	packetService.GetNifInfo(getNifInfoStatus,0,nifInfoPckg);
       
  7081 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getNifInfoStatus, ETimeMedium), KErrNone, 
       
  7082 			_L("RPacketService::GetNifInfo timed out."));
       
  7083 	ASSERT_EQUALS(getNifInfoStatus.Int(), KErrNone, 
       
  7084 			_L("RPacketService::GetNifInfo failed."));
       
  7085 	ASSERT_TRUE(nifInfo.iContextName.Length()>0,_L("RPacketService::GetNifInfo invlaid context name"));
       
  7086 
       
  7087 	// Check RPacketService::GetNifInfo with aCount = 0 returns iNumberOfContexts = 2
       
  7088 	ASSERT_EQUALS(nifInfo.iNumberOfContexts,2,_L("RPacketService::GetNifInfo wrong number of contexts"));
       
  7089 
       
  7090 	// Check RPacketService::GetNifInfo with aCount = 0 returns iNifStatus = EStatusActive
       
  7091 	ASSERT_EQUALS(nifInfo.iNifStatus,RPacketContext::EStatusActive,_L("RPacketService::GetNifInfo wrong status"));
       
  7092 
       
  7093 	// Check RPacketService::GetNifInfo with aCount = 0 returns valid address in iPdpAddress
       
  7094 	ASSERT_TRUE(nifInfo.iPdpAddress.Length()>0,_L("RPacketService::GetNifInfo invlaid PDP address"));
       
  7095 
       
  7096 	// Check RPacketService::GetNifInfo with aCount = 0 returns EInternalContext
       
  7097 	ASSERT_EQUALS(nifInfo.iContextType, RPacketService::EInternalContext,_L("RPacketService::GetNifInfo wrong type"));
       
  7098 
       
  7099 	// Check RPacketService::GetNifInfo with aCount = 1 returns KErrArgument
       
  7100 	packetService.GetNifInfo(getNifInfoStatus,1,nifInfoPckg);
       
  7101 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getNifInfoStatus, ETimeMedium), KErrNone, 
       
  7102 			_L("RPacketService::GetNifInfo timed out."));
       
  7103 	ASSERT_EQUALS(getNifInfoStatus.Int(), KErrArgument, 
       
  7104 			_L("RPacketService::GetNifInfo did not failed."));
       
  7105 
       
  7106 	// Check RPacketService::EnumerateContextsInNif with aExistingContextName = existing primary context name returns aCount = 2
       
  7107 	TExtEtelRequestStatus enumContextsInfStatus(packetService, EPacketEnumerateContextsInNif);
       
  7108 	CleanupStack::PushL(enumContextsInfStatus);
       
  7109 	count=-1;
       
  7110 	packetService.EnumerateContextsInNif(enumContextsInfStatus,contextId,count);
       
  7111 	ASSERT_EQUALS(WaitForRequestWithTimeOut(enumContextsInfStatus, ETimeMedium), KErrNone, 
       
  7112 			_L("RPacketService::EnumerateContextsInNif timed out."));
       
  7113 	ASSERT_EQUALS(enumContextsInfStatus.Int(), KErrNone, 
       
  7114 			_L("RPacketService::EnumerateContextsInNif failed."));
       
  7115 	ASSERT_EQUALS(count,2,_L("RPacketService::EnumerateContextsInNif did not return correct number of NIFs."));
       
  7116 
       
  7117 	// Check RPacketService::GetContextNameInNif with aExistingContextName = existing primary context name and aIndex = 0 returns aContextName = name of primary context
       
  7118 	TBuf<200> contextName;
       
  7119 	TExtEtelRequestStatus getContextNameInNifStatus(packetService, EPacketGetContextNameInNif);
       
  7120 	CleanupStack::PushL(getContextNameInNifStatus);
       
  7121 	packetService.GetContextNameInNif(getContextNameInNifStatus,contextId,0,contextName);
       
  7122 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getContextNameInNifStatus, ETimeMedium), KErrNone, 
       
  7123 			_L("RPacketService::GetContextNameInNif timed out."));
       
  7124 	ASSERT_EQUALS(getContextNameInNifStatus.Int(), KErrNone, 
       
  7125 			_L("RPacketService::GetContextNameInNif failed."));
       
  7126 	ASSERT_EQUALS_DES16(contextName,contextId,_L("RPacketService::GetContextNameInNif did not returned the expected value."));
       
  7127 
       
  7128 	// Check RPacketService::GetContextNameInNif with aExistingContextName = existing primary context name and aIndex = 1 returns aContextName = name of secondary context
       
  7129 	packetService.GetContextNameInNif(getContextNameInNifStatus,contextId,1,contextName);
       
  7130 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getContextNameInNifStatus, ETimeMedium), KErrNone, 
       
  7131 			_L("RPacketService::GetContextNameInNif timed out."));
       
  7132 	ASSERT_EQUALS(getContextNameInNifStatus.Int(), KErrNone, 
       
  7133 			_L("RPacketService::GetContextNameInNif failed."));
       
  7134 	ASSERT_EQUALS_DES16(contextName,secondaryContextId,_L("RPacketService::GetContextNameInNif did not returned the expected value."));
       
  7135 
       
  7136 	// Post notification for context's status change
       
  7137 	TExtEtelRequestStatus notifyContextStChStatus(primaryPacketContext, EPacketContextNotifyStatusChange);
       
  7138 	CleanupStack::PushL(notifyContextStChStatus);
       
  7139 	RPacketContext::TContextStatus packetContextStatus;
       
  7140 	primaryPacketContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);
       
  7141 
       
  7142 	// Post notification for secondary context's status change
       
  7143 	TExtEtelRequestStatus secondaryNotifyContextStChStatus(secondaryPacketContext, EPacketContextNotifyStatusChange);
       
  7144 	CleanupStack::PushL(secondaryNotifyContextStChStatus);
       
  7145 	RPacketContext::TContextStatus secondaryPacketContextStatus;
       
  7146     secondaryPacketContext.NotifyStatusChange(secondaryNotifyContextStChStatus, secondaryPacketContextStatus);
       
  7147 
       
  7148 	// Post notification for service's status change
       
  7149 	TExtEtelRequestStatus notifyServiceStChStatus(packetService, EPacketNotifyStatusChange);
       
  7150 	CleanupStack::PushL(notifyServiceStChStatus);
       
  7151 	RPacketService::TStatus packetServiceStatus;
       
  7152 	packetService.NotifyStatusChange(notifyServiceStChStatus, packetServiceStatus);
       
  7153     
       
  7154 	// Deactivate the NIF with RPacketService::DeactivateNIF and aContextName = name of primary context 
       
  7155     ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d</font>"), 10047);
       
  7156 	ASSERT_EQUALS(1,0, _L("Test leaving because it will cause TSY crash, remove this when defect is fixed"));
       
  7157 	TEST_CHECK_POINT_L(_L("test leaving..."));
       
  7158 	TExtEtelRequestStatus deactivateNifStatus(packetService, EPacketDeactivateNIF);
       
  7159 	CleanupStack::PushL(deactivateNifStatus);
       
  7160     packetService.DeactivateNIF(deactivateNifStatus,contextId);
       
  7161 	ASSERT_EQUALS(WaitForRequestWithTimeOut(deactivateNifStatus, ETimeMedium), KErrNone, 
       
  7162 			_L("RPacketService::DeactivateNIF timed out."));
       
  7163 	ASSERT_EQUALS(deactivateNifStatus.Int(), KErrNone, 
       
  7164 			_L("RPacketService::DeactivateNIF failed."));
       
  7165     
       
  7166 
       
  7167 	// ===  Check context and service statuses ===
       
  7168 
       
  7169 	// Check RPacketContext::NotifyStatusChange for primary context completes with EStatusDeactivating -> EStatusInactive
       
  7170 	RPacketContext::TContextStatus expectedPacketContextStatus = RPacketContext::EStatusDeactivating;
       
  7171 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  7172 			    primaryPacketContext,
       
  7173 				notifyContextStChStatus,
       
  7174 				packetContextStatus, 
       
  7175 				expectedPacketContextStatus,
       
  7176 				KErrNone);
       
  7177 	packetService.NotifyStatusChange(notifyServiceStChStatus, packetServiceStatus);
       
  7178 	
       
  7179 	//  -> EStatusInactive
       
  7180 	expectedPacketContextStatus = RPacketContext::EStatusInactive;
       
  7181 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  7182 			    primaryPacketContext,
       
  7183 				notifyContextStChStatus,
       
  7184 				packetContextStatus, 
       
  7185 				expectedPacketContextStatus,
       
  7186 				KErrNone);
       
  7187 
       
  7188 	// Check RPacketContext::GetStatus for primary context returns EStatusInactive
       
  7189 	ASSERT_EQUALS(primaryPacketContext.GetStatus(packetContextStatus), KErrNone, _L("RPacketContext::GetStatus returned with an error."));
       
  7190 	ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusInactive, _L("RPacketContext::GetStatus returns incorrect status."));
       
  7191 
       
  7192 	// Check RPacketContext::NotifyStatusChange for secondary context completes with EStatusDeactivating -> EStatusInactive
       
  7193     expectedPacketContextStatus = RPacketContext::EStatusDeactivating;
       
  7194 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  7195 				secondaryPacketContext,
       
  7196 				secondaryNotifyContextStChStatus,
       
  7197 				secondaryPacketContextStatus, 
       
  7198 				expectedPacketContextStatus,
       
  7199 				KErrNone);
       
  7200 
       
  7201 	//   ->  EStatusInactive
       
  7202     secondaryPacketContext.NotifyStatusChange(secondaryNotifyContextStChStatus, secondaryPacketContextStatus);
       
  7203     expectedPacketContextStatus = RPacketContext::EStatusInactive;
       
  7204 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  7205 				secondaryPacketContext,
       
  7206 				secondaryNotifyContextStChStatus,
       
  7207 				secondaryPacketContextStatus, 
       
  7208 				expectedPacketContextStatus,
       
  7209 				KErrNone);
       
  7210 
       
  7211 	// Check RPacketContext::GetStatus for secondary context returns EStatusInactive
       
  7212 	ASSERT_EQUALS(secondaryPacketContext.GetStatus(packetContextStatus), KErrNone, _L("RPacketContext::GetStatus returned with an error."));
       
  7213 	ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusInactive, _L("RPacketContext::GetStatus returns incorrect status."));
       
  7214 
       
  7215 	// Check RPacketService::NotifyStatusChange completes with EStatusAttached
       
  7216 	RPacketService::TStatus expectedPacketServiceStatus = RPacketService::EStatusAttached;
       
  7217 	iPacketServiceTestHelper.WaitForPacketServiceNotifyStatusChange(
       
  7218 				packetService,
       
  7219 				notifyServiceStChStatus,
       
  7220 				packetServiceStatus, 
       
  7221 				expectedPacketServiceStatus,
       
  7222 				KErrNone);
       
  7223 
       
  7224 	// Check RPacketService::GetStatus returns EStatusAttached
       
  7225 	RPacketService::TStatus pckSrvcStatus;
       
  7226 	ASSERT_EQUALS(packetService.GetStatus(pckSrvcStatus), KErrNone, _L("RPacketService::GetStatus returned with an error."));
       
  7227 	ASSERT_EQUALS(pckSrvcStatus, RPacketService::EStatusAttached, _L("RPacketService::GetStatus returns incorrect status."));
       
  7228 
       
  7229 	
       
  7230 	////////////////////////////////////////////////////////////////
       
  7231 	// TEST END
       
  7232 	////////////////////////////////////////////////////////////////
       
  7233     StartCleanup();
       
  7234 	
       
  7235 	// Pop:
       
  7236 	//	deactivateNifStatus
       
  7237 	//	notifyServiceStChStatus
       
  7238 	//	secondaryNotifyContextStChStatus
       
  7239 	//	notifyContextStChStatus
       
  7240 	//	getContextNameInNifStatus
       
  7241 	//	enumContextsInfStatus
       
  7242 	//	getNifInfoStatus
       
  7243 	//	enumerateNifsStatus
       
  7244 	//	notifyContextStatus
       
  7245 	CleanupStack::PopAndDestroy(9,&notifyContextStatus);
       
  7246 	
       
  7247 	return TestStepResult();
       
  7248 	}
       
  7249 
       
  7250 TPtrC CCTSYIntegrationTestPacketContext0030::GetTestStepName()
       
  7251 /**
       
  7252  * @return The test step name.
       
  7253  */
       
  7254 	{
       
  7255 	return _L("CCTSYIntegrationTestPacketContext0030");
       
  7256 	}
       
  7257 
       
  7258 
       
  7259 
       
  7260 CCTSYIntegrationTestPacketContext0031::CCTSYIntegrationTestPacketContext0031(CEtelSessionMgr& aEtelSessionMgr)
       
  7261 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
  7262 /**
       
  7263  * Constructor.
       
  7264  */
       
  7265 	{
       
  7266 	SetTestStepName(CCTSYIntegrationTestPacketContext0031::GetTestStepName());
       
  7267 	}
       
  7268 
       
  7269 CCTSYIntegrationTestPacketContext0031::~CCTSYIntegrationTestPacketContext0031()
       
  7270 /**
       
  7271  * Destructor.
       
  7272  */
       
  7273 	{
       
  7274 	}
       
  7275 
       
  7276 TVerdict CCTSYIntegrationTestPacketContext0031::doTestStepL()
       
  7277 /**
       
  7278  * @SYMTestCaseID BA-CTSY-INT-PKTC-0031
       
  7279  * @SYMFssID BA/CTSY/PKTC-0031
       
  7280  * @SYMTestCaseDesc Deactivate NIF when there is only one NIF.
       
  7281  * @SYMTestPriority High
       
  7282  * @SYMTestActions RPacketService::GetStatus, RPacketService::EnumerateContextsInNif, RPacketService::EnumerateContexts, RPacketContext::NotifyStatusChange, RPacketContext::GetStatus, RPacketService::DeactivateNIF, RPacketService::GetNifInfo, RPacketService::DeactivateNIF, RPacketService::GetNifInfo, RPacketService::DeactivateNIF
       
  7283  * @SYMTestExpectedResults Pass - All contexts in NIF deactivated.
       
  7284  * @SYMTestType CIT
       
  7285  * @SYMTestCaseDependencies simulated/automatic
       
  7286  *
       
  7287  * Reason for test: Verify primary and secondary contexts in NIF are deactivated when secondary context name specified.
       
  7288  *
       
  7289  * @return - TVerdict code
       
  7290  */
       
  7291 	{
       
  7292 
       
  7293 	////////////////////////////////////////////////////////////////
       
  7294 	// SET UP
       
  7295 	////////////////////////////////////////////////////////////////
       
  7296 
       
  7297 
       
  7298 	// Call TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL		
       
  7299     RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
  7300 	CHECK_EQUALS_L(iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(phone), KErrNone, _L("TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL returned with an error"));
       
  7301     
       
  7302     //Check if we are on a simulated network
       
  7303  	iNetworkTestHelper.CheckPhoneConnectedToAniteL(phone);
       
  7304 
       
  7305 	//  ===  Ensure there is an active primary and secondary context. ===   
       
  7306 
       
  7307     // Get packet service
       
  7308 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, KMainPhone, KMainPacketService);
       
  7309 
       
  7310     // Ensure phone is attached to the packet service
       
  7311     SetAttachModeToWhenPossibleAndWaitForAttachL(packetService);
       
  7312     
       
  7313     // Open a primary PDP context
       
  7314 	RPacketContext& primaryPacketContext = iEtelSessionMgr.GetPrimaryPacketContextL(
       
  7315 											KMainServer,
       
  7316 											KMainPhone,
       
  7317 											KMainPacketService,
       
  7318 											KPrimaryPacketContext1);
       
  7319 
       
  7320     // Open a secondary PDP context	
       
  7321 	RPacketContext& secondaryPacketContext = iEtelSessionMgr.GetSecondaryPacketContextL(
       
  7322 												KMainServer,
       
  7323 												KMainPhone,
       
  7324 												KMainPacketService, 
       
  7325 												KPrimaryPacketContext1,
       
  7326 												KSecondaryPacketContext1);
       
  7327 	
       
  7328     // Activate primary context.											
       
  7329 	iPacketServiceTestHelper.ActivatePrimaryPacketContextL(phone, primaryPacketContext);
       
  7330 		
       
  7331 	// Activate the secondary context 1.
       
  7332 	ActivateSecondaryPacketContextL(secondaryPacketContext);
       
  7333 
       
  7334 
       
  7335 	////////////////////////////////////////////////////////////////
       
  7336 	// SET UP END
       
  7337 	////////////////////////////////////////////////////////////////
       
  7338 	
       
  7339 	StartTest();
       
  7340 	
       
  7341 	////////////////////////////////////////////////////////////////
       
  7342 	// TEST START
       
  7343 	////////////////////////////////////////////////////////////////
       
  7344 
       
  7345 	// Get context info	
       
  7346 	TExtEtelRequestStatus getContextInfo(packetService, EPacketGetContextInfo);
       
  7347 	CleanupStack::PushL(getContextInfo);
       
  7348 	RPacketService::TContextInfo contextInfo;
       
  7349 	TInt index = 0;
       
  7350 	packetService.GetContextInfo(getContextInfo, index, contextInfo);
       
  7351 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getContextInfo, ETimeLong), KErrNone, _L("RPacketService::GetContextInfo timed out"));
       
  7352 	ASSERT_TRUE(contextInfo.iName.Length() > 0, _L("RPacketService::GetContextInfo returned with zero length context name"));
       
  7353 	index = 1;
       
  7354 	RPacketService::TContextInfo contextInfo2;
       
  7355 	packetService.GetContextInfo(getContextInfo, index, contextInfo2);
       
  7356 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getContextInfo, ETimeLong), KErrNone, _L("RPacketService::GetContextInfo timed out"));
       
  7357 	ASSERT_TRUE(contextInfo2.iName.Length() > 0, _L("RPacketService::GetContextInfo returned with zero length context name"));
       
  7358 	
       
  7359 	// Check RPacketService::EnumerateNifs returns aCount = 1
       
  7360 	TExtEtelRequestStatus nifsStatus(packetService, EPacketEnumerateNifs);
       
  7361 	CleanupStack::PushL(nifsStatus);
       
  7362 	TInt nifCount = 0;
       
  7363 	const TInt wantedCount = 1;
       
  7364 	packetService.EnumerateNifs(nifsStatus, nifCount);
       
  7365 	ASSERT_EQUALS(WaitForRequestWithTimeOut(nifsStatus, ETimeLong), KErrNone, _L("RPacketService::EnumerateNifs timed out."));
       
  7366 	ASSERT_EQUALS(nifCount, wantedCount, _L("RPacketService::EnumerateNifs returned with an error."));
       
  7367 	
       
  7368 	// Check RPacketService::GetNifInfo with aCount = 0 returns valid name in iContextName
       
  7369 	TExtEtelRequestStatus nifInfoStatus(packetService, EPacketGetNifInfo);
       
  7370 	CleanupStack::PushL(nifInfoStatus);
       
  7371 	TInt nifInfoCount = 0;
       
  7372 	RPacketService::TNifInfoV2 nifInfoV2;
       
  7373 	RPacketService::TNifInfoV2Pckg nifInfoV2Pkg(nifInfoV2);
       
  7374 	packetService.GetNifInfo(nifInfoStatus, nifInfoCount, nifInfoV2Pkg);
       
  7375 
       
  7376 	ASSERT_EQUALS(WaitForRequestWithTimeOut(nifInfoStatus, ETimeLong), KErrNone, _L("RPacketService::GetNifInfo returned an error"));
       
  7377 	ASSERT_TRUE(nifInfoV2.iContextName.Length() > 0, _L("RPacketService::GetNifInfo with valid name  returned with an error"));
       
  7378 
       
  7379 	// Check RPacketService::GetNifInfo with aCount = 0 returns iNumberOfContexts = 2
       
  7380 	ASSERT_EQUALS(nifInfoV2.iNumberOfContexts, 2, _L("RPacketService::GetNifInfo returned with incorrect number of contexts"));
       
  7381 
       
  7382 	// Check RPacketService::GetNifInfo with aCount = 0 returns iNifStatus = EStatusActive
       
  7383 	ASSERT_EQUALS(nifInfoV2.iNifStatus, RPacketContext::EStatusActive, _L("RPacketService::GetNifInfo returned with incorrect NIF status"));
       
  7384 
       
  7385 	// Check RPacketService::GetNifInfo with aCount = 0 returns valid address in iPdpAddress
       
  7386  	ASSERT_TRUE(nifInfoV2.iPdpAddress.Length() > 0, _L("RPacketService::GetNifInfo returned with invalid pdp address"));
       
  7387 
       
  7388 	// Check RPacketService::GetNifInfo with aCount = 0 returns EExternalContext
       
  7389 	// $CTSYProblem:RPacketService::GetNifInfo always returns EInternalContext
       
  7390     // Changed test procedure to check for EInternalContext instead of EExternalContext
       
  7391 	ASSERT_EQUALS(nifInfoV2.iContextType, RPacketService::EInternalContext, _L("RPacketService::GetNifInfo returned wrong context type."));
       
  7392 
       
  7393 	// Check RPacketService::GetNifInfo with aCount = 1 returns KErrArgument
       
  7394 	nifInfoCount = 1;
       
  7395 	packetService.GetNifInfo(nifInfoStatus, nifInfoCount, nifInfoV2Pkg);
       
  7396 	ASSERT_EQUALS(WaitForRequestWithTimeOut(nifInfoStatus, ETimeLong), KErrNone, _L("RPacketService::GetNifInfo returned an error"));	
       
  7397 	ASSERT_EQUALS(nifInfoStatus.Int(), KErrArgument, _L("RPacketService::GetNifInfo did not failed."));
       
  7398 
       
  7399 	// Check RPacketService::EnumerateContextsInNif with aExistingContextName = existing primary context name returns aCount = 2
       
  7400 	TExtEtelRequestStatus reqContextNifStatus(packetService, EPacketEnumerateContextsInNif);
       
  7401 	CleanupStack::PushL(reqContextNifStatus);	
       
  7402 	packetService.EnumerateContextsInNif(reqContextNifStatus, contextInfo.iName, nifCount);
       
  7403 	ASSERT_EQUALS(WaitForRequestWithTimeOut(reqContextNifStatus, ETimeLong), KErrNone, _L("RPacketContext::EnumerateContextsInNif timed out."));
       
  7404 	ASSERT_EQUALS(nifCount, 2, _L("RPacketContext::EnumerateContextsInNif did not return 2 as expected"));
       
  7405 
       
  7406 	// Check RPacketService::GetContextNameInNif with aExistingContextName = existing primary context name and aIndex = 0 returns aContextName = name of primary context
       
  7407 	TName contextName;
       
  7408 	TExtEtelRequestStatus getContextNameInNifStatus(packetService, EPacketGetContextNameInNif);
       
  7409 	CleanupStack::PushL(getContextNameInNifStatus);	
       
  7410 	packetService.GetContextNameInNif(getContextNameInNifStatus, contextInfo.iName, 0, contextName);
       
  7411 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getContextNameInNifStatus, ETimeMedium), KErrNone, _L("RPacketService::GetContextNameInNif timed out."));
       
  7412 	ASSERT_EQUALS(getContextNameInNifStatus.Int(), KErrNone, _L("RPacketService::GetContextNameInNif returned with an error."));
       
  7413 	ASSERT_EQUALS_DES16(contextName,contextInfo.iName,_L("RPacketService::GetContextNameInNif did not returned the expected value."));
       
  7414 
       
  7415 	// Check RPacketService::GetContextNameInNif with aExistingContextName = existing primary context name and aIndex = 1 returns aContextName = name of secondary context
       
  7416 	packetService.GetContextNameInNif(getContextNameInNifStatus,contextInfo.iName, 1, contextName);
       
  7417 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getContextNameInNifStatus, ETimeMedium), KErrNone, _L("RPacketService::GetContextNameInNif timed out."));
       
  7418 	ASSERT_EQUALS(getContextNameInNifStatus.Int(), KErrNone, _L("RPacketService::GetContextNameInNif returned with an error."));
       
  7419 	ASSERT_EQUALS_DES16(contextName, contextInfo2.iName,_L("RPacketService::GetContextNameInNif did not returned the expected value."));
       
  7420 
       
  7421 	// Post notification for service's status change
       
  7422 	TExtEtelRequestStatus notifyServiceStChStatus(packetService, EPacketNotifyStatusChange);
       
  7423 	CleanupStack::PushL(notifyServiceStChStatus);
       
  7424 	RPacketService::TStatus packetServiceStatus;
       
  7425 	packetService.NotifyStatusChange(notifyServiceStChStatus, packetServiceStatus);
       
  7426 	
       
  7427 	// Post notification for primary context status change
       
  7428 	TExtEtelRequestStatus notifyContextStChStatus(primaryPacketContext, EPacketContextNotifyStatusChange);
       
  7429 	CleanupStack::PushL(notifyContextStChStatus);
       
  7430 	RPacketContext::TContextStatus packetContextStatus;
       
  7431 	primaryPacketContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);
       
  7432 																
       
  7433 	// Post notification for secondary context status change
       
  7434 	TExtEtelRequestStatus notifySecondaryContextStChStatus(secondaryPacketContext, EPacketContextNotifyStatusChange);
       
  7435 	CleanupStack::PushL(notifySecondaryContextStChStatus);
       
  7436 	RPacketContext::TContextStatus secPacketContextStatus;
       
  7437 	secondaryPacketContext.NotifyStatusChange(notifySecondaryContextStChStatus, secPacketContextStatus);
       
  7438 
       
  7439 	// Deactivate the NIF with RPacketService::DeactivateNIF and aContextName = name of secondary context 
       
  7440     ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d</font>"), 10047);
       
  7441 	ASSERT_EQUALS(1,0, _L("Test leaving because it will cause TSY crash, remove this when defect is fixed"));
       
  7442 	TEST_CHECK_POINT_L(_L("test leaving..."));
       
  7443 	TExtEtelRequestStatus deactivateNifStatus(packetService, EPacketDeactivateNIF);
       
  7444 	CleanupStack::PushL(deactivateNifStatus);
       
  7445     packetService.DeactivateNIF(deactivateNifStatus,contextInfo2.iName);
       
  7446 	ASSERT_EQUALS(WaitForRequestWithTimeOut(deactivateNifStatus, ETimeMedium), KErrNone, _L("RPacketService::DeactivateNIF timed out."));
       
  7447 	ASSERT_EQUALS(deactivateNifStatus.Int(), KErrNone, _L("RPacketService::DeactivateNIF returned with an error."));
       
  7448 	
       
  7449 	// ===  Check context and service statuses ===
       
  7450 
       
  7451 	// Check RPacketContext::NotifyStatusChange for primary context completes with EStatusDeactivating -> EStatusInactive
       
  7452 	RPacketContext::TContextStatus expectedPacketContextStatus = RPacketContext::EStatusDeactivating;
       
  7453 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  7454 			    primaryPacketContext,
       
  7455 				notifyContextStChStatus,
       
  7456 				packetContextStatus, 
       
  7457 				expectedPacketContextStatus,
       
  7458 				KErrNone);
       
  7459 				
       
  7460     primaryPacketContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);	
       
  7461 	expectedPacketContextStatus = RPacketContext::EStatusInactive;
       
  7462 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  7463 			    primaryPacketContext,
       
  7464 				notifyContextStChStatus,
       
  7465 				packetContextStatus, 
       
  7466 				expectedPacketContextStatus,
       
  7467 				KErrNone);
       
  7468 				
       
  7469 	// Check RPacketContext::GetStatus for primary context returns EStatusInactive
       
  7470 	ASSERT_EQUALS(primaryPacketContext.GetStatus(packetContextStatus), KErrNone, _L("RPacketContext::GetStatus for primary context returned with an error."));
       
  7471 	ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusInactive, _L("RPacketContext::GetStatus returns incorrect status."));
       
  7472 
       
  7473 	// Check RPacketContext::NotifyStatusChange for secondary context completes with EStatusDeactivating -> EStatusInactive
       
  7474 	RPacketContext::TContextStatus expectedSecondaryPacketContextStatus = RPacketContext::EStatusDeactivating;
       
  7475    	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  7476 				secondaryPacketContext,
       
  7477 				notifySecondaryContextStChStatus,
       
  7478 				secPacketContextStatus, 
       
  7479 				expectedSecondaryPacketContextStatus,
       
  7480 				KErrNone);
       
  7481 				
       
  7482 	secondaryPacketContext.NotifyStatusChange(notifySecondaryContextStChStatus, secPacketContextStatus);
       
  7483 	expectedSecondaryPacketContextStatus = RPacketContext::EStatusInactive;	
       
  7484 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  7485 				secondaryPacketContext,
       
  7486 				notifySecondaryContextStChStatus,
       
  7487 				secPacketContextStatus, 
       
  7488 				expectedSecondaryPacketContextStatus,
       
  7489 				KErrNone);
       
  7490 
       
  7491 	// Check RPacketContext::GetStatus for secondary context returns EStatusInactive
       
  7492 	ASSERT_EQUALS(secondaryPacketContext.GetStatus(secPacketContextStatus), KErrNone, _L("RPacketContext::GetStatus for secondary context returned with an error."));
       
  7493 	ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusInactive, _L("RPacketContext::GetStatus returns incorrect status."));
       
  7494 
       
  7495 	// Check RPacketService::NotifyStatusChange completes with EStatusAttached
       
  7496 	RPacketService::TStatus expectedPacketServiceStatus = RPacketService::EStatusAttached;
       
  7497 	iPacketServiceTestHelper.WaitForPacketServiceNotifyStatusChange(
       
  7498 				packetService,
       
  7499 				notifyServiceStChStatus,
       
  7500 				packetServiceStatus, 
       
  7501 				expectedPacketServiceStatus,
       
  7502 				KErrNone);
       
  7503 				
       
  7504 	// Check RPacketService::GetStatus returns EStatusAttached
       
  7505 	ASSERT_EQUALS(packetService.GetStatus(packetServiceStatus), KErrNone, _L("RPacketService::GetStatus return error."));
       
  7506 	ASSERT_EQUALS(packetServiceStatus, RPacketService::EStatusAttached, _L("RPacketService::GetStatus returns incorrect status."));
       
  7507 
       
  7508 	
       
  7509 	////////////////////////////////////////////////////////////////
       
  7510 	// TEST END
       
  7511 	////////////////////////////////////////////////////////////////
       
  7512 
       
  7513     StartCleanup();
       
  7514 	
       
  7515 	// Pop:
       
  7516 	// notifyServiceStChStatus
       
  7517 	// notifyContextStChStatus
       
  7518 	// notifySecondaryContextStChStatus
       
  7519 	// getContextInfo
       
  7520 	// nifsStatus
       
  7521 	// nifInfoStatus
       
  7522 	// reqContextNifStatus
       
  7523 	// getContextNameInNifStatus
       
  7524 	// deactivateNifStatus	
       
  7525 	CleanupStack::PopAndDestroy(9,&notifyServiceStChStatus);
       
  7526 	
       
  7527 	return TestStepResult();
       
  7528 	}
       
  7529 
       
  7530 TPtrC CCTSYIntegrationTestPacketContext0031::GetTestStepName()
       
  7531 /**
       
  7532  * @return The test step name.
       
  7533  */
       
  7534 	{
       
  7535 	return _L("CCTSYIntegrationTestPacketContext0031");
       
  7536 	}
       
  7537 
       
  7538 
       
  7539 
       
  7540 CCTSYIntegrationTestPacketContext0032::CCTSYIntegrationTestPacketContext0032(CEtelSessionMgr& aEtelSessionMgr)
       
  7541 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
  7542 /**
       
  7543  * Constructor.
       
  7544  */
       
  7545 	{
       
  7546 	SetTestStepName(CCTSYIntegrationTestPacketContext0032::GetTestStepName());
       
  7547 	}
       
  7548 
       
  7549 CCTSYIntegrationTestPacketContext0032::~CCTSYIntegrationTestPacketContext0032()
       
  7550 /**
       
  7551  * Destructor.
       
  7552  */
       
  7553 	{
       
  7554 	}
       
  7555 
       
  7556 TVerdict CCTSYIntegrationTestPacketContext0032::doTestStepL()
       
  7557 /**
       
  7558  * @SYMTestCaseID BA-CTSY-INT-PKTC-0032
       
  7559  * @SYMFssID BA/CTSY/PKTC-0032
       
  7560  * @SYMTestCaseDesc Deactivate NIF when there is more than one NIF.
       
  7561  * @SYMTestPriority High
       
  7562  * @SYMTestActions RPacketService::EnumerateNifs, RPacketService::GetNifInfo, RPacketService::GetContextNameInNif, RPacketContext::NotifyStatusChange, RPacketService::DeactivateNIF, RPacketService::GetStatus, RPacketService::EnumerateContextsInNif
       
  7563  * @SYMTestExpectedResults Pass - All contexts in NIF deactivated. Other contexts unaffected.
       
  7564  * @SYMTestType CIT
       
  7565  * @SYMTestCaseDependencies simulated/automatic
       
  7566  *
       
  7567  * Reason for test: Verify primary and secondary contexts in NIF are deactivated when primary context name specified
       
  7568 
       
  7569 Verify contexts in another NIF are not affected.
       
  7570  *
       
  7571  * @return - TVerdict code
       
  7572  */
       
  7573 	{
       
  7574 
       
  7575 	////////////////////////////////////////////////////////////////
       
  7576 	// SET UP
       
  7577 	////////////////////////////////////////////////////////////////
       
  7578 
       
  7579 	
       
  7580 	// === Ensure there is an 2 primary contexts active. Each of these must have an active secondary context opened from it. (Primary 1 and secondary 1 in one NIF and primary 2 and secondary 2 in the second NIF.) ===
       
  7581 	
       
  7582  	// Call TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL		
       
  7583     RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
  7584 	CHECK_EQUALS_L(iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(phone), KErrNone, _L("TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL returned with an error"));
       
  7585   
       
  7586   	//Check if we are on a simulated network
       
  7587  	iNetworkTestHelper.CheckPhoneConnectedToAniteL(phone);
       
  7588  	
       
  7589     // Get packet service
       
  7590 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, KMainPhone, KMainPacketService);
       
  7591 
       
  7592     // Ensure phone is attached to the packet service
       
  7593     SetAttachModeToWhenPossibleAndWaitForAttachL(packetService);
       
  7594     
       
  7595     // Post notification for the RPacketService::NotifyContextAdded
       
  7596    	TExtEtelRequestStatus notifyContextPrimary1Status(packetService, EPacketNotifyContextAdded);
       
  7597 	CleanupStack::PushL(notifyContextPrimary1Status);
       
  7598 	
       
  7599     // Open a primary PDP context 1
       
  7600     TName primaryContextId1;
       
  7601     packetService.NotifyContextAdded(notifyContextPrimary1Status, primaryContextId1);
       
  7602 	RPacketContext& primaryPacketContext = iEtelSessionMgr.GetPrimaryPacketContextL(
       
  7603 											KMainServer,
       
  7604 											KMainPhone,
       
  7605 											KMainPacketService,
       
  7606 											KPrimaryPacketContext1);
       
  7607 											
       
  7608 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(notifyContextPrimary1Status, ETimeMedium), KErrNone, _L("RPacketService::NotifyContextAdded did not complete."));
       
  7609 	CHECK_EQUALS_L(notifyContextPrimary1Status.Int(), KErrNone, _L("RPacketService::NotifyContextAdded returned with error status."));										
       
  7610 											
       
  7611 	// Post notification for the RPacketService::NotifyContextAdded
       
  7612    	TExtEtelRequestStatus notifyContextPrimary2Status(packetService, EPacketNotifyContextAdded);
       
  7613 	CleanupStack::PushL(notifyContextPrimary2Status);
       
  7614 	
       
  7615     // Open a primary PDP context 2 
       
  7616     TName primaryContextId2;
       
  7617     packetService.NotifyContextAdded(notifyContextPrimary2Status, primaryContextId2);
       
  7618 	RPacketContext& primaryPacketContext2 = iEtelSessionMgr.GetPrimaryPacketContextL(
       
  7619 											KMainServer,
       
  7620 											KMainPhone,
       
  7621 											KMainPacketService,
       
  7622 											KPrimaryPacketContext2);
       
  7623 											
       
  7624 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(notifyContextPrimary2Status, ETimeMedium), KErrNone, _L("RPacketService::NotifyContextAdded did not complete."));
       
  7625 	CHECK_EQUALS_L(notifyContextPrimary2Status.Int(), KErrNone, _L("RPacketService::NotifyContextAdded returned with error status."));
       
  7626 		
       
  7627 	// Activate primary context 1.											
       
  7628 	iPacketServiceTestHelper.ActivatePrimaryPacketContextL(phone, primaryPacketContext);
       
  7629 	
       
  7630 	// Activate primary context 2.											
       
  7631 	iPacketServiceTestHelper.ActivatePrimaryPacketContextL(phone, primaryPacketContext2, 2);
       
  7632 	
       
  7633 	// Post notification for the RPacketService::NotifyContextAdded
       
  7634    	TExtEtelRequestStatus notifyContextSecondary1Status(packetService, EPacketNotifyContextAdded);
       
  7635 	CleanupStack::PushL(notifyContextSecondary1Status);	
       
  7636 	
       
  7637 	// Open a secondary PDP context 1. 
       
  7638 	TName secondaryContextId1;		
       
  7639 	packetService.NotifyContextAdded(notifyContextSecondary1Status, secondaryContextId1);
       
  7640 	RPacketContext& secondaryPacketContext = iEtelSessionMgr.GetSecondaryPacketContextL(
       
  7641 												KMainServer,
       
  7642 												KMainPhone,
       
  7643 												KMainPacketService, 
       
  7644 												KPrimaryPacketContext1,
       
  7645 												KSecondaryPacketContext1);
       
  7646 												
       
  7647 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(notifyContextSecondary1Status, ETimeMedium), KErrNone, _L("RPacketService::NotifyContextAdded did not complete."));
       
  7648 	CHECK_EQUALS_L(notifyContextSecondary1Status.Int(), KErrNone, _L("RPacketService::NotifyContextAdded returned with error status."));
       
  7649 																									
       
  7650 	// Post notification for the RPacketService::NotifyContextAdded
       
  7651    	TExtEtelRequestStatus notifyContextSecondary2Status(packetService, EPacketNotifyContextAdded);
       
  7652 	CleanupStack::PushL(notifyContextSecondary2Status);
       
  7653 													
       
  7654 	// Open a secondary PDP context 2. 
       
  7655 	// $CTSYProblem LTSY dose not allow us to initialise 4 packets contexts
       
  7656 
       
  7657 	// Activate the secondary context 1.
       
  7658 	CHECK_TRUE_L(ActivateSecondaryPacketContextL(secondaryPacketContext, KPrimaryPacketContext1, KSecondaryPacketContext1),_L("Can't activate the secondary context"));
       
  7659 
       
  7660 	// Activate the secondary context 2.
       
  7661 	// $CTSYProblem LTSY dose not allow us to initialise 4 packets contexts
       
  7662 
       
  7663 
       
  7664 	////////////////////////////////////////////////////////////////
       
  7665 	// SET UP END
       
  7666 	////////////////////////////////////////////////////////////////
       
  7667 	
       
  7668 	StartTest();
       
  7669 	
       
  7670 	////////////////////////////////////////////////////////////////
       
  7671 	// TEST START
       
  7672 	////////////////////////////////////////////////////////////////
       
  7673 	
       
  7674 	
       
  7675 	// Check RPacketService::EnumerateNifs returns aCount = 2
       
  7676 	TExtEtelRequestStatus nifsStatus(packetService, EPacketEnumerateNifs);
       
  7677 	CleanupStack::PushL(nifsStatus);
       
  7678 	TInt nifCount = 0;
       
  7679 	const TInt wantedCount = 2;
       
  7680 	packetService.EnumerateNifs(nifsStatus, nifCount);
       
  7681 	ASSERT_EQUALS(WaitForRequestWithTimeOut(nifsStatus, ETimeLong), KErrNone, _L("RPacketService::EnumerateNifs timed out."));
       
  7682 	ASSERT_EQUALS(nifCount, wantedCount, _L("RPacketService::EnumerateNifs returned with an error."));
       
  7683 	
       
  7684 	// Check RPacketService::GetNifInfo with aCount = 0 returns valid name in iContextName
       
  7685 	// Check RPacketService::GetNifInfo with aCount = 0 returns iNumberOfContexts = 2
       
  7686 	// Check RPacketService::GetNifInfo with aCount = 0 returns iNifStatus = EStatusActive
       
  7687 	// Check RPacketService::GetNifInfo with aCount = 0 returns valid address in iPdpAddress
       
  7688 	// Check RPacketService::GetNifInfo with aCount = 0 returns EExternalContext
       
  7689 	// Check RPacketService::GetNifInfo with aCount = 1 returns valid name in iContextName
       
  7690 	// Check RPacketService::GetNifInfo with aCount = 1 returns iNumberOfContexts = 2
       
  7691 	// Check RPacketService::GetNifInfo with aCount = 1 returns iNifStatus = EStatusActive
       
  7692 	// Check RPacketService::GetNifInfo with aCount = 1 returns valid address in iPdpAddress
       
  7693 	// Check RPacketService::GetNifInfo with aCount = 1 returns EExternalContext
       
  7694 	// Check RPacketService::GetNifInfo with aCount = 2 returns KErrArgument
       
  7695 	TExtEtelRequestStatus nifInfoStatus(packetService, EPacketGetNifInfo);
       
  7696 	CleanupStack::PushL(nifInfoStatus);
       
  7697 	TInt nifInfoCount = 0;
       
  7698 	RPacketService::TNifInfoV2 nifInfoV2;
       
  7699 	RPacketService::TNifInfoV2Pckg nifInfoV2Pkg(nifInfoV2);
       
  7700 	packetService.GetNifInfo(nifInfoStatus, nifInfoCount, nifInfoV2Pkg);
       
  7701 
       
  7702 	ASSERT_EQUALS(WaitForRequestWithTimeOut(nifInfoStatus, ETimeLong), KErrNone, _L("RPacketService::GetNifInfo returned an error"));
       
  7703 	ASSERT_TRUE(nifInfoV2.iContextName.Length() > 0, _L("RPacketService::GetNifInfo with aCount = 0 returned with invalid iContextName"));
       
  7704 	ASSERT_EQUALS(nifInfoV2.iNumberOfContexts, 2, _L("RPacketService::GetNifInfo with iNumberOfContexts returned with an error"));
       
  7705 	ASSERT_EQUALS(nifInfoV2.iNifStatus, RPacketContext::EStatusActive, _L("RPacketService::GetNifInfo with iNifStatus returned with an error"));
       
  7706  	ASSERT_TRUE(nifInfoV2.iPdpAddress.Length() > 0, _L("RPacketService::GetNifInfo returned with invalid pdp address"));
       
  7707 	ASSERT_EQUALS(nifInfoV2.iContextType, RPacketService::EExternalContext, _L("RPacketService::GetNifInfo with iContextType returned with an error"));
       
  7708 
       
  7709 	nifInfoCount = 1;
       
  7710 	RPacketService::TNifInfoV2 secondNifInfoV2;
       
  7711 	RPacketService::TNifInfoV2Pckg secondNifInfoV2V2Pkg(secondNifInfoV2);
       
  7712 	packetService.GetNifInfo(nifInfoStatus,nifInfoCount,secondNifInfoV2V2Pkg);
       
  7713 	ASSERT_EQUALS(WaitForRequestWithTimeOut(nifInfoStatus, ETimeMedium), KErrNone, _L("RPacketService::GetNifInfo timed out."));
       
  7714 	ASSERT_EQUALS(nifInfoStatus.Int(), KErrNone, _L("RPacketService::GetNifInfo returned with error."));
       
  7715 	ASSERT_TRUE(secondNifInfoV2.iContextName.Length() > 0, _L("RPacketService::GetNifInfo with aCount = 0 returned with invalid iContextName"));
       
  7716 	ASSERT_EQUALS(secondNifInfoV2.iNumberOfContexts, 2, _L("RPacketService::GetNifInfo with iNumberOfContexts returned with an error"));
       
  7717 	ASSERT_EQUALS(secondNifInfoV2.iNifStatus, RPacketContext::EStatusActive, _L("RPacketService::GetNifInfo with iNifStatus returned with an error"));
       
  7718  	ASSERT_TRUE(secondNifInfoV2.iPdpAddress.Length() > 0, _L("RPacketService::GetNifInfo returned with invalid pdp address"));
       
  7719 	ASSERT_EQUALS(secondNifInfoV2.iContextType, RPacketService::EExternalContext, _L("RPacketService::GetNifInfo with iContextType returned with an error"));
       
  7720 	
       
  7721 	nifInfoCount = 2;
       
  7722 	packetService.GetNifInfo(nifInfoStatus,nifInfoCount,nifInfoV2Pkg);
       
  7723 	ASSERT_EQUALS(WaitForRequestWithTimeOut(nifInfoStatus, ETimeMedium), KErrNone, _L("RPacketService::GetNifInfo timed out."));
       
  7724 	ASSERT_EQUALS(nifInfoStatus.Int(), KErrArgument, _L("RPacketService::GetNifInfo did not returned with error."));
       
  7725 	
       
  7726 	// Check RPacketService::EnumerateContextsInNif with aExistingContextName = primary 1 returns aCount = 2
       
  7727 	// Check RPacketService::EnumerateContextsInNif with aExistingContextName = primary 2 returns aCount = 2
       
  7728 	// Check RPacketService::EnumerateContextsInNif with aExistingContextName = secondary 1 returns aCount = 2
       
  7729 	// Check RPacketService::EnumerateContextsInNif with aExistingContextName = secondary 2 returns aCount = 2
       
  7730 	TInt wantedNifCount = 2;
       
  7731 	TExtEtelRequestStatus enumerateContextsInNifStatus(packetService, EPacketEnumerateContextsInNif);
       
  7732 	CleanupStack::PushL(enumerateContextsInNifStatus);
       
  7733 	packetService.EnumerateContextsInNif(enumerateContextsInNifStatus, primaryContextId1, nifCount);
       
  7734 	ASSERT_EQUALS(WaitForRequestWithTimeOut(enumerateContextsInNifStatus, ETimeLong), KErrNone, _L("RPacketContext::EnumerateContextsInNif timed out."));
       
  7735 	ASSERT_EQUALS(nifCount, wantedNifCount, _L("RPacketContext::EnumerateContextsInNif did not return 2 as expected."));
       
  7736 	
       
  7737 	nifCount = 0;
       
  7738 	packetService.EnumerateContextsInNif(enumerateContextsInNifStatus, primaryContextId2, nifCount);
       
  7739 	ASSERT_EQUALS(WaitForRequestWithTimeOut(enumerateContextsInNifStatus, ETimeLong), KErrNone, _L("RPacketContext::EnumerateContextsInNif timed out."));
       
  7740 	ASSERT_EQUALS(nifCount, wantedNifCount, _L("RPacketContext::EnumerateContextsInNif did not return 2 as expected."));
       
  7741 	
       
  7742 	nifCount = 0;
       
  7743 	packetService.EnumerateContextsInNif(enumerateContextsInNifStatus, secondaryContextId1, nifCount);
       
  7744 	ASSERT_EQUALS(WaitForRequestWithTimeOut(enumerateContextsInNifStatus, ETimeLong), KErrNone, _L("RPacketContext::EnumerateContextsInNif timed out."));
       
  7745 	ASSERT_EQUALS(nifCount, wantedNifCount, _L("RPacketContext::EnumerateContextsInNif did not return 2 as expected."));
       
  7746 	
       
  7747 	nifCount = 0;	
       
  7748 	// $CTSYProblem LTSY dose not allow us to initialise 4 packets contexts
       
  7749 	
       
  7750 	// Check RPacketService::GetContextNameInNif with aExistingContextName = primary 1 and aIndex = 0 returns aContextName = name of primary context 1
       
  7751 	// Check RPacketService::GetContextNameInNif with aExistingContextName = primary 1 and aIndex = 1 returns aContextName = name of secondary context 1
       
  7752 	// Check RPacketService::GetContextNameInNif with aExistingContextName = secondary 1 and aIndex = 0 returns aContextName = name of primary context 1
       
  7753 	// Check RPacketService::GetContextNameInNif with aExistingContextName = secondary 1 and aIndex = 1 returns aContextName = name of secondary context 1
       
  7754 	// Check RPacketService::GetContextNameInNif with aExistingContextName = primary 2 and aIndex = 0 returns aContextName = name of primary context 2
       
  7755 	// Check RPacketService::GetContextNameInNif with aExistingContextName = primary 2 and aIndex = 1 returns aContextName = name of secondary context 2
       
  7756 	// Check RPacketService::GetContextNameInNif with aExistingContextName = secondary 2 and aIndex = 0 returns aContextName = name of primary context 2
       
  7757 	// Check RPacketService::GetContextNameInNif with aExistingContextName = secondary 2 and aIndex = 1 returns aContextName = name of secondary context 2
       
  7758     TExtEtelRequestStatus contextNameNifsStatus(packetService, EPacketGetContextNameInNif);
       
  7759 	CleanupStack::PushL(contextNameNifsStatus);
       
  7760 	TInt index = 0;	
       
  7761 	TName returnedContextName;
       
  7762 	packetService.GetContextNameInNif(contextNameNifsStatus, primaryContextId1, index, returnedContextName );
       
  7763 	ASSERT_EQUALS(WaitForRequestWithTimeOut(contextNameNifsStatus, ETimeLong), KErrNone, _L("RPacketContext::GetContextNameInNif timed out."));
       
  7764 	ASSERT_EQUALS(contextNameNifsStatus.Int(), KErrNone, _L("RPacketContext::GetContextNameInNif returned error"));
       
  7765 	ASSERT_EQUALS_DES16(returnedContextName, primaryContextId1, _L("RPacketContext::GetContextNameInNif with aExistingContextName = existing context name returned with an error"));
       
  7766 
       
  7767 	index = 1;
       
  7768 	packetService.GetContextNameInNif(contextNameNifsStatus, primaryContextId1, index, returnedContextName );
       
  7769 	ASSERT_EQUALS(WaitForRequestWithTimeOut(contextNameNifsStatus, ETimeLong), KErrNone, _L("RPacketContext::GetContextNameInNif timed out."));
       
  7770 	ASSERT_EQUALS(contextNameNifsStatus.Int(), KErrNone, _L("RPacketContext::GetContextNameInNif returned error"));
       
  7771 	ASSERT_EQUALS_DES16(returnedContextName, secondaryContextId1, _L("RPacketContext::GetContextNameInNif with aExistingContextName = existing context name returned with an error"));	
       
  7772 
       
  7773 	index = 0;
       
  7774 	packetService.GetContextNameInNif(contextNameNifsStatus, secondaryContextId1, index, returnedContextName );
       
  7775 	ASSERT_EQUALS(WaitForRequestWithTimeOut(contextNameNifsStatus, ETimeLong), KErrNone, _L("RPacketContext::GetContextNameInNif timed out."));
       
  7776 	ASSERT_EQUALS(contextNameNifsStatus.Int(), KErrNone, _L("RPacketContext::GetContextNameInNif returned error"));
       
  7777 	ASSERT_EQUALS_DES16(returnedContextName, primaryContextId1, _L("RPacketContext::GetContextNameInNif with aExistingContextName = existing context name returned with an error"));
       
  7778 
       
  7779 	index = 1;
       
  7780 	packetService.GetContextNameInNif(contextNameNifsStatus, secondaryContextId1, index, returnedContextName );
       
  7781 	ASSERT_EQUALS(WaitForRequestWithTimeOut(contextNameNifsStatus, ETimeLong), KErrNone, _L("RPacketContext::GetContextNameInNif timed out."));
       
  7782 	ASSERT_EQUALS(contextNameNifsStatus.Int(), KErrNone, _L("RPacketContext::GetContextNameInNif returned error"));
       
  7783 	ASSERT_EQUALS_DES16(returnedContextName, secondaryContextId1, _L("RPacketContext::GetContextNameInNif with aExistingContextName = existing context name returned with an error"));
       
  7784 
       
  7785 	index = 0;
       
  7786 	packetService.GetContextNameInNif(contextNameNifsStatus, primaryContextId2, index, returnedContextName );
       
  7787 	ASSERT_EQUALS(WaitForRequestWithTimeOut(contextNameNifsStatus, ETimeLong), KErrNone, _L("RPacketContext::GetContextNameInNif timed out."));
       
  7788 	ASSERT_EQUALS(contextNameNifsStatus.Int(), KErrNone, _L("RPacketContext::GetContextNameInNif returned error"));
       
  7789 	ASSERT_EQUALS_DES16(returnedContextName, primaryContextId2, _L("RPacketContext::GetContextNameInNif with aExistingContextName = existing context name returned with an error"));
       
  7790 
       
  7791 	index = 1;
       
  7792 	// $CTSYProblem LTSY dose not allow us to initialise 4 packets contexts
       
  7793 
       
  7794 	index = 0;
       
  7795 	// $CTSYProblem LTSY dose not allow us to initialise 4 packets contexts
       
  7796 
       
  7797 	index = 1;
       
  7798 	// $CTSYProblem LTSY dose not allow us to initialise 4 packets contexts
       
  7799 
       
  7800 	// Post notifications for primary & secondary context status changes
       
  7801 	// $CTSYProblem LTSY dose not allow us to initialise 4 packets contexts
       
  7802 	TExtEtelRequestStatus notifyprimaryContextStChStatus(primaryPacketContext, EPacketContextNotifyStatusChange);
       
  7803 	CleanupStack::PushL(notifyprimaryContextStChStatus);
       
  7804 	RPacketContext::TContextStatus primaryPacketContextStatus;
       
  7805 	primaryPacketContext.NotifyStatusChange(notifyprimaryContextStChStatus, primaryPacketContextStatus);
       
  7806 
       
  7807 	TExtEtelRequestStatus notifyprimary2ContextStChStatus(primaryPacketContext2, EPacketContextNotifyStatusChange);
       
  7808 	CleanupStack::PushL(notifyprimary2ContextStChStatus);
       
  7809 	RPacketContext::TContextStatus primaryPacketContext2Status;
       
  7810 	primaryPacketContext2.NotifyStatusChange(notifyprimary2ContextStChStatus, primaryPacketContext2Status);
       
  7811 
       
  7812 	TExtEtelRequestStatus notifySecondaryContextStChStatus(secondaryPacketContext, EPacketContextNotifyStatusChange);
       
  7813 	CleanupStack::PushL(notifySecondaryContextStChStatus);
       
  7814 	RPacketContext::TContextStatus secPacketContextStatus;
       
  7815 	secondaryPacketContext.NotifyStatusChange(notifySecondaryContextStChStatus, secPacketContextStatus);
       
  7816 	
       
  7817 		
       
  7818 	// Deactivate the NIF with RPacketService::DeactivateNIF and aContextName = name of primary 2 
       
  7819 	TExtEtelRequestStatus deactivateNifStatus(packetService, EPacketDeactivateNIF);
       
  7820 	CleanupStack::PushL(deactivateNifStatus);
       
  7821     packetService.DeactivateNIF(deactivateNifStatus,primaryContextId2);
       
  7822 	ASSERT_EQUALS(WaitForRequestWithTimeOut(deactivateNifStatus, ETimeMedium), KErrNone, _L("RPacketService::DeactivateNIF timed out."));
       
  7823 	ASSERT_EQUALS(deactivateNifStatus.Int(), KErrNone, _L("RPacketService::DeactivateNIF returned with error."));
       
  7824 	
       
  7825 	// ===  Check context and service statuses ===
       
  7826 
       
  7827 	// Check RPacketContext::NotifyStatusChange for primary 2 completes with EStatusDeactivating -> EStatusInactive
       
  7828 	RPacketContext::TContextStatus expectedPacketContextStatus = RPacketContext::EStatusDeactivating;
       
  7829 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  7830 			    primaryPacketContext2,
       
  7831 				notifyprimary2ContextStChStatus,
       
  7832 				primaryPacketContext2Status, 
       
  7833 				expectedPacketContextStatus,
       
  7834 				KErrNone);
       
  7835 				
       
  7836 	primaryPacketContext2.NotifyStatusChange(notifyprimary2ContextStChStatus, primaryPacketContext2Status);
       
  7837 	expectedPacketContextStatus = RPacketContext::EStatusInactive;
       
  7838 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  7839 			    primaryPacketContext2,
       
  7840 				notifyprimary2ContextStChStatus,
       
  7841 				primaryPacketContext2Status, 
       
  7842 				expectedPacketContextStatus,
       
  7843 				KErrNone);
       
  7844 				
       
  7845 	// Check RPacketContext::GetStatus for primary 2 returns EStatusInactive
       
  7846 	ASSERT_EQUALS(primaryPacketContext2.GetStatus(primaryPacketContext2Status), KErrNone, _L("RPacketContext::GetStatus returned with an error."));
       
  7847 	ASSERT_EQUALS(primaryPacketContext2Status, RPacketContext::EStatusInactive, _L("RPacketContext::GetStatus returns incorrect status."));
       
  7848 
       
  7849 	// Check RPacketContext::NotifyStatusChange for secondary 2 completes with EStatusDeactivating -> EStatusInactive
       
  7850 	// $CTSYProblem LTSY dose not allow us to initialise 4 packets contexts
       
  7851 				
       
  7852 	// Check RPacketContext::GetStatus for secondary 2 returns EStatusInactive
       
  7853 	// Check RPacketContext::GetStatus for primary 1 returns EStatusActive
       
  7854 	// Check RPacketContext::GetStatus for secondary 1 returns EStatusActive
       
  7855 	// $CTSYProblem LTSY dose not allow us to initialise 4 packets contexts
       
  7856 	ASSERT_EQUALS(primaryPacketContext.GetStatus(primaryPacketContextStatus), KErrNone, _L("RPacketContext::GetStatus returned with an error."));
       
  7857 	ASSERT_EQUALS(primaryPacketContextStatus, RPacketContext::EStatusActive, _L("RPacketContext::GetStatus returns incorrect status."));
       
  7858 	ASSERT_EQUALS(secondaryPacketContext.GetStatus(secPacketContextStatus), KErrNone, _L("RPacketContext::GetStatus returned with an error."));
       
  7859 	ASSERT_EQUALS(secPacketContextStatus, RPacketContext::EStatusActive, _L("RPacketContext::GetStatus returns incorrect status."));
       
  7860 
       
  7861 	// Check RPacketService::GetStatus returns EStatusActive
       
  7862 	RPacketService::TStatus pckSrvcStatus;
       
  7863 	ASSERT_EQUALS(packetService.GetStatus(pckSrvcStatus), KErrNone, _L("RPacketService::GetStatus returned with an error."));
       
  7864 	ASSERT_EQUALS(pckSrvcStatus, RPacketService::EStatusActive, _L("RPacketService::GetStatus returns incorrect status."));
       
  7865 
       
  7866 	////////////////////////////////////////////////////////////////
       
  7867 	// TEST END
       
  7868 	////////////////////////////////////////////////////////////////
       
  7869 
       
  7870     StartCleanup();
       
  7871 	
       
  7872 	// Pop:
       
  7873 	//	deactivateNifStatus
       
  7874 	//	notifySecondaryContextStChStatus
       
  7875 	//	notifyprimary2ContextStChStatus
       
  7876 	//	notifyprimaryContextStChStatus
       
  7877 	//	contextNameNifsStatus
       
  7878 	//	enumerateContextsInNifStatus
       
  7879 	//	nifInfoStatus
       
  7880 	//	nifsStatus
       
  7881 	//	notifyContextSecondary2Status
       
  7882 	//	notifyContextSecondary1Status
       
  7883 	//	notifyContextPrimary2Status
       
  7884 	//	notifyContextPrimary1Status
       
  7885 	CleanupStack::PopAndDestroy(12,&notifyContextPrimary1Status);
       
  7886 	
       
  7887 	return TestStepResult();
       
  7888 	}
       
  7889 
       
  7890 TPtrC CCTSYIntegrationTestPacketContext0032::GetTestStepName()
       
  7891 /**
       
  7892  * @return The test step name.
       
  7893  */
       
  7894 	{
       
  7895 	return _L("CCTSYIntegrationTestPacketContext0032");
       
  7896 	}
       
  7897 
       
  7898 
       
  7899 
       
  7900 CCTSYIntegrationTestPacketContext0033::CCTSYIntegrationTestPacketContext0033(CEtelSessionMgr& aEtelSessionMgr)
       
  7901 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
  7902 /**
       
  7903  * Constructor.
       
  7904  */
       
  7905 	{
       
  7906 	SetTestStepName(CCTSYIntegrationTestPacketContext0033::GetTestStepName());
       
  7907 	}
       
  7908 
       
  7909 CCTSYIntegrationTestPacketContext0033::~CCTSYIntegrationTestPacketContext0033()
       
  7910 /**
       
  7911  * Destructor.
       
  7912  */
       
  7913 	{
       
  7914 	}
       
  7915 
       
  7916 TVerdict CCTSYIntegrationTestPacketContext0033::doTestStepL()
       
  7917 /**
       
  7918  * @SYMTestCaseID BA-CTSY-INT-PKTC-0033
       
  7919  * @SYMFssID BA/CTSY/PKTC-0033
       
  7920  * @SYMTestCaseDesc Deactivate NIF specifying unknown context name.
       
  7921  * @SYMTestPriority High
       
  7922  * @SYMTestActions RPacketService::DeactivateNIF, RPacketContext::GetStatus
       
  7923  * @SYMTestExpectedResults Pass - No NIFs deactivated.
       
  7924  * @SYMTestType CIT
       
  7925  * @SYMTestCaseDependencies live/automatic
       
  7926  *
       
  7927  * Reason for test: Verify context status unaffected.
       
  7928  *
       
  7929  * @return - TVerdict code
       
  7930  */
       
  7931 	{
       
  7932 
       
  7933 	////////////////////////////////////////////////////////////////
       
  7934 	// SET UP
       
  7935 	////////////////////////////////////////////////////////////////
       
  7936 
       
  7937 	
       
  7938 	// Ensure there is an active primary context. 
       
  7939     RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
  7940 	// Call TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL
       
  7941 	CHECK_EQUALS_L(iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(phone), KErrNone, _L("TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL returned with an error"));
       
  7942 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, KMainPhone, KMainPacketService);
       
  7943     SetAttachModeToWhenPossibleAndWaitForAttachL(packetService);
       
  7944 	RPacketContext& primaryPacketContext = iEtelSessionMgr.GetPrimaryPacketContextL(KMainServer, KMainPhone, KMainPacketService, KPrimaryPacketContext1);
       
  7945 	iPacketServiceTestHelper.ActivatePrimaryPacketContextL(phone, primaryPacketContext);
       
  7946 
       
  7947 
       
  7948 	////////////////////////////////////////////////////////////////
       
  7949 	// SET UP END
       
  7950 	////////////////////////////////////////////////////////////////
       
  7951 	
       
  7952 	StartTest();
       
  7953 	
       
  7954 	////////////////////////////////////////////////////////////////
       
  7955 	// TEST START
       
  7956 	////////////////////////////////////////////////////////////////
       
  7957 	
       
  7958 	
       
  7959 	// Check RPacketService::GetStatus returns EStatusActive
       
  7960 	RPacketService::TStatus pckServiceStatus;
       
  7961 	ASSERT_EQUALS(packetService.GetStatus(pckServiceStatus), KErrNone, _L("RPacketService::GetStatus returned with an error."));
       
  7962 	ASSERT_EQUALS(pckServiceStatus, RPacketService::EStatusActive, _L("RPacketService::GetStatus did not return EStatusActive as expected."));
       
  7963 
       
  7964 	// Check RPacketContext::GetStatus returns EStatusActive
       
  7965 	RPacketContext::TContextStatus pckContextStatus;
       
  7966 	ASSERT_EQUALS(primaryPacketContext.GetStatus(pckContextStatus), KErrNone, _L("RPacketContext::GetStatus returned with an error."));
       
  7967 	ASSERT_EQUALS(pckContextStatus, RPacketContext::EStatusActive, _L("RPacketContext::GetStatus did not return EStatusActive as expected."));
       
  7968 
       
  7969 	// Deactivate the NIF with RPacketService::DeactivateNIF and aContextName = unknown context name 
       
  7970 	TExtEtelRequestStatus deactiveNIFStatus(packetService, EPacketDeactivateNIF);
       
  7971 	CleanupStack::PushL(deactiveNIFStatus);
       
  7972 	RPacketService::TContextInfo unknownContextInfo;
       
  7973 	unknownContextInfo.iName = _L("unknown123abc");
       
  7974 	packetService.DeactivateNIF(deactiveNIFStatus, unknownContextInfo.iName);
       
  7975 
       
  7976 	// Check error is returned.
       
  7977 	ASSERT_EQUALS(WaitForRequestWithTimeOut(deactiveNIFStatus, ETimeMedium), KErrNone, _L("RPacketService::DeactivateNIF timed out."));
       
  7978 	ASSERT_TRUE(deactiveNIFStatus.Int() != KErrNone, _L("RPacketService::DeactivateNIF did not return error as expected."));
       
  7979 
       
  7980 	// Check RPacketService::GetStatus returns EStatusActive
       
  7981 	ASSERT_EQUALS(packetService.GetStatus(pckServiceStatus), KErrNone, _L("RPacketService::GetStatus returned with an error."));
       
  7982 	ASSERT_EQUALS(pckServiceStatus, RPacketService::EStatusActive, _L("RPacketService::GetStatus did not return EStatusActive as expected."));
       
  7983 
       
  7984 	// Check RPacketContext::GetStatus returns EStatusActive
       
  7985 	ASSERT_EQUALS(primaryPacketContext.GetStatus(pckContextStatus), KErrNone, _L("RPacketContext::GetStatus returned with an error."));
       
  7986 	ASSERT_EQUALS(pckContextStatus, RPacketContext::EStatusActive, _L("RPacketContext::GetStatus did not return EStatusActive as expected."));
       
  7987 
       
  7988 	
       
  7989 	////////////////////////////////////////////////////////////////
       
  7990 	// TEST END
       
  7991 	////////////////////////////////////////////////////////////////
       
  7992 
       
  7993     StartCleanup();
       
  7994 	
       
  7995 	// Pop
       
  7996 	// deactiveNIFStatus
       
  7997 	CleanupStack::PopAndDestroy(1, &deactiveNIFStatus);
       
  7998 	
       
  7999 	return TestStepResult();
       
  8000 	}
       
  8001 
       
  8002 TPtrC CCTSYIntegrationTestPacketContext0033::GetTestStepName()
       
  8003 /**
       
  8004  * @return The test step name.
       
  8005  */
       
  8006 	{
       
  8007 	return _L("CCTSYIntegrationTestPacketContext0033");
       
  8008 	}
       
  8009 
       
  8010 
       
  8011 
       
  8012 CCTSYIntegrationTestPacketContext0034::CCTSYIntegrationTestPacketContext0034(CEtelSessionMgr& aEtelSessionMgr)
       
  8013 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
  8014 /**
       
  8015  * Constructor.
       
  8016  */
       
  8017 	{
       
  8018 	SetTestStepName(CCTSYIntegrationTestPacketContext0034::GetTestStepName());
       
  8019 	}
       
  8020 
       
  8021 CCTSYIntegrationTestPacketContext0034::~CCTSYIntegrationTestPacketContext0034()
       
  8022 /**
       
  8023  * Destructor.
       
  8024  */
       
  8025 	{
       
  8026 	}
       
  8027 
       
  8028 TVerdict CCTSYIntegrationTestPacketContext0034::doTestStepL()
       
  8029 /**
       
  8030  * @SYMTestCaseID BA-CTSY-INT-PKTC-0034
       
  8031  * @SYMFssID BA/CTSY/PKTC-0034
       
  8032  * @SYMTestCaseDesc Deactivate NIF when there is more than one NIF.
       
  8033  * @SYMTestPriority High
       
  8034  * @SYMTestActions RPacketService::NotifyAttachModeChange, RPacketService::GetAttachMode, RPacketService::NotifyStatusChange, RPacketService::GetStatus, RPacketContext::SetConfig, RPacketContext::Activate, RPacketService::EnumerateContextsInNif, RPacketService::EnumerateContexts, RPacketContext::NotifyStatusChange, RPacketContext::GetStatus, RPacketService::DeactivateNIF, RPacketService::GetNifInfo
       
  8035  * @SYMTestExpectedResults Pass - All contexts in NIF deactivated. Other contexts unaffected.
       
  8036  * @SYMTestType CIT
       
  8037  * @SYMTestCaseDependencies simulated/automatic
       
  8038  *
       
  8039  * Reason for test: Verify primary and secondary contexts in NIF are deactivated when secondary context name specified
       
  8040 
       
  8041 Verify contexts in another NIF are not affected.
       
  8042  *
       
  8043  * @return - TVerdict code
       
  8044  */
       
  8045 	{
       
  8046 
       
  8047 	////////////////////////////////////////////////////////////////
       
  8048 	// SET UP
       
  8049 	////////////////////////////////////////////////////////////////
       
  8050 	
       
  8051     //Check if we are on a simulated network 
       
  8052     RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
  8053 	CHECK_EQUALS_L(iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(phone), KErrNone, _L("TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL returned with an error."));
       
  8054     iNetworkTestHelper.CheckPhoneConnectedToAniteL(phone);
       
  8055 	
       
  8056 	// Ensure there is an 2 primary contexts active. Each of these must have an active secondary context opened from it. (Primary 1 and secondary 1 in one NIF and primary 2 and secondary 2 in the second NIF.) 
       
  8057 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, KMainPhone, KMainPacketService);
       
  8058     SetAttachModeToWhenPossibleAndWaitForAttachL(packetService);
       
  8059 
       
  8060 	TName primaryContextId1;
       
  8061 	TName primaryContextId2;
       
  8062 	
       
  8063 	TExtEtelRequestStatus notifyContextStatusPrimary1(packetService, EPacketNotifyContextAdded);
       
  8064 	CleanupStack::PushL(notifyContextStatusPrimary1);
       
  8065 	
       
  8066 	packetService.NotifyContextAdded(notifyContextStatusPrimary1, primaryContextId1);
       
  8067 	RPacketContext& primaryPacketContext1 = iEtelSessionMgr.GetPrimaryPacketContextL(
       
  8068 									KMainServer,
       
  8069 									KMainPhone,
       
  8070 									KMainPacketService,
       
  8071 									KPrimaryPacketContext1);
       
  8072 									
       
  8073 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(notifyContextStatusPrimary1, ETimeMedium), KErrNone, _L("RPacketService::NotifyContextAdded did not complete."));
       
  8074 	CHECK_EQUALS_L(notifyContextStatusPrimary1.Int(), KErrNone, _L("RPacketService::NotifyContextAdded returned with error status."));
       
  8075 	CHECK_TRUE_L(primaryContextId1.Length() > 0, _L("RPacketService::NotifyContextAdded returned with invalid context name."));								
       
  8076 												
       
  8077 	TExtEtelRequestStatus notifyContextStatusPrimary2(packetService, EPacketNotifyContextAdded);
       
  8078 	CleanupStack::PushL(notifyContextStatusPrimary2);											
       
  8079 																
       
  8080 	packetService.NotifyContextAdded(notifyContextStatusPrimary2, primaryContextId2);
       
  8081 	RPacketContext& primaryPacketContext2 = iEtelSessionMgr.GetPrimaryPacketContextL(
       
  8082 									KMainServer,
       
  8083 									KMainPhone,
       
  8084 									KMainPacketService,
       
  8085 									KPrimaryPacketContext2);
       
  8086 									
       
  8087 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(notifyContextStatusPrimary2, ETimeMedium), KErrNone, _L("RPacketService::NotifyContextAdded did not complete."));
       
  8088 	CHECK_EQUALS_L(notifyContextStatusPrimary2.Int(), KErrNone, _L("RPacketService::NotifyContextAdded returned with error status."));
       
  8089 	CHECK_TRUE_L(primaryContextId2.Length() > 0, _L("RPacketService::NotifyContextAdded returned with invalid context name."));									
       
  8090 
       
  8091 	iPacketServiceTestHelper.ActivatePrimaryPacketContextL(phone, primaryPacketContext1);	
       
  8092 	iPacketServiceTestHelper.ActivatePrimaryPacketContextL(phone, primaryPacketContext2, 2);	
       
  8093 
       
  8094 	TName secondaryContextId1;
       
  8095 	TName secondaryContextId2;
       
  8096 	TExtEtelRequestStatus notifyContextStatusSecondary1(packetService, EPacketNotifyContextAdded);
       
  8097 	CleanupStack::PushL(notifyContextStatusSecondary1);	
       
  8098 	
       
  8099 	packetService.NotifyContextAdded(notifyContextStatusSecondary1, secondaryContextId1);
       
  8100 	RPacketContext& secondaryPacketContext1 = iEtelSessionMgr.GetSecondaryPacketContextL(
       
  8101 												KMainServer,
       
  8102 												KMainPhone,
       
  8103 												KMainPacketService, 
       
  8104 												KPrimaryPacketContext1,
       
  8105 												KSecondaryPacketContext1);
       
  8106 												
       
  8107 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(notifyContextStatusSecondary1, ETimeMedium), KErrNone, _L("RPacketService::NotifyContextAdded did not complete."));
       
  8108 	CHECK_EQUALS_L(notifyContextStatusSecondary1.Int(), KErrNone, _L("RPacketService::NotifyContextAdded returned with error status."));
       
  8109 	CHECK_TRUE_L(secondaryContextId1.Length() > 0, _L("RPacketService::NotifyContextAdded returned with invalid context name."));
       
  8110 												
       
  8111 	TExtEtelRequestStatus notifyContextStatusSecondary2(packetService, EPacketNotifyContextAdded);
       
  8112 	CleanupStack::PushL(notifyContextStatusSecondary2);													
       
  8113 																							
       
  8114 	packetService.NotifyContextAdded(notifyContextStatusSecondary2, secondaryContextId2);
       
  8115 	// $CTSYProblem This test cannot be run since LTSY does not allow us to initialise 4 packets contexts
       
  8116     CHECK_TRUE_L(EFalse,_L("$CTSYProblem This test cannot be run since LTSY does not allow us to initialise 4 packets contexts"));
       
  8117 	RPacketContext& secondaryPacketContext2 = iEtelSessionMgr.GetSecondaryPacketContextL(
       
  8118 												KMainServer,
       
  8119 												KMainPhone,
       
  8120 												KMainPacketService, 
       
  8121 												KPrimaryPacketContext2,
       
  8122 												KSecondaryPacketContext2);
       
  8123 											
       
  8124 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(notifyContextStatusSecondary2, ETimeMedium), KErrNone, _L("RPacketService::NotifyContextAdded did not complete."));
       
  8125 	CHECK_EQUALS_L(notifyContextStatusSecondary2.Int(), KErrNone, _L("RPacketService::NotifyContextAdded returned with error status."));
       
  8126 	CHECK_TRUE_L(secondaryContextId2.Length() > 0, _L("RPacketService::NotifyContextAdded returned with invalid context name."));
       
  8127 																								
       
  8128 	CHECK_TRUE_L(ActivateSecondaryPacketContextL(secondaryPacketContext1), _L("Can't activate the secondary context"));
       
  8129 	CHECK_TRUE_L(ActivateSecondaryPacketContextL(secondaryPacketContext2), _L("Can't activate the secondary context"));												
       
  8130 
       
  8131 	////////////////////////////////////////////////////////////////
       
  8132 	// SET UP END
       
  8133 	////////////////////////////////////////////////////////////////
       
  8134 	
       
  8135 	StartTest();
       
  8136 	
       
  8137 	////////////////////////////////////////////////////////////////
       
  8138 	// TEST START
       
  8139 	////////////////////////////////////////////////////////////////
       
  8140 	
       
  8141 	// Check RPacketService::EnumerateNifs returns aCount = 2
       
  8142 	TExtEtelRequestStatus nifsStatus(packetService, EPacketEnumerateNifs);
       
  8143 	CleanupStack::PushL(nifsStatus);
       
  8144 	TInt nifCount = 0;
       
  8145 	TInt wantedNifCount = 2;
       
  8146 	packetService.EnumerateNifs(nifsStatus, nifCount);
       
  8147 	ASSERT_EQUALS(WaitForRequestWithTimeOut(nifsStatus, ETimeLong), KErrNone, _L("RPacketService::EnumerateNifs timed out."));
       
  8148 	ASSERT_EQUALS(nifsStatus.Int(), KErrNone, _L("RPacketService::EnumerateNifs returned with error."));
       
  8149 	ASSERT_EQUALS(nifCount, wantedNifCount, _L("RPacketService::EnumerateNifs returned wrong NIF count."));
       
  8150 
       
  8151 	// Check RPacketService::GetNifInfo with aCount = 0 returns valid name in iContextName
       
  8152 	TInt nifInfoCount = 0;
       
  8153 	TExtEtelRequestStatus nifInfoStatus(packetService, EPacketGetNifInfo);
       
  8154 	CleanupStack::PushL(nifInfoStatus);
       
  8155 	RPacketService::TNifInfoV2 nifInfo;
       
  8156 	RPacketService::TNifInfoV2Pckg nifInfoPckg(nifInfo);
       
  8157 	packetService.GetNifInfo(nifInfoStatus, nifInfoCount, nifInfoPckg);
       
  8158 	ASSERT_EQUALS(WaitForRequestWithTimeOut(nifInfoStatus, ETimeMedium), KErrNone, _L("RPacketService::GetNifInfo timed out."));
       
  8159 	ASSERT_EQUALS(nifInfoStatus.Int(), KErrNone, _L("RPacketService::GetNifInfo returned with error."));
       
  8160 	ASSERT_EQUALS_DES16(nifInfo.iContextName, primaryContextId1, _L("RPacketService::GetNifInfo returned with invalid context name."));
       
  8161 	
       
  8162 	// Check RPacketService::GetNifInfo with aCount = 0 returns iNumberOfContexts = 2
       
  8163 	TInt wantedNumberOfContexts = 2;
       
  8164 	ASSERT_EQUALS(nifInfo.iNumberOfContexts, wantedNumberOfContexts, _L("RPacketService::GetNifInfo returned wrong number of contexts."));
       
  8165 	
       
  8166 	// Check RPacketService::GetNifInfo with aCount = 0 returns iNifStatus = EStatusActive
       
  8167 	ASSERT_EQUALS(nifInfo.iNifStatus, RPacketContext::EStatusActive, _L("RPacketService::GetNifInfo did not return EStatusActive as expected."));
       
  8168  
       
  8169 	// Check RPacketService::GetNifInfo with aCount = 0 returns valid address in iPdpAddress
       
  8170 	ASSERT_TRUE(nifInfo.iPdpAddress.Length() > 0, _L("RPacketService::GetNifInfo returned with invalid pdp address."));
       
  8171 	
       
  8172 	// Check RPacketService::GetNifInfo with aCount = 0 returns EExternalContext
       
  8173 	// $CTSYProblem:RPacketService::GetNifInfo always returns EInternalContext
       
  8174     // Changed test procedure to check for EInternalContext instead of EExternalContext
       
  8175 	ASSERT_EQUALS(nifInfo.iContextType, RPacketService::EInternalContext, _L("RPacketService::GetNifInfo returned wrong context type."));
       
  8176 
       
  8177 	// Check RPacketService::GetNifInfo with aCount = 1 returns valid name in iContextName
       
  8178 	nifInfoCount = 1;
       
  8179 	packetService.GetNifInfo(nifInfoStatus, nifInfoCount, nifInfoPckg);
       
  8180 	ASSERT_EQUALS(WaitForRequestWithTimeOut(nifInfoStatus, ETimeMedium), KErrNone, _L("RPacketService::GetNifInfo timed out."));
       
  8181 	ASSERT_EQUALS(nifInfoStatus.Int(), KErrNone, _L("RPacketService::GetNifInfo returned with error."));
       
  8182 	ASSERT_EQUALS_DES16(nifInfo.iContextName, primaryContextId2, _L("RPacketService::GetNifInfo returned with invalid context name."));
       
  8183 	
       
  8184 	// Check RPacketService::GetNifInfo with aCount = 1 returns iNumberOfContexts = 2
       
  8185 	ASSERT_EQUALS(nifInfo.iNumberOfContexts,2,_L("RPacketService::GetNifInfo wrong number of contexts."));
       
  8186 	
       
  8187 	// Check RPacketService::GetNifInfo with aCount = 1 returns iNifStatus = EStatusActive
       
  8188 	ASSERT_EQUALS(nifInfo.iNifStatus, RPacketContext::EStatusActive, _L("RPacketService::GetNifInfo did not return EStatusActive as expected."));
       
  8189  
       
  8190 	// Check RPacketService::GetNifInfo with aCount = 1 returns valid address in iPdpAddress
       
  8191 	ASSERT_TRUE(nifInfo.iPdpAddress.Length() > 0, _L("RPacketService::GetNifInfo returned with invalid pdp address."));
       
  8192 	
       
  8193 	// Check RPacketService::GetNifInfo with aCount = 1 returns EExternalContext
       
  8194 	// $CTSYProblem:RPacketService::GetNifInfo always returns EInternalContext
       
  8195     // Changed test procedure to check for EInternalContext instead of EExternalContext
       
  8196 	ASSERT_EQUALS(nifInfo.iContextType, RPacketService::EInternalContext, _L("RPacketService::GetNifInfo returned wrong context type."));
       
  8197 	
       
  8198 	// Check RPacketService::GetNifInfo with aCount = 2 returns KErrArgument
       
  8199 	nifInfoCount = 2;
       
  8200 	packetService.GetNifInfo(nifInfoStatus, nifInfoCount, nifInfoPckg);
       
  8201 	ASSERT_EQUALS(WaitForRequestWithTimeOut(nifInfoStatus, ETimeMedium), KErrNone, _L("RPacketService::GetNifInfo timed out."));
       
  8202 	ASSERT_EQUALS(nifInfoStatus.Int(), KErrArgument, _L("RPacketService::GetNifInfo did not returned an error."));
       
  8203 
       
  8204 	// Check RPacketService::EnumerateContextsInNif with aExistingContextName = primary 1 returns aCount = 2
       
  8205 	TInt wantedCount = 2;
       
  8206 	TInt contextsInNifCount = 0;
       
  8207 	TExtEtelRequestStatus enumerateContextsInNifStatus(packetService, EPacketEnumerateContextsInNif);
       
  8208 	CleanupStack::PushL(enumerateContextsInNifStatus);
       
  8209 	packetService.EnumerateContextsInNif(enumerateContextsInNifStatus, primaryContextId1, contextsInNifCount);
       
  8210 	ASSERT_EQUALS(WaitForRequestWithTimeOut(enumerateContextsInNifStatus, ETimeLong), KErrNone, _L("RPacketService::EnumerateContextsInNif timed out."));
       
  8211 	ASSERT_EQUALS(enumerateContextsInNifStatus.Int(), KErrNone, _L("RPacketService::EnumerateContextsInNif returned with error."));
       
  8212 	ASSERT_EQUALS(contextsInNifCount, wantedCount, _L("RPacketService::EnumerateContextsInNif did not return 2 as expected."));
       
  8213 	
       
  8214 	// Check RPacketService::EnumerateContextsInNif with aExistingContextName = primary 2 returns aCount = 2
       
  8215 	contextsInNifCount = 0;
       
  8216 	packetService.EnumerateContextsInNif(enumerateContextsInNifStatus, primaryContextId2, contextsInNifCount);
       
  8217 	ASSERT_EQUALS(WaitForRequestWithTimeOut(enumerateContextsInNifStatus, ETimeLong), KErrNone, _L("RPacketService::EnumerateContextsInNif timed out."));
       
  8218 	ASSERT_EQUALS(enumerateContextsInNifStatus.Int(), KErrNone, _L("RPacketService::EnumerateContextsInNif returned with error."));
       
  8219 	ASSERT_EQUALS(contextsInNifCount, wantedCount, _L("RPacketService::EnumerateContextsInNif did not return 2 as expected."));
       
  8220 	
       
  8221 	// Check RPacketService::EnumerateContextsInNif with aExistingContextName = secondary 1 returns aCount = 2
       
  8222 	contextsInNifCount = 0;
       
  8223 	packetService.EnumerateContextsInNif(enumerateContextsInNifStatus, secondaryContextId1, contextsInNifCount);
       
  8224 	ASSERT_EQUALS(WaitForRequestWithTimeOut(enumerateContextsInNifStatus, ETimeLong), KErrNone, _L("RPacketService::EnumerateContextsInNif timed out."));
       
  8225 	ASSERT_EQUALS(enumerateContextsInNifStatus.Int(), KErrNone, _L("RPacketService::EnumerateContextsInNif returned with error."));
       
  8226 	ASSERT_EQUALS(contextsInNifCount, wantedCount, _L("RPacketService::EnumerateContextsInNif did not return 2 as expected."));
       
  8227 		
       
  8228 	// Check RPacketService::EnumerateContextsInNif with aExistingContextName = secondary 2 returns aCount = 2
       
  8229     contextsInNifCount = 0;
       
  8230 	packetService.EnumerateContextsInNif(enumerateContextsInNifStatus, secondaryContextId2, contextsInNifCount);
       
  8231 	ASSERT_EQUALS(WaitForRequestWithTimeOut(enumerateContextsInNifStatus, ETimeLong), KErrNone, _L("RPacketService::EnumerateContextsInNif timed out."));
       
  8232 	ASSERT_EQUALS(enumerateContextsInNifStatus.Int(), KErrNone, _L("RPacketService::EnumerateContextsInNif returned with error."));
       
  8233 	ASSERT_EQUALS(contextsInNifCount, wantedCount, _L("RPacketService::EnumerateContextsInNif did not return 2 as expected."));
       
  8234 
       
  8235 	// Check RPacketService::GetContextNameInNif with aExistingContextName = primary 1 and aIndex = 0 returns aContextName = name of primary context 1
       
  8236 	const TInt index0 = 0;
       
  8237 	const TInt index1 = 1;
       
  8238 	TName contextName;
       
  8239 	TExtEtelRequestStatus getContextNameInNifStatus(packetService, EPacketGetContextNameInNif);
       
  8240 	CleanupStack::PushL(getContextNameInNifStatus);
       
  8241 	packetService.GetContextNameInNif(getContextNameInNifStatus, primaryContextId1, index0, contextName);
       
  8242 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getContextNameInNifStatus, ETimeLong), KErrNone, _L("RPacketService::GetContextNameInNif timed out."));
       
  8243 	ASSERT_EQUALS_DES16(contextName, primaryContextId1, _L("RPacketService::GetContextNameInNif returned context name which doesn't match with the existing context name."));
       
  8244 	
       
  8245 	// Check RPacketService::GetContextNameInNif with aExistingContextName = primary 1 and aIndex = 1 returns aContextName = name of secondary context 1
       
  8246 	packetService.GetContextNameInNif(getContextNameInNifStatus, primaryContextId1, index1, contextName);
       
  8247 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getContextNameInNifStatus, ETimeLong), KErrNone, _L("RPacketService::GetContextNameInNif timed out."));
       
  8248 	ASSERT_EQUALS_DES16(contextName, secondaryContextId1, _L("RPacketService::GetContextNameInNif returned context name which doesn't match with the existing context name."));
       
  8249 	
       
  8250 	// Check RPacketService::GetContextNameInNif with aExistingContextName = secondary 1 and aIndex = 0 returns aContextName = name of primary context 1
       
  8251 	packetService.GetContextNameInNif(getContextNameInNifStatus, secondaryContextId1, index0, contextName);
       
  8252 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getContextNameInNifStatus, ETimeLong), KErrNone, _L("RPacketService::GetContextNameInNif timed out."));
       
  8253 	ASSERT_EQUALS_DES16(contextName, primaryContextId1, _L("RPacketService::GetContextNameInNif returned context name which doesn't match with the existing context name."));
       
  8254 
       
  8255 	// Check RPacketService::GetContextNameInNif with aExistingContextName = secondary 1 and aIndex = 1 returns aContextName = name of secondary context 1
       
  8256 	packetService.GetContextNameInNif(getContextNameInNifStatus, secondaryContextId1, index1, contextName);
       
  8257 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getContextNameInNifStatus, ETimeLong), KErrNone, _L("RPacketService::GetContextNameInNif timed out."));
       
  8258 	ASSERT_EQUALS_DES16(contextName, secondaryContextId1, _L("RPacketService::GetContextNameInNif returned context name which doesn't match with the existing context name."));
       
  8259 	
       
  8260 	// Check RPacketService::GetContextNameInNif with aExistingContextName = primary 2 and aIndex = 0 returns aContextName = name of primary context 2
       
  8261 	packetService.GetContextNameInNif(getContextNameInNifStatus, primaryContextId2, index0, contextName);
       
  8262 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getContextNameInNifStatus, ETimeLong), KErrNone, _L("RPacketService::GetContextNameInNif timed out."));
       
  8263 	ASSERT_EQUALS_DES16(contextName, primaryContextId2, _L("RPacketService::GetContextNameInNif returned context name which doesn't match with the existing context name."));
       
  8264 	
       
  8265 	// Check RPacketService::GetContextNameInNif with aExistingContextName = primary 2 and aIndex = 1 returns aContextName = name of secondary context 2
       
  8266 	packetService.GetContextNameInNif(getContextNameInNifStatus, primaryContextId2, index1, contextName);
       
  8267 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getContextNameInNifStatus, ETimeLong), KErrNone, _L("RPacketService::GetContextNameInNif timed out."));
       
  8268     ASSERT_EQUALS_DES16(contextName, secondaryContextId2, _L("RPacketService::GetContextNameInNif returned context name which doesn't match with the existing context name."));
       
  8269 
       
  8270 	// Check RPacketService::GetContextNameInNif with aExistingContextName = secondary 2 and aIndex = 0 returns aContextName = name of primary context 2
       
  8271 	packetService.GetContextNameInNif(getContextNameInNifStatus, secondaryContextId2, index0, contextName);
       
  8272 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getContextNameInNifStatus, ETimeLong), KErrNone, _L("RPacketService::GetContextNameInNif timed out."));
       
  8273 	ASSERT_EQUALS_DES16(contextName, primaryContextId2, _L("RPacketService::GetContextNameInNif returned context name which doesn't match with the existing context name."));
       
  8274 		
       
  8275 	// Check RPacketService::GetContextNameInNif with aExistingContextName = secondary 2 and aIndex = 1 returns aContextName = name of secondary context 2
       
  8276 	packetService.GetContextNameInNif(getContextNameInNifStatus, secondaryContextId2, index1, contextName);
       
  8277 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getContextNameInNifStatus, ETimeLong), KErrNone, _L("RPacketService::GetContextNameInNif timed out."));
       
  8278 	ASSERT_EQUALS_DES16(contextName, secondaryContextId2, _L("RPacketService::GetContextNameInNif returned context name which doesn't match with the existing context name."));
       
  8279 	
       
  8280 	// Post notifications for primary2 and secondary2 context's status change
       
  8281 	TExtEtelRequestStatus notifyPrimaryContext2StChStatus(primaryPacketContext2, EPacketContextNotifyStatusChange);
       
  8282 	CleanupStack::PushL(notifyPrimaryContext2StChStatus);
       
  8283 	RPacketContext::TContextStatus primaryPacketContext2Status;
       
  8284 	primaryPacketContext2.NotifyStatusChange(notifyPrimaryContext2StChStatus, primaryPacketContext2Status);
       
  8285 
       
  8286 	TExtEtelRequestStatus notifySecondaryContext2StChStatus(secondaryPacketContext2, EPacketContextNotifyStatusChange);
       
  8287 	CleanupStack::PushL(notifySecondaryContext2StChStatus);
       
  8288 	RPacketContext::TContextStatus secondaryPacketContext2Status;
       
  8289 	secondaryPacketContext2.NotifyStatusChange(notifySecondaryContext2StChStatus, secondaryPacketContext2Status);
       
  8290 
       
  8291 	// Post notifications for primary1 context status change
       
  8292 	TExtEtelRequestStatus notifyPrimaryContext1StChStatus(primaryPacketContext1, EPacketContextNotifyStatusChange);
       
  8293 	CleanupStack::PushL(notifyPrimaryContext1StChStatus);
       
  8294 	RPacketContext::TContextStatus primaryPacketContext1Status;
       
  8295 	primaryPacketContext1.NotifyStatusChange(notifyPrimaryContext1StChStatus, primaryPacketContext1Status);
       
  8296 
       
  8297 	// Deactivate the NIF with RPacketService::DeactivateNIF and aContextName = name of secondary 2 
       
  8298 	TExtEtelRequestStatus deactivateNIFStatus(packetService, EPacketDeactivateNIF);
       
  8299 	CleanupStack::PushL(deactivateNIFStatus);
       
  8300 	packetService.DeactivateNIF(deactivateNIFStatus, secondaryContextId2);
       
  8301 	ASSERT_EQUALS(WaitForRequestWithTimeOut(deactivateNIFStatus, ETimeMedium), KErrNone, _L("RPacketService::DeactivateNIF timed out."));
       
  8302 	ASSERT_EQUALS(deactivateNIFStatus.Int(), KErrNone, _L("RPacketService::DeactivateNIF returned with error.."));
       
  8303 	
       
  8304 	// ===  Check context and service statuses ===
       
  8305 
       
  8306 	// Check RPacketContext::NotifyStatusChange for primary 2 completes with EStatusDeactivating -> EStatusInactive
       
  8307     RPacketContext::TContextStatus 	expectedPacketContextStatus = RPacketContext::EStatusDeactivating;
       
  8308 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  8309 					primaryPacketContext2,
       
  8310 					notifyPrimaryContext2StChStatus,
       
  8311 					primaryPacketContext2Status, 
       
  8312 					expectedPacketContextStatus,
       
  8313 					KErrNone);
       
  8314 
       
  8315 	primaryPacketContext2.NotifyStatusChange(notifyPrimaryContext2StChStatus, primaryPacketContext2Status);
       
  8316 	expectedPacketContextStatus = RPacketContext::EStatusInactive;
       
  8317 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  8318 					primaryPacketContext2,
       
  8319 					notifyPrimaryContext2StChStatus,
       
  8320 					primaryPacketContext2Status, 
       
  8321 					expectedPacketContextStatus,
       
  8322 					KErrNone);
       
  8323 
       
  8324 	// Check RPacketContext::GetStatus for primary 2 returns EStatusInactive
       
  8325 	ASSERT_EQUALS(primaryPacketContext2.GetStatus(primaryPacketContext2Status), KErrNone, _L("RPacketContext::GetStatus returned with an error."));
       
  8326 	ASSERT_EQUALS(primaryPacketContext2Status, RPacketContext::EStatusInactive, _L("RPacketContext::GetStatus returns incorrect status."));
       
  8327 	
       
  8328 	// Check RPacketContext::NotifyStatusChange for secondary 2 completes with EStatusDeactivating -> EStatusInactive
       
  8329 	expectedPacketContextStatus = RPacketContext::EStatusDeactivating;
       
  8330 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  8331 			    secondaryPacketContext2,
       
  8332 				notifySecondaryContext2StChStatus,
       
  8333 				secondaryPacketContext2Status, 
       
  8334 				expectedPacketContextStatus,
       
  8335 				KErrNone);
       
  8336 				
       
  8337 	secondaryPacketContext2.NotifyStatusChange(notifySecondaryContext2StChStatus, secondaryPacketContext2Status);
       
  8338 	expectedPacketContextStatus = RPacketContext::EStatusInactive;
       
  8339 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  8340 			    secondaryPacketContext2,
       
  8341 				notifySecondaryContext2StChStatus,
       
  8342 				secondaryPacketContext2Status, 
       
  8343 				expectedPacketContextStatus,
       
  8344 				KErrNone); 
       
  8345 
       
  8346 	// Check RPacketContext::GetStatus for secondary 2 returns EStatusInactive
       
  8347 	ASSERT_EQUALS(secondaryPacketContext2.GetStatus(secondaryPacketContext2Status), KErrNone, _L("RPacketContext::GetStatus returned with an error."));
       
  8348 	ASSERT_EQUALS(secondaryPacketContext2Status, RPacketContext::EStatusInactive, _L("RPacketContext::GetStatus returns incorrect status."));	
       
  8349 	
       
  8350 	// Check RPacketContext::GetStatus for primary 1 returns EStatusActive
       
  8351 	ASSERT_EQUALS(primaryPacketContext1.GetStatus(primaryPacketContext1Status), KErrNone, _L("RPacketContext::GetStatus returned with an error."));
       
  8352 	ASSERT_EQUALS(primaryPacketContext1Status, RPacketContext::EStatusActive, _L("RPacketContext::GetStatus returns incorrect status."));
       
  8353 	
       
  8354 	// Check RPacketContext::GetStatus for secondary 1 returns EStatusActive
       
  8355 	RPacketContext::TContextStatus secondaryPacketContext1Status;
       
  8356 	ASSERT_EQUALS(secondaryPacketContext1.GetStatus(secondaryPacketContext1Status), KErrNone, _L("RPacketContext::GetStatus returned with an error."));
       
  8357 	ASSERT_EQUALS(secondaryPacketContext1Status, RPacketContext::EStatusActive, _L("RPacketContext::GetStatus returns incorrect status."));
       
  8358 	
       
  8359 	// Check RPacketService::GetStatus returns EStatusActive	
       
  8360 	RPacketService::TStatus pckSrvcStatus;
       
  8361 	ASSERT_EQUALS(packetService.GetStatus(pckSrvcStatus), KErrNone, _L("RPacketService::GetStatus returned with an error."));
       
  8362 	ASSERT_EQUALS(pckSrvcStatus, RPacketService::EStatusActive, _L("RPacketService::GetStatus returns incorrect status."));
       
  8363 	
       
  8364 	////////////////////////////////////////////////////////////////
       
  8365 	// TEST END
       
  8366 	////////////////////////////////////////////////////////////////
       
  8367 
       
  8368     StartCleanup();
       
  8369 	
       
  8370 	// pop
       
  8371 	// notifyContextStatusPrimary1
       
  8372 	// notifyContextStatusPrimary1
       
  8373 	// notifyContextStatusSecondary1
       
  8374 	// notifyContextStatusSecondary2
       
  8375 	// nifsStatus
       
  8376 	// nifInfoStatus
       
  8377 	// enumerateContextsInNifStatus
       
  8378 	// getContextNameInNifStatus
       
  8379 	// notifyPrimaryContext1StChStatus
       
  8380 	// notifySecondaryContext2StChStatus
       
  8381 	// notifyPrimaryContext1StChStatus
       
  8382 	// deactivateNIFStatus	
       
  8383 	CleanupStack::PopAndDestroy(12,&notifyContextStatusPrimary1);
       
  8384 	
       
  8385 	return TestStepResult();
       
  8386 	}
       
  8387 
       
  8388 TPtrC CCTSYIntegrationTestPacketContext0034::GetTestStepName()
       
  8389 /**
       
  8390  * @return The test step name.
       
  8391  */
       
  8392 	{
       
  8393 	return _L("CCTSYIntegrationTestPacketContext0034");
       
  8394 	}
       
  8395 
       
  8396 
       
  8397 
       
  8398 CCTSYIntegrationTestPacketContext0035::CCTSYIntegrationTestPacketContext0035(CEtelSessionMgr& aEtelSessionMgr)
       
  8399 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
  8400 /**
       
  8401  * Constructor.
       
  8402  */
       
  8403 	{
       
  8404 	SetTestStepName(CCTSYIntegrationTestPacketContext0035::GetTestStepName());
       
  8405 	}
       
  8406 
       
  8407 CCTSYIntegrationTestPacketContext0035::~CCTSYIntegrationTestPacketContext0035()
       
  8408 /**
       
  8409  * Destructor.
       
  8410  */
       
  8411 	{
       
  8412 	}
       
  8413 
       
  8414 TVerdict CCTSYIntegrationTestPacketContext0035::doTestStepL()
       
  8415 /**
       
  8416  * @SYMTestCaseID BA-CTSY-INT-PKTC-0035
       
  8417  * @SYMFssID BA/CTSY/PKTC-0035
       
  8418  * @SYMTestCaseDesc Enumerate NIFs.
       
  8419  * @SYMTestPriority High
       
  8420  * @SYMTestActions RPacketContext::GetStatus, RPacketContext::AddPacketFilter, RPacketService::EnumerateNifs, RPacketContext::NotifyStatusChange, RPacketContext::SetConfig, RPacketQoS::OpenNewQoS, RPacketQoS::GetProfileCapabilities, RPacketQoS::SetProfileParameters
       
  8421  * @SYMTestExpectedResults Pass - Number of NIFs correct.
       
  8422  * @SYMTestType CIT
       
  8423  * @SYMTestCaseDependencies live/automatic
       
  8424  *
       
  8425  * Reason for test: Verify number of NIFs and NIF info correct as contexts are activated. Verify that for each primary context that is activated, number of NIFs increases by 1, if a secondary context is activated number of NIFs does not change.
       
  8426  *
       
  8427  * @return - TVerdict code
       
  8428  */
       
  8429 	{
       
  8430 
       
  8431 	////////////////////////////////////////////////////////////////
       
  8432 	// SET UP
       
  8433 	////////////////////////////////////////////////////////////////
       
  8434 
       
  8435 	
       
  8436 	// Ensure packet service is attached, 
       
  8437 
       
  8438 
       
  8439 	////////////////////////////////////////////////////////////////
       
  8440 	// SET UP END
       
  8441 	////////////////////////////////////////////////////////////////
       
  8442 	
       
  8443 	StartTest();
       
  8444 	
       
  8445 	////////////////////////////////////////////////////////////////
       
  8446 	// TEST START
       
  8447 	////////////////////////////////////////////////////////////////
       
  8448 	
       
  8449 	
       
  8450 	// Open a new primary context (context 1). 
       
  8451 
       
  8452 	// Add a TPacketFilterV2 packet filter to the secondary context using RPacketContext::AddPacketFilter 
       
  8453 
       
  8454 	// ===  Add QoS ===
       
  8455 
       
  8456 	// Open a new QoS from the secondary context  
       
  8457 
       
  8458 	// Get GPRS QoS profile capabilities with RPacketQoS::GetProfileCapabilities 
       
  8459 
       
  8460 	// Set requested profile parameters with RPacketQoS::SetProfileParameters and TQoSGPRSRequested with parameters within range returned by RPacketQoS::GetProfileCapabilities 
       
  8461 
       
  8462 	// Set a valid context config using RPacketContext::SetConfig 
       
  8463 
       
  8464 	// Activate packet context with RPacketContext::Activate 
       
  8465 
       
  8466 	// Check RPacketContext::NotifyStatusChange completes with EStatusActivating -> EStatusActive
       
  8467 
       
  8468 	// Check RPacketContext::GetStatus returns EStatusActive
       
  8469 
       
  8470 	// Check RPacketService::EnumerateNifs returns aCount = 1
       
  8471 
       
  8472 	// Open a new primary context (context 2) 
       
  8473 
       
  8474 	// Add a TPacketFilterV3 packet filter to context 2 using RPacketContext::AddPacketFilter 
       
  8475 
       
  8476 	// Open a new QoS from context 2  
       
  8477 
       
  8478 	// Get R5 QoS profile capabilities with RPacketQoS::GetProfileCapabilities 
       
  8479 
       
  8480 	// Set requested profile parameters with RPacketQoS::SetProfileParameters and TQoSR5Requested with parameters within range returned by RPacketQoS::GetProfileCapabilities 
       
  8481 
       
  8482 	// Set a valid context config for context 2 using RPacketContext::SetConfig 
       
  8483 
       
  8484 	// Activate packet context for context 2 with RPacketContext::Activate 
       
  8485 
       
  8486 	// Check RPacketContext::NotifyStatusChange for context 2 completes with EStatusActivating -> EStatusActive
       
  8487 
       
  8488 	// Check RPacketContext::GetStatus for context 2 returns EStatusActive
       
  8489 
       
  8490 	// Check RPacketService::EnumerateNifs returns aCount = 2
       
  8491 
       
  8492 	// Open a new secondary context from context 1 (this is context 3) 
       
  8493 
       
  8494 	// Set a valid context config for context 3 using RPacketContext::SetConfig 
       
  8495 
       
  8496 	// Activate packet context for context 3 with RPacketContext::Activate 
       
  8497 
       
  8498 	// Check RPacketContext::NotifyStatusChange for context 3 completes with EStatusActivating -> EStatusActive
       
  8499 
       
  8500 	// Check RPacketContext::GetStatus for context 3 returns EStatusActive
       
  8501 
       
  8502 	// Check RPacketService::EnumerateNifs returns aCount = 2
       
  8503 
       
  8504 	
       
  8505 	////////////////////////////////////////////////////////////////
       
  8506 	// TEST END
       
  8507 	////////////////////////////////////////////////////////////////
       
  8508 
       
  8509     StartCleanup();
       
  8510 	
       
  8511 	// Put any required test clean up here, then remove this comment
       
  8512 	
       
  8513 	return TestStepResult();
       
  8514 	}
       
  8515 
       
  8516 TPtrC CCTSYIntegrationTestPacketContext0035::GetTestStepName()
       
  8517 /**
       
  8518  * @return The test step name.
       
  8519  */
       
  8520 	{
       
  8521 	return _L("CCTSYIntegrationTestPacketContext0035");
       
  8522 	}
       
  8523 
       
  8524 
       
  8525 
       
  8526 CCTSYIntegrationTestPacketContext0036::CCTSYIntegrationTestPacketContext0036(CEtelSessionMgr& aEtelSessionMgr)
       
  8527 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
  8528 /**
       
  8529  * Constructor.
       
  8530  */
       
  8531 	{
       
  8532 	SetTestStepName(CCTSYIntegrationTestPacketContext0036::GetTestStepName());
       
  8533 	}
       
  8534 
       
  8535 CCTSYIntegrationTestPacketContext0036::~CCTSYIntegrationTestPacketContext0036()
       
  8536 /**
       
  8537  * Destructor.
       
  8538  */
       
  8539 	{
       
  8540 	}
       
  8541 
       
  8542 TVerdict CCTSYIntegrationTestPacketContext0036::doTestStepL()
       
  8543 /**
       
  8544  * @SYMTestCaseID BA-CTSY-INT-PKTC-0036
       
  8545  * @SYMFssID BA/CTSY/PKTC-0036
       
  8546  * @SYMTestCaseDesc Activate a primary context with packet filter and QoS set up.
       
  8547  * @SYMTestPriority High
       
  8548  * @SYMTestActions RPacketContext::AddPacketFilter, RPacketContext::EnumeratePacketFilters, RPacketContext::GetPacketFilterInfo, RPacketQoS::OpenNewQoS, RPacketQoS::SetProfileParameters, RPacketQoS::GetProfileParameters, RPacketQoS::GetProfileCapabilities, RPacketContext::GetProfileName
       
  8549  * @SYMTestExpectedResults Pass - Packet filter added to context and context activated.
       
  8550  * @SYMTestType CIT
       
  8551  * @SYMTestCaseDependencies live/automatic
       
  8552  *
       
  8553  * Reason for test: Verify packet filter info and QoS profile info correct.
       
  8554  *
       
  8555  * @return - TVerdict code
       
  8556  */
       
  8557 	{
       
  8558 
       
  8559 	////////////////////////////////////////////////////////////////
       
  8560 	// SET UP
       
  8561 	////////////////////////////////////////////////////////////////
       
  8562 
       
  8563 	
       
  8564 	// Ensure phone is attached to the packet service 
       
  8565 
       
  8566 
       
  8567 	////////////////////////////////////////////////////////////////
       
  8568 	// SET UP END
       
  8569 	////////////////////////////////////////////////////////////////
       
  8570 	
       
  8571 	StartTest();
       
  8572 	
       
  8573 	////////////////////////////////////////////////////////////////
       
  8574 	// TEST START
       
  8575 	////////////////////////////////////////////////////////////////
       
  8576 	
       
  8577 	
       
  8578 	// Open a new primary context 
       
  8579 
       
  8580 	// Add a TPacketFilterV2 packet filter to the primary context using RPacketContext::AddPacketFilter 
       
  8581 
       
  8582 	// Check RPacketContext::EnumeratePacketFilters returns aCount = 1
       
  8583 
       
  8584 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 0 returns same packet filter info added to the context
       
  8585 
       
  8586 	// Open a new QoS from the primary context  
       
  8587 
       
  8588 	// Get profile capabilities with RPacketCotnext::GetProfileCapabilities with aProfileCaps as a packaged RPacketContext::TQoSCapsGPRS  
       
  8589 
       
  8590 	// Set requested profile parameters with RPacketQoS::SetProfileParameters and TQoSR5Requested with parameters within range returned by RPacketQoS::GetProfileCapabilities 
       
  8591 
       
  8592 	// Check RPacketContext::GetProfileName returns QoS profile name with length > 0
       
  8593 
       
  8594 	// Set a valid context config using RPacketContext::SetConfig 
       
  8595 
       
  8596 	// Activate packet context with RPacketContext::Activate 
       
  8597 
       
  8598 	// Check RPacketContext::NotifyStatusChange completes with EStatusActivating -> EStatusActive
       
  8599 
       
  8600 	// Check RPacketContext::GetStatus returns EStatusActive
       
  8601 
       
  8602 	// Check RPacketContext::EnumeratePacketFilters returns aCount = 1
       
  8603 
       
  8604 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 0 returns same packet filter info added to the context
       
  8605 
       
  8606 	// Repeat test with RPacketContext::TQoSCapsR99_R4 and RPacketContext::TQoSCapsR5 instead of RPacketContext::TQoSCapsGPRS 
       
  8607 
       
  8608 	
       
  8609 	////////////////////////////////////////////////////////////////
       
  8610 	// TEST END
       
  8611 	////////////////////////////////////////////////////////////////
       
  8612 
       
  8613     StartCleanup();
       
  8614 	
       
  8615 	// Put any required test clean up here, then remove this comment
       
  8616 	
       
  8617 	return TestStepResult();
       
  8618 	}
       
  8619 
       
  8620 TPtrC CCTSYIntegrationTestPacketContext0036::GetTestStepName()
       
  8621 /**
       
  8622  * @return The test step name.
       
  8623  */
       
  8624 	{
       
  8625 	return _L("CCTSYIntegrationTestPacketContext0036");
       
  8626 	}
       
  8627 
       
  8628 
       
  8629 
       
  8630 CCTSYIntegrationTestPacketContext0037::CCTSYIntegrationTestPacketContext0037(CEtelSessionMgr& aEtelSessionMgr)
       
  8631 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
  8632 /**
       
  8633  * Constructor.
       
  8634  */
       
  8635 	{
       
  8636 	SetTestStepName(CCTSYIntegrationTestPacketContext0037::GetTestStepName());
       
  8637 	}
       
  8638 
       
  8639 CCTSYIntegrationTestPacketContext0037::~CCTSYIntegrationTestPacketContext0037()
       
  8640 /**
       
  8641  * Destructor.
       
  8642  */
       
  8643 	{
       
  8644 	}
       
  8645 
       
  8646 TVerdict CCTSYIntegrationTestPacketContext0037::doTestStepL()
       
  8647 /**
       
  8648  * @SYMTestCaseID BA-CTSY-INT-PKTC-0037
       
  8649  * @SYMFssID BA/CTSY/PKTC-0037
       
  8650  * @SYMTestCaseDesc Modify a primary context with packet filter and QoS.
       
  8651  * @SYMTestPriority High
       
  8652  * @SYMTestActions RPacketContext::ModifyActiveContext, RPacketContext::GetProfileParameters, RPacketContext::GetProfileName, RPacketContext::RemovePacketFilter, RPacketContext::EnumeratePacketFilters, RPacketQoS::SetProfileParameters, RPacketQoS::OpenNewQoS, RPacketContext::AddPacketFilter
       
  8653  * @SYMTestExpectedResults Pass - Context is modified.
       
  8654  * @SYMTestType CIT
       
  8655  * @SYMTestCaseDependencies live/automatic
       
  8656  *
       
  8657  * Reason for test: Verify packet filter info and QoS profile info correct.
       
  8658  *
       
  8659  * @return - TVerdict code
       
  8660  */
       
  8661 	{
       
  8662 
       
  8663 	////////////////////////////////////////////////////////////////
       
  8664 	// SET UP
       
  8665 	////////////////////////////////////////////////////////////////
       
  8666 
       
  8667 	
       
  8668 	// Ensure there is an active primary context. 
       
  8669 
       
  8670 
       
  8671 	////////////////////////////////////////////////////////////////
       
  8672 	// SET UP END
       
  8673 	////////////////////////////////////////////////////////////////
       
  8674 	
       
  8675 	StartTest();
       
  8676 	
       
  8677 	////////////////////////////////////////////////////////////////
       
  8678 	// TEST START
       
  8679 	////////////////////////////////////////////////////////////////
       
  8680 	
       
  8681 	
       
  8682 	// Add a TPacketFilterV2packet filter to the primary context using RPacketContext::AddPacketFilter 
       
  8683 
       
  8684 	// Open a new QoS from the primary context 
       
  8685 
       
  8686 	// Set requested profile parameters with RPacketQoS::SetProfileParameters and TQoSGPRSRequested with parameters within range returned by RPacketQoS::GetProfileCapabilities 
       
  8687 
       
  8688 	// Check RPacketContext::GetProfileName returns QoS profile name with length > 0
       
  8689 
       
  8690 	// Modify the active context with RPacketContext::ModifyActiveContext 
       
  8691 
       
  8692 	// Check RPacketContext::EnumeratePacketFilters returns aCount = 1
       
  8693 
       
  8694 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 0 returns same packet filter info added to the context
       
  8695 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 1 returns KErrArgument
       
  8696 
       
  8697 	// Check RPacketContext::GetProfileParameters returns TQoSGPRSNegotiated parameters.
       
  8698 
       
  8699 	// Remove packet filter with RPacketContext::RemovePacketFilter. 
       
  8700 
       
  8701 	// Modify the active context with RPacketContext::ModifyActiveContext 
       
  8702 
       
  8703 	// Check RPacketContext::EnumeratePacketFilters returns aCount = 1
       
  8704 
       
  8705 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 0 returns KErrArgument
       
  8706 
       
  8707 	// Repeat test with TQoSR99_R4Requested and TQoSR5Requested types in  RPacketQoS::SetProfileParameters and checking for TQoSR99_R4Negotiated and TQoSR5Negotiated  in RPacketContext::GetProfileParameters respectively. 
       
  8708 
       
  8709 	
       
  8710 	////////////////////////////////////////////////////////////////
       
  8711 	// TEST END
       
  8712 	////////////////////////////////////////////////////////////////
       
  8713 
       
  8714     StartCleanup();
       
  8715 	
       
  8716 	// Put any required test clean up here, then remove this comment
       
  8717 	
       
  8718 	return TestStepResult();
       
  8719 	}
       
  8720 
       
  8721 TPtrC CCTSYIntegrationTestPacketContext0037::GetTestStepName()
       
  8722 /**
       
  8723  * @return The test step name.
       
  8724  */
       
  8725 	{
       
  8726 	return _L("CCTSYIntegrationTestPacketContext0037");
       
  8727 	}
       
  8728 
       
  8729 
       
  8730 
       
  8731 CCTSYIntegrationTestPacketContext0038::CCTSYIntegrationTestPacketContext0038(CEtelSessionMgr& aEtelSessionMgr, const TDesC& aName)
       
  8732 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
  8733 /**
       
  8734  * Constructor.
       
  8735  */
       
  8736 	{
       
  8737 	SetTestStepName(aName);
       
  8738 	if(aName.Find(_L("GRPS")) != KErrNotFound)
       
  8739 		{
       
  8740 		iTestType = EQoSGPRS;
       
  8741 		}
       
  8742 	else if(aName.Find(_L("R4")) != KErrNotFound)
       
  8743 		{
       
  8744 		iTestType = EQoSR4;
       
  8745 		}
       
  8746 	else if(aName.Find(_L("R5")) != KErrNotFound)
       
  8747 		{
       
  8748 		iTestType = EQoSR5;
       
  8749 		}
       
  8750 	}
       
  8751 
       
  8752 CCTSYIntegrationTestPacketContext0038::~CCTSYIntegrationTestPacketContext0038()
       
  8753 /**
       
  8754  * Destructor.
       
  8755  */
       
  8756 	{
       
  8757 	}
       
  8758 
       
  8759 
       
  8760 template<class PARAMETERS, class CAPABILITIES, class NEGOTIATED>
       
  8761 	TBool CCTSYIntegrationTestPacketContext0038::ActiveContextL(RPacketContext &aPacketContext,
       
  8762                                                                RPacketQoS &aPacketQoS,
       
  8763                                                                PARAMETERS &aParameters,
       
  8764                                                                CAPABILITIES &aCapabilities,
       
  8765                                                                NEGOTIATED &aNegotiated)
       
  8766 
       
  8767 /**
       
  8768  * Activate a secondary context. This is actually a single context activation method, 
       
  8769  * the test activate the context three times, each with diffrent type of parameters, capabilities and negotiation objects
       
  8770  * 
       
  8771  * @param aPacketContext Reference to the secondary context session.
       
  8772  * @param aPacketQoS Reference to the packet Quality of Service session.
       
  8773  * @param aParameters Reference to the QoS parameters. Must be TQoSGPRSRequested, TQoSR99_R4Requested or TQoSR5Requested.
       
  8774  * @param aCapabilities Reference to the QoS capabilities. Must be a TQoSCapsGPRS, TQoSCapsR99_R4 or TQoSCapsR5 respectivley.
       
  8775  * @param aNegotiated Reference to the QoS nagotiated. Must be a TQoSGPRSNegotiated, t99_r4Negotiated or r5Negotiated respectivley.
       
  8776  * 
       
  8777  * @return ETrue if the activation went well
       
  8778  */
       
  8779     {
       
  8780     TBool ret = ETrue;
       
  8781 
       
  8782     // Add a TPacketFilterV2 packet filter to the secondary context using RPacketContext::AddPacketFilter 
       
  8783 	ASSERT_EQUALS(AddPacketFilterV2ToContextL(aPacketContext,1), KErrNone,
       
  8784 					_L("RPacketContext::AddPacketFilter returned with error status")); 
       
  8785 
       
  8786 	// Get profile capabilities with RPacketCotnext::GetProfileCapabilities with aProfileCaps as a packaged CAPABILITIES
       
  8787 	TExtEtelRequestStatus getProfileCapStatus(aPacketQoS, EPacketQoSGetProfileCaps);
       
  8788 	CleanupStack::PushL(getProfileCapStatus);
       
  8789 	TPckg<CAPABILITIES> qosCapsPckg(aCapabilities);
       
  8790 	aPacketQoS.GetProfileCapabilities(getProfileCapStatus, qosCapsPckg);
       
  8791 	LOCAL_ASSERT_EQUALS(WaitForRequestWithTimeOut(getProfileCapStatus, ETimeMedium), KErrNone, 
       
  8792                         _L("RPacketQoS::GetProfileCapabilities timed out."));
       
  8793 	LOCAL_ASSERT_EQUALS(getProfileCapStatus.Int(), KErrNone,
       
  8794                         _L("RPacketQoS::GetProfileCapabilities returned with error status."));
       
  8795 
       
  8796     // Set requested profile parameters with RPacketQoS::SetProfileParameters and PARAMETERS with parameters within range returned by RPacketQoS::GetProfileCapabilities 
       
  8797 	TPckg<PARAMETERS> qosReqPckg(aParameters);
       
  8798     FillParametersFromCapabilities(aParameters,aCapabilities);
       
  8799 	TExtEtelRequestStatus setProfileParamStatus(aPacketQoS, EPacketQoSSetProfileParams);
       
  8800 	CleanupStack::PushL(setProfileParamStatus);
       
  8801     aPacketQoS.SetProfileParameters(setProfileParamStatus, qosReqPckg);
       
  8802 	LOCAL_ASSERT_EQUALS(WaitForRequestWithTimeOut(setProfileParamStatus, ETimeMedium), KErrNone, 
       
  8803                   _L("RPacketQoS::SetProfileParameters timed out."));
       
  8804 	LOCAL_ASSERT_EQUALS(setProfileParamStatus.Int(), KErrNone,
       
  8805                   _L("RPacketQoS::SetProfileParameters returned with error status."));
       
  8806 
       
  8807 	// Check RPacketContext::GetProfileName returns QoS profile name with length > 0
       
  8808     TName profileName;
       
  8809     LOCAL_ASSERT_EQUALS(aPacketContext.GetProfileName(profileName),KErrNone,
       
  8810                         _L("RPacketContext::GetProfileName returned with error status."));
       
  8811     LOCAL_ASSERT_TRUE(profileName.Length()>0,
       
  8812                       _L("RPacketContext::GetProfileName name length is 0."));
       
  8813 
       
  8814 	// Post notification for context's status change
       
  8815 	TExtEtelRequestStatus notifyContextStChStatus(aPacketContext, EPacketContextNotifyStatusChange);
       
  8816 	CleanupStack::PushL(notifyContextStChStatus);
       
  8817 	RPacketContext::TContextStatus packetContextStatus;
       
  8818 	aPacketContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);
       
  8819     
       
  8820     // Activate the secondary context. 
       
  8821 	TExtEtelRequestStatus contextActivateStatus(aPacketContext, EPacketContextActivate);
       
  8822 	CleanupStack::PushL(contextActivateStatus);
       
  8823 	aPacketContext.Activate(contextActivateStatus);
       
  8824 	LOCAL_ASSERT_EQUALS(WaitForRequestWithTimeOut(contextActivateStatus, ETimeMedium), KErrNone, 
       
  8825 					_L("RPacketContext::Activate timed out."));
       
  8826 	LOCAL_ASSERT_EQUALS(contextActivateStatus.Int(), KErrNone,
       
  8827 					_L("RPacketContext::Activate returned with error status."));
       
  8828 
       
  8829 	// Check RPacketContext::NotifyStatusChange for the secondary context completes with EStatusActivating -> EStatusActive
       
  8830     RPacketContext::TContextStatus expectedPacketContextStatus = RPacketContext::EStatusActivating;
       
  8831 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  8832 				aPacketContext,
       
  8833 				notifyContextStChStatus,
       
  8834 				packetContextStatus, 
       
  8835 				expectedPacketContextStatus,
       
  8836 				KErrNone);
       
  8837     LOCAL_ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusActivating, _L("Packet Context's status expected to be EStatusActivating but is not."));
       
  8838     aPacketContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);	
       
  8839     expectedPacketContextStatus = RPacketContext::EStatusActive;
       
  8840 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  8841 				aPacketContext,
       
  8842 				notifyContextStChStatus,
       
  8843 				packetContextStatus, 
       
  8844 				expectedPacketContextStatus,
       
  8845 				KErrNone);
       
  8846 
       
  8847 	// Check RPacketContext::GetStatus for the secondary context returns EStatusActive
       
  8848 	LOCAL_ASSERT_EQUALS(aPacketContext.GetStatus(packetContextStatus), KErrNone, _L("RPacketContext::GetStatus returned with an error."));
       
  8849 	LOCAL_ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusActive, _L("RPacketContext::GetStatus returns incorrect status."));
       
  8850 
       
  8851 	// Check RPacketContext::EnumeratePacketFilters returns aCount = 1
       
  8852     TInt count=-1;
       
  8853     TExtEtelRequestStatus enumeratePacketFiltersChStatus(aPacketContext, EPacketContextEnumeratePacketFilters);
       
  8854     CleanupStack::PushL(enumeratePacketFiltersChStatus);
       
  8855     aPacketContext.EnumeratePacketFilters(enumeratePacketFiltersChStatus,count);
       
  8856 	LOCAL_ASSERT_EQUALS(WaitForRequestWithTimeOut(enumeratePacketFiltersChStatus, ETimeShort), KErrNone,
       
  8857                   _L("RPacketContext::EnumeratePacketFilters timed out"));
       
  8858     LOCAL_ASSERT_EQUALS(enumeratePacketFiltersChStatus.Int(), KErrNone,
       
  8859                   _L("RPacketContext::EnumeratePacketFilters returned an error"));
       
  8860     LOCAL_ASSERT_EQUALS(count, 1,
       
  8861                   _L("RPacketContext::EnumeratePacketFilters returned wrong number"));
       
  8862 
       
  8863 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 0 returns packet filter added to the context
       
  8864     TExtEtelRequestStatus getPacketFilterInfoStatus(aPacketContext, EPacketContextGetPacketFilterInfo);
       
  8865     CleanupStack::PushL(getPacketFilterInfoStatus);
       
  8866     RPacketContext::TPacketFilterV2 packetFilter;
       
  8867 	RPacketContext::TPacketFilterV2Pckg packetFilterPkg(packetFilter);
       
  8868     aPacketContext.GetPacketFilterInfo(getPacketFilterInfoStatus,0,packetFilterPkg);
       
  8869 	LOCAL_ASSERT_EQUALS(WaitForRequestWithTimeOut(getPacketFilterInfoStatus, ETimeShort), KErrNone,
       
  8870                   _L("RPacketContext::GetPacketFilterInfo timed out"));
       
  8871     LOCAL_ASSERT_EQUALS(getPacketFilterInfoStatus.Int(), KErrNone,
       
  8872                   _L("RPacketContext::GetPacketFilterInfo returned an error"));
       
  8873     RPacketContext::TPacketFilterV2 defaultPacketFilterInfo;
       
  8874     FillPacketFilter(defaultPacketFilterInfo,1);
       
  8875     LOCAL_ASSERT_TRUE(CompareFilters(packetFilter,defaultPacketFilterInfo),_L("RPacketContext::GetPacketFilterInfo returned wrong filter"));
       
  8876 
       
  8877 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 1 returns KErrArgument
       
  8878     aPacketContext.GetPacketFilterInfo(getPacketFilterInfoStatus,1,packetFilterPkg);
       
  8879 	LOCAL_ASSERT_EQUALS(WaitForRequestWithTimeOut(getPacketFilterInfoStatus, ETimeShort), KErrNone,
       
  8880                   _L("RPacketContext::GetPacketFilterInfo timed out"));
       
  8881     LOCAL_ASSERT_EQUALS(getPacketFilterInfoStatus.Int(), KErrArgument,
       
  8882                   _L("RPacketContext::GetPacketFilterInfo did not returned an error"));
       
  8883 
       
  8884 	// Check RPacketContext::GetProfileParameters returns NEGOTIATED parameters.
       
  8885     TExtEtelRequestStatus getProfileParametersStatus(aPacketQoS, EPacketQoSGetProfileParams);
       
  8886     CleanupStack::PushL(getProfileParametersStatus);
       
  8887 	TPckg<NEGOTIATED> negotiatedPckg(aNegotiated);
       
  8888     aPacketQoS.GetProfileParameters(getProfileParametersStatus,negotiatedPckg);
       
  8889 	LOCAL_ASSERT_EQUALS(WaitForRequestWithTimeOut(getProfileParametersStatus, ETimeShort), KErrNone,
       
  8890                   _L("RPacketQoS::GetProfileParameters timed out"));
       
  8891     LOCAL_ASSERT_EQUALS(getProfileParametersStatus.Int(), KErrNone,
       
  8892                   _L("RPacketQoS::GetProfileParameters returned an error"));
       
  8893     
       
  8894 	// Deactivate context.
       
  8895     TExtEtelRequestStatus deactivateContextStatus(aPacketContext, EPacketContextDeactivate);
       
  8896     CleanupStack::PushL(getProfileParametersStatus);
       
  8897     aPacketContext.Deactivate(deactivateContextStatus);
       
  8898 	LOCAL_ASSERT_EQUALS(WaitForRequestWithTimeOut(deactivateContextStatus, ETimeMedium), KErrNone, 
       
  8899 					_L("RPacketContext::Deactivate timed out."));
       
  8900 	LOCAL_ASSERT_EQUALS(deactivateContextStatus.Int(), KErrNone,
       
  8901 					_L("RPacketContext::Deactivate returned with error status."));
       
  8902 
       
  8903 	
       
  8904     iEtelSessionMgr.ReleaseSecondaryPacketContext(
       
  8905 			KMainServer,
       
  8906 			KMainPhone,
       
  8907 			KMainPacketService, 
       
  8908 			KPrimaryPacketContext1,
       
  8909 			KSecondaryPacketContext3);
       
  8910 
       
  8911 	// Pop:
       
  8912 	//  deactivateContextStatus
       
  8913 	//	getProfileParametersStatus
       
  8914 	//	getPacketFilterInfoStatus
       
  8915 	//	enumeratePacketFiltersChStatus
       
  8916 	//	contextActivateStatus
       
  8917 	//	notifyContextStChStatus
       
  8918 	//	setProfileParamStatus
       
  8919 	//	getProfileCapStatus
       
  8920 	CleanupStack::PopAndDestroy(8,&getProfileCapStatus);
       
  8921 
       
  8922     return ret;
       
  8923     }
       
  8924 TVerdict CCTSYIntegrationTestPacketContext0038::doTestStepL()
       
  8925 /**
       
  8926  * @SYMTestCaseID BA-CTSY-INT-PKTC-0038
       
  8927  * @SYMFssID BA/CTSY/PKTC-0038
       
  8928  * @SYMTestCaseDesc Activate a secondary context with packet filter and QoS set up.
       
  8929  * @SYMTestPriority High
       
  8930  * @SYMTestActions RPacketContext::GetProfileName, RPacketContext::GetStatus, RPacketContext::EnumeratePacketFilters, RPacketContext::AddPacketFilter, RPacketContext::NotifyStatusChange, RPacketContext::GetPacketFilterInfo, RPacketContext::ModifyActiveContext, RPacketQoS::OpenNewQoS, RPacketQoS::SetProfileParameters, RPacketContext::RemovePacketFilter
       
  8931  * @SYMTestExpectedResults Pass - Packet filter added and removed successfully.Context active.
       
  8932  * @SYMTestType CIT
       
  8933  * @SYMTestCaseDependencies live/automatic
       
  8934  *
       
  8935  * Reason for test: Verify packet filter info and QoS profile info correct.
       
  8936  *
       
  8937  * @return - TVerdict code
       
  8938  */
       
  8939 	{
       
  8940 
       
  8941 	////////////////////////////////////////////////////////////////
       
  8942 	// SET UP
       
  8943 	////////////////////////////////////////////////////////////////
       
  8944 
       
  8945 	DEBUG_PRINTF2(_L("Starting with type %d"),iTestType);
       
  8946 
       
  8947 	// Call TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL		
       
  8948     RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
  8949 	CHECK_EQUALS_L(iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(phone), KErrNone, _L("TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL returned with an error"));
       
  8950  	iNetworkTestHelper.CheckPhoneConnectedToAniteL(phone);
       
  8951 
       
  8952 	// Ensure there is an active primary context. 
       
  8953 	RPacketContext& packetContext = iEtelSessionMgr.GetPrimaryPacketContextL(
       
  8954 			KMainServer,
       
  8955 			KMainPhone,
       
  8956 			KMainPacketService,
       
  8957 			KPrimaryPacketContext1);
       
  8958 	iPacketServiceTestHelper.ActivatePrimaryPacketContextL(phone,packetContext);
       
  8959 
       
  8960 
       
  8961 	////////////////////////////////////////////////////////////////
       
  8962 	// SET UP END
       
  8963 	////////////////////////////////////////////////////////////////
       
  8964 	
       
  8965 	StartTest();
       
  8966 	
       
  8967 	////////////////////////////////////////////////////////////////
       
  8968 	// TEST START
       
  8969 	////////////////////////////////////////////////////////////////
       
  8970 	
       
  8971 	
       
  8972 	// Open a new secondary context. 
       
  8973     RPacketContext& secondaryPacketContext1 = iEtelSessionMgr.GetSecondaryPacketContextL(
       
  8974 			KMainServer,
       
  8975 			KMainPhone,
       
  8976 			KMainPacketService, 
       
  8977 			KPrimaryPacketContext1,
       
  8978 			KSecondaryPacketContext1);
       
  8979 
       
  8980 	// Open a new QoS from the secondary context 
       
  8981 	RPacketQoS& packetQoS1 = iEtelSessionMgr.GetSecondaryPacketContextQoSL(
       
  8982 			KMainServer,
       
  8983 			KMainPhone,
       
  8984 			KMainPacketService, 
       
  8985 			KPrimaryPacketContext1,
       
  8986 			KSecondaryPacketContext1);
       
  8987 
       
  8988     RPacketQoS::TQoSGPRSRequested gprsRequested;
       
  8989     RPacketQoS::TQoSCapsGPRS capsGPRS;
       
  8990     RPacketQoS::TQoSGPRSNegotiated gprsNegotiated;
       
  8991     
       
  8992     RPacketQoS::TQoSR99_R4Requested r99_r4Requested;
       
  8993     RPacketQoS::TQoSCapsR99_R4 capsR99_R4;
       
  8994     RPacketQoS::TQoSR99_R4Negotiated t99_r4Negotiated;
       
  8995     t99_r4Negotiated.iTrafficClass = RPacketQoS::ETrafficClassUnspecified; 
       
  8996     t99_r4Negotiated.iDeliveryOrderReqd = RPacketQoS::EDeliveryOrderUnspecified;
       
  8997     t99_r4Negotiated.iDeliverErroneousSDU = RPacketQoS::EErroneousSDUDeliveryUnspecified;
       
  8998     //t99_r4Negotiated.iMaxSDUSize = 500; //not sure
       
  8999     //t99_r4Negotiated.iMaxRate.iUplinkRate = 5000; //not sure 
       
  9000     //t99_r4Negotiated.iMaxRate.iDownlinkRate = 5000; //not sure 
       
  9001     t99_r4Negotiated.iBER = RPacketQoS::EBERUnspecified;
       
  9002     t99_r4Negotiated.iSDUErrorRatio = RPacketQoS::ESDUErrorRatioUnspecified;
       
  9003     t99_r4Negotiated.iTrafficHandlingPriority = RPacketQoS::ETrafficPriorityUnspecified; 
       
  9004     //t99_r4Negotiated.iTransferDelay = 110; //not sure
       
  9005     //t99_r4Negotiated.iGuaranteedRate.iUplinkRate = 5000; //not sure 
       
  9006     //t99_r4Negotiated.iGuaranteedRate.iDownlinkRate = 5000; //not sure 
       
  9007     
       
  9008     RPacketQoS::TQoSR5Requested r5Requested;
       
  9009     RPacketQoS::TQoSCapsR5 capsr5;
       
  9010     RPacketQoS::TQoSR5Negotiated r5Negotiated;
       
  9011 
       
  9012     switch(iTestType)
       
  9013 		{
       
  9014 		case EQoSGPRS:
       
  9015 		    //Activate The Context using TQoSGPRSRequested, TQoSCapsGPRS and TQoSGPRSNegotiated
       
  9016 		    ASSERT_TRUE(ActiveContextL(secondaryPacketContext1,packetQoS1,gprsRequested,capsGPRS,gprsNegotiated),
       
  9017 		                _L("CCTSYIntegrationTestPacketContext0038::ActiveContextL failed"));
       
  9018 		    break;
       
  9019 		case EQoSR4:
       
  9020 		    ASSERT_TRUE(ActiveContextL(secondaryPacketContext1,packetQoS1,r99_r4Requested,capsR99_R4,t99_r4Negotiated),
       
  9021 		                _L("CCTSYIntegrationTestPacketContext0038::ActiveContextL failed"));
       
  9022 		    break;
       
  9023 		case EQoSR5:
       
  9024 		    ASSERT_TRUE(ActiveContextL(secondaryPacketContext1,packetQoS1,r5Requested,capsr5,r5Negotiated),
       
  9025 		                _L("CCTSYIntegrationTestPacketContext0038::ActiveContextL failed"));
       
  9026 			break;
       
  9027 		default:
       
  9028 			CHECK_TRUE_L(EFalse, _L("Wrong test type!"));
       
  9029 			
       
  9030 		}
       
  9031 
       
  9032 
       
  9033 	// Repeat test with TQoSR99_R4Requested and TQoSR5Requested types in  RPacketQoS::SetProfileParameters and checking for TQoSR99_R4Negotiated and TQoSR5Negotiated  in RPacketContext::GetProfileParameters respectively. 
       
  9034 
       
  9035 
       
  9036     //Activate The Context using TQoSR99_R4Requested, TQoSCapsR99_R4 and TQoSR99_R4Negotiated
       
  9037 
       
  9038 
       
  9039     //Activate The Context using TQoSR5Requested, TQoSCapsR5 and TQoSR5Negotiated
       
  9040     
       
  9041 	////////////////////////////////////////////////////////////////
       
  9042 	// TEST END
       
  9043 	////////////////////////////////////////////////////////////////
       
  9044 
       
  9045     StartCleanup();
       
  9046 	
       
  9047 	return TestStepResult();
       
  9048 	}
       
  9049 
       
  9050 TPtrC CCTSYIntegrationTestPacketContext0038::GetTestStepName()
       
  9051 /**
       
  9052  * @return The test step name.
       
  9053  */
       
  9054 	{
       
  9055 	return _L("CCTSYIntegrationTestPacketContext0038");
       
  9056 	}
       
  9057 
       
  9058 
       
  9059 
       
  9060 CCTSYIntegrationTestPacketContext0039::CCTSYIntegrationTestPacketContext0039(CEtelSessionMgr& aEtelSessionMgr, const TDesC& aName)
       
  9061 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
  9062 /**
       
  9063  * Constructor.
       
  9064  */
       
  9065 	{
       
  9066 	SetTestStepName(aName);
       
  9067 	if(aName.Find(_L("GRPS")) != KErrNotFound)
       
  9068 		{
       
  9069 		iTestType = EQoSGPRS;
       
  9070 		}
       
  9071 	else if(aName.Find(_L("R4")) != KErrNotFound)
       
  9072 		{
       
  9073 		iTestType = EQoSR4;
       
  9074 		}
       
  9075 	else if(aName.Find(_L("R5")) != KErrNotFound)
       
  9076 		{
       
  9077 		iTestType = EQoSR5;
       
  9078 		}
       
  9079 	}
       
  9080 
       
  9081 CCTSYIntegrationTestPacketContext0039::~CCTSYIntegrationTestPacketContext0039()
       
  9082 /**
       
  9083  * Destructor.
       
  9084  */
       
  9085 	{
       
  9086 	}
       
  9087 
       
  9088 template<class PARAMETERS,class CAPABILITIES,class NEGOTIATED>
       
  9089   TBool CCTSYIntegrationTestPacketContext0039::ActivateAndModifyContextL(RPacketContext &aPacketContext,
       
  9090                                                                         RPacketQoS &aPacketQoS,
       
  9091                                                                         PARAMETERS &aParameters,
       
  9092                                                                         CAPABILITIES &aCapabilities,
       
  9093                                                                         NEGOTIATED &aNegotiated)
       
  9094 /**
       
  9095  * Activate and modify a secondary context. This is actually a single context activation and modification method, 
       
  9096  * the test activate and modify the context three times, each with diffrent type of parameters, capabilities and negotiation objects
       
  9097  * 
       
  9098  * @param aPacketContext Reference to the secondary context session.
       
  9099  * @param aPacketQoS Reference to the packet Quality of Service session.
       
  9100  * @param aParameters Reference to the QoS parameters. Must be TQoSGPRSRequested, TQoSR99_R4Requested or TQoSR5Requested.
       
  9101  * @param aCapabilities Reference to the QoS capabilities. Must be a TQoSCapsGPRS, TQoSCapsR99_R4 or TQoSCapsR5 respectivley.
       
  9102  * @param aNegotiated Reference to the QoS nagotiated. Must be a TQoSGPRSNegotiated, t99_r4Negotiated or r5Negotiated respectivley.
       
  9103  * 
       
  9104  * @return ETrue if the activation went well
       
  9105  */
       
  9106     {
       
  9107     TBool ret=ETrue;
       
  9108 
       
  9109 	// Add a TPacketFilterV2 packet filter to the secondary context using RPacketContext::AddPacketFilter
       
  9110     LOCAL_ASSERT_EQUALS(AddPacketFilterV2ToContextL(aPacketContext,1), KErrNone,
       
  9111                         _L("RPacketContext::AddPacketFilter returned with error status"));
       
  9112 
       
  9113 	// Add a second TPacketFilterV2 packet filter to the secondary context using RPacketContext::AddPacketFilter 
       
  9114     LOCAL_ASSERT_EQUALS(AddPacketFilterV2ToContextL(aPacketContext,2), KErrNone,
       
  9115                         _L("RPacketContext::AddPacketFilter returned with error status"));
       
  9116 
       
  9117 	// Get profile capabilities with RPacketCotnext::GetProfileCapabilities with aProfileCaps as a packaged CAPABILITIES  
       
  9118 	TExtEtelRequestStatus getProfileCapStatus(aPacketQoS, EPacketQoSGetProfileCaps);
       
  9119 	CleanupStack::PushL(getProfileCapStatus);
       
  9120 	TPckg<CAPABILITIES> qosCapsPckg(aCapabilities);
       
  9121 	aPacketQoS.GetProfileCapabilities(getProfileCapStatus, qosCapsPckg);
       
  9122 	LOCAL_ASSERT_EQUALS(WaitForRequestWithTimeOut(getProfileCapStatus, ETimeMedium), KErrNone, 
       
  9123                         _L("RPacketQoS::GetProfileCapabilities timed out."));
       
  9124 	LOCAL_ASSERT_EQUALS(getProfileCapStatus.Int(), KErrNone,
       
  9125                         _L("RPacketQoS::GetProfileCapabilities returned with error status."));
       
  9126 
       
  9127 	// Set requested profile parameters with RPacketQoS::SetProfileParameters and PARAMETERS with parameters within range returned by RPacketQoS::GetProfileCapabilities 
       
  9128 	TPckg<PARAMETERS> qosReqPckg(aParameters);
       
  9129     FillParametersFromCapabilities(aParameters,aCapabilities);
       
  9130 	TExtEtelRequestStatus setProfileParamStatus(aPacketQoS, EPacketQoSSetProfileParams);
       
  9131 	CleanupStack::PushL(setProfileParamStatus);
       
  9132     aPacketQoS.SetProfileParameters(setProfileParamStatus, qosReqPckg);
       
  9133 	LOCAL_ASSERT_EQUALS(WaitForRequestWithTimeOut(setProfileParamStatus, ETimeMedium), KErrNone, 
       
  9134                   _L("RPacketQoS::SetProfileParameters timed out."));
       
  9135 	LOCAL_ASSERT_EQUALS(setProfileParamStatus.Int(), KErrNone,
       
  9136                   _L("RPacketQoS::SetProfileParameters returned with error status."));
       
  9137 
       
  9138 	// Check RPacketContext::GetProfileName returns QoS profile name with length > 0
       
  9139     TName profileName;
       
  9140     LOCAL_ASSERT_EQUALS(aPacketContext.GetProfileName(profileName),KErrNone,
       
  9141                         _L("RPacketContext::GetProfileName returned with error status."));
       
  9142     LOCAL_ASSERT_TRUE(profileName.Length()>0,
       
  9143                       _L("RPacketContext::GetProfileName name length is 0."));
       
  9144 
       
  9145 	// ===  Activate a context with two packet filters and QoS ===
       
  9146 
       
  9147 	// Post notification for context's status change
       
  9148 	TExtEtelRequestStatus notifyContextStChStatus(aPacketContext, EPacketContextNotifyStatusChange);
       
  9149 	CleanupStack::PushL(notifyContextStChStatus);
       
  9150 	RPacketContext::TContextStatus packetContextStatus;
       
  9151 	aPacketContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);
       
  9152 
       
  9153 	// Activate the secondary context. 
       
  9154 	TExtEtelRequestStatus contextActivateStatus(aPacketContext, EPacketContextActivate);
       
  9155 	CleanupStack::PushL(contextActivateStatus);
       
  9156 	aPacketContext.Activate(contextActivateStatus);
       
  9157 	LOCAL_ASSERT_EQUALS(WaitForRequestWithTimeOut(contextActivateStatus, ETimeMedium), KErrNone, 
       
  9158 					_L("RPacketContext::Activate timed out."));
       
  9159 	LOCAL_ASSERT_EQUALS(contextActivateStatus.Int(), KErrNone,
       
  9160 					_L("RPacketContext::Activate returned with error status."));
       
  9161 
       
  9162 	// Check RPacketContext::NotifyStatusChange for the secondary context completes with EStatusActivating -> EStatusActive
       
  9163     RPacketContext::TContextStatus expectedPacketContextStatus = RPacketContext::EStatusActivating;
       
  9164 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  9165 				aPacketContext,
       
  9166 				notifyContextStChStatus,
       
  9167 				packetContextStatus, 
       
  9168 				expectedPacketContextStatus,
       
  9169 				KErrNone);
       
  9170     LOCAL_ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusActivating, _L("Packet Context's status expected to be EStatusActivating but is not."));
       
  9171     aPacketContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);	
       
  9172     expectedPacketContextStatus = RPacketContext::EStatusActive;
       
  9173 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  9174 				aPacketContext,
       
  9175 				notifyContextStChStatus,
       
  9176 				packetContextStatus, 
       
  9177 				expectedPacketContextStatus,
       
  9178 				KErrNone);
       
  9179 
       
  9180 	// Check RPacketContext::GetStatus for the secondary context returns EStatusActive
       
  9181 	LOCAL_ASSERT_EQUALS(aPacketContext.GetStatus(packetContextStatus), KErrNone, _L("RPacketContext::GetStatus returned with an error."));
       
  9182 	LOCAL_ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusActive, _L("RPacketContext::GetStatus returns incorrect status."));
       
  9183 
       
  9184 	// Check RPacketContext::EnumeratePacketFilters returns aCount = 2
       
  9185     TInt count=-1;
       
  9186     TExtEtelRequestStatus enumeratePacketFiltersChStatus(aPacketContext, EPacketContextEnumeratePacketFilters);
       
  9187     CleanupStack::PushL(enumeratePacketFiltersChStatus);
       
  9188     aPacketContext.EnumeratePacketFilters(enumeratePacketFiltersChStatus,count);
       
  9189 	LOCAL_ASSERT_EQUALS(WaitForRequestWithTimeOut(enumeratePacketFiltersChStatus, ETimeShort), KErrNone,
       
  9190                   _L("RPacketContext::EnumeratePacketFilters timed out"));
       
  9191     LOCAL_ASSERT_EQUALS(enumeratePacketFiltersChStatus.Int(), KErrNone,
       
  9192                   _L("RPacketContext::EnumeratePacketFilters returned an error"));
       
  9193     LOCAL_ASSERT_EQUALS(count, 2,
       
  9194                   _L("RPacketContext::EnumeratePacketFilters returned wrong number"));
       
  9195 
       
  9196 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 0 returns first packet filter added to the context
       
  9197     TExtEtelRequestStatus getPacketFilterInfoStatus(aPacketContext, EPacketContextGetPacketFilterInfo);
       
  9198     CleanupStack::PushL(getPacketFilterInfoStatus);
       
  9199     RPacketContext::TPacketFilterV2 packetFilter;
       
  9200 	RPacketContext::TPacketFilterV2Pckg packetFilterPkg(packetFilter);
       
  9201     aPacketContext.GetPacketFilterInfo(getPacketFilterInfoStatus,0,packetFilterPkg);
       
  9202 	LOCAL_ASSERT_EQUALS(WaitForRequestWithTimeOut(getPacketFilterInfoStatus, ETimeShort), KErrNone,
       
  9203                   _L("RPacketContext::GetPacketFilterInfo timed out"));
       
  9204     LOCAL_ASSERT_EQUALS(getPacketFilterInfoStatus.Int(), KErrNone,
       
  9205                   _L("RPacketContext::GetPacketFilterInfo returned an error"));
       
  9206     RPacketContext::TPacketFilterV2 defaultPacketFilterInfo;
       
  9207     FillPacketFilter(defaultPacketFilterInfo,1);
       
  9208     LOCAL_ASSERT_TRUE(CompareFilters(packetFilter,defaultPacketFilterInfo),_L("RPacketContext::GetPacketFilterInfo returned wrong filter"));
       
  9209 
       
  9210 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 1 returns second packet filter added to the context
       
  9211     aPacketContext.GetPacketFilterInfo(getPacketFilterInfoStatus,1,packetFilterPkg);
       
  9212 	LOCAL_ASSERT_EQUALS(WaitForRequestWithTimeOut(getPacketFilterInfoStatus, ETimeShort), KErrNone,
       
  9213                   _L("RPacketContext::GetPacketFilterInfo timed out"));
       
  9214     LOCAL_ASSERT_EQUALS(getPacketFilterInfoStatus.Int(), KErrNone,
       
  9215                   _L("RPacketContext::GetPacketFilterInfo returned an error"));
       
  9216     FillPacketFilter(defaultPacketFilterInfo,2);
       
  9217     LOCAL_ASSERT_TRUE(CompareFilters(packetFilter,defaultPacketFilterInfo),_L("RPacketContext::GetPacketFilterInfo returned wrong filter"));
       
  9218 
       
  9219 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 2 returns KErrArgument
       
  9220     aPacketContext.GetPacketFilterInfo(getPacketFilterInfoStatus,2,packetFilterPkg);
       
  9221 	LOCAL_ASSERT_EQUALS(WaitForRequestWithTimeOut(getPacketFilterInfoStatus, ETimeShort), KErrNone,
       
  9222                   _L("RPacketContext::GetPacketFilterInfo timed out"));
       
  9223     LOCAL_ASSERT_EQUALS(getPacketFilterInfoStatus.Int(), KErrArgument,
       
  9224                   _L("RPacketContext::GetPacketFilterInfo did not returned an error"));
       
  9225 
       
  9226 	// Check RPacketContext::GetProfileParameters returns NEGOTIATED parameters.
       
  9227     TExtEtelRequestStatus getProfileParametersStatus(aPacketQoS, EPacketQoSGetProfileParams);
       
  9228     CleanupStack::PushL(getProfileParametersStatus);
       
  9229 	TPckg<NEGOTIATED> negotiatedPckg(aNegotiated);
       
  9230     aPacketQoS.GetProfileParameters(getProfileParametersStatus,negotiatedPckg);
       
  9231 	LOCAL_ASSERT_EQUALS(WaitForRequestWithTimeOut(getProfileParametersStatus, ETimeShort), KErrNone,
       
  9232                   _L("RPacketQoS::GetProfileParameters timed out"));
       
  9233     LOCAL_ASSERT_EQUALS(getProfileParametersStatus.Int(), KErrNone,
       
  9234                   _L("RPacketQoS::GetProfileParameters returned an error"));
       
  9235 
       
  9236 	// ===  Add another packet filter and modify the context ===
       
  9237 
       
  9238 	// Add a third TPacketFilterV3 packet filter to the secondary context using RPacketContext::AddPacketFilter 
       
  9239     LOCAL_ASSERT_EQUALS(AddPacketFilterV2ToContextL(aPacketContext,3), KErrNone,
       
  9240                         _L("RPacketContext::AddPacketFilter returned with error status"));
       
  9241 
       
  9242 	// Modify the secondary context with RPacketContext::ModifyActiveContext 
       
  9243 	// $CTSYProblem The LTSY or the Anite system has no support to RPacketContext::ModifyActiveContext
       
  9244 	ERR_PRINTF1(_L("<font color=Cyan>$CTSYProblem: The LTSY or the Anite system has no support to RPacketContext::ModifyActiveContext.<font color=Black>"));    
       
  9245 	TExtEtelRequestStatus modifyActiveContextStatus(aPacketContext, EPacketContextModifyActiveContext);
       
  9246 	CleanupStack::PushL(modifyActiveContextStatus);
       
  9247 	aPacketContext.ModifyActiveContext(modifyActiveContextStatus);
       
  9248 	LOCAL_ASSERT_EQUALS(WaitForRequestWithTimeOut(modifyActiveContextStatus, ETimeMedium), KErrNone, 
       
  9249                   _L("RPacketContext::ModifyActiveContext timed out."));
       
  9250 	LOCAL_ASSERT_EQUALS(modifyActiveContextStatus.Int(), KErrNone,
       
  9251                   _L("RPacketContext::ModifyActiveContext returned with error status."));
       
  9252 
       
  9253 	// Check RPacketContext::EnumeratePacketFilters returns aCount = 3
       
  9254     aPacketContext.EnumeratePacketFilters(enumeratePacketFiltersChStatus,count);
       
  9255 	LOCAL_ASSERT_EQUALS(WaitForRequestWithTimeOut(enumeratePacketFiltersChStatus, ETimeShort), KErrNone,
       
  9256                   _L("RPacketContext::EnumeratePacketFilters timed out"));
       
  9257     LOCAL_ASSERT_EQUALS(enumeratePacketFiltersChStatus.Int(), KErrNone,
       
  9258                   _L("RPacketContext::EnumeratePacketFilters returned an error"));
       
  9259     LOCAL_ASSERT_EQUALS(count, 3,
       
  9260                   _L("RPacketContext::EnumeratePacketFilters returned wrong number"));
       
  9261 
       
  9262 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 0 returns first packet filter added to the context
       
  9263     aPacketContext.GetPacketFilterInfo(getPacketFilterInfoStatus,0,packetFilterPkg);
       
  9264 	LOCAL_ASSERT_EQUALS(WaitForRequestWithTimeOut(getPacketFilterInfoStatus, ETimeShort), KErrNone,
       
  9265                   _L("RPacketContext::GetPacketFilterInfo timed out"));
       
  9266     LOCAL_ASSERT_EQUALS(getPacketFilterInfoStatus.Int(), KErrNone,
       
  9267                   _L("RPacketContext::GetPacketFilterInfo returned an error"));
       
  9268     FillPacketFilter(defaultPacketFilterInfo,1);
       
  9269     LOCAL_ASSERT_TRUE(CompareFilters(packetFilter,defaultPacketFilterInfo),_L("RPacketContext::GetPacketFilterInfo returned wrong filter"));
       
  9270 
       
  9271 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 1 returns second packet filter added to the context
       
  9272     aPacketContext.GetPacketFilterInfo(getPacketFilterInfoStatus,1,packetFilterPkg);
       
  9273 	LOCAL_ASSERT_EQUALS(WaitForRequestWithTimeOut(getPacketFilterInfoStatus, ETimeShort), KErrNone,
       
  9274                   _L("RPacketContext::GetPacketFilterInfo timed out"));
       
  9275     LOCAL_ASSERT_EQUALS(getPacketFilterInfoStatus.Int(), KErrNone,
       
  9276                   _L("RPacketContext::GetPacketFilterInfo returned an error"));
       
  9277     FillPacketFilter(defaultPacketFilterInfo,2);
       
  9278     LOCAL_ASSERT_TRUE(CompareFilters(packetFilter,defaultPacketFilterInfo),_L("RPacketContext::GetPacketFilterInfo returned wrong filter"));
       
  9279 
       
  9280 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 2 returns third packet filter added to the context
       
  9281     aPacketContext.GetPacketFilterInfo(getPacketFilterInfoStatus,2,packetFilterPkg);
       
  9282 	LOCAL_ASSERT_EQUALS(WaitForRequestWithTimeOut(getPacketFilterInfoStatus, ETimeShort), KErrNone,
       
  9283                   _L("RPacketContext::GetPacketFilterInfo timed out"));
       
  9284     LOCAL_ASSERT_EQUALS(getPacketFilterInfoStatus.Int(), KErrNone,
       
  9285                   _L("RPacketContext::GetPacketFilterInfo returned an error"));
       
  9286     FillPacketFilter(defaultPacketFilterInfo,3);
       
  9287     LOCAL_ASSERT_TRUE(CompareFilters(packetFilter,defaultPacketFilterInfo),_L("RPacketContext::GetPacketFilterInfo returned wrong filter"));
       
  9288 
       
  9289 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 3 returns KErrArgument
       
  9290     aPacketContext.GetPacketFilterInfo(getPacketFilterInfoStatus,3,packetFilterPkg);
       
  9291 	LOCAL_ASSERT_EQUALS(WaitForRequestWithTimeOut(getPacketFilterInfoStatus, ETimeShort), KErrNone,
       
  9292                   _L("RPacketContext::GetPacketFilterInfo timed out"));
       
  9293     LOCAL_ASSERT_EQUALS(getPacketFilterInfoStatus.Int(), KErrArgument,
       
  9294                   _L("RPacketContext::GetPacketFilterInfo did not returned an error"));
       
  9295 
       
  9296 	// ===  Remove a packet filter and modify the context ===
       
  9297 
       
  9298 	// Remove the third packet filter from the secondary context with RPacketContext::RemovePacketFilter 
       
  9299     TExtEtelRequestStatus removePacketFilterStatus(aPacketContext, EPacketContextRemovePacketFilter);
       
  9300     CleanupStack::PushL(removePacketFilterStatus);
       
  9301     aPacketContext.RemovePacketFilter(removePacketFilterStatus,2);
       
  9302 	LOCAL_ASSERT_EQUALS(WaitForRequestWithTimeOut(removePacketFilterStatus, ETimeShort), KErrNone,
       
  9303                   _L("RPacketContext::RemovePacketFilter timed out"));
       
  9304     LOCAL_ASSERT_EQUALS(removePacketFilterStatus.Int(), KErrNone,
       
  9305                   _L("RPacketContext::RemovePacketFilter returned an error"));
       
  9306 
       
  9307 	// Modify the secondary context with RPacketContext::ModifyActiveContext 
       
  9308     aPacketContext.ModifyActiveContext(modifyActiveContextStatus);
       
  9309 	LOCAL_ASSERT_EQUALS(WaitForRequestWithTimeOut(modifyActiveContextStatus, ETimeMedium), KErrNone, 
       
  9310                   _L("RPacketContext::ModifyActiveContext timed out."));
       
  9311 	LOCAL_ASSERT_EQUALS(modifyActiveContextStatus.Int(), KErrNone,
       
  9312                   _L("RPacketContext::ModifyActiveContext returned with error status."));
       
  9313 
       
  9314 	// Check RPacketContext::EnumeratePacketFilters returns aCount = 2
       
  9315     count=-1;
       
  9316     TExtEtelRequestStatus enumeratePacketFiltersStatus(aPacketContext, EPacketContextEnumeratePacketFilters);
       
  9317     CleanupStack::PushL(enumeratePacketFiltersStatus);
       
  9318     aPacketContext.EnumeratePacketFilters(enumeratePacketFiltersStatus,count);
       
  9319 	LOCAL_ASSERT_EQUALS(WaitForRequestWithTimeOut(enumeratePacketFiltersStatus, ETimeShort), KErrNone,
       
  9320                   _L("RPacketContext::EnumeratePacketFilters timed out"));
       
  9321     LOCAL_ASSERT_EQUALS(enumeratePacketFiltersStatus.Int(), KErrNone,
       
  9322                   _L("RPacketContext::EnumeratePacketFilters returned an error"));
       
  9323     LOCAL_ASSERT_EQUALS(count, 2,
       
  9324                   _L("RPacketContext::EnumeratePacketFilters returned wrong number"));
       
  9325 
       
  9326 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 0 returns first packet filter added to the context
       
  9327     aPacketContext.GetPacketFilterInfo(getPacketFilterInfoStatus,0,packetFilterPkg);
       
  9328 	LOCAL_ASSERT_EQUALS(WaitForRequestWithTimeOut(getPacketFilterInfoStatus, ETimeShort), KErrNone,
       
  9329                   _L("RPacketContext::GetPacketFilterInfo timed out"));
       
  9330     LOCAL_ASSERT_EQUALS(getPacketFilterInfoStatus.Int(), KErrNone,
       
  9331                   _L("RPacketContext::GetPacketFilterInfo returned an error"));
       
  9332     FillPacketFilter(defaultPacketFilterInfo,1);
       
  9333     LOCAL_ASSERT_TRUE(CompareFilters(packetFilter,defaultPacketFilterInfo),_L("RPacketContext::GetPacketFilterInfo returned wrong filter"));
       
  9334 
       
  9335 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 1 returns second packet filter added to the context
       
  9336     aPacketContext.GetPacketFilterInfo(getPacketFilterInfoStatus,1,packetFilterPkg);
       
  9337 	LOCAL_ASSERT_EQUALS(WaitForRequestWithTimeOut(getPacketFilterInfoStatus, ETimeShort), KErrNone,
       
  9338                   _L("RPacketContext::GetPacketFilterInfo timed out"));
       
  9339     LOCAL_ASSERT_EQUALS(getPacketFilterInfoStatus.Int(), KErrNone,
       
  9340                   _L("RPacketContext::GetPacketFilterInfo returned an error"));
       
  9341     FillPacketFilter(defaultPacketFilterInfo,2);
       
  9342     LOCAL_ASSERT_TRUE(CompareFilters(packetFilter,defaultPacketFilterInfo),_L("RPacketContext::GetPacketFilterInfo returned wrong filter"));
       
  9343 
       
  9344 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 2 returns KErrArgument
       
  9345     aPacketContext.GetPacketFilterInfo(getPacketFilterInfoStatus,2,packetFilterPkg);
       
  9346 	LOCAL_ASSERT_EQUALS(WaitForRequestWithTimeOut(getPacketFilterInfoStatus, ETimeShort), KErrNone,
       
  9347                   _L("RPacketContext::GetPacketFilterInfo timed out"));
       
  9348     LOCAL_ASSERT_EQUALS(getPacketFilterInfoStatus.Int(), KErrArgument,
       
  9349                   _L("RPacketContext::GetPacketFilterInfo did not returned an error"));
       
  9350 
       
  9351 	// ===  Remove another packet filter and modify the context ===
       
  9352 
       
  9353 	// Remove the first packet filter from the secondary context with RPacketContext::RemovePacketFilter 
       
  9354     aPacketContext.RemovePacketFilter(removePacketFilterStatus,0);
       
  9355 	LOCAL_ASSERT_EQUALS(WaitForRequestWithTimeOut(removePacketFilterStatus, ETimeShort), KErrNone,
       
  9356                   _L("RPacketContext::RemovePacketFilter timed out"));
       
  9357     LOCAL_ASSERT_EQUALS(removePacketFilterStatus.Int(), KErrNone,
       
  9358                   _L("RPacketContext::RemovePacketFilter returned an error"));
       
  9359 
       
  9360 	// Modify the secondary context with RPacketContext::ModifyActiveContext 
       
  9361     aPacketContext.ModifyActiveContext(modifyActiveContextStatus);
       
  9362 	LOCAL_ASSERT_EQUALS(WaitForRequestWithTimeOut(modifyActiveContextStatus, ETimeMedium), KErrNone, 
       
  9363                   _L("RPacketContext::ModifyActiveContext timed out."));
       
  9364 	LOCAL_ASSERT_EQUALS(modifyActiveContextStatus.Int(), KErrNone,
       
  9365                   _L("RPacketContext::ModifyActiveContext returned with error status."));
       
  9366 
       
  9367 	// Check RPacketContext::EnumeratePacketFilters returns aCount = 1
       
  9368     count=-1;
       
  9369     aPacketContext.EnumeratePacketFilters(enumeratePacketFiltersStatus,count);
       
  9370 	LOCAL_ASSERT_EQUALS(WaitForRequestWithTimeOut(enumeratePacketFiltersStatus, ETimeShort), KErrNone,
       
  9371                   _L("RPacketContext::EnumeratePacketFilters timed out"));
       
  9372     LOCAL_ASSERT_EQUALS(enumeratePacketFiltersStatus.Int(), KErrNone,
       
  9373                   _L("RPacketContext::EnumeratePacketFilters returned an error"));
       
  9374     LOCAL_ASSERT_EQUALS(count, 1,
       
  9375                   _L("RPacketContext::EnumeratePacketFilters returned wrong number"));
       
  9376 
       
  9377 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 0 returns second packet filter added to the context
       
  9378     aPacketContext.GetPacketFilterInfo(getPacketFilterInfoStatus,0,packetFilterPkg);
       
  9379 	LOCAL_ASSERT_EQUALS(WaitForRequestWithTimeOut(getPacketFilterInfoStatus, ETimeShort), KErrNone,
       
  9380                   _L("RPacketContext::GetPacketFilterInfo timed out"));
       
  9381     LOCAL_ASSERT_EQUALS(getPacketFilterInfoStatus.Int(), KErrNone,
       
  9382                   _L("RPacketContext::GetPacketFilterInfo returned an error"));
       
  9383     FillPacketFilter(defaultPacketFilterInfo,2);
       
  9384     LOCAL_ASSERT_TRUE(CompareFilters(packetFilter,defaultPacketFilterInfo),_L("RPacketContext::GetPacketFilterInfo returned wrong filter"));
       
  9385 
       
  9386 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 1 returns KErrArgument
       
  9387     aPacketContext.GetPacketFilterInfo(getPacketFilterInfoStatus,1,packetFilterPkg);
       
  9388 	LOCAL_ASSERT_EQUALS(WaitForRequestWithTimeOut(getPacketFilterInfoStatus, ETimeShort), KErrNone,
       
  9389                   _L("RPacketContext::GetPacketFilterInfo timed out"));
       
  9390     LOCAL_ASSERT_EQUALS(getPacketFilterInfoStatus.Int(), KErrArgument,
       
  9391                   _L("RPacketContext::GetPacketFilterInfo did not returned an error"));
       
  9392 
       
  9393 	// Pop:
       
  9394 	//	enumeratePacketFiltersStatus
       
  9395 	//	removePacketFilterStatus
       
  9396 	//	modifyActiveContextStatus
       
  9397 	//	getProfileParametersStatus
       
  9398 	//	getPacketFilterInfoStatus
       
  9399 	//	enumeratePacketFiltersChStatus
       
  9400 	//	contextActivateStatus
       
  9401 	//	notifyContextStChStatus
       
  9402 	//	setProfileParamStatus
       
  9403 	//	getProfileCapStatus
       
  9404 	CleanupStack::PopAndDestroy(10,&getProfileCapStatus);
       
  9405 	
       
  9406     return ret;
       
  9407     }
       
  9408 
       
  9409 
       
  9410 TVerdict CCTSYIntegrationTestPacketContext0039::doTestStepL()
       
  9411 /**
       
  9412  * @SYMTestCaseID BA-CTSY-INT-PKTC-0039
       
  9413  * @SYMFssID BA/CTSY/PKTC-0039
       
  9414  * @SYMTestCaseDesc Modify a secondary context with packet filter and QoS.
       
  9415  * @SYMTestPriority High
       
  9416  * @SYMTestActions RPacketContext::GetProfileName, RPacketContext::GetStatus, RPacketContext::EnumeratePacketFilters, RPacketContext::AddPacketFilter, RPacketContext::NotifyStatusChange, RPacketContext::GetPacketFilterInfo, RPacketContext::ModifyActiveContext, RPacketContext::RemovePacketFilter, RPacketQoS::OpenNewQoS, RPacketQoS::SetProfileParameters
       
  9417  * @SYMTestExpectedResults Pass - Packet filter added and removed successfully.Context modified successfully.
       
  9418  * @SYMTestType CIT
       
  9419  * @SYMTestCaseDependencies live/automatic
       
  9420  *
       
  9421  * Reason for test: Verify packet filter info and QoS profile info correct.
       
  9422  *
       
  9423  * @return - TVerdict code
       
  9424  */
       
  9425 	{
       
  9426 
       
  9427 	////////////////////////////////////////////////////////////////
       
  9428 	// SET UP
       
  9429 	////////////////////////////////////////////////////////////////
       
  9430 
       
  9431 	DEBUG_PRINTF2(_L("Starting with type %d"),iTestType);
       
  9432 	
       
  9433     // Call TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL		
       
  9434     RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
  9435 	CHECK_EQUALS_L(iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(phone), KErrNone, _L("TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL returned with an error"));
       
  9436  	iNetworkTestHelper.CheckPhoneConnectedToAniteL(phone);
       
  9437 	
       
  9438 	// Ensure there is an active primary context. 
       
  9439 	RPacketContext& packetContext = iEtelSessionMgr.GetPrimaryPacketContextL(
       
  9440 			KMainServer,
       
  9441 			KMainPhone,
       
  9442 			KMainPacketService,
       
  9443 			KPrimaryPacketContext1);
       
  9444 	iPacketServiceTestHelper.ActivatePrimaryPacketContextL(phone,packetContext);
       
  9445 
       
  9446 
       
  9447 	////////////////////////////////////////////////////////////////
       
  9448 	// SET UP END
       
  9449 	////////////////////////////////////////////////////////////////
       
  9450 	
       
  9451 	StartTest();
       
  9452 	
       
  9453 	////////////////////////////////////////////////////////////////
       
  9454 	// TEST START
       
  9455 	////////////////////////////////////////////////////////////////
       
  9456 	
       
  9457 	
       
  9458 	// Open a new secondary context. 
       
  9459     RPacketContext& secondaryPacketContext1 = iEtelSessionMgr.GetSecondaryPacketContextL(
       
  9460 			KMainServer,
       
  9461 			KMainPhone,
       
  9462 			KMainPacketService, 
       
  9463 			KPrimaryPacketContext1,
       
  9464 			KSecondaryPacketContext1);
       
  9465 
       
  9466 	// Open a new QoS from the secodnary context  
       
  9467 	RPacketQoS& packetQoS1 = iEtelSessionMgr.GetSecondaryPacketContextQoSL(
       
  9468 			KMainServer,
       
  9469 			KMainPhone,
       
  9470 			KMainPacketService, 
       
  9471 			KPrimaryPacketContext1,
       
  9472 			KSecondaryPacketContext1);
       
  9473 
       
  9474     // Activate and modify the context with TQoSGPRSRequested, TQoSCapsGPRS and TQoSGPRSNegotiated
       
  9475     RPacketQoS::TQoSGPRSRequested gprsRequested;
       
  9476     RPacketQoS::TQoSCapsGPRS capsGPRS;
       
  9477     RPacketQoS::TQoSGPRSNegotiated gprsNegotiated;
       
  9478     RPacketQoS::TQoSR99_R4Requested r99_r4Requested;
       
  9479     RPacketQoS::TQoSCapsR99_R4 capsR99_R4;
       
  9480     RPacketQoS::TQoSR99_R4Negotiated t99_r4Negotiated;
       
  9481     RPacketQoS::TQoSR5Requested r5Requested;
       
  9482     RPacketQoS::TQoSCapsR5 capsr5;
       
  9483     RPacketQoS::TQoSR5Negotiated r5Negotiated;
       
  9484     switch (iTestType)
       
  9485 		{
       
  9486 		case EQoSGPRS:
       
  9487 		    ASSERT_TRUE(ActivateAndModifyContextL(secondaryPacketContext1,packetQoS1,gprsRequested,capsGPRS,gprsNegotiated),
       
  9488 		                _L("CCTSYIntegrationTestPacketContext0039::ActivateAndModifyContextL failed"));
       
  9489 		    break;
       
  9490 		case EQoSR4:
       
  9491 		    ASSERT_TRUE(ActivateAndModifyContextL(secondaryPacketContext1,packetQoS1,r99_r4Requested,capsR99_R4,t99_r4Negotiated),
       
  9492 		                _L("CCTSYIntegrationTestPacketContext0039::ActivateAndModifyContextL failed"));
       
  9493 		    break;
       
  9494 		case EQoSR5:
       
  9495 		    ASSERT_TRUE(ActivateAndModifyContextL(secondaryPacketContext1,packetQoS1,r5Requested,capsr5,r5Negotiated),
       
  9496 		                _L("CCTSYIntegrationTestPacketContext0039::ActivateAndModifyContextL failed"));
       
  9497 		    break;			
       
  9498 			
       
  9499 		default:
       
  9500 			CHECK_TRUE_L(EFalse, _L("Wrong test type!"));
       
  9501 			break;
       
  9502 		}
       
  9503 
       
  9504 	// Repeat test with TQoSR99_R4Requested and TQoSR5Requested types in  RPacketQoS::SetProfileParameters and checking for TQoSR99_R4Negotiated and TQoSR5Negotiated  in RPacketContext::GetProfileParameters respectively. 
       
  9505 
       
  9506 	
       
  9507 	////////////////////////////////////////////////////////////////
       
  9508 	// TEST END
       
  9509 	////////////////////////////////////////////////////////////////
       
  9510 
       
  9511     StartCleanup();
       
  9512 	
       
  9513 	return TestStepResult();
       
  9514 	}
       
  9515 
       
  9516 TPtrC CCTSYIntegrationTestPacketContext0039::GetTestStepName()
       
  9517 /**
       
  9518  * @return The test step name.
       
  9519  */
       
  9520 	{
       
  9521 	return _L("CCTSYIntegrationTestPacketContext0039");
       
  9522 	}
       
  9523 
       
  9524 
       
  9525 
       
  9526 CCTSYIntegrationTestPacketContext0040::CCTSYIntegrationTestPacketContext0040(CEtelSessionMgr& aEtelSessionMgr)
       
  9527 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
  9528 /**
       
  9529  * Constructor.
       
  9530  */
       
  9531 	{
       
  9532 	SetTestStepName(CCTSYIntegrationTestPacketContext0040::GetTestStepName());
       
  9533 	}
       
  9534 
       
  9535 CCTSYIntegrationTestPacketContext0040::~CCTSYIntegrationTestPacketContext0040()
       
  9536 /**
       
  9537  * Destructor.
       
  9538  */
       
  9539 	{
       
  9540 	}
       
  9541 
       
  9542 TVerdict CCTSYIntegrationTestPacketContext0040::doTestStepL()
       
  9543 /**
       
  9544  * @SYMTestCaseID BA-CTSY-INT-PKTC-0040
       
  9545  * @SYMFssID BA/CTSY/PKTC-0040
       
  9546  * @SYMTestCaseDesc Activate a secondary context with the maximum number of packet filters allowed by default TFT.
       
  9547  * @SYMTestPriority High
       
  9548  * @SYMTestActions RPacketContext::OpenNewSecondaryContext, RPacketContext::NotifyStatusChange, RPacketContext::GetStatus, RPacketContext::AddPacketFilter, RPacketContext::EnumeratePacketFilters, RPacketContext::GetPacketFilterInfo, RPacketContext::Activate
       
  9549  * @SYMTestExpectedResults Pass - 8 packet filters added. Unable to add 9th packet filter.
       
  9550  * @SYMTestType CIT
       
  9551  * @SYMTestCaseDependencies simulated/automatic
       
  9552  *
       
  9553  * Reason for test: Verify packet filter info and QoS profile info correct.
       
  9554  *
       
  9555  * @return - TVerdict code
       
  9556  */
       
  9557 	{
       
  9558 
       
  9559 	////////////////////////////////////////////////////////////////
       
  9560 	// SET UP
       
  9561 	////////////////////////////////////////////////////////////////
       
  9562 
       
  9563 
       
  9564     // Check that the phone is registered with the network simulator. 
       
  9565     RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
  9566 	CHECK_EQUALS_L(iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(phone), KErrNone, _L("TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL returned with an error"));
       
  9567 	iNetworkTestHelper.CheckPhoneConnectedToAniteL(phone);
       
  9568 
       
  9569 	// Ensure there is an active primary context. 
       
  9570 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, KMainPhone, KMainPacketService);
       
  9571     SetAttachModeToWhenPossibleAndWaitForAttachL(packetService);
       
  9572 	RPacketContext& primaryPacketContext = iEtelSessionMgr.GetPrimaryPacketContextL(
       
  9573 											KMainServer,
       
  9574 											KMainPhone,
       
  9575 											KMainPacketService,
       
  9576 											KPrimaryPacketContext1);
       
  9577 	iPacketServiceTestHelper.ActivatePrimaryPacketContextL(phone, primaryPacketContext);
       
  9578 
       
  9579 
       
  9580 	////////////////////////////////////////////////////////////////
       
  9581 	// SET UP END
       
  9582 	////////////////////////////////////////////////////////////////
       
  9583 	
       
  9584 	StartTest();
       
  9585 	
       
  9586 	////////////////////////////////////////////////////////////////
       
  9587 	// TEST START
       
  9588 	////////////////////////////////////////////////////////////////
       
  9589 	
       
  9590 	
       
  9591 	// Open a new secondary context. 
       
  9592 	RPacketContext& secondaryPacketContext = iEtelSessionMgr.GetSecondaryPacketContextL(
       
  9593 			KMainServer,
       
  9594 			KMainPhone,
       
  9595 			KMainPacketService, 
       
  9596 			KPrimaryPacketContext1,
       
  9597 			KSecondaryPacketContext1);
       
  9598 
       
  9599 	// Add 8 TPacketFilterV2 packet filters to the secondary context using RPacketContext::AddPacketFilter each with a different iId. 
       
  9600 	// $CTSYProblem Adding 7 filters wil cause the LTSY to crash the board
       
  9601 	for(TInt index = 1; index < 7; index++)
       
  9602 		{
       
  9603 		ASSERT_EQUALS(AddPacketFilterV2ToContextL(secondaryPacketContext, index), KErrNone, _L("RPacketContext::AddPacketFilter returned with error status")); 
       
  9604 		}
       
  9605 
       
  9606 	// ===  Attempt to add a 9th filter ===
       
  9607 
       
  9608 	// Check RPacketContext::AddPacketFilter returns KErrArgument
       
  9609 	// $CTSYProblem Adding 7 filters wil cause the LTSY to crash the board
       
  9610 
       
  9611 	// Open a new QoS from the secondary context 
       
  9612 	RPacketQoS& packetQoS = iEtelSessionMgr.GetSecondaryPacketContextQoSL(
       
  9613 												KMainServer,
       
  9614 												KMainPhone,
       
  9615 												KMainPacketService, 
       
  9616 												KPrimaryPacketContext1,
       
  9617 												KSecondaryPacketContext1);
       
  9618 
       
  9619 	// Get QoS profile capabilities with RPacketQoS::GetProfileCapabilities
       
  9620 	TExtEtelRequestStatus getProfileCapStatus(packetQoS, EPacketQoSGetProfileCaps);
       
  9621 	CleanupStack::PushL(getProfileCapStatus);
       
  9622 	RPacketQoS::TQoSCapsGPRS qosCapGprs;
       
  9623 	TPckg<RPacketQoS::TQoSCapsGPRS> qosCapsGprsPckg(qosCapGprs);
       
  9624 	packetQoS.GetProfileCapabilities(getProfileCapStatus, qosCapsGprsPckg);
       
  9625 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getProfileCapStatus, ETimeMedium), KErrNone, _L("RPacketQoS::GetProfileCapabilities timed out."));
       
  9626     ASSERT_EQUALS(getProfileCapStatus.Int(), KErrNone, _L("RPacketQoS::GetProfileCapabilities returned with error status."));
       
  9627 
       
  9628 	// Set requested profile parameters with RPacketQoS::SetProfileParameters and TQoSGPRSRequested with parameters within range returned by RPacketQoS::GetProfileCapabilities 
       
  9629      RPacketQoS::TQoSGPRSRequested qosGprsRequested;
       
  9630 	TPckg<RPacketQoS::TQoSGPRSRequested> qosGprsReqPckg(qosGprsRequested);
       
  9631     FillParametersFromCapabilities(qosGprsRequested,qosCapGprs);    
       
  9632 	TExtEtelRequestStatus setProfileParamStatus(packetQoS, EPacketQoSSetProfileParams);
       
  9633 	CleanupStack::PushL(setProfileParamStatus);
       
  9634 	packetQoS.SetProfileParameters(setProfileParamStatus, qosGprsReqPckg);
       
  9635 	ASSERT_EQUALS(WaitForRequestWithTimeOut(setProfileParamStatus, ETimeMedium), KErrNone, _L("RPacketQoS::SetProfileParameters timed out."));
       
  9636 	ASSERT_EQUALS(setProfileParamStatus.Int(), KErrNone, _L("RPacketQoS::SetProfileParameters returned with error status."));
       
  9637 
       
  9638 	// Check RPacketContext::GetProfileName returns QoS profile name with length > 0
       
  9639     TName profileName;
       
  9640     profileName.Zero();
       
  9641     ASSERT_EQUALS(secondaryPacketContext.GetProfileName(profileName),KErrNone, _L("RPacketContext::GetProfileName returned with error status."));
       
  9642     ASSERT_TRUE(profileName.Length()>0, _L("RPacketContext::GetProfileName name length is 0."));
       
  9643 
       
  9644 	// Post notification for context's status change
       
  9645 	TExtEtelRequestStatus notifySecContextStChStatus(secondaryPacketContext, EPacketContextNotifyStatusChange);
       
  9646 	CleanupStack::PushL(notifySecContextStChStatus);
       
  9647 	RPacketContext::TContextStatus secPacketContextStatus;
       
  9648 	secondaryPacketContext.NotifyStatusChange(notifySecContextStChStatus, secPacketContextStatus);
       
  9649 
       
  9650 	// Activate the secondary context. 
       
  9651 	TExtEtelRequestStatus secContextActivateStatus(secondaryPacketContext, EPacketContextActivate);
       
  9652 	CleanupStack::PushL(secContextActivateStatus);
       
  9653 	secondaryPacketContext.Activate(secContextActivateStatus);
       
  9654 	ASSERT_EQUALS(WaitForRequestWithTimeOut(secContextActivateStatus, ETimeLong), KErrNone, _L("RPacketContext::Activate timed out."));
       
  9655 	ASSERT_EQUALS(secContextActivateStatus.Int(), KErrNone, _L("RPacketContext::Activate returned with error status."));
       
  9656 
       
  9657 	// Check RPacketContext::NotifyStatusChange for the secondary context completes with EStatusActivating -> EStatusActive
       
  9658     RPacketContext::TContextStatus expectedSecContextStatus = RPacketContext::EStatusActivating;
       
  9659 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  9660 				secondaryPacketContext,
       
  9661 				notifySecContextStChStatus,
       
  9662 				secPacketContextStatus, 
       
  9663 				expectedSecContextStatus,
       
  9664 				KErrNone);
       
  9665 
       
  9666     secondaryPacketContext.NotifyStatusChange(notifySecContextStChStatus, secPacketContextStatus);	
       
  9667     expectedSecContextStatus = RPacketContext::EStatusActive;
       
  9668 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  9669 				secondaryPacketContext,
       
  9670 				notifySecContextStChStatus,
       
  9671 				secPacketContextStatus, 
       
  9672 				expectedSecContextStatus,
       
  9673 				KErrNone);
       
  9674 
       
  9675 	// Check RPacketContext::GetStatus for the secondary context returns EStatusActive
       
  9676 	ASSERT_EQUALS(secondaryPacketContext.GetStatus(secPacketContextStatus), KErrNone, _L("RPacketContext::GetStatus returned with an error."));
       
  9677     ASSERT_EQUALS(secPacketContextStatus, RPacketContext::EStatusActive, _L("RPacketContext::GetStatus status expected to be EStatusActive but is not."));
       
  9678 
       
  9679 	// Check RPacketContext::EnumeratePacketFilters returns aCount = 8
       
  9680 	TExtEtelRequestStatus enumeratePacketFiltersStatus(secondaryPacketContext, EPacketContextEnumeratePacketFilters);
       
  9681 	CleanupStack::PushL(enumeratePacketFiltersStatus);
       
  9682 	TInt packetFiltersCount(0);
       
  9683 	secondaryPacketContext.EnumeratePacketFilters(enumeratePacketFiltersStatus, packetFiltersCount);
       
  9684 	ASSERT_EQUALS(WaitForRequestWithTimeOut(enumeratePacketFiltersStatus, ETimeLong), KErrNone, _L("RPacketContext::EnumeratePacketFilters timed out."));
       
  9685 	ASSERT_EQUALS(enumeratePacketFiltersStatus.Int(), KErrNone, _L("RPacketContext::EnumeratePacketFilters returned with error status."));
       
  9686 	ASSERT_EQUALS(packetFiltersCount, 8, _L("RPacketContext::EnumeratePacketFilters returned wrong number of packet filters."));
       
  9687 
       
  9688 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 0 returns first packet filter added to the context
       
  9689 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 1 returns second packet filter added to the context
       
  9690 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 2 returns third packet filter added to the context
       
  9691 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 3 returns fourth packet filter added to the context
       
  9692 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 4 returns fifth packet filter added to the context
       
  9693 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 5 returns sixth packet filter added to the context
       
  9694 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 6 returns seventh packet filter added to the context
       
  9695 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 7 returns eighth packet filter added to the context
       
  9696 	// $CTSYProblem Adding 7 filters wil cause the LTSY to crash the board
       
  9697     RPacketContext::TPacketFilterV2 getPacketFilterV2;
       
  9698     RPacketContext::TPacketFilterV2Pckg getPacketFilterV2pkg(getPacketFilterV2);
       
  9699 	TExtEtelRequestStatus getPacketFilterInfoStatus(secondaryPacketContext, EPacketContextGetPacketFilterInfo);
       
  9700     CleanupStack::PushL(getPacketFilterInfoStatus);
       
  9701 	RPacketContext::TPacketFilterV2 defaultPacketFilterInfo;
       
  9702 
       
  9703 	for (TInt index = 0; index < 6; index++)
       
  9704 		{
       
  9705 		secondaryPacketContext.GetPacketFilterInfo(getPacketFilterInfoStatus, index, getPacketFilterV2pkg);
       
  9706 		ASSERT_EQUALS(WaitForRequestWithTimeOut(getPacketFilterInfoStatus, ETimeShort), KErrNone, _L("RPacketContext::GetPacketFilterInfo timed out"));
       
  9707 	    ASSERT_EQUALS(getPacketFilterInfoStatus.Int(), KErrNone, _L("RPacketContext::GetPacketFilterInfo returned an error"));
       
  9708 		FillPacketFilter(defaultPacketFilterInfo, index + 1);
       
  9709 		ASSERT_TRUE(CompareFilters(getPacketFilterV2,defaultPacketFilterInfo),_L("RPacketContext::GetPacketFilterInfo returned wrong filter"));
       
  9710 		}
       
  9711 
       
  9712 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 8 returns KErrArgument
       
  9713 	secondaryPacketContext.GetPacketFilterInfo(getPacketFilterInfoStatus, 7, getPacketFilterV2pkg);
       
  9714 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getPacketFilterInfoStatus, ETimeShort), KErrNone, _L("RPacketContext::GetPacketFilterInfo timed out"));
       
  9715     ASSERT_EQUALS(getPacketFilterInfoStatus.Int(), KErrArgument, _L("RPacketContext::GetPacketFilterInfo did not return correct error"));
       
  9716 
       
  9717 
       
  9718 	////////////////////////////////////////////////////////////////
       
  9719 	// TEST END
       
  9720 	////////////////////////////////////////////////////////////////
       
  9721 
       
  9722     StartCleanup();
       
  9723 	
       
  9724 	// Pop
       
  9725 	// getProfileCapStatus
       
  9726 	// setProfileParamStatus
       
  9727 	// notifySecContextStChStatus
       
  9728 	// secContextActivateStatus
       
  9729 	// enumeratePacketFiltersStatus
       
  9730 	// getPacketFilterInfoStatus
       
  9731 	CleanupStack::PopAndDestroy(6, &getProfileCapStatus);
       
  9732 	
       
  9733 	return TestStepResult();
       
  9734 	}
       
  9735 
       
  9736 TPtrC CCTSYIntegrationTestPacketContext0040::GetTestStepName()
       
  9737 /**
       
  9738  * @return The test step name.
       
  9739  */
       
  9740 	{
       
  9741 	return _L("CCTSYIntegrationTestPacketContext0040");
       
  9742 	}
       
  9743 
       
  9744 
       
  9745 
       
  9746 CCTSYIntegrationTestPacketContext0041::CCTSYIntegrationTestPacketContext0041(CEtelSessionMgr& aEtelSessionMgr)
       
  9747 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
  9748 /**
       
  9749  * Constructor.
       
  9750  */
       
  9751 	{
       
  9752 	SetTestStepName(CCTSYIntegrationTestPacketContext0041::GetTestStepName());
       
  9753 	}
       
  9754 
       
  9755 CCTSYIntegrationTestPacketContext0041::~CCTSYIntegrationTestPacketContext0041()
       
  9756 /**
       
  9757  * Destructor.
       
  9758  */
       
  9759 	{
       
  9760 	}
       
  9761 
       
  9762 TVerdict CCTSYIntegrationTestPacketContext0041::doTestStepL()
       
  9763 /**
       
  9764  * @SYMTestCaseID BA-CTSY-INT-PKTC-0041
       
  9765  * @SYMFssID BA/CTSY/PKTC-0041
       
  9766  * @SYMTestCaseDesc Modify a secondary context with the maximum number of packet filters allowed by default TFT.
       
  9767  * @SYMTestPriority High
       
  9768  * @SYMTestActions RPacketContext::OpenNewSecondaryContext, RPacketContext::GetPacketFilterInfo, RPacketContext::NotifyStatusChange, RPacketContext::ModifyActiveContext, RPacketContext::GetProfileParameters, RPacketContext::GetProfileName, RPacketContext::GetStatus, RPacketContext::RemovePacketFilter, RPacketContext::EnumeratePacketFilters, RPacketQoS::SetProfileParameters, RPacketQoS::OpenNewQoS, RPacketContext::AddPacketFilter
       
  9769  * @SYMTestExpectedResults Pass - 8 packet filters added. Unable to add 9th packet filter.
       
  9770  * @SYMTestType CIT
       
  9771  * @SYMTestCaseDependencies simulated/automatic
       
  9772  *
       
  9773  * Reason for test: Verify packet filter info correct.
       
  9774  *
       
  9775  * @return - TVerdict code
       
  9776  */
       
  9777 	{
       
  9778 
       
  9779 	////////////////////////////////////////////////////////////////
       
  9780 	// SET UP
       
  9781 	////////////////////////////////////////////////////////////////
       
  9782 
       
  9783 
       
  9784     //Check if we are on a simulated network to run emergency call tests
       
  9785     RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
  9786 	CHECK_EQUALS_L(iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(phone), KErrNone, _L("TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL returned with an error"));
       
  9787     iNetworkTestHelper.CheckPhoneConnectedToAniteL(phone);	
       
  9788 
       
  9789 	// Ensure there is an active primary context. 
       
  9790 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, KMainPhone, KMainPacketService);
       
  9791     SetAttachModeToWhenPossibleAndWaitForAttachL(packetService);
       
  9792 	RPacketContext& primaryPacketContext = iEtelSessionMgr.GetPrimaryPacketContextL(
       
  9793 											KMainServer,
       
  9794 											KMainPhone,
       
  9795 											KMainPacketService,
       
  9796 											KPrimaryPacketContext1);
       
  9797 	iPacketServiceTestHelper.ActivatePrimaryPacketContextL(phone, primaryPacketContext);
       
  9798 
       
  9799 
       
  9800 	////////////////////////////////////////////////////////////////
       
  9801 	// SET UP END
       
  9802 	////////////////////////////////////////////////////////////////
       
  9803 	
       
  9804 	StartTest();
       
  9805 	
       
  9806 	////////////////////////////////////////////////////////////////
       
  9807 	// TEST START
       
  9808 	////////////////////////////////////////////////////////////////
       
  9809 	
       
  9810 	
       
  9811 	// Open a new secondary context. 
       
  9812     RPacketContext& secondaryPacketContext = iEtelSessionMgr.GetSecondaryPacketContextL(
       
  9813 			KMainServer,
       
  9814 			KMainPhone,
       
  9815 			KMainPacketService, 
       
  9816 			KPrimaryPacketContext1,
       
  9817 			KSecondaryPacketContext1);
       
  9818 
       
  9819 	// Add a TPacketFilterV2 packet filter with iId = 1 to the secondary context using RPacketContext::AddPacketFilter 
       
  9820 	ASSERT_EQUALS(AddPacketFilterV2ToContextL(secondaryPacketContext, 1), KErrNone, _L("RPacketContext::AddPacketFilter returned with error status")); 
       
  9821 
       
  9822 	// Open a new QoS from the secondary context
       
  9823 	RPacketQoS& packetQoS = iEtelSessionMgr.GetSecondaryPacketContextQoSL(
       
  9824 												KMainServer,
       
  9825 												KMainPhone,
       
  9826 												KMainPacketService, 
       
  9827 												KPrimaryPacketContext1,
       
  9828 												KSecondaryPacketContext1);
       
  9829 
       
  9830 	// Get QoS profile capabilities with RPacketQoS::GetProfileCapabilities
       
  9831 	TExtEtelRequestStatus getProfileCapStatus(packetQoS, EPacketQoSGetProfileCaps);
       
  9832 	CleanupStack::PushL(getProfileCapStatus);
       
  9833 	RPacketQoS::TQoSCapsGPRS qosCapGprs;
       
  9834 	TPckg<RPacketQoS::TQoSCapsGPRS> qosCapsGprsPckg(qosCapGprs);
       
  9835 	packetQoS.GetProfileCapabilities(getProfileCapStatus, qosCapsGprsPckg);
       
  9836 
       
  9837 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getProfileCapStatus, ETimeMedium), KErrNone, _L("RPacketQoS::GetProfileCapabilities timed out."));
       
  9838     ASSERT_EQUALS(getProfileCapStatus.Int(), KErrNone, _L("RPacketQoS::GetProfileCapabilities returned with error status."));
       
  9839 
       
  9840 	// Set requested profile parameters with RPacketQoS::SetProfileParameters and TQoSGPRSRequested with parameters within range returned by RPacketQoS::GetProfileCapabilities 
       
  9841     RPacketQoS::TQoSGPRSRequested qosGprsRequested;
       
  9842 	TPckg<RPacketQoS::TQoSGPRSRequested> qosGprsReqPckg(qosGprsRequested);
       
  9843     FillParametersFromCapabilities(qosGprsRequested,qosCapGprs);
       
  9844 	TExtEtelRequestStatus setProfileParamStatus(packetQoS, EPacketQoSSetProfileParams);
       
  9845 	CleanupStack::PushL(setProfileParamStatus);
       
  9846 	packetQoS.SetProfileParameters(setProfileParamStatus, qosGprsReqPckg);
       
  9847 	ASSERT_EQUALS(WaitForRequestWithTimeOut(setProfileParamStatus, ETimeMedium), KErrNone, _L("RPacketQoS::SetProfileParameters timed out."));
       
  9848 	ASSERT_EQUALS(setProfileParamStatus.Int(), KErrNone, _L("RPacketQoS::SetProfileParameters returned with error status."));
       
  9849 
       
  9850 	// Check RPacketContext::GetProfileName returns QoS profile name with length > 0
       
  9851     TName profileName;
       
  9852     profileName.Zero();
       
  9853     ASSERT_EQUALS(secondaryPacketContext.GetProfileName(profileName),KErrNone, _L("RPacketContext::GetProfileName returned with error status."));
       
  9854     ASSERT_TRUE(profileName.Length()>0, _L("RPacketContext::GetProfileName name length is 0."));
       
  9855 
       
  9856 	// Post notification for context's status change
       
  9857 	TExtEtelRequestStatus notifySecContextStChStatus(secondaryPacketContext, EPacketContextNotifyStatusChange);
       
  9858 	CleanupStack::PushL(notifySecContextStChStatus);
       
  9859 	RPacketContext::TContextStatus secPacketContextStatus;
       
  9860 	secondaryPacketContext.NotifyStatusChange(notifySecContextStChStatus, secPacketContextStatus);
       
  9861 
       
  9862 	// Activate the secondary context. 
       
  9863 	TExtEtelRequestStatus secContextActivateStatus(secondaryPacketContext, EPacketContextActivate);
       
  9864 	CleanupStack::PushL(secContextActivateStatus);
       
  9865 	secondaryPacketContext.Activate(secContextActivateStatus);
       
  9866 
       
  9867 	ASSERT_EQUALS(WaitForRequestWithTimeOut(secContextActivateStatus, ETimeLong), KErrNone, _L("RPacketContext::Activate timed out."));
       
  9868 	ASSERT_EQUALS(secContextActivateStatus.Int(), KErrNone, _L("RPacketContext::Activate returned with error status."));
       
  9869 
       
  9870 	// Check RPacketContext::NotifyStatusChange for the secondary context completes with EStatusActivating -> EStatusActive
       
  9871     RPacketContext::TContextStatus expectedSecContextStatus = RPacketContext::EStatusActivating;
       
  9872 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  9873 				secondaryPacketContext,
       
  9874 				notifySecContextStChStatus,
       
  9875 				secPacketContextStatus, 
       
  9876 				expectedSecContextStatus,
       
  9877 				KErrNone);
       
  9878     secondaryPacketContext.NotifyStatusChange(notifySecContextStChStatus, secPacketContextStatus);	
       
  9879     expectedSecContextStatus = RPacketContext::EStatusActive;
       
  9880 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
  9881 				secondaryPacketContext,
       
  9882 				notifySecContextStChStatus,
       
  9883 				secPacketContextStatus, 
       
  9884 				expectedSecContextStatus,
       
  9885 				KErrNone);
       
  9886 
       
  9887 	// Check RPacketContext::GetStatus for the secondary context returns EStatusActive
       
  9888 	ASSERT_EQUALS(secondaryPacketContext.GetStatus(secPacketContextStatus), KErrNone, _L("RPacketContext::GetStatus returned with an error."));
       
  9889     ASSERT_EQUALS(secPacketContextStatus, RPacketContext::EStatusActive, _L("RPacketContext::GetStatus status expected to be EStatusActive but is not."));
       
  9890 
       
  9891 	// Add 7 more TPacketFilterV2 packet filters (with iId = 2 to 8) to the secondary context using RPacketContext::AddPacketFilter 
       
  9892 	for(TInt index = 2; index < 9; index++)
       
  9893 		{
       
  9894 		ASSERT_EQUALS(AddPacketFilterV2ToContextL(secondaryPacketContext, index), KErrNone, _L("RPacketContext::AddPacketFilter returned with error status")); 
       
  9895 		}
       
  9896 
       
  9897 	// ===  Attempt to add a 9th filter to the context ===
       
  9898 
       
  9899 	// Check RPacketContext::AddPacketFilter with iId = 9 returns KErrArgument
       
  9900 	// $CTSYProblem.
       
  9901 	// PacketContext::AddPacketFilter return KErrGeneral instead of KErrArgument for wrong argument. 
       
  9902 	ASSERT_EQUALS(AddPacketFilterV2ToContextL(secondaryPacketContext, 9,KErrGeneral), KErrGeneral, _L("RPacketContext::AddPacketFilter did not return with an error as expected."));
       
  9903 
       
  9904 	// Modify the secondary context with RPacketContext::ModifyActiveContext 
       
  9905 	// $CTSYProblem The LTSY or the Anite system has no support to RPacketContext::ModifyActiveContext
       
  9906 	ERR_PRINTF1(_L("<font color=Cyan>$CTSYProblem: The LTSY or the Anite system has no support to RPacketContext::ModifyActiveContext.<font color=Black>"));    
       
  9907 	TExtEtelRequestStatus modifyActiveContextStatus(secondaryPacketContext, EPacketContextModifyActiveContext);
       
  9908 	CleanupStack::PushL(modifyActiveContextStatus);
       
  9909 	secondaryPacketContext.ModifyActiveContext(modifyActiveContextStatus);
       
  9910 	ASSERT_EQUALS(WaitForRequestWithTimeOut(modifyActiveContextStatus, ETimeMedium), KErrNone, _L("RPacketContext::ModifyActiveContext timed out."));
       
  9911 	ASSERT_EQUALS(modifyActiveContextStatus.Int(), KErrNone, _L("RPacketContext::ModifyActiveContext returned with error status."));
       
  9912 
       
  9913 	// Check RPacketContext::EnumeratePacketFilters returns aCount = 8
       
  9914 	TExtEtelRequestStatus enumeratePacketFiltersStatus(secondaryPacketContext, EPacketContextEnumeratePacketFilters);
       
  9915 	CleanupStack::PushL(enumeratePacketFiltersStatus);
       
  9916 	TInt packetFiltersCount(0);
       
  9917 	secondaryPacketContext.EnumeratePacketFilters(enumeratePacketFiltersStatus, packetFiltersCount);
       
  9918 	ASSERT_EQUALS(WaitForRequestWithTimeOut(enumeratePacketFiltersStatus, ETimeLong), KErrNone, _L("RPacketContext::EnumeratePacketFilters timed out."));
       
  9919 	ASSERT_EQUALS(enumeratePacketFiltersStatus.Int(), KErrNone, _L("RPacketContext::EnumeratePacketFilters returned with error status."));
       
  9920 	ASSERT_EQUALS(packetFiltersCount, 8, _L("RPacketContext::EnumeratePacketFilters returned wrong number of packet filters."));
       
  9921 
       
  9922 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 0 returns first packet filter added to the context
       
  9923 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 1 returns second packet filter added to the context
       
  9924 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 2 returns third packet filter added to the context
       
  9925 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 3 returns fourth packet filter added to the context
       
  9926 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 4 returns fifth packet filter added to the context
       
  9927 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 5 returns sixth packet filter added to the context
       
  9928 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 6 returns seventh packet filter added to the context
       
  9929 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 7 returns eighth packet filter added to the context
       
  9930     RPacketContext::TPacketFilterV2 getPacketFilterV2;
       
  9931     RPacketContext::TPacketFilterV2Pckg getPacketFilterV2pkg(getPacketFilterV2);
       
  9932 	TExtEtelRequestStatus getPacketFilterInfoStatus(secondaryPacketContext, EPacketContextGetPacketFilterInfo);
       
  9933     CleanupStack::PushL(getPacketFilterInfoStatus);
       
  9934 	RPacketContext::TPacketFilterV2 defaultPacketFilterInfo;
       
  9935 
       
  9936 	for (TInt index = 0; index < 8; index++)
       
  9937 		{
       
  9938 		secondaryPacketContext.GetPacketFilterInfo(getPacketFilterInfoStatus, index, getPacketFilterV2pkg);
       
  9939 		ASSERT_EQUALS(WaitForRequestWithTimeOut(getPacketFilterInfoStatus, ETimeShort), KErrNone, _L("RPacketContext::GetPacketFilterInfo timed out"));
       
  9940 	    ASSERT_EQUALS(getPacketFilterInfoStatus.Int(), KErrNone, _L("RPacketContext::GetPacketFilterInfo returned an error"));
       
  9941 		FillPacketFilter(defaultPacketFilterInfo, index + 1);
       
  9942 		ASSERT_TRUE(CompareFilters(getPacketFilterV2,defaultPacketFilterInfo),_L("RPacketContext::GetPacketFilterInfo returned wrong filter"));
       
  9943 		}
       
  9944 
       
  9945 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 8 returns KErrArgument
       
  9946 	secondaryPacketContext.GetPacketFilterInfo(getPacketFilterInfoStatus, 8, getPacketFilterV2pkg);
       
  9947 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getPacketFilterInfoStatus, ETimeShort), KErrNone, _L("RPacketContext::GetPacketFilterInfo timed out"));
       
  9948     ASSERT_EQUALS(getPacketFilterInfoStatus.Int(), KErrArgument, _L("RPacketContext::GetPacketFilterInfo did not return correct error"));
       
  9949 
       
  9950 	// Remove the filter with iId = 3 using RPacketContext::RemovePacketFilter 
       
  9951 	TExtEtelRequestStatus removePacketFilterStatus(secondaryPacketContext, EPacketContextRemovePacketFilter);
       
  9952 	CleanupStack::PushL(removePacketFilterStatus);
       
  9953 	TInt wantedId = 3;
       
  9954 	secondaryPacketContext.RemovePacketFilter(removePacketFilterStatus, wantedId);
       
  9955 	ASSERT_EQUALS(WaitForRequestWithTimeOut(removePacketFilterStatus, ETimeShort), KErrNone, _L("RPacketContext::RemovePacketFilter timed out"));
       
  9956 	ASSERT_EQUALS(removePacketFilterStatus.Int(), KErrNone, _L("RPacketContext::RemovePacketFilter returned an error"));
       
  9957 
       
  9958 	// Modify the secondary context with RPacketContext::ModifyActiveContext 
       
  9959 	secondaryPacketContext.ModifyActiveContext(modifyActiveContextStatus);
       
  9960 	ASSERT_EQUALS(WaitForRequestWithTimeOut(modifyActiveContextStatus, ETimeMedium), KErrNone, _L("RPacketContext::ModifyActiveContext timed out."));
       
  9961 	ASSERT_EQUALS(modifyActiveContextStatus.Int(), KErrNone, _L("RPacketContext::ModifyActiveContext returned with error status."));
       
  9962 
       
  9963 	// Check RPacketContext::EnumeratePacketFilters returns aCount = 7
       
  9964 	packetFiltersCount = 0;
       
  9965 	secondaryPacketContext.EnumeratePacketFilters(enumeratePacketFiltersStatus, packetFiltersCount);
       
  9966 	ASSERT_EQUALS(WaitForRequestWithTimeOut(enumeratePacketFiltersStatus, ETimeLong), KErrNone, _L("RPacketContext::EnumeratePacketFilters timed out."));
       
  9967 	ASSERT_EQUALS(enumeratePacketFiltersStatus.Int(), KErrNone, _L("RPacketContext::EnumeratePacketFilters returned with error status."));
       
  9968 	ASSERT_EQUALS(packetFiltersCount, 7, _L("RPacketContext::EnumeratePacketFilters returned wrong number of packet filters."));
       
  9969 
       
  9970 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 0 returns first packet filter added to the context
       
  9971 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 1 returns second packet filter added to the context
       
  9972 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 2 returns fourth packet filter added to the context
       
  9973 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 3 returns fifth packet filter added to the context
       
  9974 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 4 returns sixth packet filter added to the context
       
  9975 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 5 returns seventh packet filter added to the context
       
  9976 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 6 returns eighth packet filter added to the context
       
  9977 	for (TInt index = 0; index < 7; index++)
       
  9978 		{
       
  9979 		secondaryPacketContext.GetPacketFilterInfo(getPacketFilterInfoStatus, index, getPacketFilterV2pkg);
       
  9980 		ASSERT_EQUALS(WaitForRequestWithTimeOut(getPacketFilterInfoStatus, ETimeShort), KErrNone, _L("RPacketContext::GetPacketFilterInfo timed out"));
       
  9981 	    ASSERT_EQUALS(getPacketFilterInfoStatus.Int(), KErrNone, _L("RPacketContext::GetPacketFilterInfo returned an error"));
       
  9982 		
       
  9983 		if(index >= 2)
       
  9984 			{
       
  9985 			FillPacketFilter(defaultPacketFilterInfo, index + 2);
       
  9986 			}
       
  9987 		else
       
  9988 			{
       
  9989 			FillPacketFilter(defaultPacketFilterInfo, index + 1);
       
  9990 			}
       
  9991 			
       
  9992 		ASSERT_TRUE(CompareFilters(getPacketFilterV2,defaultPacketFilterInfo),_L("RPacketContext::GetPacketFilterInfo returned wrong filter"));
       
  9993 		}
       
  9994 
       
  9995 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 7 returns KErrArgument
       
  9996 	secondaryPacketContext.GetPacketFilterInfo(getPacketFilterInfoStatus, 7, getPacketFilterV2pkg);
       
  9997 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getPacketFilterInfoStatus, ETimeShort), KErrNone, _L("RPacketContext::GetPacketFilterInfo timed out"));
       
  9998     ASSERT_EQUALS(getPacketFilterInfoStatus.Int(), KErrArgument, _L("RPacketContext::GetPacketFilterInfo did not return correct error"));
       
  9999 
       
 10000 	// ===  Add a packet filter with the same Id as an existing one (modification of a packet filter) ===
       
 10001 
       
 10002 	// Add another filter packet filter to the context with iId = 1 
       
 10003     RPacketContext::TPacketFilterV2 packetFilterV2;
       
 10004     FillPacketFilter(packetFilterV2, 3);
       
 10005 	RPacketContext::TPacketFilterV2Pckg packetFilterV2pckg(packetFilterV2);
       
 10006 	TExtEtelRequestStatus addFilterStatus(primaryPacketContext, EPacketContextAddPacketFilter); 
       
 10007     CleanupStack::PushL(addFilterStatus);
       
 10008     packetFilterV2.iId = 1;
       
 10009 	secondaryPacketContext.AddPacketFilter(addFilterStatus, packetFilterV2pckg);
       
 10010 	ASSERT_EQUALS(WaitForRequestWithTimeOut(addFilterStatus, ETimeMedium), KErrNone, _L("RPacketContext::AddPacketFilter timed out"));
       
 10011     ASSERT_EQUALS(addFilterStatus.Int(), KErrNone, _L("RPacketContext::AddPacketFilter returned an error"));
       
 10012 
       
 10013 	// Modify the secondary context with RPacketContext::ModifyActiveContext 
       
 10014 	secondaryPacketContext.ModifyActiveContext(modifyActiveContextStatus);
       
 10015 	ASSERT_EQUALS(WaitForRequestWithTimeOut(modifyActiveContextStatus, ETimeMedium), KErrNone, _L("RPacketContext::ModifyActiveContext timed out."));
       
 10016 	ASSERT_EQUALS(modifyActiveContextStatus.Int(), KErrNone, _L("RPacketContext::ModifyActiveContext returned with error status."));
       
 10017 
       
 10018 	// Check RPacketContext::EnumeratePacketFilters returns aCount = 7
       
 10019 	packetFiltersCount = 0;
       
 10020 	secondaryPacketContext.EnumeratePacketFilters(enumeratePacketFiltersStatus, packetFiltersCount);
       
 10021 	ASSERT_EQUALS(WaitForRequestWithTimeOut(enumeratePacketFiltersStatus, ETimeLong), KErrNone, _L("RPacketContext::EnumeratePacketFilters timed out."));
       
 10022 	ASSERT_EQUALS(enumeratePacketFiltersStatus.Int(), KErrNone, _L("RPacketContext::EnumeratePacketFilters returned with error status."));
       
 10023 	ASSERT_EQUALS(packetFiltersCount, 7, _L("RPacketContext::EnumeratePacketFilters returned wrong number of packet filters."));
       
 10024 
       
 10025 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 0 returns newly added packet filter 
       
 10026 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 1 returns second packet filter added to the context
       
 10027 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 2 returns fourth packet filter added to the context
       
 10028 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 3 returns fifth packet filter added to the context
       
 10029 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 4 returns sixth packet filter added to the tcontext
       
 10030 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 5 returns seventh packet filter added to the context
       
 10031 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 6 returns eighth packet filter added to the context
       
 10032 	for (TInt index = 0; index < 7; index++)
       
 10033 		{
       
 10034 		secondaryPacketContext.GetPacketFilterInfo(getPacketFilterInfoStatus, index, getPacketFilterV2pkg);
       
 10035 		ASSERT_EQUALS(WaitForRequestWithTimeOut(getPacketFilterInfoStatus, ETimeShort), KErrNone, _L("RPacketContext::GetPacketFilterInfo timed out"));
       
 10036 	    ASSERT_EQUALS(getPacketFilterInfoStatus.Int(), KErrNone, _L("RPacketContext::GetPacketFilterInfo returned an error"));
       
 10037 
       
 10038 		if(index == 0)
       
 10039 			{
       
 10040 			FillPacketFilter(defaultPacketFilterInfo, 3);
       
 10041 			defaultPacketFilterInfo.iId = 1;
       
 10042 			}
       
 10043 		else if(index >= 2)
       
 10044 			{
       
 10045 			FillPacketFilter(defaultPacketFilterInfo, index + 2);
       
 10046 			}
       
 10047 		else
       
 10048 			{
       
 10049 			FillPacketFilter(defaultPacketFilterInfo, index + 1);
       
 10050 			}
       
 10051 
       
 10052 		ASSERT_TRUE(CompareFilters(getPacketFilterV2,defaultPacketFilterInfo),_L("RPacketContext::GetPacketFilterInfo returned wrong filter"));
       
 10053 		}
       
 10054 
       
 10055 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 7 returns KErrArgument
       
 10056 	secondaryPacketContext.GetPacketFilterInfo(getPacketFilterInfoStatus, 7, getPacketFilterV2pkg);
       
 10057 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getPacketFilterInfoStatus, ETimeShort), KErrNone, _L("RPacketContext::GetPacketFilterInfo timed out"));
       
 10058     ASSERT_EQUALS(getPacketFilterInfoStatus.Int(), KErrArgument, _L("RPacketContext::GetPacketFilterInfo did not return correct error"));
       
 10059 
       
 10060 	// ===  Add a packet filter with iId = 3 (add new one that was removed) ===
       
 10061 
       
 10062 	// Add another filter packet filter to the context with iId = 3 
       
 10063 	ASSERT_EQUALS(AddPacketFilterV2ToContextL(secondaryPacketContext, 3), KErrNone, _L("RPacketContext::AddPacketFilter returned with error status")); 
       
 10064 
       
 10065 	// Modify the secondary context with RPacketContext::ModifyActiveContext 
       
 10066 	secondaryPacketContext.ModifyActiveContext(modifyActiveContextStatus);
       
 10067 	ASSERT_EQUALS(WaitForRequestWithTimeOut(modifyActiveContextStatus, ETimeMedium), KErrNone, _L("RPacketContext::ModifyActiveContext timed out."));
       
 10068 	ASSERT_EQUALS(modifyActiveContextStatus.Int(), KErrNone, _L("RPacketContext::ModifyActiveContext returned with error status."));
       
 10069 
       
 10070 	// Check RPacketContext::EnumeratePacketFilters returns aCount = 8
       
 10071 	packetFiltersCount = 0;
       
 10072 	secondaryPacketContext.EnumeratePacketFilters(enumeratePacketFiltersStatus, packetFiltersCount);
       
 10073 	ASSERT_EQUALS(WaitForRequestWithTimeOut(enumeratePacketFiltersStatus, ETimeLong), KErrNone, _L("RPacketContext::EnumeratePacketFilters timed out."));
       
 10074 	ASSERT_EQUALS(enumeratePacketFiltersStatus.Int(), KErrNone, _L("RPacketContext::EnumeratePacketFilters returned with error status."));
       
 10075 	ASSERT_EQUALS(packetFiltersCount, 8, _L("RPacketContext::EnumeratePacketFilters returned wrong number of packet filters."));
       
 10076 
       
 10077 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 0 returns first packet filter added to the context
       
 10078 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 1 returns second packet filter added to the context
       
 10079 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 2 returns third packet filter added to the context
       
 10080 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 3 returns fourth packet filter added to the context
       
 10081 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 4 returns fifth packet filter added to the context
       
 10082 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 5 returns sixth packet filter added to the context
       
 10083 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 6 returns seventh packet filter added to the context
       
 10084 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 7 returns eighth packet filter added to the context
       
 10085 	for (TInt index = 0; index < 8; index++)
       
 10086 		{
       
 10087 		secondaryPacketContext.GetPacketFilterInfo(getPacketFilterInfoStatus, index, getPacketFilterV2pkg);
       
 10088 		ASSERT_EQUALS(WaitForRequestWithTimeOut(getPacketFilterInfoStatus, ETimeShort), KErrNone, _L("RPacketContext::GetPacketFilterInfo timed out"));
       
 10089 	    ASSERT_EQUALS(getPacketFilterInfoStatus.Int(), KErrNone, _L("RPacketContext::GetPacketFilterInfo returned an error"));
       
 10090 
       
 10091 		if(index == 0)
       
 10092 			{
       
 10093 			FillPacketFilter(defaultPacketFilterInfo, 3);
       
 10094 			defaultPacketFilterInfo.iId = 1;
       
 10095 			}
       
 10096 		else
       
 10097 			{
       
 10098 			FillPacketFilter(defaultPacketFilterInfo, index + 1);
       
 10099 			}
       
 10100 
       
 10101 		ASSERT_TRUE(CompareFilters(getPacketFilterV2,defaultPacketFilterInfo),_L("RPacketContext::GetPacketFilterInfo returned wrong filter"));
       
 10102 		}
       
 10103 
       
 10104 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 8 returns KErrArgument
       
 10105 	secondaryPacketContext.GetPacketFilterInfo(getPacketFilterInfoStatus, 8, getPacketFilterV2pkg);
       
 10106 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getPacketFilterInfoStatus, ETimeShort), KErrNone, _L("RPacketContext::GetPacketFilterInfo timed out"));
       
 10107     ASSERT_EQUALS(getPacketFilterInfoStatus.Int(), KErrArgument, _L("RPacketContext::GetPacketFilterInfo did not return correct error"));
       
 10108 
       
 10109 
       
 10110 	////////////////////////////////////////////////////////////////
       
 10111 	// TEST END
       
 10112 	////////////////////////////////////////////////////////////////
       
 10113 
       
 10114     StartCleanup();
       
 10115 	
       
 10116 	// Pop
       
 10117 	// getProfileCapStatus
       
 10118 	// setProfileParamStatus
       
 10119 	// notifySecContextStChStatus
       
 10120 	// secContextActivateStatus
       
 10121 	// addFilterStatus
       
 10122 	// modifyActiveContextStatus
       
 10123 	// enumeratePacketFiltersStatus
       
 10124 	// getPacketFilterInfoStatus
       
 10125 	// removePacketFilterStatus
       
 10126 	CleanupStack::PopAndDestroy(9, &getProfileCapStatus);
       
 10127 
       
 10128 	return TestStepResult();
       
 10129 	}
       
 10130 
       
 10131 TPtrC CCTSYIntegrationTestPacketContext0041::GetTestStepName()
       
 10132 /**
       
 10133  * @return The test step name.
       
 10134  */
       
 10135 	{
       
 10136 	return _L("CCTSYIntegrationTestPacketContext0041");
       
 10137 	}
       
 10138 
       
 10139 
       
 10140 
       
 10141 CCTSYIntegrationTestPacketContext0042::CCTSYIntegrationTestPacketContext0042(CEtelSessionMgr& aEtelSessionMgr)
       
 10142 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
 10143 /**
       
 10144  * Constructor.
       
 10145  */
       
 10146 	{
       
 10147 	SetTestStepName(CCTSYIntegrationTestPacketContext0042::GetTestStepName());
       
 10148 	}
       
 10149 
       
 10150 CCTSYIntegrationTestPacketContext0042::~CCTSYIntegrationTestPacketContext0042()
       
 10151 /**
       
 10152  * Destructor.
       
 10153  */
       
 10154 	{
       
 10155 	}
       
 10156 
       
 10157 TVerdict CCTSYIntegrationTestPacketContext0042::doTestStepL()
       
 10158 /**
       
 10159  * @SYMTestCaseID BA-CTSY-INT-PKTC-0042
       
 10160  * @SYMFssID BA/CTSY/PKTC-0042
       
 10161  * @SYMTestCaseDesc Activate a secondary context creating a TFT for the packet filters.
       
 10162  * @SYMTestPriority High
       
 10163  * @SYMTestActions RPacketContext::OpenNewSecondaryContext, RPacketContext::NotifyStatusChange, RPacketContext::GetStatus, RPacketContext::CreateNewTFT, RPacketContext::AddPacketFilter, RPacketContext::EnumeratePacketFilters, RPacketContext::GetPacketFilterInfo, RPacketContext::Activate, RPacketContext::DeleteTFT
       
 10164  * @SYMTestExpectedResults Pass - TFT created and deleted.
       
 10165  * @SYMTestType CIT
       
 10166  * @SYMTestCaseDependencies simulated/automatic
       
 10167  *
       
 10168  * Reason for test: Verify packet filter info correct.
       
 10169  *
       
 10170  * @return - TVerdict code
       
 10171  */
       
 10172 	{
       
 10173 
       
 10174 	////////////////////////////////////////////////////////////////
       
 10175 	// SET UP
       
 10176 	////////////////////////////////////////////////////////////////
       
 10177 
       
 10178 	// ==== Ensure there is an active primary context === 
       
 10179 
       
 10180     //Check if we are on a simulated network
       
 10181     RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
 10182 	CHECK_EQUALS_L(iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(phone), KErrNone, _L("TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL returned with an error"));
       
 10183  	iNetworkTestHelper.CheckPhoneConnectedToAniteL(phone);
       
 10184 
       
 10185     // Get packet service
       
 10186 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, KMainPhone, KMainPacketService);
       
 10187 
       
 10188 	// Set the attach mode to EAttachWhenPossible. 
       
 10189     SetAttachModeToWhenPossibleAndWaitForAttachL(packetService);
       
 10190     
       
 10191     // Open primary context
       
 10192     RPacketContext& primaryPacketContext = iEtelSessionMgr.GetPrimaryPacketContextL(
       
 10193 											KMainServer,
       
 10194 											KMainPhone,
       
 10195 											KMainPacketService,
       
 10196 											KPrimaryPacketContext1);
       
 10197 
       
 10198 	// Activate primary context.											
       
 10199 	iPacketServiceTestHelper.ActivatePrimaryPacketContextL(phone,primaryPacketContext);	
       
 10200 
       
 10201 	////////////////////////////////////////////////////////////////
       
 10202 	// SET UP END
       
 10203 	////////////////////////////////////////////////////////////////
       
 10204 	
       
 10205 	StartTest();
       
 10206 	
       
 10207 	////////////////////////////////////////////////////////////////
       
 10208 	// TEST START
       
 10209 	////////////////////////////////////////////////////////////////
       
 10210 
       
 10211 
       
 10212 	// Open a new secondary context. 
       
 10213     RPacketContext& secondaryPacketContext = iEtelSessionMgr.GetSecondaryPacketContextL(
       
 10214 			KMainServer,
       
 10215 			KMainPhone,
       
 10216 			KMainPacketService, 
       
 10217 			KPrimaryPacketContext1,
       
 10218 			KSecondaryPacketContext1);
       
 10219 
       
 10220 	// Create a new TFT with RPacketContext::CreateNewTFT and aSize = 5 
       
 10221 	TExtEtelRequestStatus createNewTFTStatus(secondaryPacketContext, EPacketContextCreateNewTFT);
       
 10222 	CleanupStack::PushL(createNewTFTStatus);
       
 10223 	const TInt size(5);
       
 10224 	ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d</font>"), 50005);
       
 10225 	secondaryPacketContext.CreateNewTFT(createNewTFTStatus, size);
       
 10226 	ASSERT_EQUALS(WaitForRequestWithTimeOut(createNewTFTStatus, ETimeMedium), KErrNone, _L("RPacketContext::CreateNewTFT timed out"));
       
 10227 	ASSERT_EQUALS(createNewTFTStatus.Int(), KErrNone, _L("RPacketContext::CreateNewTFT returned an error"));
       
 10228 
       
 10229 	// Add a TPacketFilterV2 packet filter with iId = 1 to the secondary context using RPacketContext::AddPacketFilter 
       
 10230 	// Add a TPacketFilterV2 packet filter with iId = 2 to the secondary context using RPacketContext::AddPacketFilter 
       
 10231 	// Add a TPacketFilterV2 packet filter with iId = 3 to the secondary context using RPacketContext::AddPacketFilter 
       
 10232 	// Add a TPacketFilterV2 packet filter with iId = 4 to the secondary context using RPacketContext::AddPacketFilter 
       
 10233 	// Add a TPacketFilterV2 packet filter with iId = 5 to the secondary context using RPacketContext::AddPacketFilter 
       
 10234 	for (TInt index = 1; index < 6; index++)
       
 10235 		{
       
 10236 		ASSERT_EQUALS(AddPacketFilterV2ToContextL(secondaryPacketContext, index), KErrNone, _L("RPacketContext::AddPacketFilter returned with error status")); 
       
 10237 		}
       
 10238 
       
 10239 	// Add a TPacketFilterV2 packet filter with iId = 6 to the secondary context returns KErrArgument 
       
 10240 	ASSERT_EQUALS(AddPacketFilterV2ToContextL(secondaryPacketContext, 6), KErrArgument, _L("RPacketContext::AddPacketFilter did not return with an error as expected.")); 
       
 10241 
       
 10242 	// Open a new QoS from the secondary context  
       
 10243 	RPacketQoS& packetQoS = iEtelSessionMgr.GetSecondaryPacketContextQoSL(
       
 10244 												KMainServer,
       
 10245 												KMainPhone,
       
 10246 												KMainPacketService, 
       
 10247 												KPrimaryPacketContext1,
       
 10248 												KSecondaryPacketContext1);
       
 10249 
       
 10250 	// Get QoS profile capabilities with RPacketQoS::GetProfileCapabilities
       
 10251 	TExtEtelRequestStatus getProfileCapStatus(packetQoS, EPacketQoSGetProfileCaps);
       
 10252 	CleanupStack::PushL(getProfileCapStatus);
       
 10253 	RPacketQoS::TQoSCapsGPRS qosCapGprs;
       
 10254 	TPckg<RPacketQoS::TQoSCapsGPRS> qosCapsGprsPckg(qosCapGprs);
       
 10255 	packetQoS.GetProfileCapabilities(getProfileCapStatus, qosCapsGprsPckg);
       
 10256 
       
 10257 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getProfileCapStatus, ETimeMedium), KErrNone, _L("RPacketQoS::GetProfileCapabilities timed out."));
       
 10258     ASSERT_EQUALS(getProfileCapStatus.Int(), KErrNone, _L("RPacketQoS::GetProfileCapabilities returned with error status."));
       
 10259 
       
 10260 	// Set requested profile parameters with RPacketQoS::SetProfileParameters and TQoSGPRSRequested with parameters within range returned by RPacketQoS::GetProfileCapabilities 
       
 10261     RPacketQoS::TQoSGPRSRequested qosGprsRequested;
       
 10262 	TPckg<RPacketQoS::TQoSGPRSRequested> qosGprsReqPckg(qosGprsRequested);
       
 10263     FillParametersFromCapabilities(qosGprsRequested,qosCapGprs);    
       
 10264 	TExtEtelRequestStatus setProfileParamStatus(packetQoS, EPacketQoSSetProfileParams);
       
 10265 	CleanupStack::PushL(setProfileParamStatus);
       
 10266 	packetQoS.SetProfileParameters(setProfileParamStatus, qosGprsReqPckg);
       
 10267 	ASSERT_EQUALS(WaitForRequestWithTimeOut(setProfileParamStatus, ETimeMedium), KErrNone, _L("RPacketQoS::SetProfileParameters timed out."));
       
 10268 	ASSERT_EQUALS(setProfileParamStatus.Int(), KErrNone, _L("RPacketQoS::SetProfileParameters returned with error status."));
       
 10269 
       
 10270 	// Check RPacketContext::GetProfileName returns QoS profile name with length > 0
       
 10271     TName profileName;
       
 10272     ASSERT_EQUALS(secondaryPacketContext.GetProfileName(profileName),KErrNone, _L("RPacketContext::GetProfileName returned with error status."));
       
 10273     ASSERT_TRUE(profileName.Length()>0, _L("RPacketContext::GetProfileName name length is 0."));
       
 10274 
       
 10275 	// Post notification for context's status change
       
 10276 	TExtEtelRequestStatus notifySecContextStChStatus(secondaryPacketContext, EPacketContextNotifyStatusChange);
       
 10277 	CleanupStack::PushL(notifySecContextStChStatus);
       
 10278 	RPacketContext::TContextStatus secPacketContextStatus;
       
 10279 	secondaryPacketContext.NotifyStatusChange(notifySecContextStChStatus, secPacketContextStatus);
       
 10280 
       
 10281 	// Activate the secondary context. 
       
 10282 	TExtEtelRequestStatus secContextActivateStatus(secondaryPacketContext, EPacketContextActivate);
       
 10283 	CleanupStack::PushL(secContextActivateStatus);
       
 10284 	secondaryPacketContext.Activate(secContextActivateStatus);
       
 10285 
       
 10286 	// Check RPacketContext::NotifyStatusChange for the secondary context completes with EStatusActivating -> EStatusActive
       
 10287     RPacketContext::TContextStatus expectedSecContextStatus = RPacketContext::EStatusActivating;
       
 10288 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
 10289 				secondaryPacketContext,
       
 10290 				notifySecContextStChStatus,
       
 10291 				secPacketContextStatus, 
       
 10292 				expectedSecContextStatus,
       
 10293 				KErrNone);
       
 10294     secondaryPacketContext.NotifyStatusChange(notifySecContextStChStatus, secPacketContextStatus);	
       
 10295     expectedSecContextStatus = RPacketContext::EStatusActive;
       
 10296 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
 10297 				secondaryPacketContext,
       
 10298 				notifySecContextStChStatus,
       
 10299 				secPacketContextStatus, 
       
 10300 				expectedSecContextStatus,
       
 10301 				KErrNone);
       
 10302 
       
 10303 	// Check RPacketContext::GetStatus for the secondary context returns EStatusActive
       
 10304 	ASSERT_EQUALS(secondaryPacketContext.GetStatus(secPacketContextStatus), KErrNone, _L("RPacketContext::GetStatus returned with an error."));
       
 10305     ASSERT_EQUALS(secPacketContextStatus, RPacketContext::EStatusActive, _L("RPacketContext::GetStatus status expected to be EStatusActive but is not."));
       
 10306 
       
 10307 	// Check RPacketContext::EnumeratePacketFilters returns aCount = 5
       
 10308 	TExtEtelRequestStatus enumeratePacketFiltersStatus(secondaryPacketContext, EPacketContextEnumeratePacketFilters);
       
 10309 	CleanupStack::PushL(enumeratePacketFiltersStatus);
       
 10310 	TInt packetFiltersCount(0);
       
 10311 	secondaryPacketContext.EnumeratePacketFilters(enumeratePacketFiltersStatus, packetFiltersCount);
       
 10312 	ASSERT_EQUALS(WaitForRequestWithTimeOut(enumeratePacketFiltersStatus, ETimeLong), KErrNone, _L("RPacketContext::EnumeratePacketFilters timed out."));
       
 10313 	ASSERT_EQUALS(enumeratePacketFiltersStatus.Int(), KErrNone, _L("RPacketContext::EnumeratePacketFilters returned with error status."));
       
 10314 	ASSERT_EQUALS(packetFiltersCount, 5, _L("RPacketContext::EnumeratePacketFilters returned wrong number of packet filters."));
       
 10315 
       
 10316 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 0 returns first packet filter added to the context
       
 10317 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 1 returns second packet filter added to the context
       
 10318 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 2 returns third packet filter added to the context
       
 10319 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 3 returns fourth packet filter added to the context
       
 10320 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 4 returns fifth packet filter added to the context
       
 10321     RPacketContext::TPacketFilterV2 getPacketFilterV2;
       
 10322     RPacketContext::TPacketFilterV2Pckg getPacketFilterV2pkg(getPacketFilterV2);
       
 10323 	TExtEtelRequestStatus getPacketFilterInfoStatus(secondaryPacketContext, EPacketContextGetPacketFilterInfo);
       
 10324     CleanupStack::PushL(getPacketFilterInfoStatus);
       
 10325 	RPacketContext::TPacketFilterV2 defaultPacketFilterInfo;
       
 10326 
       
 10327 	for (TInt index = 0; index < 5; index++)
       
 10328 		{
       
 10329 		secondaryPacketContext.GetPacketFilterInfo(getPacketFilterInfoStatus, index, getPacketFilterV2pkg);
       
 10330 		ASSERT_EQUALS(WaitForRequestWithTimeOut(getPacketFilterInfoStatus, ETimeShort), KErrNone, _L("RPacketContext::GetPacketFilterInfo timed out"));
       
 10331 	    ASSERT_EQUALS(getPacketFilterInfoStatus.Int(), KErrNone, _L("RPacketContext::GetPacketFilterInfo returned an error"));
       
 10332 		FillPacketFilter(defaultPacketFilterInfo, index + 1);
       
 10333 		ASSERT_TRUE(CompareFilters(getPacketFilterV2,defaultPacketFilterInfo),_L("RPacketContext::GetPacketFilterInfo returned wrong filter"));
       
 10334 		}
       
 10335 
       
 10336 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 5 returns KErrArgument
       
 10337 	TInt index = 5;
       
 10338 	secondaryPacketContext.GetPacketFilterInfo(getPacketFilterInfoStatus, index, getPacketFilterV2pkg);
       
 10339 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getPacketFilterInfoStatus, ETimeShort), KErrNone, _L("RPacketContext::GetPacketFilterInfo timed out"));
       
 10340     ASSERT_EQUALS(getPacketFilterInfoStatus.Int(), KErrArgument, _L("RPacketContext::GetPacketFilterInfo did not return correct error"));
       
 10341 
       
 10342 	// Repost notification for context's status change
       
 10343 	secondaryPacketContext.NotifyStatusChange(notifySecContextStChStatus, secPacketContextStatus);
       
 10344 
       
 10345 	// Deactivate the secondary context. 
       
 10346 	TExtEtelRequestStatus contextDeactivateStatus(secondaryPacketContext, EPacketContextDeactivate);
       
 10347 	CleanupStack::PushL(contextDeactivateStatus);
       
 10348 	secondaryPacketContext.Deactivate(contextDeactivateStatus);
       
 10349 
       
 10350 	ASSERT_EQUALS(WaitForRequestWithTimeOut(contextDeactivateStatus, ETimeLong), KErrNone, _L("RPacketContext::Deactivate timed out."));					
       
 10351 	ASSERT_EQUALS(contextDeactivateStatus.Int(), KErrNone, _L("RPacketContext::Deactivate returned with error status."));
       
 10352 
       
 10353 	// Check RPacketContext::NotifyStatusChange for the secondary context completes with EStatusInactive
       
 10354     RPacketContext::TContextStatus 	expectedPacketContextStatus = RPacketContext::EStatusInactive;
       
 10355 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
 10356 					secondaryPacketContext,
       
 10357 					notifySecContextStChStatus,
       
 10358 					secPacketContextStatus, 
       
 10359 					expectedPacketContextStatus,
       
 10360 					KErrNone);
       
 10361 
       
 10362 	// Check RPacketContext::GetStatus for the secondary context returns EStatusInactive
       
 10363 	ASSERT_EQUALS(secondaryPacketContext.GetStatus(secPacketContextStatus), KErrNone, _L("RPacketContext::GetStatus returned with an error."));
       
 10364     ASSERT_EQUALS(secPacketContextStatus, RPacketContext::EStatusInactive, _L("RPacketContext::GetStatus status did not return EStatusInactive."));
       
 10365 
       
 10366 	// Delete the TFT with RPacketContext::DeleteTFT 
       
 10367 	TExtEtelRequestStatus deleteTFTStatus(secondaryPacketContext, EPacketContextDeleteTFT);
       
 10368 	CleanupStack::PushL(deleteTFTStatus);
       
 10369 	ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d</font>"), 50006);
       
 10370 	secondaryPacketContext.DeleteTFT(deleteTFTStatus);
       
 10371 	ASSERT_EQUALS(WaitForRequestWithTimeOut(createNewTFTStatus, ETimeMedium), KErrNone, _L("RPacketContext::DeleteTFT timed out"));
       
 10372 	ASSERT_EQUALS(createNewTFTStatus.Int(), KErrNone, _L("RPacketContext::DeleteTFT returned an error"));
       
 10373 
       
 10374 
       
 10375 	////////////////////////////////////////////////////////////////
       
 10376 	// TEST END
       
 10377 	////////////////////////////////////////////////////////////////
       
 10378 
       
 10379     StartCleanup();
       
 10380 
       
 10381 	// Pop
       
 10382 	// createNewTFTStatus
       
 10383 	// getProfileCapStatus
       
 10384 	// setProfileParamStatus
       
 10385 	// notifySecContextStChStatus
       
 10386 	// secContextActivateStatus
       
 10387 	// enumeratePacketFiltersStatus
       
 10388 	// getPacketFilterInfoStatus
       
 10389 	// contextDeactivateStatus
       
 10390 	// deleteTFTStatus
       
 10391 	CleanupStack::PopAndDestroy(9, &createNewTFTStatus);
       
 10392 
       
 10393 	return TestStepResult();
       
 10394 	}
       
 10395 
       
 10396 TPtrC CCTSYIntegrationTestPacketContext0042::GetTestStepName()
       
 10397 /**
       
 10398  * @return The test step name.
       
 10399  */
       
 10400 	{
       
 10401 	return _L("CCTSYIntegrationTestPacketContext0042");
       
 10402 	}
       
 10403 
       
 10404 
       
 10405 
       
 10406 CCTSYIntegrationTestPacketContext0043::CCTSYIntegrationTestPacketContext0043(CEtelSessionMgr& aEtelSessionMgr)
       
 10407 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
 10408 /**
       
 10409  * Constructor.
       
 10410  */
       
 10411 	{
       
 10412 	SetTestStepName(CCTSYIntegrationTestPacketContext0043::GetTestStepName());
       
 10413 	}
       
 10414 
       
 10415 CCTSYIntegrationTestPacketContext0043::~CCTSYIntegrationTestPacketContext0043()
       
 10416 /**
       
 10417  * Destructor.
       
 10418  */
       
 10419 	{
       
 10420 	}
       
 10421 
       
 10422 TVerdict CCTSYIntegrationTestPacketContext0043::doTestStepL()
       
 10423 /**
       
 10424  * @SYMTestCaseID BA-CTSY-INT-PKTC-0043
       
 10425  * @SYMFssID BA/CTSY/PKTC-0043
       
 10426  * @SYMTestCaseDesc Modify a secondary context creating a TFT for the packet filters.
       
 10427  * @SYMTestPriority High
       
 10428  * @SYMTestActions RPacketContext::OpenNewSecondaryContext, RPacketContext::NotifyStatusChange, RPacketContext::GetStatus, RPacketContext::Activate, RPacketContext::AddPacketFilter, RPacketContext::EnumeratePacketFilters, RPacketContext::GetPacketFilterInfo, RPacketContext::ModifyActiveContext, RPacketContext::DeleteTFT
       
 10429  * @SYMTestExpectedResults Pass - TFT created and deleted.
       
 10430  * @SYMTestType CIT
       
 10431  * @SYMTestCaseDependencies simulated/automatic
       
 10432  *
       
 10433  * Reason for test: Verify packet filter info correct.
       
 10434  *
       
 10435  * @return - TVerdict code
       
 10436  */
       
 10437 	{
       
 10438 
       
 10439 	////////////////////////////////////////////////////////////////
       
 10440 	// SET UP
       
 10441 	////////////////////////////////////////////////////////////////
       
 10442 
       
 10443 
       
 10444     //Check if we are on a simulated network to run emergency call tests
       
 10445     RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
 10446 	CHECK_EQUALS_L(iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(phone), KErrNone, _L("TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL returned with an error"));
       
 10447     iNetworkTestHelper.CheckPhoneConnectedToAniteL(phone);	
       
 10448 
       
 10449 	// Ensure there is an active primary context. 
       
 10450 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, KMainPhone, KMainPacketService);
       
 10451     SetAttachModeToWhenPossibleAndWaitForAttachL(packetService);
       
 10452 	RPacketContext& primaryPacketContext = iEtelSessionMgr.GetPrimaryPacketContextL(
       
 10453 											KMainServer,
       
 10454 											KMainPhone,
       
 10455 											KMainPacketService,
       
 10456 											KPrimaryPacketContext1);
       
 10457 	iPacketServiceTestHelper.ActivatePrimaryPacketContextL(phone, primaryPacketContext);
       
 10458 
       
 10459 
       
 10460 	////////////////////////////////////////////////////////////////
       
 10461 	// SET UP END
       
 10462 	////////////////////////////////////////////////////////////////
       
 10463 	
       
 10464 	StartTest();
       
 10465 	
       
 10466 	////////////////////////////////////////////////////////////////
       
 10467 	// TEST START
       
 10468 	////////////////////////////////////////////////////////////////
       
 10469 	
       
 10470 	
       
 10471 	// Open a new secondary context. 
       
 10472     RPacketContext& secondaryPacketContext = iEtelSessionMgr.GetSecondaryPacketContextL(
       
 10473 			KMainServer,
       
 10474 			KMainPhone,
       
 10475 			KMainPacketService, 
       
 10476 			KPrimaryPacketContext1,
       
 10477 			KSecondaryPacketContext1);
       
 10478 
       
 10479 	// Create a new TFT with RPacketContext::CreateNewTFT and aSize = 5 
       
 10480 	TExtEtelRequestStatus createNewTFTStatus(secondaryPacketContext, EPacketContextCreateNewTFT);
       
 10481 	CleanupStack::PushL(createNewTFTStatus);
       
 10482 	const TInt size(5);
       
 10483 	ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d</font>"), 50005);
       
 10484 	secondaryPacketContext.CreateNewTFT(createNewTFTStatus, size);
       
 10485 	ASSERT_EQUALS(WaitForRequestWithTimeOut(createNewTFTStatus, ETimeMedium), KErrNone, _L("RPacketContext::CreateNewTFT timed out"));
       
 10486 	ASSERT_EQUALS(createNewTFTStatus.Int(), KErrNone, _L("RPacketContext::CreateNewTFT returned an error"));
       
 10487 
       
 10488 	// Add a TPacketFilterV2 packet filter with iId = 1 to the secondary context using RPacketContext::AddPacketFilter 
       
 10489 	ASSERT_EQUALS(AddPacketFilterV2ToContextL(secondaryPacketContext, 1), KErrNone, _L("RPacketContext::AddPacketFilter returned with error status")); 
       
 10490 
       
 10491 	// Open a new QoS from the secondary context with  
       
 10492 	RPacketQoS& packetQoS = iEtelSessionMgr.GetSecondaryPacketContextQoSL(
       
 10493 												KMainServer,
       
 10494 												KMainPhone,
       
 10495 												KMainPacketService, 
       
 10496 												KPrimaryPacketContext1,
       
 10497 												KSecondaryPacketContext1);
       
 10498 
       
 10499 	// Get QoS profile capabilities with RPacketQoS::GetProfileCapabilities
       
 10500 	TExtEtelRequestStatus getProfileCapStatus(packetQoS, EPacketQoSGetProfileCaps);
       
 10501 	CleanupStack::PushL(getProfileCapStatus);
       
 10502 	RPacketQoS::TQoSCapsGPRS qosCapGprs;
       
 10503 	TPckg<RPacketQoS::TQoSCapsGPRS> qosCapsGprsPckg(qosCapGprs);
       
 10504 	packetQoS.GetProfileCapabilities(getProfileCapStatus, qosCapsGprsPckg);
       
 10505 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getProfileCapStatus, ETimeMedium), KErrNone, _L("RPacketQoS::GetProfileCapabilities timed out."));
       
 10506     ASSERT_EQUALS(getProfileCapStatus.Int(), KErrNone, _L("RPacketQoS::GetProfileCapabilities returned with error status."));
       
 10507 
       
 10508 	// Set requested profile parameters with RPacketQoS::SetProfileParameters and TQoSGPRSRequested with parameters within range returned by RPacketQoS::GetProfileCapabilities 
       
 10509     RPacketQoS::TQoSGPRSRequested qosGprsRequested;
       
 10510 	TPckg<RPacketQoS::TQoSGPRSRequested> qosGprsReqPckg(qosGprsRequested);
       
 10511     FillParametersFromCapabilities(qosGprsRequested,qosCapGprs);    
       
 10512 	TExtEtelRequestStatus setProfileParamStatus(packetQoS, EPacketQoSSetProfileParams);
       
 10513 	CleanupStack::PushL(setProfileParamStatus);
       
 10514 	packetQoS.SetProfileParameters(setProfileParamStatus, qosGprsReqPckg);
       
 10515 	ASSERT_EQUALS(WaitForRequestWithTimeOut(setProfileParamStatus, ETimeMedium), KErrNone, _L("RPacketQoS::SetProfileParameters timed out."));
       
 10516 	ASSERT_EQUALS(setProfileParamStatus.Int(), KErrNone, _L("RPacketQoS::SetProfileParameters returned with error status."));
       
 10517 
       
 10518 	// Check RPacketContext::GetProfileName returns QoS profile name with length > 0
       
 10519     TName profileName;
       
 10520     ASSERT_EQUALS(secondaryPacketContext.GetProfileName(profileName),KErrNone, _L("RPacketContext::GetProfileName returned with error status."));
       
 10521     ASSERT_TRUE(profileName.Length()>0, _L("RPacketContext::GetProfileName name length is 0."));
       
 10522 
       
 10523 	// Post notification for context's status change
       
 10524 	TExtEtelRequestStatus notifySecContextStChStatus(secondaryPacketContext, EPacketContextNotifyStatusChange);
       
 10525 	CleanupStack::PushL(notifySecContextStChStatus);
       
 10526 	RPacketContext::TContextStatus secPacketContextStatus;
       
 10527 	secondaryPacketContext.NotifyStatusChange(notifySecContextStChStatus, secPacketContextStatus);
       
 10528 
       
 10529 	// Activate the secondary context. 
       
 10530 	TExtEtelRequestStatus secContextActivateStatus(secondaryPacketContext, EPacketContextActivate);
       
 10531 	CleanupStack::PushL(secContextActivateStatus);
       
 10532 	secondaryPacketContext.Activate(secContextActivateStatus);
       
 10533 
       
 10534 	// Check RPacketContext::NotifyStatusChange for the secondary context completes with EStatusActivating -> EStatusActive
       
 10535     RPacketContext::TContextStatus expectedSecContextStatus = RPacketContext::EStatusActivating;
       
 10536 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
 10537 				secondaryPacketContext,
       
 10538 				notifySecContextStChStatus,
       
 10539 				secPacketContextStatus, 
       
 10540 				expectedSecContextStatus,
       
 10541 				KErrNone);
       
 10542 
       
 10543     secondaryPacketContext.NotifyStatusChange(notifySecContextStChStatus, secPacketContextStatus);	
       
 10544     expectedSecContextStatus = RPacketContext::EStatusActive;
       
 10545 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
 10546 				secondaryPacketContext,
       
 10547 				notifySecContextStChStatus,
       
 10548 				secPacketContextStatus, 
       
 10549 				expectedSecContextStatus,
       
 10550 				KErrNone);
       
 10551 
       
 10552 	// Check RPacketContext::GetStatus for the secondary context returns EStatusActive
       
 10553 	ASSERT_EQUALS(secondaryPacketContext.GetStatus(secPacketContextStatus), KErrNone, _L("RPacketContext::GetStatus returned with an error."));
       
 10554     ASSERT_EQUALS(secPacketContextStatus, RPacketContext::EStatusActive, _L("RPacketContext::GetStatus status expected to be EStatusActive but is not."));
       
 10555 
       
 10556 	// Check RPacketContext::EnumeratePacketFilters returns aCount = 1
       
 10557 	TExtEtelRequestStatus enumeratePacketFiltersStatus(secondaryPacketContext, EPacketContextEnumeratePacketFilters);
       
 10558 	CleanupStack::PushL(enumeratePacketFiltersStatus);
       
 10559 	TInt packetFiltersCount(0);
       
 10560 	secondaryPacketContext.EnumeratePacketFilters(enumeratePacketFiltersStatus, packetFiltersCount);
       
 10561 	ASSERT_EQUALS(WaitForRequestWithTimeOut(enumeratePacketFiltersStatus, ETimeLong), KErrNone, _L("RPacketContext::EnumeratePacketFilters timed out."));
       
 10562 	ASSERT_EQUALS(enumeratePacketFiltersStatus.Int(), KErrNone, _L("RPacketContext::EnumeratePacketFilters returned with error status."));
       
 10563 	ASSERT_EQUALS(packetFiltersCount, 1, _L("RPacketContext::EnumeratePacketFilters returned wrong number of packet filters."));
       
 10564 
       
 10565 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 0 returns packet filter with iId = 1
       
 10566     RPacketContext::TPacketFilterV2 getPacketFilterV2;
       
 10567     RPacketContext::TPacketFilterV2Pckg getPacketFilterV2pkg(getPacketFilterV2);
       
 10568 	TExtEtelRequestStatus getPacketFilterInfoStatus(secondaryPacketContext, EPacketContextGetPacketFilterInfo);
       
 10569     CleanupStack::PushL(getPacketFilterInfoStatus);
       
 10570 	RPacketContext::TPacketFilterV2 defaultPacketFilterInfo;
       
 10571 	FillPacketFilter(defaultPacketFilterInfo, 1);
       
 10572 	secondaryPacketContext.GetPacketFilterInfo(getPacketFilterInfoStatus, 0, getPacketFilterV2pkg);
       
 10573 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getPacketFilterInfoStatus, ETimeShort), KErrNone, _L("RPacketContext::GetPacketFilterInfo timed out"));
       
 10574     ASSERT_EQUALS(getPacketFilterInfoStatus.Int(), KErrNone, _L("RPacketContext::GetPacketFilterInfo returned an error"));
       
 10575 	ASSERT_TRUE(CompareFilters(getPacketFilterV2,defaultPacketFilterInfo),_L("RPacketContext::GetPacketFilterInfo returned wrong filter"));
       
 10576 
       
 10577 	// Add 4 more TPacketFilterV2 packet filters (with iId = 2 to 5) to the secondary context using RPacketContext::AddPacketFilter 
       
 10578 	for(TInt index = 2; index < 6; index++)
       
 10579 		{
       
 10580 		ASSERT_EQUALS(AddPacketFilterV2ToContextL(secondaryPacketContext, index), KErrNone, _L("RPacketContext::AddPacketFilter returned with error status")); 
       
 10581 		}
       
 10582 
       
 10583 	// ===  Attempt to add a 6th filter to the context ===
       
 10584 
       
 10585 	// Check RPacketContext::AddPacketFilter with iId = 6 returns KErrArgument
       
 10586 	ASSERT_EQUALS(AddPacketFilterV2ToContextL(secondaryPacketContext, 6), KErrArgument, _L("RPacketContext::AddPacketFilter did not return with an error as expected."));
       
 10587 
       
 10588 	// Modify the secondary context with RPacketContext::ModifyActiveContext 
       
 10589 	TExtEtelRequestStatus modifyActiveContextStatus(secondaryPacketContext, EPacketContextModifyActiveContext);
       
 10590 	CleanupStack::PushL(modifyActiveContextStatus);
       
 10591 	secondaryPacketContext.ModifyActiveContext(modifyActiveContextStatus);
       
 10592 	ASSERT_EQUALS(WaitForRequestWithTimeOut(modifyActiveContextStatus, ETimeMedium), KErrNone, _L("RPacketContext::ModifyActiveContext timed out."));
       
 10593 	ASSERT_EQUALS(modifyActiveContextStatus.Int(), KErrNone, _L("RPacketContext::ModifyActiveContext returned with error status."));
       
 10594 
       
 10595 	// Check RPacketContext::EnumeratePacketFilters returns aCount = 5
       
 10596 	packetFiltersCount = 0;
       
 10597 	secondaryPacketContext.EnumeratePacketFilters(enumeratePacketFiltersStatus, packetFiltersCount);
       
 10598 	ASSERT_EQUALS(WaitForRequestWithTimeOut(enumeratePacketFiltersStatus, ETimeLong), KErrNone, _L("RPacketContext::EnumeratePacketFilters timed out."));
       
 10599 	ASSERT_EQUALS(enumeratePacketFiltersStatus.Int(), KErrNone, _L("RPacketContext::EnumeratePacketFilters returned with error status."));
       
 10600 	ASSERT_EQUALS(packetFiltersCount, 5, _L("RPacketContext::EnumeratePacketFilters returned wrong number of packet filters."));
       
 10601 
       
 10602 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 0 returns first packet filter added to the context
       
 10603 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 1 returns second packet filter added to the context
       
 10604 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 2 returns third packet filter added to the context
       
 10605 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 3 returns fourth packet filter added to the context
       
 10606 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 4 returns fifth packet filter added to the context
       
 10607 	for (TInt index = 0; index < 5; index++)
       
 10608 		{
       
 10609 		secondaryPacketContext.GetPacketFilterInfo(getPacketFilterInfoStatus, index, getPacketFilterV2pkg);
       
 10610 		ASSERT_EQUALS(WaitForRequestWithTimeOut(getPacketFilterInfoStatus, ETimeShort), KErrNone, _L("RPacketContext::GetPacketFilterInfo timed out"));
       
 10611 	    ASSERT_EQUALS(getPacketFilterInfoStatus.Int(), KErrNone, _L("RPacketContext::GetPacketFilterInfo returned an error"));
       
 10612 		FillPacketFilter(defaultPacketFilterInfo, index + 1);
       
 10613 		ASSERT_TRUE(CompareFilters(getPacketFilterV2,defaultPacketFilterInfo),_L("RPacketContext::GetPacketFilterInfo returned wrong filter"));
       
 10614 		}
       
 10615 
       
 10616 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 5 returns KErrArgument
       
 10617 	secondaryPacketContext.GetPacketFilterInfo(getPacketFilterInfoStatus, 5, getPacketFilterV2pkg);
       
 10618 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getPacketFilterInfoStatus, ETimeShort), KErrNone, _L("RPacketContext::GetPacketFilterInfo timed out"));
       
 10619     ASSERT_EQUALS(getPacketFilterInfoStatus.Int(), KErrArgument, _L("RPacketContext::GetPacketFilterInfo did not return correct error"));
       
 10620 
       
 10621 	// Remove the filter with iId = 3 using RPacketContext::RemovePacketFilter 
       
 10622 	TExtEtelRequestStatus removePacketFilterStatus(secondaryPacketContext, EPacketContextRemovePacketFilter);
       
 10623 	CleanupStack::PushL(removePacketFilterStatus);
       
 10624 	TInt wantedId = 3;
       
 10625 	secondaryPacketContext.RemovePacketFilter(removePacketFilterStatus, wantedId);
       
 10626 	ASSERT_EQUALS(WaitForRequestWithTimeOut(removePacketFilterStatus, ETimeShort), KErrNone, _L("RPacketContext::RemovePacketFilter timed out"));
       
 10627 	ASSERT_EQUALS(removePacketFilterStatus.Int(), KErrNone, _L("RPacketContext::RemovePacketFilter returned an error"));
       
 10628 
       
 10629 	// Modify the secondary context with RPacketContext::ModifyActiveContext 
       
 10630 	secondaryPacketContext.ModifyActiveContext(modifyActiveContextStatus);
       
 10631 	ASSERT_EQUALS(WaitForRequestWithTimeOut(modifyActiveContextStatus, ETimeMedium), KErrNone, _L("RPacketContext::ModifyActiveContext timed out."));
       
 10632 	ASSERT_EQUALS(modifyActiveContextStatus.Int(), KErrNone, _L("RPacketContext::ModifyActiveContext returned with error status."));
       
 10633 
       
 10634 	// Check RPacketContext::EnumeratePacketFilters returns aCount = 4
       
 10635 	packetFiltersCount = 0;
       
 10636 	secondaryPacketContext.EnumeratePacketFilters(enumeratePacketFiltersStatus, packetFiltersCount);
       
 10637 	ASSERT_EQUALS(WaitForRequestWithTimeOut(enumeratePacketFiltersStatus, ETimeLong), KErrNone, _L("RPacketContext::EnumeratePacketFilters timed out."));
       
 10638 	ASSERT_EQUALS(enumeratePacketFiltersStatus.Int(), KErrNone, _L("RPacketContext::EnumeratePacketFilters returned with error status."));
       
 10639 	ASSERT_EQUALS(packetFiltersCount, 4, _L("RPacketContext::EnumeratePacketFilters returned wrong number of packet filters."));
       
 10640 
       
 10641 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 0 returns first packet filter added to the context
       
 10642 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 1 returns second packet filter added to the context
       
 10643 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 2 returns fourth packet filter added to the context
       
 10644 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 3 returns fifth packet filter added to the context
       
 10645 	for (TInt index = 0; index < 4; index++)
       
 10646 		{
       
 10647 		secondaryPacketContext.GetPacketFilterInfo(getPacketFilterInfoStatus, index, getPacketFilterV2pkg);
       
 10648 		ASSERT_EQUALS(WaitForRequestWithTimeOut(getPacketFilterInfoStatus, ETimeShort), KErrNone, _L("RPacketContext::GetPacketFilterInfo timed out"));
       
 10649 	    ASSERT_EQUALS(getPacketFilterInfoStatus.Int(), KErrNone, _L("RPacketContext::GetPacketFilterInfo returned an error"));
       
 10650 	    
       
 10651 	    if (index >= 2) // Third filter removed earlier in this test
       
 10652 			{
       
 10653 			FillPacketFilter(defaultPacketFilterInfo, index + 2);
       
 10654 			}
       
 10655 	    else
       
 10656    			{
       
 10657    			FillPacketFilter(defaultPacketFilterInfo, index + 1);
       
 10658    			}
       
 10659 
       
 10660 		ASSERT_TRUE(CompareFilters(getPacketFilterV2,defaultPacketFilterInfo),_L("RPacketContext::GetPacketFilterInfo returned wrong filter"));
       
 10661 		}
       
 10662 
       
 10663 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 4 returns KErrArgument
       
 10664 	secondaryPacketContext.GetPacketFilterInfo(getPacketFilterInfoStatus, 4, getPacketFilterV2pkg);
       
 10665 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getPacketFilterInfoStatus, ETimeShort), KErrNone, _L("RPacketContext::GetPacketFilterInfo timed out"));
       
 10666     ASSERT_EQUALS(getPacketFilterInfoStatus.Int(), KErrArgument, _L("RPacketContext::GetPacketFilterInfo did not return correct error"));
       
 10667 
       
 10668 	// ===  Add a packet filter with the same Id as an existing one (modification of a packet filter) ===
       
 10669 
       
 10670 	// Add another packet filter to the context with iId = 1 
       
 10671     RPacketContext::TPacketFilterV2 packetFilterV2;
       
 10672 	RPacketContext::TPacketFilterV2Pckg packetFilterV2pckg(packetFilterV2);
       
 10673 	TExtEtelRequestStatus addFilterStatus(primaryPacketContext, EPacketContextAddPacketFilter); 
       
 10674     CleanupStack::PushL(addFilterStatus);
       
 10675 	FillPacketFilter(packetFilterV2, 2);
       
 10676 	packetFilterV2.iId = 1;
       
 10677 	secondaryPacketContext.AddPacketFilter(addFilterStatus, packetFilterV2pckg);
       
 10678 	ASSERT_EQUALS(WaitForRequestWithTimeOut(addFilterStatus, ETimeMedium), KErrNone, _L("RPacketContext::AddPacketFilter timed out"));
       
 10679 	ASSERT_EQUALS(addFilterStatus.Int(), KErrNone, _L("RPacketContext::AddPacketFilter returned an error"));
       
 10680 
       
 10681 	// Modify the secondary context with RPacketContext::ModifyActiveContext 
       
 10682 	secondaryPacketContext.ModifyActiveContext(modifyActiveContextStatus);
       
 10683 	ASSERT_EQUALS(WaitForRequestWithTimeOut(modifyActiveContextStatus, ETimeMedium), KErrNone, _L("RPacketContext::ModifyActiveContext timed out."));
       
 10684 	ASSERT_EQUALS(modifyActiveContextStatus.Int(), KErrNone, _L("RPacketContext::ModifyActiveContext returned with error status."));
       
 10685 
       
 10686 	// Check RPacketContext::EnumeratePacketFilters returns aCount = 4
       
 10687 	packetFiltersCount = 0;
       
 10688 	secondaryPacketContext.EnumeratePacketFilters(enumeratePacketFiltersStatus, packetFiltersCount);
       
 10689 	ASSERT_EQUALS(WaitForRequestWithTimeOut(enumeratePacketFiltersStatus, ETimeLong), KErrNone, _L("RPacketContext::EnumeratePacketFilters timed out."));
       
 10690 	ASSERT_EQUALS(enumeratePacketFiltersStatus.Int(), KErrNone, _L("RPacketContext::EnumeratePacketFilters returned with error status."));
       
 10691 	ASSERT_EQUALS(packetFiltersCount, 4, _L("RPacketContext::EnumeratePacketFilters returned wrong number of packet filters."));
       
 10692 
       
 10693 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 0 returns first packet filter that has just been added
       
 10694 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 1 returns second packet filter added to the context
       
 10695 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 2 returns fourth packet filter added to the context
       
 10696 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 3 returns fifth packet filter added to the context
       
 10697 	for (TInt index = 0; index < 4; index++)
       
 10698 		{
       
 10699 		secondaryPacketContext.GetPacketFilterInfo(getPacketFilterInfoStatus, index, getPacketFilterV2pkg);
       
 10700 		ASSERT_EQUALS(WaitForRequestWithTimeOut(getPacketFilterInfoStatus, ETimeShort), KErrNone, _L("RPacketContext::GetPacketFilterInfo timed out"));
       
 10701 	    ASSERT_EQUALS(getPacketFilterInfoStatus.Int(), KErrNone, _L("RPacketContext::GetPacketFilterInfo returned an error"));
       
 10702 
       
 10703 		if (index == 0)
       
 10704 			{
       
 10705 			FillPacketFilter(defaultPacketFilterInfo, 2);
       
 10706             packetFilterV2.iId = 1;
       
 10707 			}
       
 10708 	    else if (index >= 2) // Third filter removed earlier in this test
       
 10709 			{
       
 10710 			FillPacketFilter(defaultPacketFilterInfo, index + 2);
       
 10711 			}
       
 10712 	    else
       
 10713 			{
       
 10714    			FillPacketFilter(defaultPacketFilterInfo, index + 1);
       
 10715 			}
       
 10716 
       
 10717 		ASSERT_TRUE(CompareFilters(getPacketFilterV2,defaultPacketFilterInfo),_L("RPacketContext::GetPacketFilterInfo returned wrong filter"));
       
 10718 		}
       
 10719 
       
 10720 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 4 returns KErrArgument
       
 10721 	secondaryPacketContext.GetPacketFilterInfo(getPacketFilterInfoStatus, 4, getPacketFilterV2pkg);
       
 10722 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getPacketFilterInfoStatus, ETimeShort), KErrNone, _L("RPacketContext::GetPacketFilterInfo timed out"));
       
 10723     ASSERT_EQUALS(getPacketFilterInfoStatus.Int(), KErrArgument, _L("RPacketContext::GetPacketFilterInfo did not return correct error"));
       
 10724 
       
 10725 	// ===  Add a packet filter with iId = 3 (add new one that was removed) ===
       
 10726 
       
 10727 	// Add another filter packet filter to the context with iId = 3 
       
 10728 	ASSERT_EQUALS(AddPacketFilterV2ToContextL(secondaryPacketContext, 3), KErrNone, _L("RPacketContext::AddPacketFilter returned with error status")); 
       
 10729 
       
 10730 	// Modify the secondary context with RPacketContext::ModifyActiveContext 
       
 10731 	secondaryPacketContext.ModifyActiveContext(modifyActiveContextStatus);
       
 10732 	ASSERT_EQUALS(WaitForRequestWithTimeOut(modifyActiveContextStatus, ETimeMedium), KErrNone, _L("RPacketContext::ModifyActiveContext timed out."));
       
 10733 	ASSERT_EQUALS(modifyActiveContextStatus.Int(), KErrNone, _L("RPacketContext::ModifyActiveContext returned with error status."));
       
 10734 
       
 10735 	// Check RPacketContext::EnumeratePacketFilters returns aCount = 5
       
 10736 	packetFiltersCount = 0;
       
 10737 	secondaryPacketContext.EnumeratePacketFilters(enumeratePacketFiltersStatus, packetFiltersCount);
       
 10738 	ASSERT_EQUALS(WaitForRequestWithTimeOut(enumeratePacketFiltersStatus, ETimeLong), KErrNone, _L("RPacketContext::EnumeratePacketFilters timed out."));
       
 10739 	ASSERT_EQUALS(enumeratePacketFiltersStatus.Int(), KErrNone, _L("RPacketContext::EnumeratePacketFilters returned with error status."));
       
 10740 	ASSERT_EQUALS(packetFiltersCount, 5, _L("RPacketContext::EnumeratePacketFilters returned wrong number of packet filters."));
       
 10741 
       
 10742 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 0 returns first packet filter added to the context
       
 10743 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 1 returns second packet filter added to the context
       
 10744 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 2 returns third packet filter added to the context
       
 10745 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 3 returns fourth packet filter added to the context
       
 10746 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 4 returns fifth packet filter added to the context
       
 10747 	for (TInt index = 1; index < 4; index++)
       
 10748 		{
       
 10749 		secondaryPacketContext.GetPacketFilterInfo(getPacketFilterInfoStatus, index, getPacketFilterV2pkg);
       
 10750 		ASSERT_EQUALS(WaitForRequestWithTimeOut(getPacketFilterInfoStatus, ETimeShort), KErrNone, _L("RPacketContext::GetPacketFilterInfo timed out"));
       
 10751 	    ASSERT_EQUALS(getPacketFilterInfoStatus.Int(), KErrNone, _L("RPacketContext::GetPacketFilterInfo returned an error"));
       
 10752 
       
 10753 		if (index == 0)
       
 10754 			{
       
 10755 			FillPacketFilter(defaultPacketFilterInfo, 2);
       
 10756             packetFilterV2.iId = 1;
       
 10757 			}
       
 10758 		else
       
 10759 			{
       
 10760 			FillPacketFilter(defaultPacketFilterInfo, index + 1);
       
 10761 			}
       
 10762 
       
 10763 		ASSERT_TRUE(CompareFilters(getPacketFilterV2,defaultPacketFilterInfo),_L("RPacketContext::GetPacketFilterInfo returned wrong filter"));
       
 10764 		}
       
 10765 
       
 10766 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 5 returns KErrArgument
       
 10767 	secondaryPacketContext.GetPacketFilterInfo(getPacketFilterInfoStatus, 5, getPacketFilterV2pkg);
       
 10768 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getPacketFilterInfoStatus, ETimeShort), KErrNone, _L("RPacketContext::GetPacketFilterInfo timed out"));
       
 10769     ASSERT_EQUALS(getPacketFilterInfoStatus.Int(), KErrArgument, _L("RPacketContext::GetPacketFilterInfo did not return correct error"));
       
 10770 
       
 10771 	// Repost notification for context's status change
       
 10772 	secondaryPacketContext.NotifyStatusChange(notifySecContextStChStatus, secPacketContextStatus);
       
 10773 
       
 10774 	// Deactivate the secondary context. 
       
 10775 	TExtEtelRequestStatus contextDeactivateStatus(secondaryPacketContext, EPacketContextDeactivate);
       
 10776 	CleanupStack::PushL(contextDeactivateStatus);
       
 10777 	secondaryPacketContext.Deactivate(contextDeactivateStatus);
       
 10778 
       
 10779 	ASSERT_EQUALS(WaitForRequestWithTimeOut(contextDeactivateStatus, ETimeLong), KErrNone, _L("RPacketContext::Deactivate timed out."));					
       
 10780 	ASSERT_EQUALS(contextDeactivateStatus.Int(), KErrNone, _L("RPacketContext::Deactivate returned with error status."));
       
 10781 
       
 10782 	// Check RPacketContext::NotifyStatusChange for the secondary context completes with EStatusInactive
       
 10783     RPacketContext::TContextStatus 	expectedPacketContextStatus = RPacketContext::EStatusInactive;
       
 10784 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
 10785 					secondaryPacketContext,
       
 10786 					notifySecContextStChStatus,
       
 10787 					secPacketContextStatus, 
       
 10788 					expectedPacketContextStatus,
       
 10789 					KErrNone);
       
 10790 
       
 10791 	// Check RPacketContext::GetStatus for the secondary context returns EStatusInactive
       
 10792 	ASSERT_EQUALS(secondaryPacketContext.GetStatus(secPacketContextStatus), KErrNone, _L("RPacketContext::GetStatus returned with an error."));
       
 10793     ASSERT_EQUALS(secPacketContextStatus, RPacketContext::EStatusInactive, _L("Packet Context's status expected to be EStatusActive but is not."));
       
 10794 
       
 10795 	// Delete the TFT with RPacketContext::DeleteTFT 
       
 10796 	TExtEtelRequestStatus deleteTFTStatus(secondaryPacketContext, EPacketContextDeleteTFT);
       
 10797 	CleanupStack::PushL(deleteTFTStatus);
       
 10798 	ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d</font>"), 50006);
       
 10799 	secondaryPacketContext.DeleteTFT(deleteTFTStatus);
       
 10800 	ASSERT_EQUALS(WaitForRequestWithTimeOut(createNewTFTStatus, ETimeMedium), KErrNone, _L("RPacketContext::DeleteTFT timed out"));
       
 10801 	ASSERT_EQUALS(createNewTFTStatus.Int(), KErrNone, _L("RPacketContext::DeleteTFT returned an error"));
       
 10802 
       
 10803 
       
 10804 	////////////////////////////////////////////////////////////////
       
 10805 	// TEST END
       
 10806 	////////////////////////////////////////////////////////////////
       
 10807 
       
 10808     StartCleanup();
       
 10809 	
       
 10810 	// Pop
       
 10811 	// createNewTFTStatus
       
 10812 	// getProfileCapStatus
       
 10813 	// setProfileParamStatus
       
 10814 	// notifySecContextStChStatus
       
 10815 	// secContextActivateStatus
       
 10816 	// enumeratePacketFiltersStatus
       
 10817 	// getPacketFilterInfoStatus
       
 10818 	// modifyActiveContextStatus
       
 10819 	// removePacketFilterStatus
       
 10820 	// addFilterStatus
       
 10821 	// contextDeactivateStatus
       
 10822 	// deleteTFTStatus
       
 10823 	CleanupStack::PopAndDestroy(12, &createNewTFTStatus);
       
 10824 	
       
 10825 	return TestStepResult();
       
 10826 	}
       
 10827 
       
 10828 TPtrC CCTSYIntegrationTestPacketContext0043::GetTestStepName()
       
 10829 /**
       
 10830  * @return The test step name.
       
 10831  */
       
 10832 	{
       
 10833 	return _L("CCTSYIntegrationTestPacketContext0043");
       
 10834 	}
       
 10835 
       
 10836 
       
 10837 
       
 10838 CCTSYIntegrationTestPacketContext0044::CCTSYIntegrationTestPacketContext0044(CEtelSessionMgr& aEtelSessionMgr)
       
 10839 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
 10840 /**
       
 10841  * Constructor.
       
 10842  */
       
 10843 	{
       
 10844 	SetTestStepName(CCTSYIntegrationTestPacketContext0044::GetTestStepName());
       
 10845 	}
       
 10846 
       
 10847 CCTSYIntegrationTestPacketContext0044::~CCTSYIntegrationTestPacketContext0044()
       
 10848 /**
       
 10849  * Destructor.
       
 10850  */
       
 10851 	{
       
 10852 	}
       
 10853 
       
 10854 TVerdict CCTSYIntegrationTestPacketContext0044::doTestStepL()
       
 10855 /**
       
 10856  * @SYMTestCaseID BA-CTSY-INT-PKTC-0044
       
 10857  * @SYMFssID BA/CTSY/PKTC-0044
       
 10858  * @SYMTestCaseDesc Modify a context when it is not active.
       
 10859  * @SYMTestPriority High
       
 10860  * @SYMTestActions RPacketContext::OpenNewSecondaryContext
       
 10861  * @SYMTestExpectedResults Pass - Error returned on attempt to modify a context that is not active.
       
 10862  * @SYMTestType CIT
       
 10863  * @SYMTestCaseDependencies live/automatic
       
 10864  *
       
 10865  * Reason for test: Verify context status and packet service status and error returned for modify.
       
 10866  *
       
 10867  * @return - TVerdict code
       
 10868  */
       
 10869 	{
       
 10870 
       
 10871 	////////////////////////////////////////////////////////////////
       
 10872 	// SET UP
       
 10873 	////////////////////////////////////////////////////////////////
       
 10874 
       
 10875 
       
 10876     // Call TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL
       
 10877     RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
 10878 	CHECK_EQUALS_L(iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(phone), KErrNone, _L("TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL returned with an error"));
       
 10879 
       
 10880     // Get packet service
       
 10881 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, KMainPhone, KMainPacketService);
       
 10882 
       
 10883     // Ensure phone is attached to the packet service
       
 10884     SetAttachModeToWhenPossibleAndWaitForAttachL(packetService);
       
 10885 
       
 10886 
       
 10887 	////////////////////////////////////////////////////////////////
       
 10888 	// SET UP END
       
 10889 	////////////////////////////////////////////////////////////////
       
 10890 	
       
 10891 	StartTest();
       
 10892 	
       
 10893 	////////////////////////////////////////////////////////////////
       
 10894 	// TEST START
       
 10895 	////////////////////////////////////////////////////////////////
       
 10896 
       
 10897 
       
 10898 	// Open a new primary context.
       
 10899 	RPacketContext& primaryPacketContext = iEtelSessionMgr.GetPrimaryPacketContextL(
       
 10900 																KMainServer,
       
 10901 																KMainPhone,
       
 10902 																KMainPacketService,
       
 10903 																KPrimaryPacketContext1);
       
 10904 
       
 10905 	// Modify the context with RPacketContext::ModifyActiveContext 
       
 10906 	TExtEtelRequestStatus modifyActiveContextStatus(primaryPacketContext, EPacketContextModifyActiveContext);
       
 10907 	CleanupStack::PushL(modifyActiveContextStatus);
       
 10908 	primaryPacketContext.ModifyActiveContext(modifyActiveContextStatus);
       
 10909 	ASSERT_EQUALS(WaitForRequestWithTimeOut(modifyActiveContextStatus, ETimeMedium), KErrNone, _L("RPacketContext::ModifyActiveContext timed out."));
       
 10910 
       
 10911 	// Check error is returned.
       
 10912 	ASSERT_TRUE(modifyActiveContextStatus.Int() != KErrNone, _L("RPacketContext::ModifyActiveContext did not return with an error as expected."));
       
 10913 
       
 10914 	// Open a new secondary context from the primary  
       
 10915     RPacketContext& secondaryPacketContext = iEtelSessionMgr.GetSecondaryPacketContextL(
       
 10916 																KMainServer,
       
 10917 																KMainPhone,
       
 10918 																KMainPacketService, 
       
 10919 																KPrimaryPacketContext1,
       
 10920 																KSecondaryPacketContext1);
       
 10921 
       
 10922 	// Modify the secondary context with RPacketContext::ModifyActiveContext 
       
 10923 	TExtEtelRequestStatus modifyActiveContextStatus2(secondaryPacketContext, EPacketContextModifyActiveContext);
       
 10924 	CleanupStack::PushL(modifyActiveContextStatus2);
       
 10925 	secondaryPacketContext.ModifyActiveContext(modifyActiveContextStatus2);
       
 10926 	ASSERT_EQUALS(WaitForRequestWithTimeOut(modifyActiveContextStatus2, ETimeMedium), KErrNone, _L("RPacketContext::ModifyActiveContext timed out."));
       
 10927 
       
 10928 	// Check error is returned.
       
 10929 	ASSERT_TRUE(modifyActiveContextStatus2.Int() != KErrNone, _L("RPacketContext::ModifyActiveContext did not return with an error as expected."));
       
 10930 
       
 10931 
       
 10932 	////////////////////////////////////////////////////////////////
       
 10933 	// TEST END
       
 10934 	////////////////////////////////////////////////////////////////
       
 10935 
       
 10936     StartCleanup();
       
 10937 	
       
 10938 	// Pop
       
 10939 	// modifyActiveContextStatus
       
 10940 	// modifyActiveContextStatus2
       
 10941 	CleanupStack::PopAndDestroy(2, &modifyActiveContextStatus);
       
 10942 	
       
 10943 	return TestStepResult();
       
 10944 	}
       
 10945 
       
 10946 TPtrC CCTSYIntegrationTestPacketContext0044::GetTestStepName()
       
 10947 /**
       
 10948  * @return The test step name.
       
 10949  */
       
 10950 	{
       
 10951 	return _L("CCTSYIntegrationTestPacketContext0044");
       
 10952 	}
       
 10953 
       
 10954 
       
 10955 
       
 10956 CCTSYIntegrationTestPacketContext0045::CCTSYIntegrationTestPacketContext0045(CEtelSessionMgr& aEtelSessionMgr)
       
 10957 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
 10958 /**
       
 10959  * Constructor.
       
 10960  */
       
 10961 	{
       
 10962 	SetTestStepName(CCTSYIntegrationTestPacketContext0045::GetTestStepName());
       
 10963 	}
       
 10964 
       
 10965 CCTSYIntegrationTestPacketContext0045::~CCTSYIntegrationTestPacketContext0045()
       
 10966 /**
       
 10967  * Destructor.
       
 10968  */
       
 10969 	{
       
 10970 	}
       
 10971 
       
 10972 TVerdict CCTSYIntegrationTestPacketContext0045::doTestStepL()
       
 10973 /**
       
 10974  * @SYMTestCaseID BA-CTSY-INT-PKTC-0045
       
 10975  * @SYMFssID BA/CTSY/PKTC-0045
       
 10976  * @SYMTestCaseDesc Add packet filter with same ID as previous packet filter.
       
 10977  * @SYMTestPriority High
       
 10978  * @SYMTestActions RPacketContext::SetConfig, RPacketContext::NotifyStatusChange, RPacketContext::GetStatus, RPacketContext::Activate, RPacketContext::AddPacketFilter, RPacketContext::EnumeratePacketFilters, RPacketContext::GetPacketFilterInfo, RPacketContext::ModifyActiveContext
       
 10979  * @SYMTestExpectedResults Pass - Old filter replaced.
       
 10980  * @SYMTestType CIT
       
 10981  * @SYMTestCaseDependencies live/automatic
       
 10982  *
       
 10983  * Reason for test: Verify existing packet filter is replaced.
       
 10984  *
       
 10985  * @return - TVerdict code
       
 10986  */
       
 10987 	{
       
 10988 
       
 10989 	////////////////////////////////////////////////////////////////
       
 10990 	// SET UP
       
 10991 	////////////////////////////////////////////////////////////////
       
 10992 
       
 10993 	
       
 10994 	// Ensure there is an active primary context. 
       
 10995 
       
 10996 
       
 10997 	////////////////////////////////////////////////////////////////
       
 10998 	// SET UP END
       
 10999 	////////////////////////////////////////////////////////////////
       
 11000 	
       
 11001 	StartTest();
       
 11002 	
       
 11003 	////////////////////////////////////////////////////////////////
       
 11004 	// TEST START
       
 11005 	////////////////////////////////////////////////////////////////
       
 11006 	
       
 11007 	
       
 11008 	// Open a new primary context. 
       
 11009 
       
 11010 	// Add a TPacketFilterV2 packet filter with iId = 1 to the context using RPacketContext::AddPacketFilter 
       
 11011 
       
 11012 	// Add a TPacketFilterV2 packet filter with iId = 1 but with different values for the other field to the context using RPacketContext::AddPacketFilter 
       
 11013 
       
 11014 	// Set a valid config for the primary context. 
       
 11015 
       
 11016 	// Activate the context. 
       
 11017 
       
 11018 	// Check RPacketContext::NotifyStatusChange completes with EStatusActivating -> EStatusActive
       
 11019 
       
 11020 	// Check RPacketContext::GetStatus returns EStatusActive
       
 11021 
       
 11022 	// Check RPacketContext::EnumeratePacketFilters returns aCount = 1
       
 11023 
       
 11024 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 0 returns packet filter with details equal to those used in second call to RPacketContext::AddPacketFilter
       
 11025 
       
 11026 	// Add a TPacketFilterV2 packet filter with iId = 1 but with different values for the other field to the context using RPacketContext::AddPacketFilter 
       
 11027 
       
 11028 	// Modify the context 
       
 11029 
       
 11030 	// Check RPacketContext::EnumeratePacketFilters returns aCount = 1
       
 11031 
       
 11032 	// Check RPacketContext::GetPacketFilterInfo with aIndex = 0 returns packet filter with details equal to those used in third call to RPacketContext::AddPacketFilter
       
 11033 
       
 11034 	
       
 11035 	////////////////////////////////////////////////////////////////
       
 11036 	// TEST END
       
 11037 	////////////////////////////////////////////////////////////////
       
 11038 
       
 11039     StartCleanup();
       
 11040 	
       
 11041 	// Put any required test clean up here, then remove this comment
       
 11042 	
       
 11043 	return TestStepResult();
       
 11044 	}
       
 11045 
       
 11046 TPtrC CCTSYIntegrationTestPacketContext0045::GetTestStepName()
       
 11047 /**
       
 11048  * @return The test step name.
       
 11049  */
       
 11050 	{
       
 11051 	return _L("CCTSYIntegrationTestPacketContext0045");
       
 11052 	}
       
 11053 
       
 11054 
       
 11055 
       
 11056 CCTSYIntegrationTestPacketContext0046::CCTSYIntegrationTestPacketContext0046(CEtelSessionMgr& aEtelSessionMgr)
       
 11057 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
 11058 /**
       
 11059  * Constructor.
       
 11060  */
       
 11061 	{
       
 11062 	SetTestStepName(CCTSYIntegrationTestPacketContext0046::GetTestStepName());
       
 11063 	}
       
 11064 
       
 11065 CCTSYIntegrationTestPacketContext0046::~CCTSYIntegrationTestPacketContext0046()
       
 11066 /**
       
 11067  * Destructor.
       
 11068  */
       
 11069 	{
       
 11070 	}
       
 11071 
       
 11072 TVerdict CCTSYIntegrationTestPacketContext0046::doTestStepL()
       
 11073 /**
       
 11074  * @SYMTestCaseID BA-CTSY-INT-PKTC-0046
       
 11075  * @SYMFssID BA/CTSY/PKTC-0046
       
 11076  * @SYMTestCaseDesc Remove packet filter specifying invalid ID.
       
 11077  * @SYMTestPriority High
       
 11078  * @SYMTestActions RPacketContext::RemovePacketFilter
       
 11079  * @SYMTestExpectedResults Pass - Error returned.
       
 11080  * @SYMTestType CIT
       
 11081  * @SYMTestCaseDependencies live/automatic
       
 11082  *
       
 11083  * Reason for test: Verify error is returned.
       
 11084  *
       
 11085  * @return - TVerdict code
       
 11086  */
       
 11087 	{
       
 11088 
       
 11089 	////////////////////////////////////////////////////////////////
       
 11090 	// SET UP
       
 11091 	////////////////////////////////////////////////////////////////
       
 11092 
       
 11093 	
       
 11094 	// Ensure there is an active primary context. 
       
 11095 
       
 11096 
       
 11097 	////////////////////////////////////////////////////////////////
       
 11098 	// SET UP END
       
 11099 	////////////////////////////////////////////////////////////////
       
 11100 	
       
 11101 	StartTest();
       
 11102 	
       
 11103 	////////////////////////////////////////////////////////////////
       
 11104 	// TEST START
       
 11105 	////////////////////////////////////////////////////////////////
       
 11106 	
       
 11107 	
       
 11108 	// Add a TPacketFilterV2 packet filter with iId = 1 to the context using RPacketContext::AddPacketFilter 
       
 11109 
       
 11110 	// Modify the context. 
       
 11111 
       
 11112 	// Remove a packet filter with RPacketContext::RemovePacketFilter and aId = 2 
       
 11113 
       
 11114 	// Check KErrArgument is returned
       
 11115 
       
 11116 	// Remove a packet filter with RPacketContext::RemovePacketFilter and aId = -1 
       
 11117 
       
 11118 	// Check KErrArgument is returned
       
 11119 
       
 11120 	
       
 11121 	////////////////////////////////////////////////////////////////
       
 11122 	// TEST END
       
 11123 	////////////////////////////////////////////////////////////////
       
 11124 
       
 11125     StartCleanup();
       
 11126 	
       
 11127 	// Put any required test clean up here, then remove this comment
       
 11128 	
       
 11129 	return TestStepResult();
       
 11130 	}
       
 11131 
       
 11132 TPtrC CCTSYIntegrationTestPacketContext0046::GetTestStepName()
       
 11133 /**
       
 11134  * @return The test step name.
       
 11135  */
       
 11136 	{
       
 11137 	return _L("CCTSYIntegrationTestPacketContext0046");
       
 11138 	}
       
 11139 
       
 11140 
       
 11141 
       
 11142 CCTSYIntegrationTestPacketContext0047::CCTSYIntegrationTestPacketContext0047(CEtelSessionMgr& aEtelSessionMgr)
       
 11143 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
 11144 /**
       
 11145  * Constructor.
       
 11146  */
       
 11147 	{
       
 11148 	SetTestStepName(CCTSYIntegrationTestPacketContext0047::GetTestStepName());
       
 11149 	}
       
 11150 
       
 11151 CCTSYIntegrationTestPacketContext0047::~CCTSYIntegrationTestPacketContext0047()
       
 11152 /**
       
 11153  * Destructor.
       
 11154  */
       
 11155 	{
       
 11156 	}
       
 11157 
       
 11158 TVerdict CCTSYIntegrationTestPacketContext0047::doTestStepL()
       
 11159 /**
       
 11160  * @SYMTestCaseID BA-CTSY-INT-PKTC-0047
       
 11161  * @SYMFssID BA/CTSY/PKTC-0047
       
 11162  * @SYMTestCaseDesc Activate a primary context with media auth tokens added but no QoS or packet filters.
       
 11163  * @SYMTestPriority High
       
 11164  * @SYMTestActions RPacketService::NotifyStatusChange, RPacketService::GetStatus, RPacketContext::AddMediaAuthorizationL, RPacketContext::GetStatus, RPacketContext::SetConfig
       
 11165  * @SYMTestExpectedResults Pass - Context activated.
       
 11166  * @SYMTestType CIT
       
 11167  * @SYMTestCaseDependencies live/automatic
       
 11168  *
       
 11169  * Reason for test: Verify context is activated.
       
 11170  *
       
 11171  * @return - TVerdict code
       
 11172  */
       
 11173 	{
       
 11174 
       
 11175 	////////////////////////////////////////////////////////////////
       
 11176 	// SET UP
       
 11177 	////////////////////////////////////////////////////////////////
       
 11178 
       
 11179 	
       
 11180 	// Ensure phone is attached to the packet service. 
       
 11181 
       
 11182 
       
 11183 	////////////////////////////////////////////////////////////////
       
 11184 	// SET UP END
       
 11185 	////////////////////////////////////////////////////////////////
       
 11186 	
       
 11187 	StartTest();
       
 11188 	
       
 11189 	////////////////////////////////////////////////////////////////
       
 11190 	// TEST START
       
 11191 	////////////////////////////////////////////////////////////////
       
 11192 	
       
 11193 	
       
 11194 	// Open a primary context 
       
 11195 
       
 11196 	// Add a media auth token using RPacketContext::AddMediaAuthorizationL 
       
 11197 
       
 11198 	// Set a valid context config using RPacketContext::SetConfig 
       
 11199 
       
 11200 	// Activate the context. 
       
 11201 
       
 11202 	// Check RPacketService::NotifyStatusChange completes with EStatusActive
       
 11203 
       
 11204 	// Check RPacketService::GetStatus returns EStatusActive
       
 11205 
       
 11206 	// Check RPacketContext::NotifyStatusChange completes with EStatusActivating -> EStatusActive
       
 11207 
       
 11208 	// Check RPacketContext::GetStatus returns EStatusActive
       
 11209 
       
 11210 	
       
 11211 	////////////////////////////////////////////////////////////////
       
 11212 	// TEST END
       
 11213 	////////////////////////////////////////////////////////////////
       
 11214 
       
 11215     StartCleanup();
       
 11216 	
       
 11217 	// Put any required test clean up here, then remove this comment
       
 11218 	
       
 11219 	return TestStepResult();
       
 11220 	}
       
 11221 
       
 11222 TPtrC CCTSYIntegrationTestPacketContext0047::GetTestStepName()
       
 11223 /**
       
 11224  * @return The test step name.
       
 11225  */
       
 11226 	{
       
 11227 	return _L("CCTSYIntegrationTestPacketContext0047");
       
 11228 	}
       
 11229 
       
 11230 
       
 11231 
       
 11232 CCTSYIntegrationTestPacketContext0048::CCTSYIntegrationTestPacketContext0048(CEtelSessionMgr& aEtelSessionMgr)
       
 11233 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
 11234 /**
       
 11235  * Constructor.
       
 11236  */
       
 11237 	{
       
 11238 	SetTestStepName(CCTSYIntegrationTestPacketContext0048::GetTestStepName());
       
 11239 	}
       
 11240 
       
 11241 CCTSYIntegrationTestPacketContext0048::~CCTSYIntegrationTestPacketContext0048()
       
 11242 /**
       
 11243  * Destructor.
       
 11244  */
       
 11245 	{
       
 11246 	}
       
 11247 
       
 11248 TVerdict CCTSYIntegrationTestPacketContext0048::doTestStepL()
       
 11249 /**
       
 11250  * @SYMTestCaseID BA-CTSY-INT-PKTC-0048
       
 11251  * @SYMFssID BA/CTSY/PKTC-0048
       
 11252  * @SYMTestCaseDesc Modify a primary context with media auth tokens added but no QoS or packet filters.
       
 11253  * @SYMTestPriority High
       
 11254  * @SYMTestActions RPacketContext::NotifyStatusChange, RPacketService::GetStatus, RPacketContext::AddMediaAuthorizationL, RPacketContext::GetStatus, RPacketContext::SetConfig
       
 11255  * @SYMTestExpectedResults Pass - Context modified.
       
 11256  * @SYMTestType CIT
       
 11257  * @SYMTestCaseDependencies live/automatic
       
 11258  *
       
 11259  * Reason for test: Verify context is modified.
       
 11260  *
       
 11261  * @return - TVerdict code
       
 11262  */
       
 11263 	{
       
 11264 
       
 11265 	////////////////////////////////////////////////////////////////
       
 11266 	// SET UP
       
 11267 	////////////////////////////////////////////////////////////////
       
 11268 
       
 11269 	
       
 11270 	// Ensure phone is attached to the packet service. 
       
 11271 
       
 11272 
       
 11273 	////////////////////////////////////////////////////////////////
       
 11274 	// SET UP END
       
 11275 	////////////////////////////////////////////////////////////////
       
 11276 	
       
 11277 	StartTest();
       
 11278 	
       
 11279 	////////////////////////////////////////////////////////////////
       
 11280 	// TEST START
       
 11281 	////////////////////////////////////////////////////////////////
       
 11282 	
       
 11283 	
       
 11284 	// Open a primary context 
       
 11285 
       
 11286 	// Add a media auth token using RPacketContext::AddMediaAuthorizationL 
       
 11287 
       
 11288 	// Set a valid context config using RPacketContext::SetConfig 
       
 11289 
       
 11290 	// Activate the context. 
       
 11291 
       
 11292 	// Check RPacketContext::NotifyStatusChange completes with EStatusActivating -> EStatusActive
       
 11293 
       
 11294 	// Check RPacketContext::GetStatus returns EStatusActive
       
 11295 
       
 11296 	// Remove media auth token using RPacketContext::RemoveMediaAuthorization and aAuthorizationToken = identifier used in RPacketContext::AddMediaAuthorizationL 
       
 11297 
       
 11298 	// Check RPacketContext::GetStatus returns EStatusActive
       
 11299 
       
 11300 	// Check RPacketService::GetStatus returns EStatusActive
       
 11301 
       
 11302 	
       
 11303 	////////////////////////////////////////////////////////////////
       
 11304 	// TEST END
       
 11305 	////////////////////////////////////////////////////////////////
       
 11306 
       
 11307     StartCleanup();
       
 11308 	
       
 11309 	// Put any required test clean up here, then remove this comment
       
 11310 	
       
 11311 	return TestStepResult();
       
 11312 	}
       
 11313 
       
 11314 TPtrC CCTSYIntegrationTestPacketContext0048::GetTestStepName()
       
 11315 /**
       
 11316  * @return The test step name.
       
 11317  */
       
 11318 	{
       
 11319 	return _L("CCTSYIntegrationTestPacketContext0048");
       
 11320 	}
       
 11321 
       
 11322 
       
 11323 
       
 11324 CCTSYIntegrationTestPacketContext0049::CCTSYIntegrationTestPacketContext0049(CEtelSessionMgr& aEtelSessionMgr)
       
 11325 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
 11326 /**
       
 11327  * Constructor.
       
 11328  */
       
 11329 	{
       
 11330 	SetTestStepName(CCTSYIntegrationTestPacketContext0049::GetTestStepName());
       
 11331 	}
       
 11332 
       
 11333 CCTSYIntegrationTestPacketContext0049::~CCTSYIntegrationTestPacketContext0049()
       
 11334 /**
       
 11335  * Destructor.
       
 11336  */
       
 11337 	{
       
 11338 	}
       
 11339 
       
 11340 TVerdict CCTSYIntegrationTestPacketContext0049::doTestStepL()
       
 11341 /**
       
 11342  * @SYMTestCaseID BA-CTSY-INT-PKTC-0049
       
 11343  * @SYMFssID BA/CTSY/PKTC-0049
       
 11344  * @SYMTestCaseDesc Activate a secondary context with media auth tokens added but no QoS or packet filters.
       
 11345  * @SYMTestPriority High
       
 11346  * @SYMTestActions RPacketContext::OpenNewSecondaryContext, RPacketContext::SetConfig, RPacketContext::NotifyStatusChange, RPacketContext::GetStatus, RPacketService::NotifyStatusChange, RPacketService::GetStatus, RPacketContext::Activate, RPacketContext::AddMediaAuthorizationL, RPacketContext::RemoveMediaAuthorization
       
 11347  * @SYMTestExpectedResults Pass - Context activated.
       
 11348  * @SYMTestType CIT
       
 11349  * @SYMTestCaseDependencies simulated/automatic
       
 11350  *
       
 11351  * Reason for test: Verify context is activated.
       
 11352  *
       
 11353  * @return - TVerdict code
       
 11354  */
       
 11355 	{
       
 11356 
       
 11357 	////////////////////////////////////////////////////////////////
       
 11358 	// SET UP
       
 11359 	////////////////////////////////////////////////////////////////
       
 11360 
       
 11361 	
       
 11362 	// Ensure there is a primary context active which has been activated with QoS and has a packet filter added to it.
       
 11363 	// Call TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL		
       
 11364     RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
 11365 	CHECK_EQUALS_L(iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(phone), KErrNone, _L("TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL returned with an error"));
       
 11366  	iNetworkTestHelper.CheckPhoneConnectedToAniteL(phone);
       
 11367 
       
 11368     // Get packet service
       
 11369 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, KMainPhone, KMainPacketService);
       
 11370 
       
 11371     // Ensure phone is attached to the packet service
       
 11372     SetAttachModeToWhenPossibleAndWaitForAttachL(packetService); 
       
 11373 
       
 11374 	// Open a new primary context. 
       
 11375 	RPacketContext& primaryContext = iEtelSessionMgr.GetPrimaryPacketContextL(
       
 11376 											KMainServer,
       
 11377 											KMainPhone,
       
 11378 											KMainPacketService,
       
 11379 											KPrimaryPacketContext1);
       
 11380 	// Open a new QoS for primary context
       
 11381 	RPacketQoS& contextQoS = iEtelSessionMgr.GetPrimaryPacketContextQoSL(
       
 11382 											KMainServer,
       
 11383 											KMainPhone,
       
 11384 											KMainPacketService,
       
 11385 											KPrimaryPacketContext1);	
       
 11386 
       
 11387 	// $CTSYProblem Can't add filters to primary context 
       
 11388 	//CHECK_EQUALS_L(AddPacketFilterV2ToContextL(primaryContext, 1), KErrNone, _L("RPacketContext::AddPacketFilter returned with error")); 																												
       
 11389 	iPacketServiceTestHelper.ActivatePrimaryPacketContextL(phone, primaryContext);
       
 11390 
       
 11391 	////////////////////////////////////////////////////////////////
       
 11392 	// SET UP END
       
 11393 	////////////////////////////////////////////////////////////////
       
 11394 	
       
 11395 	StartTest();
       
 11396 	
       
 11397 	////////////////////////////////////////////////////////////////
       
 11398 	// TEST START
       
 11399 	////////////////////////////////////////////////////////////////
       
 11400 		
       
 11401 	// Open a new secondary context from the primary.
       
 11402  	RPacketContext& secondaryContext = iEtelSessionMgr.GetSecondaryPacketContextL(
       
 11403 														KMainServer,
       
 11404 														KMainPhone,
       
 11405 														KMainPacketService, 
       
 11406 														KPrimaryPacketContext1,
       
 11407 														KSecondaryPacketContext1); 
       
 11408 
       
 11409 	// Add a media auth token using RPacketContext::AddMediaAuthorizationL 
       
 11410 	RPacketContext::CTFTMediaAuthorizationV3* mediaAuth = RPacketContext::CTFTMediaAuthorizationV3::NewL();
       
 11411 	CleanupStack::PushL(mediaAuth);  		
       
 11412 	TExtEtelRequestStatus requestAddMediaAuthStatus(secondaryContext, EPacketAddMediaAuthorization);
       
 11413 	CleanupStack::PushL(requestAddMediaAuthStatus);
       
 11414 	// $CTSYProblem This test cannot be run since LTSY crash when the CTSY send the EPacketAddMediaAuthorization message to him 
       
 11415     CHECK_TRUE_L(EFalse,_L("$CTSYProblem This test cannot be run since LTSY crash when the CTSY send the EPacketAddMediaAuthorization message to him"));
       
 11416 	secondaryContext.AddMediaAuthorizationL(requestAddMediaAuthStatus, *mediaAuth);	
       
 11417 	ASSERT_EQUALS(WaitForRequestWithTimeOut(requestAddMediaAuthStatus, ETimeMedium), KErrNone, _L("RPacketContext::AddMediaAuthorizationL timed out"));
       
 11418     ASSERT_EQUALS(requestAddMediaAuthStatus.Int(), KErrNone, _L("RPacketContext::AddMediaAuthorizationL returned an error"));
       
 11419 	
       
 11420 	// Post notifier for RPacketContext::NotifyStatusChange
       
 11421 	TExtEtelRequestStatus notifyContextStChStatus(secondaryContext, EPacketContextNotifyStatusChange);
       
 11422 	CleanupStack::PushL(notifyContextStChStatus);
       
 11423 	RPacketContext::TContextStatus packetContextStatus;
       
 11424 	secondaryContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);
       
 11425 	
       
 11426 	// Activate packet context with RPacketContext::Activate 
       
 11427 	TExtEtelRequestStatus contextActivateStatus(secondaryContext, EPacketContextActivate);
       
 11428 	CleanupStack::PushL(contextActivateStatus);
       
 11429 	secondaryContext.Activate(contextActivateStatus);
       
 11430 	ASSERT_EQUALS(WaitForRequestWithTimeOut(contextActivateStatus, ETimeLong), KErrNone, _L("RPacketContext::Activate timed out."));
       
 11431 	ASSERT_EQUALS(contextActivateStatus.Int(), KErrNone, _L("RPacketContext::Activate returned with error status."));
       
 11432 	
       
 11433 	// Check RPacketContext::NotifyStatusChange completes with EStatusActivating -> EStatusActive
       
 11434 	RPacketContext::TContextStatus expectedPacketContextStatus = RPacketContext::EStatusActivating;
       
 11435 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
 11436 				secondaryContext,
       
 11437 				notifyContextStChStatus,
       
 11438 				packetContextStatus, 
       
 11439 				expectedPacketContextStatus,
       
 11440 				KErrNone);
       
 11441 				
       
 11442 	secondaryContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);	
       
 11443 	expectedPacketContextStatus = RPacketContext::EStatusActive;	
       
 11444 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
 11445 				secondaryContext,
       
 11446 				notifyContextStChStatus,
       
 11447 				packetContextStatus, 
       
 11448 				expectedPacketContextStatus,
       
 11449 				KErrNone);
       
 11450 				
       
 11451 	// Check RPacketContext::GetStatus returns EStatusActive
       
 11452 	RPacketContext::TContextStatus getPacketContextStatus;
       
 11453 	ASSERT_EQUALS(secondaryContext.GetStatus(getPacketContextStatus), KErrNone, _L("RPacketContext::GetStatus for Secondary context returned with an error."));
       
 11454 	ASSERT_EQUALS(getPacketContextStatus, RPacketContext::EStatusActive, _L("RPacketContext::GetStatus returns incorrect status."));
       
 11455 
       
 11456 	////////////////////////////////////////////////////////////////
       
 11457 	// TEST END
       
 11458 	////////////////////////////////////////////////////////////////
       
 11459 
       
 11460     StartCleanup();
       
 11461 	
       
 11462 	// Pop
       
 11463 	// mediaAuth
       
 11464 	// requestAddMediaAuthStatus
       
 11465 	// notifyContextStChStatus
       
 11466 	// contextActivateStatus
       
 11467 	CleanupStack::PopAndDestroy(4, mediaAuth);
       
 11468 	
       
 11469 	return TestStepResult();
       
 11470 	}
       
 11471 
       
 11472 TPtrC CCTSYIntegrationTestPacketContext0049::GetTestStepName()
       
 11473 /**
       
 11474  * @return The test step name.
       
 11475  */
       
 11476 	{
       
 11477 	return _L("CCTSYIntegrationTestPacketContext0049");
       
 11478 	}
       
 11479 
       
 11480 
       
 11481 
       
 11482 CCTSYIntegrationTestPacketContext0050::CCTSYIntegrationTestPacketContext0050(CEtelSessionMgr& aEtelSessionMgr)
       
 11483 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
 11484 /**
       
 11485  * Constructor.
       
 11486  */
       
 11487 	{
       
 11488 	SetTestStepName(CCTSYIntegrationTestPacketContext0050::GetTestStepName());
       
 11489 	}
       
 11490 
       
 11491 CCTSYIntegrationTestPacketContext0050::~CCTSYIntegrationTestPacketContext0050()
       
 11492 /**
       
 11493  * Destructor.
       
 11494  */
       
 11495 	{
       
 11496 	}
       
 11497 
       
 11498 TVerdict CCTSYIntegrationTestPacketContext0050::doTestStepL()
       
 11499 /**
       
 11500  * @SYMTestCaseID BA-CTSY-INT-PKTC-0050
       
 11501  * @SYMFssID BA/CTSY/PKTC-0050
       
 11502  * @SYMTestCaseDesc Modify a secondary context with media auth tokens added but no QoS or packet filters.
       
 11503  * @SYMTestPriority High
       
 11504  * @SYMTestActions RPacketContext::OpenNewSecondaryContext, RPacketContext::SetConfig, RPacketContext::NotifyStatusChange, RPacketContext::GetStatus, RPacketService::NotifyStatusChange, RPacketService::GetStatus, RPacketContext::Activate, RPacketContext::AddMediaAuthorizationL, RPacketContext::RemoveMediaAuthorization, RPacketContext::ModifyActiveContext
       
 11505  * @SYMTestExpectedResults Pass - Context modified.
       
 11506  * @SYMTestType CIT
       
 11507  * @SYMTestCaseDependencies simulated/automatic
       
 11508  *
       
 11509  * Reason for test: Verify context is modified.
       
 11510  *
       
 11511  * @return - TVerdict code
       
 11512  */
       
 11513 	{
       
 11514 
       
 11515 	////////////////////////////////////////////////////////////////
       
 11516 	// SET UP
       
 11517 	////////////////////////////////////////////////////////////////
       
 11518 
       
 11519 	// Ensure there is a primary context active which has been activated with QoS and has a packet filter added to it. 
       
 11520 	RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
 11521 	CHECK_EQUALS_L(iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(phone), KErrNone, _L("TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL returned with an error"));
       
 11522 	
       
 11523 	//Check if we are on a simulated network
       
 11524  	iNetworkTestHelper.CheckPhoneConnectedToAniteL(phone);
       
 11525 	
       
 11526 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, KMainPhone, KMainPacketService);
       
 11527     SetAttachModeToWhenPossibleAndWaitForAttachL(packetService);
       
 11528 	
       
 11529 	RPacketContext& primaryContext = iEtelSessionMgr.GetPrimaryPacketContextL(
       
 11530 											KMainServer,
       
 11531 											KMainPhone,
       
 11532 											KMainPacketService,
       
 11533 											KPrimaryPacketContext1);
       
 11534 
       
 11535 	RPacketQoS& primaryQoS = iEtelSessionMgr.GetPrimaryPacketContextQoSL(
       
 11536 											KMainServer,
       
 11537 											KMainPhone,
       
 11538 											KMainPacketService,
       
 11539 											KPrimaryPacketContext1);							
       
 11540 											
       
 11541 	iPacketServiceTestHelper.ActivatePrimaryPacketContextL(phone, primaryContext);
       
 11542 
       
 11543 	////////////////////////////////////////////////////////////////
       
 11544 	// SET UP END
       
 11545 	////////////////////////////////////////////////////////////////
       
 11546 	
       
 11547 	StartTest();
       
 11548 	
       
 11549 	////////////////////////////////////////////////////////////////
       
 11550 	// TEST START
       
 11551 	////////////////////////////////////////////////////////////////
       
 11552 	
       
 11553 	// Open a new secondary context from the primary. 
       
 11554 	RPacketContext& secondaryContext = iEtelSessionMgr.GetSecondaryPacketContextL(
       
 11555 														KMainServer,
       
 11556 														KMainPhone,
       
 11557 														KMainPacketService, 
       
 11558 														KPrimaryPacketContext1,
       
 11559 														KSecondaryPacketContext1); 
       
 11560 
       
 11561 	// Add a media auth token using RPacketContext::AddMediaAuthorizationL 
       
 11562 	RPacketContext::CTFTMediaAuthorizationV3* mediaAuth = RPacketContext::CTFTMediaAuthorizationV3::NewL();
       
 11563 	CleanupStack::PushL(mediaAuth);  
       
 11564 	TExtEtelRequestStatus requestAddMediaAuthStatus(secondaryContext, EPacketAddMediaAuthorization);
       
 11565 	CleanupStack::PushL(requestAddMediaAuthStatus);
       
 11566 	// $CTSYProblem This test cannot be run since LTSY crash when the CTSY send the EPacketAddMediaAuthorization message to him 
       
 11567     CHECK_TRUE_L(EFalse,_L("$CTSYProblem This test cannot be run since LTSY crash when the CTSY send the EPacketAddMediaAuthorization message to him"));
       
 11568 	secondaryContext.AddMediaAuthorizationL(requestAddMediaAuthStatus, *mediaAuth);
       
 11569 	ASSERT_EQUALS(WaitForRequestWithTimeOut(requestAddMediaAuthStatus, ETimeMedium), KErrNone, _L("RPacketContext::AddMediaAuthorizationL timed out"));
       
 11570     ASSERT_EQUALS(requestAddMediaAuthStatus.Int(), KErrNone, _L("RPacketContext::AddMediaAuthorizationL returned an error"));	
       
 11571 
       
 11572 	// Post notifier for RPacketContext::NotifyStatusChange
       
 11573 	TExtEtelRequestStatus notifyContextStChStatus(secondaryContext, EPacketContextNotifyStatusChange);
       
 11574 	CleanupStack::PushL(notifyContextStChStatus);
       
 11575 	RPacketContext::TContextStatus packetContextStatus;
       
 11576 	secondaryContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);
       
 11577 	
       
 11578 	// Activate the context.
       
 11579 	TExtEtelRequestStatus contextActivateStatus(secondaryContext, EPacketContextActivate);
       
 11580 	CleanupStack::PushL(contextActivateStatus);
       
 11581 	secondaryContext.Activate(contextActivateStatus);
       
 11582 	ASSERT_EQUALS(WaitForRequestWithTimeOut(contextActivateStatus, ETimeLong), KErrNone, _L("RPacketContext::Activate timed out."));
       
 11583 	ASSERT_EQUALS(contextActivateStatus.Int(), KErrNone, _L("RPacketContext::Activate returned with error status."));
       
 11584 
       
 11585 	// Check RPacketContext::NotifyStatusChange completes with EStatusActivating -> EStatusActive
       
 11586 	RPacketContext::TContextStatus expectedPacketContextStatus = RPacketContext::EStatusActivating;   
       
 11587 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
 11588 				secondaryContext,
       
 11589 				notifyContextStChStatus,
       
 11590 				packetContextStatus, 
       
 11591 				expectedPacketContextStatus,
       
 11592 				KErrNone);
       
 11593 				
       
 11594 	secondaryContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);
       
 11595 	expectedPacketContextStatus = RPacketContext::EStatusActive;	
       
 11596 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
 11597 				secondaryContext,
       
 11598 				notifyContextStChStatus,
       
 11599 				packetContextStatus, 
       
 11600 				expectedPacketContextStatus,
       
 11601 				KErrNone);
       
 11602 
       
 11603 	// Check RPacketContext::GetStatus returns EStatusActive
       
 11604 	RPacketContext::TContextStatus getPacketContextStatus;
       
 11605 	ASSERT_EQUALS(secondaryContext.GetStatus(getPacketContextStatus), KErrNone, _L("RPacketContext::GetStatus for secondary context returned with an error."));
       
 11606 	ASSERT_EQUALS(getPacketContextStatus, RPacketContext::EStatusActive, _L("RPacketContext::GetStatus returns incorrect status."));
       
 11607 
       
 11608 	// Remove media auth token using RPacketContext::RemoveMediaAuthorization and aAuthorizationToken = identifier used in RPacketContext::AddMediaAuthorizationL 
       
 11609 	TExtEtelRequestStatus requestRemoveMediaAuthStatus(secondaryContext, EPacketRemoveMediaAuthorization);
       
 11610 	CleanupStack::PushL(requestRemoveMediaAuthStatus);
       
 11611 	secondaryContext.RemoveMediaAuthorization(requestRemoveMediaAuthStatus, mediaAuth->iAuthorizationToken); 
       
 11612 	ASSERT_EQUALS(WaitForRequestWithTimeOut(requestRemoveMediaAuthStatus, ETimeMedium), KErrNone, _L("RPacketContext::RemoveMediaAuthorization timed out"));
       
 11613     ASSERT_EQUALS(requestRemoveMediaAuthStatus.Int(), KErrNone, _L("RPacketContext::RemoveMediaAuthorization returned an error"));
       
 11614 
       
 11615 	// Check RPacketContext::GetStatus returns EStatusActive
       
 11616 	ASSERT_EQUALS(secondaryContext.GetStatus(getPacketContextStatus), KErrNone, _L("RPacketContext::GetStatus for secondary context returned with an error."));
       
 11617 	ASSERT_EQUALS(getPacketContextStatus, RPacketContext::EStatusActive, _L("RPacketContext::GetStatus returns incorrect status."));
       
 11618 
       
 11619 	// Check RPacketService::GetStatus returns EStatusActive
       
 11620 	RPacketService::TStatus packetServiceStatus;
       
 11621 	ASSERT_EQUALS(packetService.GetStatus(packetServiceStatus), KErrNone, _L("RPacketService::GetStatus returned with an error."));
       
 11622 	ASSERT_EQUALS(packetServiceStatus, RPacketService::EStatusActive, _L("RPacketService::GetStatus returns incorrect status."));
       
 11623 	
       
 11624 	////////////////////////////////////////////////////////////////
       
 11625 	// TEST END
       
 11626 	////////////////////////////////////////////////////////////////
       
 11627 
       
 11628     StartCleanup();
       
 11629 	
       
 11630 	// Pop:
       
 11631 	// mediaAuth
       
 11632 	// requestAddMediaAuthStatus
       
 11633 	// notifyContextStChStatus
       
 11634 	// contextActivateStatus
       
 11635 	// requestRemoveMediaAuthStatus
       
 11636 	CleanupStack::PopAndDestroy(5, &mediaAuth);
       
 11637 	
       
 11638 	return TestStepResult();
       
 11639 	}
       
 11640 
       
 11641 TPtrC CCTSYIntegrationTestPacketContext0050::GetTestStepName()
       
 11642 /**
       
 11643  * @return The test step name.
       
 11644  */
       
 11645 	{
       
 11646 	return _L("CCTSYIntegrationTestPacketContext0050");
       
 11647 	}
       
 11648 
       
 11649 
       
 11650 
       
 11651 CCTSYIntegrationTestPacketContext0051::CCTSYIntegrationTestPacketContext0051(CEtelSessionMgr& aEtelSessionMgr)
       
 11652 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
 11653 /**
       
 11654  * Constructor.
       
 11655  */
       
 11656 	{
       
 11657 	SetTestStepName(CCTSYIntegrationTestPacketContext0051::GetTestStepName());
       
 11658 	}
       
 11659 
       
 11660 CCTSYIntegrationTestPacketContext0051::~CCTSYIntegrationTestPacketContext0051()
       
 11661 /**
       
 11662  * Destructor.
       
 11663  */
       
 11664 	{
       
 11665 	}
       
 11666 
       
 11667 TVerdict CCTSYIntegrationTestPacketContext0051::doTestStepL()
       
 11668 /**
       
 11669  * @SYMTestCaseID BA-CTSY-INT-PKTC-0051
       
 11670  * @SYMFssID BA/CTSY/PKTC-0051
       
 11671  * @SYMTestCaseDesc Activate a primary context with QoS, packet filters and media auth tokens.
       
 11672  * @SYMTestPriority High
       
 11673  * @SYMTestActions RPacketContext::GetStatus, RPacketContext::AddPacketFilter, RPacketContext::NotifyStatusChange, RPacketService::NotifyStatusChange, RPacketService::GetStatus, RPacketContext::AddMediaAuthorizationL, RPacketContext::SetConfig, RPacketQoS::OpenNewQoS, RPacketQoS::GetProfileCapabilities, RPacketQoS::SetProfileParameters
       
 11674  * @SYMTestExpectedResults Pass - Context activated.
       
 11675  * @SYMTestType CIT
       
 11676  * @SYMTestCaseDependencies live/automatic
       
 11677  *
       
 11678  * Reason for test: Verify context is activated.
       
 11679  *
       
 11680  * @return - TVerdict code
       
 11681  */
       
 11682 	{
       
 11683 
       
 11684 	////////////////////////////////////////////////////////////////
       
 11685 	// SET UP
       
 11686 	////////////////////////////////////////////////////////////////
       
 11687 
       
 11688 	
       
 11689 	// Ensure phone is attached to the packet service. 
       
 11690 
       
 11691 
       
 11692 	////////////////////////////////////////////////////////////////
       
 11693 	// SET UP END
       
 11694 	////////////////////////////////////////////////////////////////
       
 11695 	
       
 11696 	StartTest();
       
 11697 	
       
 11698 	////////////////////////////////////////////////////////////////
       
 11699 	// TEST START
       
 11700 	////////////////////////////////////////////////////////////////
       
 11701 	
       
 11702 	
       
 11703 	// ===  Add packet filter ===
       
 11704 
       
 11705 	// Add a TPacketFilterV2 packet filter to the secondary context using RPacketContext::AddPacketFilter 
       
 11706 
       
 11707 	// ===  Add QoS ===
       
 11708 
       
 11709 	// Open a new QoS from the secondary context  
       
 11710 
       
 11711 	// Get GPRS QoS profile capabilities with RPacketQoS::GetProfileCapabilities 
       
 11712 
       
 11713 	// Set requested profile parameters with RPacketQoS::SetProfileParameters and TQoSGPRSRequested with parameters within range returned by RPacketQoS::GetProfileCapabilities 
       
 11714 
       
 11715 	// ===  Add media auth tokens ===
       
 11716 
       
 11717 	// Add a media auth token using RPacketContext::AddMediaAuthorizationL 
       
 11718 
       
 11719 	// Set a valid context config with RPacketContext::SetConfig 
       
 11720 
       
 11721 	// Activate primary context with RPacketContext::Activate 
       
 11722 
       
 11723 	// ===  Check context and service statuses ===
       
 11724 
       
 11725 	// Check RPacketService::NotifyStatusChange completes with EStatusActive
       
 11726 
       
 11727 	// Check RPacketService::GetStatus returns EStatusActive
       
 11728 
       
 11729 	// Check RPacketContext::NotifyStatusChange for the primary context completes with EStatusActivating -> EStatusActive
       
 11730 
       
 11731 	// Check RPacketContext::GetStatus for the primary context returns EStatusActive
       
 11732 
       
 11733 	
       
 11734 	////////////////////////////////////////////////////////////////
       
 11735 	// TEST END
       
 11736 	////////////////////////////////////////////////////////////////
       
 11737 
       
 11738     StartCleanup();
       
 11739 	
       
 11740 	// Put any required test clean up here, then remove this comment
       
 11741 	
       
 11742 	return TestStepResult();
       
 11743 	}
       
 11744 
       
 11745 TPtrC CCTSYIntegrationTestPacketContext0051::GetTestStepName()
       
 11746 /**
       
 11747  * @return The test step name.
       
 11748  */
       
 11749 	{
       
 11750 	return _L("CCTSYIntegrationTestPacketContext0051");
       
 11751 	}
       
 11752 
       
 11753 
       
 11754 
       
 11755 CCTSYIntegrationTestPacketContext0052::CCTSYIntegrationTestPacketContext0052(CEtelSessionMgr& aEtelSessionMgr)
       
 11756 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
 11757 /**
       
 11758  * Constructor.
       
 11759  */
       
 11760 	{
       
 11761 	SetTestStepName(CCTSYIntegrationTestPacketContext0052::GetTestStepName());
       
 11762 	}
       
 11763 
       
 11764 CCTSYIntegrationTestPacketContext0052::~CCTSYIntegrationTestPacketContext0052()
       
 11765 /**
       
 11766  * Destructor.
       
 11767  */
       
 11768 	{
       
 11769 	}
       
 11770 
       
 11771 TVerdict CCTSYIntegrationTestPacketContext0052::doTestStepL()
       
 11772 /**
       
 11773  * @SYMTestCaseID BA-CTSY-INT-PKTC-0052
       
 11774  * @SYMFssID BA/CTSY/PKTC-0052
       
 11775  * @SYMTestCaseDesc Modify a primary context with QoS, packet filters and media auth tokens.
       
 11776  * @SYMTestPriority High
       
 11777  * @SYMTestActions RPacketQoS::SetProfileParameters, RPacketQoS::GetProfileParameters, RPacketQoS::NotifyProfileChanged, RPacketQoS::GetProfileCapabilities, RPacketContext::OpenNewContext, RPacketContext::OpenNewSecondaryContext, RPacketContext::SetConfig, RPacketContext::NotifyStatusChange, RPacketContext::GetStatus, RPacketService::NotifyStatusChange, RPacketService::GetStatus, RPacketContext::AddPacketFilter, RPacketContext::EnumeratePacketFilters, RPacketContext::GetPacketFilterInfo, RPacketContext::RemovePacketFilter
       
 11778  * @SYMTestExpectedResults Pass - Context modified.
       
 11779  * @SYMTestType CIT
       
 11780  * @SYMTestCaseDependencies live/automatic
       
 11781  *
       
 11782  * Reason for test: Verify context is modified.
       
 11783  *
       
 11784  * @return - TVerdict code
       
 11785  */
       
 11786 	{
       
 11787 
       
 11788 	////////////////////////////////////////////////////////////////
       
 11789 	// SET UP
       
 11790 	////////////////////////////////////////////////////////////////
       
 11791 
       
 11792 	
       
 11793 	// Ensure there is an active primary context. 
       
 11794 
       
 11795 
       
 11796 	////////////////////////////////////////////////////////////////
       
 11797 	// SET UP END
       
 11798 	////////////////////////////////////////////////////////////////
       
 11799 	
       
 11800 	StartTest();
       
 11801 	
       
 11802 	////////////////////////////////////////////////////////////////
       
 11803 	// TEST START
       
 11804 	////////////////////////////////////////////////////////////////
       
 11805 	
       
 11806 	
       
 11807 	// ===  Add packet filter ===
       
 11808 
       
 11809 	// Add a TPacketFilterV2 packet filter to the primary context using RPacketContext::AddPacketFilter 
       
 11810 
       
 11811 	// ===  Add QoS ===
       
 11812 
       
 11813 	// Open a new QoS from the primary context  
       
 11814 
       
 11815 	// Get R5 QoS profile capabilities with RPacketQoS::GetProfileCapabilities 
       
 11816 
       
 11817 	// Set requested profile parameters with RPacketQoS::SetProfileParameters and TQoSR5Requested with parameters within range returned by RPacketQoS::GetProfileCapabilities 
       
 11818 
       
 11819 	// ===  Add media auth tokens ===
       
 11820 
       
 11821 	// Add a media auth token using RPacketContext::AddMediaAuthorizationL 
       
 11822 
       
 11823 	// Set a valid context config with RPacketContext::SetConfig 
       
 11824 
       
 11825 	// Activate primary context with RPacketContext::Activate 
       
 11826 
       
 11827 	// ===  Check context and service statuses ===
       
 11828 
       
 11829 	// Check RPacketService::NotifyStatusChange completes with EStatusActive
       
 11830 
       
 11831 	// Check RPacketService::GetStatus returns EStatusActive
       
 11832 
       
 11833 	// Check RPacketContext::NotifyStatusChange for the primary context completes with EStatusActivating -> EStatusActive
       
 11834 
       
 11835 	// Check RPacketContext::GetStatus for the primary context returns EStatusActive
       
 11836 
       
 11837 	// ===  Remove media auth tokens ===
       
 11838 
       
 11839 	// Remove media authorization with RPacketContext::RemoveMediaAuthorization 
       
 11840 
       
 11841 	// ===  Add media auth tokens ===
       
 11842 
       
 11843 	// Add a media auth token using RPacketContext::AddMediaAuthorizationL 
       
 11844 
       
 11845 	// Modify context with RPacketContext::ModifyActiveContext 
       
 11846 
       
 11847 	
       
 11848 	////////////////////////////////////////////////////////////////
       
 11849 	// TEST END
       
 11850 	////////////////////////////////////////////////////////////////
       
 11851 
       
 11852     StartCleanup();
       
 11853 	
       
 11854 	// Put any required test clean up here, then remove this comment
       
 11855 	
       
 11856 	return TestStepResult();
       
 11857 	}
       
 11858 
       
 11859 TPtrC CCTSYIntegrationTestPacketContext0052::GetTestStepName()
       
 11860 /**
       
 11861  * @return The test step name.
       
 11862  */
       
 11863 	{
       
 11864 	return _L("CCTSYIntegrationTestPacketContext0052");
       
 11865 	}
       
 11866 
       
 11867 
       
 11868 
       
 11869 CCTSYIntegrationTestPacketContext0053::CCTSYIntegrationTestPacketContext0053(CEtelSessionMgr& aEtelSessionMgr)
       
 11870 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
 11871 /**
       
 11872  * Constructor.
       
 11873  */
       
 11874 	{
       
 11875 	SetTestStepName(CCTSYIntegrationTestPacketContext0053::GetTestStepName());
       
 11876 	}
       
 11877 
       
 11878 CCTSYIntegrationTestPacketContext0053::~CCTSYIntegrationTestPacketContext0053()
       
 11879 /**
       
 11880  * Destructor.
       
 11881  */
       
 11882 	{
       
 11883 	}
       
 11884 
       
 11885 TVerdict CCTSYIntegrationTestPacketContext0053::doTestStepL()
       
 11886 /**
       
 11887  * @SYMTestCaseID BA-CTSY-INT-PKTC-0053
       
 11888  * @SYMFssID BA/CTSY/PKTC-0053
       
 11889  * @SYMTestCaseDesc Activate a secondary context with QoS, packet filters and media auth tokens.
       
 11890  * @SYMTestPriority High
       
 11891  * @SYMTestActions RPacketContext::GetStatus, RPacketContext::AddPacketFilter, RPacketContext::NotifyStatusChange, RPacketContext::AddMediaAuthorizationL, RPacketQoS::OpenNewQoS, RPacketQoS::GetProfileCapabilities, RPacketQoS::SetProfileParameters
       
 11892  * @SYMTestExpectedResults Pass - Context activated.
       
 11893  * @SYMTestType CIT
       
 11894  * @SYMTestCaseDependencies simulated/automatic
       
 11895  *
       
 11896  * Reason for test: Verify context is activated.
       
 11897  *
       
 11898  * @return - TVerdict code
       
 11899  */
       
 11900 	{
       
 11901 
       
 11902 	////////////////////////////////////////////////////////////////
       
 11903 	// SET UP
       
 11904 	////////////////////////////////////////////////////////////////
       
 11905 
       
 11906 
       
 11907 	// Call TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL
       
 11908     RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
 11909 	CHECK_EQUALS_L(iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(phone), KErrNone, _L("TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL returned with an error"));
       
 11910 
       
 11911     //Check if we are on a simulated network
       
 11912  	iNetworkTestHelper.CheckPhoneConnectedToAniteL(phone);
       
 11913 
       
 11914 	// Get packet service
       
 11915 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, KMainPhone, KMainPacketService);
       
 11916 
       
 11917     // Ensure phone is attached to the packet service
       
 11918     SetAttachModeToWhenPossibleAndWaitForAttachL(packetService);
       
 11919 	
       
 11920     // Open primary context
       
 11921     RPacketContext& primaryPacketContext = iEtelSessionMgr.GetPrimaryPacketContextL(
       
 11922 											KMainServer,
       
 11923 											KMainPhone,
       
 11924 											KMainPacketService,
       
 11925 											KPrimaryPacketContext1);
       
 11926 
       
 11927 	// Activate primary context.											
       
 11928 	iPacketServiceTestHelper.ActivatePrimaryPacketContextL(phone, primaryPacketContext);	
       
 11929 
       
 11930 	////////////////////////////////////////////////////////////////
       
 11931 	// SET UP END
       
 11932 	////////////////////////////////////////////////////////////////
       
 11933 	
       
 11934 	StartTest();
       
 11935 	
       
 11936 	////////////////////////////////////////////////////////////////
       
 11937 	// TEST START
       
 11938 	////////////////////////////////////////////////////////////////
       
 11939 	// Open a new secondary context 
       
 11940     RPacketContext& secondaryPacketContext = iEtelSessionMgr.GetSecondaryPacketContextL(
       
 11941 												KMainServer,
       
 11942 												KMainPhone,
       
 11943 												KMainPacketService, 
       
 11944 												KPrimaryPacketContext1,
       
 11945 												KSecondaryPacketContext1);
       
 11946 
       
 11947 	// ===  Add packet filter ===
       
 11948 
       
 11949 	// Add a TPacketFilterV2 packet filter to the secondary context using RPacketContext::AddPacketFilter 
       
 11950 	ASSERT_EQUALS(AddPacketFilterV2ToContextL(secondaryPacketContext, 1), KErrNone, _L("RPacketContext::AddPacketFilter returned with error status")); 
       
 11951 
       
 11952 	// ===  Add QoS ===
       
 11953 
       
 11954 	// Open a new QoS from the secondary context 
       
 11955 	RPacketQoS& packetQoS = iEtelSessionMgr.GetSecondaryPacketContextQoSL(
       
 11956 												KMainServer,
       
 11957 												KMainPhone,
       
 11958 												KMainPacketService, 
       
 11959 												KPrimaryPacketContext1,
       
 11960 												KSecondaryPacketContext1);
       
 11961 
       
 11962 	// Get GPRS QoS profile capabilities with RPacketQoS::GetProfileCapabilities 
       
 11963 	TExtEtelRequestStatus getProfileCapStatus(packetQoS, EPacketQoSGetProfileCaps);
       
 11964 	CleanupStack::PushL(getProfileCapStatus);
       
 11965 	RPacketQoS::TQoSCapsGPRS qosCapGprs;
       
 11966 	TPckg<RPacketQoS::TQoSCapsGPRS> qosCapsGprsPckg(qosCapGprs);
       
 11967 	packetQoS.GetProfileCapabilities(getProfileCapStatus, qosCapsGprsPckg);
       
 11968 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getProfileCapStatus, ETimeMedium), KErrNone, _L("RPacketQoS::GetProfileCapabilities timed out."));
       
 11969     ASSERT_EQUALS(getProfileCapStatus.Int(), KErrNone, _L("RPacketQoS::GetProfileCapabilities returned with error status."));
       
 11970 
       
 11971 	// Set requested profile parameters with RPacketQoS::SetProfileParameters and TQoSGPRSRequested with parameters within range returned by RPacketQoS::GetProfileCapabilities 
       
 11972     RPacketQoS::TQoSGPRSRequested qosGprsRequested;
       
 11973 	TPckg<RPacketQoS::TQoSGPRSRequested> qosGprsReqPckg(qosGprsRequested);
       
 11974     FillParametersFromCapabilities(qosGprsRequested,qosCapGprs);
       
 11975 	TExtEtelRequestStatus setProfileParamStatus(packetQoS, EPacketQoSSetProfileParams);
       
 11976 	CleanupStack::PushL(setProfileParamStatus);
       
 11977 	packetQoS.SetProfileParameters(setProfileParamStatus, qosGprsReqPckg);
       
 11978 	ASSERT_EQUALS(WaitForRequestWithTimeOut(setProfileParamStatus, ETimeMedium), KErrNone, _L("RPacketQoS::SetProfileParameters timed out."));
       
 11979 	ASSERT_EQUALS(setProfileParamStatus.Int(), KErrNone, _L("RPacketQoS::SetProfileParameters returned with error status."));
       
 11980 
       
 11981 	// ===  Add media auth tokens ===
       
 11982 
       
 11983 	// Add a media auth token using RPacketContext::AddMediaAuthorizationL 
       
 11984 	RPacketContext::CTFTMediaAuthorizationV3* mediaAuth = RPacketContext::CTFTMediaAuthorizationV3::NewL();
       
 11985 	CleanupStack::PushL(mediaAuth);  
       
 11986 	TExtEtelRequestStatus addMediaAuthStatus(secondaryPacketContext, EPacketAddMediaAuthorization);
       
 11987 	CleanupStack::PushL(addMediaAuthStatus);
       
 11988 	// $CTSYProblem This test cannot be run since LTSY crash when the CTSY send the EPacketAddMediaAuthorization message to him 
       
 11989     CHECK_TRUE_L(EFalse,_L("$CTSYProblem This test cannot be run since LTSY crash when the CTSY send the EPacketAddMediaAuthorization message to him"));
       
 11990 	secondaryPacketContext.AddMediaAuthorizationL(addMediaAuthStatus, *mediaAuth);
       
 11991 	ASSERT_EQUALS(WaitForRequestWithTimeOut(addMediaAuthStatus, ETimeMedium), KErrNone, _L("RPacketContext::AddMediaAuthorizationL timed out"));
       
 11992     ASSERT_EQUALS(addMediaAuthStatus.Int(), KErrNone, _L("RPacketContext::AddMediaAuthorizationL returned an error"));
       
 11993 
       
 11994 	//Post notifier for RPacketContext::NotifyStatusChange
       
 11995 	TExtEtelRequestStatus notifyContextStChStatus(secondaryPacketContext, EPacketContextNotifyStatusChange);
       
 11996 	CleanupStack::PushL(notifyContextStChStatus);
       
 11997 	RPacketContext::TContextStatus packetContextStatus;
       
 11998 	secondaryPacketContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);
       
 11999 	
       
 12000 	// Activate context with RPacketContext::Activate 
       
 12001 	TExtEtelRequestStatus contextActivateStatus(secondaryPacketContext, EPacketContextActivate);
       
 12002 	CleanupStack::PushL(contextActivateStatus);
       
 12003 	secondaryPacketContext.Activate(contextActivateStatus);
       
 12004 	ASSERT_EQUALS(WaitForRequestWithTimeOut(contextActivateStatus, ETimeLong), KErrNone, _L("RPacketContext::Activate timed out."));
       
 12005 	ASSERT_EQUALS(contextActivateStatus.Int(), KErrNone, _L("RPacketContext::Activate returned with error status."));
       
 12006 
       
 12007 	// ===  Check context and service statuses ===
       
 12008 
       
 12009 	// Check RPacketContext::NotifyStatusChange for the secondary context completes with EStatusActivating -> EStatusActive
       
 12010 	RPacketContext::TContextStatus expectedPacketContextStatus = RPacketContext::EStatusActivating;
       
 12011 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
 12012 				secondaryPacketContext,
       
 12013 				notifyContextStChStatus,
       
 12014 				packetContextStatus, 
       
 12015 				expectedPacketContextStatus,
       
 12016 				KErrNone);
       
 12017 
       
 12018 	secondaryPacketContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);
       
 12019 	expectedPacketContextStatus = RPacketContext::EStatusActive;
       
 12020 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
 12021 				secondaryPacketContext,
       
 12022 				notifyContextStChStatus,
       
 12023 				packetContextStatus, 
       
 12024 				expectedPacketContextStatus,
       
 12025 				KErrNone);
       
 12026 
       
 12027 	// Check RPacketContext::GetStatus for the secondary context returns EStatusActive
       
 12028 	RPacketContext::TContextStatus getPacketContextStatus;
       
 12029 	ASSERT_EQUALS(secondaryPacketContext.GetStatus(getPacketContextStatus), KErrNone, _L("RPacketContext::GetStatus for primary context returned with an error."));
       
 12030 	ASSERT_EQUALS(getPacketContextStatus, RPacketContext::EStatusActive, _L("RPacketContext::GetStatus returns incorrect status."));
       
 12031 
       
 12032 	////////////////////////////////////////////////////////////////
       
 12033 	// TEST END
       
 12034 	////////////////////////////////////////////////////////////////
       
 12035 
       
 12036     StartCleanup();
       
 12037 	
       
 12038 	// Pop
       
 12039 	// getProfileCapStatus
       
 12040 	// setProfileParamStatus
       
 12041 	// mediaAuth
       
 12042 	// addMediaAuthStatus
       
 12043 	// notifyContextStChStatus
       
 12044 	// contextActivateStatus
       
 12045 	CleanupStack::PopAndDestroy(6, &getProfileCapStatus);
       
 12046 
       
 12047 	return TestStepResult();
       
 12048 	}
       
 12049 
       
 12050 
       
 12051 TPtrC CCTSYIntegrationTestPacketContext0053::GetTestStepName()
       
 12052 /**
       
 12053  * @return The test step name.
       
 12054  */
       
 12055 	{
       
 12056 	return _L("CCTSYIntegrationTestPacketContext0053");
       
 12057 	}
       
 12058 
       
 12059 
       
 12060 
       
 12061 CCTSYIntegrationTestPacketContext0054::CCTSYIntegrationTestPacketContext0054(CEtelSessionMgr& aEtelSessionMgr)
       
 12062 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
 12063 /**
       
 12064  * Constructor.
       
 12065  */
       
 12066 	{
       
 12067 	SetTestStepName(CCTSYIntegrationTestPacketContext0054::GetTestStepName());
       
 12068 	}
       
 12069 
       
 12070 CCTSYIntegrationTestPacketContext0054::~CCTSYIntegrationTestPacketContext0054()
       
 12071 /**
       
 12072  * Destructor.
       
 12073  */
       
 12074 	{
       
 12075 	}
       
 12076 
       
 12077 TVerdict CCTSYIntegrationTestPacketContext0054::doTestStepL()
       
 12078 /**
       
 12079  * @SYMTestCaseID BA-CTSY-INT-PKTC-0054
       
 12080  * @SYMFssID BA/CTSY/PKTC-0054
       
 12081  * @SYMTestCaseDesc Modify a secondary context with QoS, packet filters and media auth tokens.
       
 12082  * @SYMTestPriority High
       
 12083  * @SYMTestActions RPacketContext::GetStatus, RPacketContext::AddPacketFilter, RPacketContext::NotifyStatusChange, RPacketContext::AddMediaAuthorizationL, RPacketQoS::OpenNewQoS, RPacketQoS::GetProfileCapabilities, RPacketQoS::SetProfileParameters
       
 12084  * @SYMTestExpectedResults Pass - Context modified.
       
 12085  * @SYMTestType CIT
       
 12086  * @SYMTestCaseDependencies simulated/automatic
       
 12087  *
       
 12088  * Reason for test: Verify context is modified.
       
 12089  *
       
 12090  * @return - TVerdict code
       
 12091  */
       
 12092 	{
       
 12093 
       
 12094 	////////////////////////////////////////////////////////////////
       
 12095 	// SET UP
       
 12096 	////////////////////////////////////////////////////////////////
       
 12097 
       
 12098 	// ==== Ensure there is an active primary context === 
       
 12099 
       
 12100     RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
 12101     
       
 12102     //Check if we are on a simulated network
       
 12103 	CHECK_EQUALS_L(iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(phone), KErrNone, _L("TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL returned with an error"));
       
 12104  	iNetworkTestHelper.CheckPhoneConnectedToAniteL(phone);
       
 12105 
       
 12106     // Get packet service
       
 12107 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, KMainPhone, KMainPacketService);
       
 12108 
       
 12109 	// Set the attach mode to EAttachWhenPossible. 
       
 12110     SetAttachModeToWhenPossibleAndWaitForAttachL(packetService);
       
 12111     
       
 12112     // Open primary context
       
 12113     RPacketContext& primaryPacketContext = iEtelSessionMgr.GetPrimaryPacketContextL(
       
 12114 											KMainServer,
       
 12115 											KMainPhone,
       
 12116 											KMainPacketService,
       
 12117 											KPrimaryPacketContext1);
       
 12118 
       
 12119 	// Activate primary context.											
       
 12120 	iPacketServiceTestHelper.ActivatePrimaryPacketContextL(phone,primaryPacketContext);												
       
 12121 
       
 12122 	////////////////////////////////////////////////////////////////
       
 12123 	// SET UP END
       
 12124 	////////////////////////////////////////////////////////////////
       
 12125 	
       
 12126 	StartTest();
       
 12127 	
       
 12128 	////////////////////////////////////////////////////////////////
       
 12129 	// TEST START
       
 12130 	////////////////////////////////////////////////////////////////
       
 12131 			
       
 12132 	// Open a new secondary context 
       
 12133     RPacketContext& secondaryPacketContext = iEtelSessionMgr.GetSecondaryPacketContextL(
       
 12134 												KMainServer,
       
 12135 												KMainPhone,
       
 12136 												KMainPacketService, 
       
 12137 												KPrimaryPacketContext1,
       
 12138 												KSecondaryPacketContext1);
       
 12139 	// ===  Add packet filter ===
       
 12140 
       
 12141 	// Add a TPacketFilterV2 packet filter to the secondary context using RPacketContext::AddPacketFilter 
       
 12142 	RPacketContext::TPacketFilterV2 packetFilterV2;
       
 12143     TInt id(1);
       
 12144     FillPacketFilter(packetFilterV2, id);
       
 12145 	RPacketContext::TPacketFilterV2Pckg packetFilterV2pckg(packetFilterV2);
       
 12146 	TExtEtelRequestStatus addFilterStatus(secondaryPacketContext, EPacketContextAddPacketFilter); 
       
 12147     CleanupStack::PushL(addFilterStatus);
       
 12148 	secondaryPacketContext.AddPacketFilter(addFilterStatus, packetFilterV2pckg);	
       
 12149 	ASSERT_EQUALS(WaitForRequestWithTimeOut(addFilterStatus, ETimeMedium), KErrNone, _L("RPacketContext::AddPacketFilter timed out"));
       
 12150     ASSERT_EQUALS(addFilterStatus.Int(), KErrNone, _L("RPacketContext::AddPacketFilter returned an error"));
       
 12151 	
       
 12152 	// ===  Add QoS ===
       
 12153 
       
 12154 	// Open a new QoS from the secondary context  
       
 12155 	RPacketQoS& contextQoS = iEtelSessionMgr.GetSecondaryPacketContextQoSL(
       
 12156 											KMainServer,
       
 12157 											KMainPhone,
       
 12158 											KMainPacketService,
       
 12159 											KPrimaryPacketContext1,
       
 12160 											KSecondaryPacketContext1);
       
 12161 											
       
 12162 	// Get GPRS QoS profile capabilities with RPacketQoS::GetProfileCapabilities 
       
 12163 	RPacketQoS::TQoSCapsGPRS qosCapsGPRS;
       
 12164 	TPckg<RPacketQoS::TQoSCapsGPRS> qosCapsGPRSPckg(qosCapsGPRS);	
       
 12165 	TExtEtelRequestStatus reqQoSProfileCaps(contextQoS, EPacketQoSGetProfileCaps);
       
 12166 	CleanupStack::PushL(reqQoSProfileCaps);
       
 12167 	contextQoS.GetProfileCapabilities(reqQoSProfileCaps, qosCapsGPRSPckg);	
       
 12168 	ASSERT_EQUALS(WaitForRequestWithTimeOut(reqQoSProfileCaps, ETimeMedium), KErrNone, _L("RPacketQoS::GetProfileCapabilities timed out."));						
       
 12169 	ASSERT_EQUALS(reqQoSProfileCaps.Int(), KErrNone, _L("RPacketQoS::GetProfileCapabilities returned with error status."));
       
 12170 	
       
 12171 	// Set requested profile parameters with RPacketQoS::SetProfileParameters and TQoSGPRSRequested with parameters within range returned by RPacketQoS::GetProfileCapabilities 
       
 12172 	RPacketQoS::TQoSGPRSRequested qosReqCapsGPRS;
       
 12173 	TPckg<RPacketQoS::TQoSGPRSRequested> qosReqCapsGPRSPckg(qosReqCapsGPRS);
       
 12174 	FillParametersFromCapabilities(qosReqCapsGPRS, qosCapsGPRS);
       
 12175 	TExtEtelRequestStatus reqStatusSetProfileParams(contextQoS,EPacketQoSSetProfileParams);
       
 12176 	CleanupStack::PushL(reqStatusSetProfileParams);
       
 12177 	contextQoS.SetProfileParameters(reqStatusSetProfileParams,qosReqCapsGPRSPckg );	
       
 12178 	ASSERT_EQUALS(WaitForRequestWithTimeOut(reqStatusSetProfileParams, ETimeMedium), KErrNone, _L("RPacketQoS::SetProfileParameters timed out."));						
       
 12179 	ASSERT_EQUALS(reqStatusSetProfileParams.Int(), KErrNone, _L("RPacketQoS::SetProfileParameters returned with error status."));
       
 12180 
       
 12181 	// ===  Add media auth tokens ===
       
 12182 
       
 12183 	// Add a media auth token using RPacketContext::AddMediaAuthorizationL 
       
 12184 	RPacketContext::CTFTMediaAuthorizationV3* mediaAuth = RPacketContext::CTFTMediaAuthorizationV3::NewL();
       
 12185 	CleanupStack::PushL(mediaAuth);  		
       
 12186 	TExtEtelRequestStatus requestAddMediaAuthStatus(secondaryPacketContext, EPacketAddMediaAuthorization);
       
 12187 	CleanupStack::PushL(requestAddMediaAuthStatus);
       
 12188 	// $CTSYProblem This test cannot be run since LTSY crash when the CTSY send the EPacketAddMediaAuthorization message to him 
       
 12189     CHECK_TRUE_L(EFalse,_L("$CTSYProblem This test cannot be run since LTSY crash when the CTSY send the EPacketAddMediaAuthorization message to him"));
       
 12190 	secondaryPacketContext.AddMediaAuthorizationL(requestAddMediaAuthStatus, *mediaAuth);	
       
 12191 	ASSERT_EQUALS(WaitForRequestWithTimeOut(requestAddMediaAuthStatus, ETimeMedium), KErrNone, _L("RPacketContext::AddMediaAuthorizationL timed out"));
       
 12192     ASSERT_EQUALS(requestAddMediaAuthStatus.Int(), KErrNone, _L("RPacketContext::AddMediaAuthorizationL returned an error"));
       
 12193 
       
 12194 	// Post notifier for RPacketContext::NotifyStatusChange
       
 12195 	TExtEtelRequestStatus notifyContextStChStatus(secondaryPacketContext, EPacketContextNotifyStatusChange);
       
 12196 	CleanupStack::PushL(notifyContextStChStatus);
       
 12197 	RPacketContext::TContextStatus packetContextStatus;
       
 12198 	secondaryPacketContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);
       
 12199 	
       
 12200 	// Activate context with RPacketContext::Activate 
       
 12201 	TExtEtelRequestStatus contextActivateStatus(secondaryPacketContext, EPacketContextActivate);
       
 12202 	CleanupStack::PushL(contextActivateStatus);
       
 12203 	secondaryPacketContext.Activate(contextActivateStatus);
       
 12204 	ASSERT_EQUALS(WaitForRequestWithTimeOut(contextActivateStatus, ETimeLong), KErrNone, _L("RPacketContext::Activate timed out."));
       
 12205 	ASSERT_EQUALS(contextActivateStatus.Int(), KErrNone, _L("RPacketContext::Activate returned with error status."));
       
 12206 	
       
 12207 	// ===  Check context and service statuses ===
       
 12208 
       
 12209 	// Check RPacketContext::NotifyStatusChange for the secondary context completes with EStatusActivating -> EStatusActive
       
 12210 	RPacketContext::TContextStatus expectedPacketContextStatus = RPacketContext::EStatusActivating;
       
 12211    	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
 12212 				secondaryPacketContext,
       
 12213 				notifyContextStChStatus,
       
 12214 				packetContextStatus, 
       
 12215 				expectedPacketContextStatus,
       
 12216 				KErrNone);
       
 12217 				
       
 12218 	secondaryPacketContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);
       
 12219 	expectedPacketContextStatus = RPacketContext::EStatusActive;	
       
 12220 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
 12221 				secondaryPacketContext,
       
 12222 				notifyContextStChStatus,
       
 12223 				packetContextStatus, 
       
 12224 				expectedPacketContextStatus,
       
 12225 				KErrNone);
       
 12226 				
       
 12227 	// Check RPacketContext::GetStatus for the secondary context returns EStatusActive
       
 12228 	RPacketContext::TContextStatus getPacketContextStatus;
       
 12229 	ASSERT_EQUALS(secondaryPacketContext.GetStatus(getPacketContextStatus), KErrNone, _L("RPacketContext::GetStatus for secondary context returned with an error."));
       
 12230 	ASSERT_EQUALS(getPacketContextStatus, RPacketContext::EStatusActive, _L("RPacketContext::GetStatus returns incorrect status."));
       
 12231 
       
 12232 	// ===  Remove media auth tokens ===
       
 12233 
       
 12234 	// Remove media authorization with RPacketContext::RemoveMediaAuthorization 
       
 12235 	TExtEtelRequestStatus requestRemoveMediaAuthStatus(secondaryPacketContext, EPacketRemoveMediaAuthorization);
       
 12236 	CleanupStack::PushL(requestRemoveMediaAuthStatus);
       
 12237 	secondaryPacketContext.RemoveMediaAuthorization(requestRemoveMediaAuthStatus, mediaAuth->iAuthorizationToken); 
       
 12238 	ASSERT_EQUALS(WaitForRequestWithTimeOut(requestRemoveMediaAuthStatus, ETimeMedium), KErrNone, _L("RPacketContext::RemoveMediaAuthorization timed out"));
       
 12239     ASSERT_EQUALS(requestRemoveMediaAuthStatus.Int(), KErrNone, _L("RPacketContext::RemoveMediaAuthorization returned an error"));
       
 12240 
       
 12241 	// ===  Add media auth tokens ===
       
 12242 
       
 12243 	// Add a media auth token using RPacketContext::AddMediaAuthorizationL
       
 12244 	RPacketContext::CTFTMediaAuthorizationV3* secondMediaAuth = RPacketContext::CTFTMediaAuthorizationV3::NewL();
       
 12245 	CleanupStack::PushL(secondMediaAuth);  
       
 12246 	TExtEtelRequestStatus requestAddMediaAuthStatusNumberTwo(secondaryPacketContext, EPacketAddMediaAuthorization);
       
 12247 	CleanupStack::PushL(requestAddMediaAuthStatusNumberTwo);
       
 12248 	secondaryPacketContext.AddMediaAuthorizationL(requestAddMediaAuthStatusNumberTwo, *secondMediaAuth);
       
 12249 	ASSERT_EQUALS(WaitForRequestWithTimeOut(requestAddMediaAuthStatusNumberTwo, ETimeMedium), KErrNone, _L("RPacketContext::AddMediaAuthorizationL timed out"));
       
 12250     ASSERT_EQUALS(requestAddMediaAuthStatusNumberTwo.Int(), KErrNone, _L("RPacketContext::AddMediaAuthorizationL returned an error")); 
       
 12251 
       
 12252 	// Modify context with RPacketContext::ModifyActiveContext 
       
 12253 	TExtEtelRequestStatus requestModifyContext(secondaryPacketContext, EPacketContextModifyActiveContext);
       
 12254 	CleanupStack::PushL(requestModifyContext);
       
 12255 	secondaryPacketContext.ModifyActiveContext(requestModifyContext);
       
 12256 	ASSERT_EQUALS(WaitForRequestWithTimeOut(requestModifyContext, ETimeMedium), KErrNone, _L("RPacketContext::ModifyActiveContext timed out"));
       
 12257     ASSERT_EQUALS(requestModifyContext.Int(), KErrNone, _L("RPacketContext::ModifyActiveContext returned an error")); 
       
 12258 	
       
 12259 	////////////////////////////////////////////////////////////////
       
 12260 	// TEST END
       
 12261 	////////////////////////////////////////////////////////////////
       
 12262 
       
 12263     StartCleanup();
       
 12264 	
       
 12265 	// Pop
       
 12266 	// addFilterStatus
       
 12267 	// reqQoSProfileCaps
       
 12268 	// reqStatusSetProfileParams
       
 12269 	// mediaAuth
       
 12270 	// requestAddMediaAuthStatus
       
 12271 	// notifyContextStChStatus
       
 12272 	// contextActivateStatus
       
 12273 	// requestRemoveMediaAuthStatus
       
 12274 	// secondMediaAuth
       
 12275 	// requestAddMediaAuthStatusNumberTwo
       
 12276 	// requestModifyContext
       
 12277 	
       
 12278 	CleanupStack::PopAndDestroy(11, &addFilterStatus);
       
 12279 	
       
 12280 	return TestStepResult();
       
 12281 	}
       
 12282 
       
 12283 TPtrC CCTSYIntegrationTestPacketContext0054::GetTestStepName()
       
 12284 /**
       
 12285  * @return The test step name.
       
 12286  */
       
 12287 	{
       
 12288 	return _L("CCTSYIntegrationTestPacketContext0054");
       
 12289 	}
       
 12290 
       
 12291 
       
 12292 
       
 12293 CCTSYIntegrationTestPacketContext0055::CCTSYIntegrationTestPacketContext0055(CEtelSessionMgr& aEtelSessionMgr)
       
 12294 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
 12295 /**
       
 12296  * Constructor.
       
 12297  */
       
 12298 	{
       
 12299 	SetTestStepName(CCTSYIntegrationTestPacketContext0055::GetTestStepName());
       
 12300 	}
       
 12301 
       
 12302 CCTSYIntegrationTestPacketContext0055::~CCTSYIntegrationTestPacketContext0055()
       
 12303 /**
       
 12304  * Destructor.
       
 12305  */
       
 12306 	{
       
 12307 	}
       
 12308 
       
 12309 TVerdict CCTSYIntegrationTestPacketContext0055::doTestStepL()
       
 12310 /**
       
 12311  * @SYMTestCaseID BA-CTSY-INT-PKTC-0055
       
 12312  * @SYMFssID BA/CTSY/PKTC-0055
       
 12313  * @SYMTestCaseDesc Remove media authorization with invalid identifier.
       
 12314  * @SYMTestPriority High
       
 12315  * @SYMTestActions RPacketContext::RemoveMediaAuthorization
       
 12316  * @SYMTestExpectedResults Pass - Error returned.
       
 12317  * @SYMTestType CIT
       
 12318  * @SYMTestCaseDependencies live/automatic
       
 12319  *
       
 12320  * Reason for test: Verify error is returned.
       
 12321  *
       
 12322  * @return - TVerdict code
       
 12323  */
       
 12324 	{
       
 12325 
       
 12326 	////////////////////////////////////////////////////////////////
       
 12327 	// SET UP
       
 12328 	////////////////////////////////////////////////////////////////
       
 12329 
       
 12330 	
       
 12331 
       
 12332 	////////////////////////////////////////////////////////////////
       
 12333 	// SET UP END
       
 12334 	////////////////////////////////////////////////////////////////
       
 12335 	
       
 12336 	StartTest();
       
 12337 	
       
 12338 	////////////////////////////////////////////////////////////////
       
 12339 	// TEST START
       
 12340 	////////////////////////////////////////////////////////////////
       
 12341 	
       
 12342 	
       
 12343 	// Open a primary context. 
       
 12344 
       
 12345 	// Add a media auth token using RPacketContext::AddMediaAuthorizationL 
       
 12346 
       
 12347 	// Remove media authorization with RPacketContext::RemoveMediaAuthorization with invalid identifier in aAuthorizationToken 
       
 12348 
       
 12349 	// Check error is returned.
       
 12350 
       
 12351 	
       
 12352 	////////////////////////////////////////////////////////////////
       
 12353 	// TEST END
       
 12354 	////////////////////////////////////////////////////////////////
       
 12355 
       
 12356     StartCleanup();
       
 12357 	
       
 12358 	// Put any required test clean up here, then remove this comment
       
 12359 	
       
 12360 	return TestStepResult();
       
 12361 	}
       
 12362 
       
 12363 TPtrC CCTSYIntegrationTestPacketContext0055::GetTestStepName()
       
 12364 /**
       
 12365  * @return The test step name.
       
 12366  */
       
 12367 	{
       
 12368 	return _L("CCTSYIntegrationTestPacketContext0055");
       
 12369 	}
       
 12370 
       
 12371 
       
 12372 
       
 12373 CCTSYIntegrationTestPacketContext0056::CCTSYIntegrationTestPacketContext0056(CEtelSessionMgr& aEtelSessionMgr)
       
 12374 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
 12375 /**
       
 12376  * Constructor.
       
 12377  */
       
 12378 	{
       
 12379 	SetTestStepName(CCTSYIntegrationTestPacketContext0056::GetTestStepName());
       
 12380 	}
       
 12381 
       
 12382 CCTSYIntegrationTestPacketContext0056::~CCTSYIntegrationTestPacketContext0056()
       
 12383 /**
       
 12384  * Destructor.
       
 12385  */
       
 12386 	{
       
 12387 	}
       
 12388 
       
 12389 TVerdict CCTSYIntegrationTestPacketContext0056::doTestStepL()
       
 12390 /**
       
 12391  * @SYMTestCaseID BA-CTSY-INT-PKTC-0056
       
 12392  * @SYMFssID BA/CTSY/PKTC-0056
       
 12393  * @SYMTestCaseDesc Activate a context and download data.
       
 12394  * @SYMTestPriority High
       
 12395  * @SYMTestActions RPacketContext::OpenExistingContext, RPacketContext::GetConnectionSpeed, RPacketContext::GetDataVolumeTransferred
       
 12396  * @SYMTestExpectedResults Pass - Context activated. Data transferred advances.
       
 12397  * @SYMTestType CIT
       
 12398  * @SYMTestCaseDependencies live/automatic
       
 12399  *
       
 12400  * Reason for test: Verify connection speed and volume data transferred advances realistically.
       
 12401  *
       
 12402  * @return - TVerdict code
       
 12403  */
       
 12404 	{
       
 12405 	
       
 12406 	////////////////////////////////////////////////////////////////
       
 12407 	// SET UP
       
 12408 	////////////////////////////////////////////////////////////////
       
 12409 
       
 12410 	// Ensure phone is attached to packet service. 
       
 12411     RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
 12412 	CHECK_EQUALS_L(iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(phone), KErrNone, _L("TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL returned with an error"));
       
 12413 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, KMainPhone, KMainPacketService);
       
 12414     SetAttachModeToWhenPossibleAndWaitForAttachL(packetService);
       
 12415 	
       
 12416 	////////////////////////////////////////////////////////////////
       
 12417 	// SET UP END
       
 12418 	////////////////////////////////////////////////////////////////
       
 12419 	
       
 12420 	StartTest();
       
 12421 	
       
 12422 	////////////////////////////////////////////////////////////////
       
 12423 	// TEST START
       
 12424 	////////////////////////////////////////////////////////////////
       
 12425 
       
 12426 	// ===  Send and receive some data and check data transferred advances ===
       
 12427 	
       
 12428 	// Activate context with ESOCK server
       
 12429 	TBuf<140> host(_L("developer.symbian.com"));
       
 12430     TBuf<140> page(_L("/main/downloads/papers/IMS_Introduction_Part_1.pdf"));
       
 12431     CHTTPDownload *download = new (ELeave) CHTTPDownload(this);
       
 12432     CleanupStack::PushL(download);
       
 12433     ASSERT_TRUE(download->StartDownloadL(host,page),_L("Download Failed"));
       
 12434     
       
 12435     // Check RPacketService::GetNifInfo with aCount = 0 returns valid name in iContextName 
       
 12436 	TInt nifInfoCount = 0;
       
 12437 	TExtEtelRequestStatus nifInfoStatus(packetService, EPacketGetNifInfo);
       
 12438 	CleanupStack::PushL(nifInfoStatus);
       
 12439 	RPacketService::TNifInfoV2 nifInfo;
       
 12440 	RPacketService::TNifInfoV2Pckg nifInfoPckg(nifInfo);
       
 12441 	packetService.GetNifInfo(nifInfoStatus, nifInfoCount, nifInfoPckg);
       
 12442 	ASSERT_EQUALS(WaitForRequestWithTimeOut(nifInfoStatus, ETimeMedium), KErrNone, _L("RPacketService::GetNifInfo timed out."));
       
 12443 	ASSERT_EQUALS(nifInfoStatus.Int(), KErrNone, _L("RPacketService::GetNifInfo returned with an error."));
       
 12444 	ASSERT_TRUE(nifInfo.iContextName.Length()>0,_L("RPacketService::GetNifInfo returned invalid context name."));
       
 12445 	TName contextName = nifInfo.iContextName;
       
 12446 	
       
 12447 	// Open a handle on an existing context with OpenExistingContext
       
 12448 	RPacketContext packetContext;										
       
 12449     ASSERT_EQUALS(packetContext.OpenExistingContext(packetService, contextName), KErrNone, _L("RPacketContext::OpenExistingContext returned with an error."));
       
 12450   	
       
 12451   	// Check RPacketContext::GetConnectionSpeed returns aRate > 0;
       
 12452     TExtEtelRequestStatus getConnectionSpeedStatus(packetContext, EPacketContextGetConnectionSpeed);
       
 12453 	CleanupStack::PushL(getConnectionSpeedStatus);
       
 12454 	TUint connectionSpeedRate;
       
 12455 	packetContext.GetConnectionSpeed(getConnectionSpeedStatus, connectionSpeedRate);
       
 12456 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getConnectionSpeedStatus, ETimeMedium), KErrNone, _L("RPacketContext::GetConnectionSpeed timed out."));
       
 12457     ASSERT_EQUALS(getConnectionSpeedStatus.Int(), KErrNone, _L("RPacketContext::GetConnectionSpeed returned with an error."));
       
 12458 	ASSERT_TRUE(connectionSpeedRate > 0, _L("RPacketContext::GetConnectionSpeed is lower than expected."));
       
 12459 	
       
 12460     // Repeat this section until download is complete and check that iBytesSent and iBytesReceived is higher than the previous
       
 12461     RPacketContext::TDataVolume dataVolume;	
       
 12462 	TUint32 zeroBytesSent = 0;
       
 12463 	TUint32 zeroBytesReceived = 0;
       
 12464 	while(download->VerifyDownloading())
       
 12465 		{
       
 12466 		packetContext.GetDataVolumeTransferred(dataVolume);	
       
 12467 		DEBUG_PRINTF2(_L("sent data: %d bytes"), dataVolume.iBytesSent);
       
 12468 		DEBUG_PRINTF2(_L("received data: %d bytes"), dataVolume.iBytesReceived);
       
 12469 		User::After(KOneSecond*3);
       
 12470 		}
       
 12471 	
       
 12472 	// Check RPacketContext::GetDataVolumeTransferred returns TDataVolume::iBytesSent is higher than the previous
       
 12473 	ASSERT_TRUE(dataVolume.iBytesSent > zeroBytesSent, _L("RPacketContext::GetVolumeDataTransferred returned with no increase in bytes sent."));
       
 12474 	// Check RPacketContext::GetDataVolumeTransferred returns TDataVolume::iBytesReceived is higher than the previous
       
 12475 	ASSERT_TRUE(dataVolume.iBytesReceived > zeroBytesReceived, _L("RPacketContext::GetVolumeDataTransferred returned with no increase in bytes received."));
       
 12476 	////////////////////////////////////////////////////////////////
       
 12477 	// TEST END
       
 12478 	////////////////////////////////////////////////////////////////
       
 12479 	
       
 12480     StartCleanup();
       
 12481 	
       
 12482 	// pop
       
 12483 	// download
       
 12484 	// nifInfoStatus
       
 12485 	// getConnectionSpeedStatus
       
 12486 	CleanupStack::PopAndDestroy(3, download);
       
 12487 	
       
 12488 	return TestStepResult();
       
 12489 	}
       
 12490 
       
 12491 TPtrC CCTSYIntegrationTestPacketContext0056::GetTestStepName()
       
 12492 /**
       
 12493  * @return The test step name.
       
 12494  */
       
 12495 	{
       
 12496 	return _L("CCTSYIntegrationTestPacketContext0056");
       
 12497 	}
       
 12498 
       
 12499 
       
 12500 
       
 12501 CCTSYIntegrationTestPacketContext0057::CCTSYIntegrationTestPacketContext0057(CEtelSessionMgr& aEtelSessionMgr)
       
 12502 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
 12503 /**
       
 12504  * Constructor.
       
 12505  */
       
 12506 	{
       
 12507 	SetTestStepName(CCTSYIntegrationTestPacketContext0057::GetTestStepName());
       
 12508 	}
       
 12509 
       
 12510 CCTSYIntegrationTestPacketContext0057::~CCTSYIntegrationTestPacketContext0057()
       
 12511 /**
       
 12512  * Destructor.
       
 12513  */
       
 12514 	{
       
 12515 	}
       
 12516 
       
 12517 TVerdict CCTSYIntegrationTestPacketContext0057::doTestStepL()
       
 12518 /**
       
 12519  * @SYMTestCaseID BA-CTSY-INT-PKTC-0057
       
 12520  * @SYMFssID BA/CTSY/PKTC-0057
       
 12521  * @SYMTestCaseDesc Download data with a primary context and a secondary context.
       
 12522  * @SYMTestPriority High
       
 12523  * @SYMTestActions RPacketContext::OpenNewSecondaryContext, RPacketContext::SetConfig, RPacketContext::Activate, RPacketContext::GetConnectionSpeed, RPacketContext::NotifyConnectionSpeedChange, RPacketContext::NotifyDataTransferred, RPacketContext::GetDataVolumeTransferred, RPacketContext::LoanCommPort, RPacketContext::RecoverCommPort, RPacketQoS::SetProfileParameters, RPacketQoS::GetProfileCapabilities, RPacketQoS::OpenNewQoS, RPacketContext::AddPacketFilter
       
 12524  * @SYMTestExpectedResults Pass - Context activated. Data transferred advances.
       
 12525  * @SYMTestType CIT
       
 12526  * @SYMTestCaseDependencies live/automatic
       
 12527  *
       
 12528  * Reason for test: Verify connection speed and volume data transferred advances realistically.
       
 12529  *
       
 12530  * @return - TVerdict code
       
 12531  */
       
 12532 	{
       
 12533 
       
 12534 	////////////////////////////////////////////////////////////////
       
 12535 	// SET UP
       
 12536 	////////////////////////////////////////////////////////////////
       
 12537 /*
       
 12538 	
       
 12539 	// Ensure phone is attached to packet service. 
       
 12540     RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
 12541 	CHECK_EQUALS_L(iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(phone), KErrNone, _L("TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL returned with an error"));
       
 12542 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, KMainPhone, KMainPacketService);
       
 12543     SetAttachModeToWhenPossibleAndWaitForAttachL(packetService);
       
 12544 
       
 12545 
       
 12546 	////////////////////////////////////////////////////////////////
       
 12547 	// SET UP END
       
 12548 	////////////////////////////////////////////////////////////////
       
 12549 	
       
 12550 	StartTest();
       
 12551 	
       
 12552 	////////////////////////////////////////////////////////////////
       
 12553 	// TEST START
       
 12554 	////////////////////////////////////////////////////////////////
       
 12555 
       
 12556 
       
 12557 	// Post notification for service's status change
       
 12558 	TExtEtelRequestStatus notifyServiceStChStatus(packetService, EPacketNotifyStatusChange);
       
 12559 	CleanupStack::PushL(notifyServiceStChStatus);
       
 12560 	RPacketService::TStatus packetServiceStatus;
       
 12561 	packetService.NotifyStatusChange(notifyServiceStChStatus, packetServiceStatus);
       
 12562     
       
 12563     // ===  Activate a primary context ===
       
 12564 
       
 12565 	// Open a new primary context 
       
 12566     // Set a valid context config using RPacketContext::SetConfig 
       
 12567 
       
 12568 	// Activate context with ESOCK server
       
 12569 	TBuf<140> host(_L("developer.symbian.com"));
       
 12570     TBuf<140> page(_L("/main/downloads/papers/IMS_Introduction_Part_1.pdf"));
       
 12571     CHTTPDownload* download = new (ELeave) CHTTPDownload(this);
       
 12572     CleanupStack::PushL(download);
       
 12573     ASSERT_TRUE(download->StartDownloadL(host,page),_L("Download Failed"));
       
 12574     
       
 12575  	// Get context info	
       
 12576 	TExtEtelRequestStatus getContextInfo(packetService, EPacketGetContextInfo);
       
 12577 	CleanupStack::PushL(getContextInfo);
       
 12578 	RPacketService::TContextInfo contextInfo;
       
 12579 	TInt index = 0;
       
 12580 	packetService.GetContextInfo(getContextInfo, index, contextInfo);
       
 12581 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getContextInfo, ETimeLong), KErrNone, _L("RPacketService::GetContextInfo timed out"));
       
 12582 	ASSERT_EQUALS(getContextInfo.Int(), KErrNone, _L("RPacketService::GetContextInfo returned an error"));
       
 12583 	ASSERT_TRUE(contextInfo.iName.Length() > 0, _L("RPacketService::GetContextInfo returned with zero length context name"));
       
 12584 
       
 12585 	// Open a handle on an existing context with OpenExistingContext
       
 12586 	RPacketContext primaryPacketContext;										
       
 12587     ASSERT_EQUALS(primaryPacketContext.OpenExistingContext(packetService, contextInfo.iName), KErrNone, _L("RPacketContext::OpenExistingContext returned with an error."));
       
 12588 
       
 12589 	// Post notification for RPacketContext::NotifyDataTransferred
       
 12590 	ERR_PRINTF1(_L("<font color=Orange>@CTSYProblem: RPacketContext::NotifyDataTransferred is not supported by CTSY. All code related to this request is commented out."));
       
 12591 	//TExtEtelRequestStatus notifyDataTransferredStatus(primaryPacketContext, EPacketContextNotifyDataTransferred);
       
 12592 	//CleanupStack::PushL(notifyDataTransferredStatus);
       
 12593 	//RPacketContext::TDataVolume primaryDataVolume;
       
 12594 	//primaryPacketContext.NotifyDataTransferred(notifyDataTransferredStatus, primaryDataVolume);
       
 12595 
       
 12596 	// Check RPacketService::NotifyStatusChange completes with EStatusActive
       
 12597 	RPacketService::TStatus expectedPacketServiceStatus = RPacketService::EStatusActive;
       
 12598 	iPacketServiceTestHelper.WaitForPacketServiceNotifyStatusChange(
       
 12599 				packetService,
       
 12600 				notifyServiceStChStatus,
       
 12601 				packetServiceStatus, 
       
 12602 				expectedPacketServiceStatus,
       
 12603 				KErrNone);
       
 12604 
       
 12605 	// Check RPacketService::GetStatus returns EStatusActive
       
 12606 	RPacketService::TStatus pckSrvcStatus;
       
 12607 	ASSERT_EQUALS(packetService.GetStatus(pckSrvcStatus), KErrNone, _L("RPacketService::GetStatus returned with an error."));
       
 12608 	ASSERT_EQUALS(pckSrvcStatus, RPacketService::EStatusActive, _L("RPacketService::GetStatus returns incorrect status."));
       
 12609 
       
 12610 	// Check RPacketContext::GetStatus returns EStatusActive
       
 12611 	RPacketContext::TContextStatus packetContextStatus;
       
 12612 	ASSERT_EQUALS(primaryPacketContext.GetStatus(packetContextStatus), KErrNone, _L("RPacketContext::GetStatus returned with an error."));
       
 12613 	ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusActive, _L("RPacketContext::GetStatus returns incorrect status."));
       
 12614 
       
 12615 	// Post notification for the RPacketContext::NotifyConnectionSpeedChange
       
 12616 	TExtEtelRequestStatus notifyConnectionSpeedChangeStatus(primaryPacketContext, EPacketContextNotifyStatusChange);
       
 12617 	CleanupStack::PushL(notifyConnectionSpeedChangeStatus);
       
 12618 	TUint rate(0);
       
 12619 	primaryPacketContext.NotifyConnectionSpeedChange(notifyConnectionSpeedChangeStatus, rate);
       
 12620 
       
 12621     // ===  Activate a secondary context ===
       
 12622 
       
 12623 	// Activate secondary context with ESOCK server
       
 12624 	TBuf<140> subHost(_L("developer.symbian.com"));
       
 12625     TBuf<140> subPage(_L("/main/downloads/papers/SymbianOSv91/Whats_new_in_Symbian_OS_v9.1.pdf"));
       
 12626 	TInt port = 80;
       
 12627     CHTTPDownload* downloadSecondary = new (ELeave) CHTTPDownload(this);
       
 12628     CleanupStack::PushL(downloadSecondary);
       
 12629    // ASSERT_TRUE(downloadSecondary->StartDownloadL(subHost, subPage, port, ETrue), _L("Download Failed"));
       
 12630     ASSERT_TRUE(downloadSecondary->StartDownloadL(subHost, subPage, port), _L("Download Failed"));
       
 12631 
       
 12632 
       
 12633  	// Get secondary context info	
       
 12634 	index = 1;
       
 12635 	packetService.GetContextInfo(getContextInfo, index, contextInfo);
       
 12636 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getContextInfo, ETimeLong), KErrNone, _L("RPacketService::GetContextInfo timed out"));
       
 12637 	ASSERT_TRUE(contextInfo.iName.Length() > 0, _L("RPacketService::GetContextInfo returned with zero length context name"));
       
 12638 
       
 12639 	// Open a handle on an existing secondary context with OpenExistingContext
       
 12640 	RPacketContext secondaryPacketContext;										
       
 12641     ASSERT_EQUALS(secondaryPacketContext.OpenExistingContext(packetService, contextInfo.iName), KErrNone, _L("RPacketContext::OpenExistingContext returned with an error."));
       
 12642 
       
 12643 	// Post notification for RPacketContext::NotifyDataTransferred
       
 12644 	ERR_PRINTF1(_L("<font color=Orange>@CTSYProblem: RPacketContext::NotifyDataTransferred is not supported by CTSY. All code related to this request is commented out."));
       
 12645 	//TExtEtelRequestStatus notifySecDataTransferredStatus(secondaryPacketContext, EPacketContextNotifyDataTransferred);
       
 12646 	//CleanupStack::PushL(notifySecDataTransferredStatus);
       
 12647 	//RPacketContext::TDataVolume secondaryDataVolume;
       
 12648 	//secondaryPacketContext.NotifyDataTransferred(notifySecDataTransferredStatus, secondaryDataVolume);
       
 12649 
       
 12650 	// Post notification for the secondary context connection speed change
       
 12651 	TExtEtelRequestStatus notifySecConnectionSpeedChangeStatus(secondaryPacketContext, EPacketContextNotifyStatusChange);
       
 12652 	CleanupStack::PushL(notifySecConnectionSpeedChangeStatus);
       
 12653 	TUint secRate(0);
       
 12654 	secondaryPacketContext.NotifyConnectionSpeedChange(notifyConnectionSpeedChangeStatus, secRate);
       
 12655 
       
 12656 	// ===  Add packet filter ===
       
 12657 
       
 12658 	// Add a TPacketFilterV2 packet filter to the secondary context using RPacketContext::AddPacketFilter 
       
 12659 	ASSERT_EQUALS(AddPacketFilterV2ToContextL(secondaryPacketContext,1), KErrNone, _L("RPacketContext::AddPacketFilter returned with error status"));
       
 12660 
       
 12661 	// ===  Add QoS ===
       
 12662 
       
 12663 	// Open a new QoS from the secondary context  
       
 12664 	RPacketQoS& packetQoS = iEtelSessionMgr.GetSecondaryPacketContextQoSL(
       
 12665 												KMainServer,
       
 12666 												KMainPhone,
       
 12667 												KMainPacketService, 
       
 12668 												KPrimaryPacketContext1,
       
 12669 												KSecondaryPacketContext1);
       
 12670 
       
 12671 	// Get GPRS QoS profile capabilities with RPacketQoS::GetProfileCapabilities 
       
 12672 	TExtEtelRequestStatus getProfileCapStatus(packetQoS, EPacketQoSGetProfileCaps);
       
 12673 	CleanupStack::PushL(getProfileCapStatus);
       
 12674 	RPacketQoS::TQoSCapsGPRS qosCapGprs;
       
 12675 	TPckg<RPacketQoS::TQoSCapsGPRS> qosCapsGprsPckg(qosCapGprs);
       
 12676 	packetQoS.GetProfileCapabilities(getProfileCapStatus, qosCapsGprsPckg);
       
 12677 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getProfileCapStatus, ETimeMedium), KErrNone, _L("RPacketQoS::GetProfileCapabilities timed out."));
       
 12678     ASSERT_EQUALS(getProfileCapStatus.Int(), KErrNone, _L("RPacketQoS::GetProfileCapabilities returned with error status."));
       
 12679 
       
 12680 	// Set requested profile parameters with RPacketQoS::SetProfileParameters and TQoSGPRSRequested with parameters within range returned by RPacketQoS::GetProfileCapabilities 
       
 12681     RPacketQoS::TQoSGPRSRequested qosGprsRequested;
       
 12682 	TPckg<RPacketQoS::TQoSGPRSRequested> qosGprsReqPckg(qosGprsRequested);
       
 12683     FillParametersFromCapabilities(qosGprsRequested,qosCapGprs);
       
 12684 	TExtEtelRequestStatus setProfileParamStatus(packetQoS, EPacketQoSSetProfileParams);
       
 12685 	CleanupStack::PushL(setProfileParamStatus);
       
 12686 	packetQoS.SetProfileParameters(setProfileParamStatus, qosGprsReqPckg);
       
 12687 	ASSERT_EQUALS(WaitForRequestWithTimeOut(setProfileParamStatus, ETimeMedium), KErrNone, _L("RPacketQoS::SetProfileParameters timed out."));
       
 12688 	ASSERT_EQUALS(setProfileParamStatus.Int(), KErrNone, _L("RPacketQoS::SetProfileParameters returned with error status."));
       
 12689 
       
 12690 	// Post notification for context's status change
       
 12691 	TExtEtelRequestStatus notifySecContextStChStatus(secondaryPacketContext, EPacketContextNotifyStatusChange);
       
 12692 	CleanupStack::PushL(notifySecContextStChStatus);
       
 12693 	RPacketContext::TContextStatus secPacketContextStatus;
       
 12694 	secondaryPacketContext.NotifyStatusChange(notifySecContextStChStatus, secPacketContextStatus);
       
 12695 
       
 12696 	// Activate context with RPacketContext::Activate 
       
 12697 	TExtEtelRequestStatus secContextActivateStatus(secondaryPacketContext, EPacketContextActivate);
       
 12698 	CleanupStack::PushL(secContextActivateStatus);
       
 12699 	secondaryPacketContext.Activate(secContextActivateStatus);
       
 12700 	ASSERT_EQUALS(WaitForRequestWithTimeOut(secContextActivateStatus, ETimeLong), KErrNone, _L("RPacketContext::Activate timed out."));
       
 12701 	ASSERT_EQUALS(secContextActivateStatus.Int(), KErrNone, _L("RPacketContext::Activate returned with error status."));
       
 12702 
       
 12703 	// Check RPacketContext::NotifyStatusChange for the secondary context completes with EStatusActivating -> EStatusActive
       
 12704     RPacketContext::TContextStatus expectedSecContextStatus = RPacketContext::EStatusActivating;
       
 12705 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
 12706 				secondaryPacketContext,
       
 12707 				notifySecContextStChStatus,
       
 12708 				secPacketContextStatus, 
       
 12709 				expectedSecContextStatus,
       
 12710 				KErrNone);
       
 12711 
       
 12712     secondaryPacketContext.NotifyStatusChange(notifySecContextStChStatus, secPacketContextStatus);	
       
 12713     expectedSecContextStatus = RPacketContext::EStatusActive;
       
 12714 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(
       
 12715 				secondaryPacketContext,
       
 12716 				notifySecContextStChStatus,
       
 12717 				secPacketContextStatus, 
       
 12718 				expectedSecContextStatus,
       
 12719 				KErrNone);
       
 12720 
       
 12721 	// Check RPacketContext::GetStatus for the secondary context returns EStatusActive
       
 12722 	ASSERT_EQUALS(secondaryPacketContext.GetStatus(secPacketContextStatus), KErrNone, _L("RPacketContext::GetStatus returned with an error."));
       
 12723     ASSERT_EQUALS(secPacketContextStatus, RPacketContext::EStatusActive, _L("Packet Context's status expected to be EStatusActive but is not."));
       
 12724     
       
 12725     // Loan comm port to the client with RPacketContext::LoanCommPort 
       
 12726 
       
 12727 	// ===  Send and receive some data and check data transferred advances ===
       
 12728 
       
 12729 	// Send some data and receive some data to which would go to the primary and the secondary context depending on packet filter values 
       
 12730 
       
 12731 	// Check RPacketContext::NotifyDataTransferred for primary context completes with TDataVolume::iBytesSent > 0
       
 12732     // @CTSYProblem: RPacketContext::NotifyDataTransferred is not supported by CTSY. All code related to this request is commented out.
       
 12733 	//ASSERT_EQUALS(WaitForRequestWithTimeOut(notifyDataTransferredStatus, ETimeMedium), KErrNone, _L("RPacketContext::NotifyDataTransferred did not complete."));
       
 12734     //ASSERT_EQUALS(notifyDataTransferredStatus.Int(), KErrNone, _L("RPacketContext::NotifyDataTransferred returned with error status."));
       
 12735     //ASSERT_TRUE(primaryDataVolume.iBytesSent > 0, _L("RPacketContext::NotifyDataTransferred returned with zero iBytesSent."));
       
 12736 
       
 12737 	// Check RPacketContext::NotifyDataTransferred for primary context completes with TDataVolume::iBytesReceived > 0
       
 12738     // @CTSYProblem: RPacketContext::NotifyDataTransferred is not supported by CTSY. All code related to this request is commented out.
       
 12739     //ASSERT_TRUE(primaryDataVolume.iBytesReceived > 0, _L("RPacketContext::NotifyDataTransferred returned with zero iBytesReceived."));
       
 12740 
       
 12741 	// Check RPacketContext::GetConnectionSpeed for primary context returns aRate > 0
       
 12742     TExtEtelRequestStatus getConnectionSpeedStatus(primaryPacketContext, EPacketContextGetConnectionSpeed);
       
 12743 	CleanupStack::PushL(getConnectionSpeedStatus);
       
 12744 	TUint connectionSpeedRate;
       
 12745 	primaryPacketContext.GetConnectionSpeed(getConnectionSpeedStatus, connectionSpeedRate);
       
 12746 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getConnectionSpeedStatus, ETimeMedium), KErrNone, _L("RPacketContext::GetConnectionSpeed timed out."));
       
 12747     ASSERT_EQUALS(getConnectionSpeedStatus.Int(), KErrNone, _L("RPacketContext::GetConnectionSpeed failed."));
       
 12748 	ASSERT_TRUE(connectionSpeedRate > 0, _L("RPacketContext::GetConnectionSpeed is lower than expected."));
       
 12749 
       
 12750 	// Check RPacketContext::NotifyConnectionSpeedChange for primary context returns aRate > 0
       
 12751 	ASSERT_EQUALS(WaitForRequestWithTimeOut(notifyConnectionSpeedChangeStatus, ETimeMedium), KErrNone, _L("RPacketContext::NotifyConnectionSpeedChange timed out."));
       
 12752     ASSERT_EQUALS(notifyConnectionSpeedChangeStatus.Int(), KErrNone, _L("RPacketContext::NotifyConnectionSpeedChange failed."));
       
 12753 	ASSERT_TRUE(rate > 0, _L("RPacketContext::NotifyConnectionSpeedChange returns aRate = 0."));
       
 12754 
       
 12755 	// Check RPacketContext::NotifyDataTransferred for secondary context completes with TDataVolume::iBytesSent > 0
       
 12756     // @CTSYProblem: RPacketContext::NotifyDataTransferred is not supported by CTSY. All code related to this request is commented out.
       
 12757 	//ASSERT_EQUALS(WaitForRequestWithTimeOut(notifySecDataTransferredStatus, ETimeMedium), KErrNone, _L("RPacketContext::NotifyDataTransferred did not complete."));
       
 12758     //ASSERT_EQUALS(notifySecDataTransferredStatus.Int(), KErrNone, _L("RPacketContext::NotifyDataTransferred returned with error status."));
       
 12759     //ASSERT_TRUE(secondaryDataVolume.iBytesSent > 0, _L("RPacketContext::NotifyDataTransferred returned with zero iBytesSent."));
       
 12760 
       
 12761 	// Check RPacketContext::NotifyDataTransferred for secondary context completes with TDataVolume::iBytesReceived > 0
       
 12762     // @CTSYProblem: RPacketContext::NotifyDataTransferred is not supported by CTSY. All code related to this request is commented out.
       
 12763     //ASSERT_TRUE(secondaryDataVolume.iBytesReceived > 0, _L("RPacketContext::NotifyDataTransferred returned with zero iBytesReceived."));
       
 12764 
       
 12765 	// Check RPacketContext::GetConnectionSpeed for secondary context returns aRate > 0
       
 12766     TExtEtelRequestStatus getSecConnectionSpeedStatus(secondaryPacketContext, EPacketContextGetConnectionSpeed);
       
 12767 	CleanupStack::PushL(getSecConnectionSpeedStatus);
       
 12768 	secondaryPacketContext.GetConnectionSpeed(getSecConnectionSpeedStatus, connectionSpeedRate);
       
 12769 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getSecConnectionSpeedStatus, ETimeMedium), KErrNone, _L("RPacketContext::GetConnectionSpeed timed out."));
       
 12770     ASSERT_EQUALS(getSecConnectionSpeedStatus.Int(), KErrNone, _L("RPacketContext::GetConnectionSpeed failed."));
       
 12771 	ASSERT_TRUE(connectionSpeedRate > 0, _L("RPacketContext::GetConnectionSpeed is lower than expected."));
       
 12772 
       
 12773 	// Check RPacketContext::NotifyConnectionSpeedChange for secondary context returns aRate > 0
       
 12774 	ASSERT_EQUALS(WaitForRequestWithTimeOut(notifySecConnectionSpeedChangeStatus, ETimeMedium), KErrNone, _L("RPacketContext::NotifyConnectionSpeedChange timed out."));
       
 12775     ASSERT_EQUALS(notifySecConnectionSpeedChangeStatus.Int(), KErrNone, _L("RPacketContext::NotifyConnectionSpeedChange failed."));
       
 12776 	ASSERT_TRUE(secRate > 0, _L("RPacketContext::NotifyConnectionSpeedChange returns aRate = 0."));
       
 12777 
       
 12778 	// Repeat this section 10 times and check that iBytesSent and iBytesReceived is higher than the previous 
       
 12779 	RPacketContext::TDataVolume priDataVolume;
       
 12780     RPacketContext::TDataVolume secDataVolume;	
       
 12781 	TUint32 primaryLastBytesSent(0);
       
 12782 	TUint32 primaryLastBytesReceived(0);
       
 12783 	TUint32 secondaryLastBytesSent(0);
       
 12784 	TUint32 secondaryLastBytesReceived(0);
       
 12785 
       
 12786 	while(download->VerifyDownloading())
       
 12787 		{
       
 12788 		// Check RPacketContext::GetDataVolumeTransferred for primary context returns TDataVolume::iBytesSent is higher than the previous
       
 12789 		primaryPacketContext.GetDataVolumeTransferred(priDataVolume);	
       
 12790 		ASSERT_TRUE(priDataVolume.iBytesSent > primaryLastBytesSent, _L("Primary packet context iBytesSend value is not higher than the previous iBytesSend value"));
       
 12791 		primaryLastBytesSent = priDataVolume.iBytesSent;
       
 12792 		
       
 12793 		// Check RPacketContext::GetDataVolumeTransferred for primary context returns TDataVolume::iBytesReceived is higher than the previous
       
 12794 		ASSERT_TRUE(priDataVolume.iBytesReceived > primaryLastBytesReceived, _L("Primary packet context iBytesReceived value is not higher than the previous iBytesReceived value"));
       
 12795 		primaryLastBytesReceived = priDataVolume.iBytesReceived;
       
 12796 		
       
 12797 		// Check RPacketContext::GetDataVolumeTransferred for secondary context returns TDataVolume::iBytesSent is higher than the previous
       
 12798 		secondaryPacketContext.GetDataVolumeTransferred(secDataVolume);	
       
 12799 		ASSERT_TRUE(secDataVolume.iBytesSent > secondaryLastBytesSent, _L("Secondary packet context iBytesSend value is not higher than the previous iBytesSend value"));
       
 12800 		secondaryLastBytesSent = secDataVolume.iBytesSent;
       
 12801 		
       
 12802 		// Check RPacketContext::GetDataVolumeTransferred for secondary context returns TDataVolume::iBytesReceived is higher than the previous
       
 12803 		ASSERT_TRUE(secDataVolume.iBytesReceived > secondaryLastBytesReceived, _L("Secondary packet context iBytesReceived value is not higher than the previous iBytesReceived value"));
       
 12804 		secondaryLastBytesReceived = secDataVolume.iBytesReceived;
       
 12805 		
       
 12806 		DEBUG_PRINTF2(_L("Primary context sent data: %d bytes"), primaryLastBytesSent);
       
 12807 		DEBUG_PRINTF2(_L("Primary context received data: %d bytes"), primaryLastBytesReceived);
       
 12808 		DEBUG_PRINTF2(_L("Secondary context sent data: %d bytes"), secondaryLastBytesSent);
       
 12809 		DEBUG_PRINTF2(_L("Secondary context received data: %d bytes"), secondaryLastBytesReceived);
       
 12810 		User::After(KOneSecond*3);
       
 12811 		}
       
 12812 
       
 12813 	// Release QoS
       
 12814 	iEtelSessionMgr.ReleaseSecondaryPacketContextQoS(KMainServer,
       
 12815 											KMainPhone, 
       
 12816 											KMainPacketService, 
       
 12817 											KPrimaryPacketContext1,
       
 12818 											KSecondaryPacketContext1);
       
 12819 
       
 12820 	// Release packet contexts
       
 12821 	iEtelSessionMgr.ReleaseSecondaryPacketContext(KMainServer,
       
 12822 											KMainPhone, 
       
 12823 											KMainPacketService, 
       
 12824 											KPrimaryPacketContext1,
       
 12825 											KSecondaryPacketContext1);
       
 12826 
       
 12827 	// Release primary packet context
       
 12828 	iEtelSessionMgr.ReleasePrimaryPacketContext(KMainServer,
       
 12829 											KMainPhone, 
       
 12830 											KMainPacketService, 
       
 12831 											KPrimaryPacketContext1);
       
 12832 
       
 12833 
       
 12834 	////////////////////////////////////////////////////////////////
       
 12835 	// TEST END
       
 12836 	////////////////////////////////////////////////////////////////
       
 12837 
       
 12838     StartCleanup();
       
 12839 	
       
 12840 	// Pop
       
 12841 	// notifyServiceStChStatus
       
 12842 	// download
       
 12843 	// getContextInfo
       
 12844 	// notifyDataTransferredStatus (@CTSYProblem, commented out)
       
 12845 	// notifyConnectionSpeedChangeStatus
       
 12846 	// downloadSecondary
       
 12847 	// notifySecDataTransferredStatus (@CTSYProblem, commented out)
       
 12848 	// notifySecConnectionSpeedChangeStatus
       
 12849 	// getProfileCapStatus
       
 12850 	// setProfileParamStatus
       
 12851 	// notifySecContextStChStatus
       
 12852 	// secContextActivateStatus
       
 12853 	// getConnectionSpeedStatus
       
 12854 	// getSecConnectionSpeedStatus
       
 12855 	CleanupStack::PopAndDestroy(12, &notifyServiceStChStatus);
       
 12856 */
       
 12857 	return TestStepResult();
       
 12858 	}
       
 12859 
       
 12860 TPtrC CCTSYIntegrationTestPacketContext0057::GetTestStepName()
       
 12861 /**
       
 12862  * @return The test step name.
       
 12863  */
       
 12864 	{
       
 12865 	return _L("CCTSYIntegrationTestPacketContext0057");
       
 12866 	}
       
 12867 
       
 12868 
       
 12869 
       
 12870 CCTSYIntegrationTestPacketContext0058::CCTSYIntegrationTestPacketContext0058(CEtelSessionMgr& aEtelSessionMgr)
       
 12871 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
 12872 /**
       
 12873  * Constructor.
       
 12874  */
       
 12875 	{
       
 12876 	SetTestStepName(CCTSYIntegrationTestPacketContext0058::GetTestStepName());
       
 12877 	}
       
 12878 
       
 12879 CCTSYIntegrationTestPacketContext0058::~CCTSYIntegrationTestPacketContext0058()
       
 12880 /**
       
 12881  * Destructor.
       
 12882  */
       
 12883 	{
       
 12884 	}
       
 12885 
       
 12886 TVerdict CCTSYIntegrationTestPacketContext0058::doTestStepL()
       
 12887 /**
       
 12888  * @SYMTestCaseID BA-CTSY-INT-PKTC-0058
       
 12889  * @SYMFssID BA/CTSY/PKTC-0058
       
 12890  * @SYMTestCaseDesc Activate a PDP context with the requested QOS equal to the subscribed QoS.
       
 12891  * @SYMTestPriority High
       
 12892  * @SYMTestActions RPacketQoS::NotifyProfileChanged, RPacketQoS::GetProfileParameters, RPacketContext::SetConfig, RPacketQoS::SetProfileParameters, RPacketQoS::GetProfileCapabilities
       
 12893  * @SYMTestExpectedResults Pass - A PDP context with subscribed QoS could be activated.
       
 12894  * @SYMTestType CIT
       
 12895  * @SYMTestCaseDependencies live/automatic
       
 12896  *
       
 12897  * Reason for test: Verify negotiated QoS same as that requested.
       
 12898  *
       
 12899  * @return - TVerdict code
       
 12900  */
       
 12901 	{
       
 12902 
       
 12903 	////////////////////////////////////////////////////////////////
       
 12904 	// SET UP
       
 12905 	////////////////////////////////////////////////////////////////
       
 12906 
       
 12907 	
       
 12908     // Call TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL		
       
 12909     RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
 12910 	CHECK_EQUALS_L(iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(phone), KErrNone, _L("TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL returned with an error"));
       
 12911 
       
 12912     // Get packet service
       
 12913 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, KMainPhone, KMainPacketService);
       
 12914 
       
 12915     // Ensure phone is attached to the packet service
       
 12916     SetAttachModeToWhenPossibleAndWaitForAttachL(packetService);
       
 12917 	
       
 12918 
       
 12919 	////////////////////////////////////////////////////////////////
       
 12920 	// SET UP END
       
 12921 	////////////////////////////////////////////////////////////////
       
 12922 	
       
 12923 	StartTest();
       
 12924 	
       
 12925 	////////////////////////////////////////////////////////////////
       
 12926 	// TEST START
       
 12927 	////////////////////////////////////////////////////////////////
       
 12928 
       
 12929    	// Get network info from phone
       
 12930 	TExtEtelRequestStatus getNetworkStatus(phone, EMobilePhoneGetCurrentNetwork);
       
 12931 	CleanupStack::PushL(getNetworkStatus);
       
 12932 	RMobilePhone::TMobilePhoneNetworkInfoV1 info;
       
 12933 	RMobilePhone::TMobilePhoneNetworkInfoV1Pckg infopckg(info);
       
 12934 	phone.GetCurrentNetwork(getNetworkStatus, infopckg);
       
 12935 
       
 12936 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getNetworkStatus, ETimeLong), KErrNone, _L("RMobilePhone::GetCurrentNetwork timed out"));
       
 12937 	ASSERT_EQUALS(getNetworkStatus.Int(), KErrNone, _L("RMobilePhone::GetCurrentNetwork returned an error"));
       
 12938 
       
 12939 	TPtrC apn, user, pwd;
       
 12940 	iPacketServiceTestHelper.GetGprsSettings(info, apn, user, pwd);
       
 12941 
       
 12942 	// == Activate a PDP context with the requested QOS equal to the subscribed QoS == 
       
 12943 	DEBUG_PRINTF1(_L("== GPRS =="));
       
 12944 	DoTest0058L(apn, user, pwd, EQoSGPRS);
       
 12945 
       
 12946 	// ===  Repeat test for R99_R4 ===
       
 12947 	// Repeat test with TQoSCapsR99_R4 instead of TQoSCapsGPRS, TQoSR99_R4Requested instead of TQoSGPRSRequested and TQoSR99_R4Negotiated instead of TQoSGPRSNegotiated 
       
 12948 	DEBUG_PRINTF1(_L("== R99_R4 =="));
       
 12949 	DoTest0058L(apn, user, pwd, EQoSR4);
       
 12950 
       
 12951 	// ===  Repeat test for R5 ===
       
 12952 	// Repeat test with TQoSCapsR5 instead of TQoSCapsGPRS, TQoSR5Requested instead of TQoSGPRSRequested, and TQoSR5Negotiated instead of TQoSGPRSNegotiated 
       
 12953 	DEBUG_PRINTF1(_L("== R5 =="));
       
 12954 	DoTest0058L(apn, user, pwd, EQoSR5);
       
 12955 
       
 12956 	
       
 12957 	////////////////////////////////////////////////////////////////
       
 12958 	// TEST END
       
 12959 	////////////////////////////////////////////////////////////////
       
 12960 
       
 12961     StartCleanup();
       
 12962 	
       
 12963 	// Pop
       
 12964 	// getNetworkStatus
       
 12965 	CleanupStack::PopAndDestroy(1, &getNetworkStatus);
       
 12966 	
       
 12967 	return TestStepResult();
       
 12968 	}
       
 12969 
       
 12970 
       
 12971 
       
 12972 
       
 12973 void CCTSYIntegrationTestPacketContext0058::DoTest0058L(TPtrC& aApn, TPtrC& aUser, TPtrC& aPwd, TInt aQoSCapType)
       
 12974 /**
       
 12975  * Activate a PDP context with the requested QOS equal to the subscribed QoS.
       
 12976  * @param aNWType Gprs / R99_R4 / R5.
       
 12977  */
       
 12978 	{
       
 12979 	
       
 12980 	// Open a new primary context. 
       
 12981 	RPacketContext& primaryPacketContext = iEtelSessionMgr.GetPrimaryPacketContextL(
       
 12982 											KMainServer,
       
 12983 											KMainPhone,
       
 12984 											KMainPacketService,
       
 12985 											KPrimaryPacketContext1);
       
 12986 
       
 12987 	// Open a new primary context QoS
       
 12988 	RPacketQoS& contextQoS = iEtelSessionMgr.GetPrimaryPacketContextQoSL(
       
 12989 											KMainServer,
       
 12990 											KMainPhone,
       
 12991 											KMainPacketService,
       
 12992 											KPrimaryPacketContext1);
       
 12993 
       
 12994 	// Get the QoS profile capabilities with RPacketQoS::GetProfileCapabilities with aProfileCaps of type TQoSCapsGPRS/TQoSCapsR99_R4/TQoSCapsR5.
       
 12995 	RPacketQoS::TQoSCapsGPRS qosCapsGPRS;
       
 12996 	RPacketQoS::TQoSCapsR99_R4 qosCapsR99;
       
 12997 	RPacketQoS::TQoSCapsR5 qosCapsR5;
       
 12998 
       
 12999 	switch(aQoSCapType)
       
 13000 		{
       
 13001 			case EQoSGPRS:
       
 13002 					GetProfileCapsL(contextQoS, qosCapsGPRS);
       
 13003 					break;
       
 13004 					
       
 13005 			case EQoSR4:		
       
 13006 					GetProfileCapsL(contextQoS, qosCapsR99);
       
 13007 					break;
       
 13008 					
       
 13009 			case EQoSR5:		
       
 13010 					GetProfileCapsL(contextQoS, qosCapsR5);					
       
 13011 					break;
       
 13012 		}
       
 13013 
       
 13014 	// Set the minimum requested QoS profile parameters to lower than what was returned from GetProfileCapabilities using RPacketQoS::SetProfileParameters
       
 13015 	// with aProfile of type TQoSGPRSRequested/TQoSR99_R4Requested/TQoSR5Requested.
       
 13016 	// Set all iMin... to a lower value than that returned by GetProfileCapabilities and all iReq... to the same value as that returned by GetProfileCapabilities. 
       
 13017 	TExtEtelRequestStatus setProfileParametersStatus(contextQoS, EPacketQoSSetProfileParams);
       
 13018 	CleanupStack::PushL(setProfileParametersStatus);
       
 13019 	RPacketQoS::TQoSGPRSRequested qoSGPRSRequested;
       
 13020 	TPckg<RPacketQoS::TQoSGPRSRequested> qoSGPRSRequestedPkg(qoSGPRSRequested);
       
 13021 	RPacketQoS::TQoSR99_R4Requested qoSR99Requested;
       
 13022 	TPckg<RPacketQoS::TQoSR99_R4Requested> qoSR99RequestedPkg(qoSR99Requested);
       
 13023 	RPacketQoS::TQoSR5Requested qoSR5Requested;
       
 13024 	TPckg<RPacketQoS::TQoSR5Requested> qoSR5RequestedPkg(qoSR5Requested);
       
 13025 	RPacketQoS::TBitRate bitRate;
       
 13026 	bitRate.iDownlinkRate = 0;
       
 13027 	bitRate.iUplinkRate = 0;
       
 13028 
       
 13029 	switch(aQoSCapType)
       
 13030 		{
       
 13031 		case EQoSGPRS: // GPRS
       
 13032 			qoSGPRSRequested.iMinDelay 			= RPacketQoS::EUnspecifiedDelayClass;
       
 13033 			qoSGPRSRequested.iMinMeanThroughput = RPacketQoS::EUnspecifiedMeanThroughput;
       
 13034 			qoSGPRSRequested.iMinPeakThroughput = RPacketQoS::EUnspecifiedPeakThroughput;
       
 13035 			qoSGPRSRequested.iMinPrecedence 	= RPacketQoS::EUnspecifiedPrecedence;
       
 13036 			qoSGPRSRequested.iMinReliability 	= RPacketQoS::EUnspecifiedReliabilityClass;
       
 13037 			
       
 13038 			qoSGPRSRequested.iReqDelay 			= RPacketQoS::EDelayClass3;
       
 13039 			qoSGPRSRequested.iReqMeanThroughput = RPacketQoS::EMeanThroughputBestEffort;
       
 13040 			qoSGPRSRequested.iReqPeakThroughput = RPacketQoS::EPeakThroughput8000;
       
 13041 			qoSGPRSRequested.iReqPrecedence 	= RPacketQoS::EPriorityMediumPrecedence;
       
 13042 			qoSGPRSRequested.iReqReliability 	= RPacketQoS::EReliabilityClass3;
       
 13043 			contextQoS.SetProfileParameters(setProfileParametersStatus ,qoSGPRSRequestedPkg);
       
 13044 			break;
       
 13045 		
       
 13046 		case EQoSR4: // R99_R4
       
 13047 			qoSR99Requested.iMinTrafficClass			= RPacketQoS::ETrafficClassUnspecified;
       
 13048 			qoSR99Requested.iMinDeliveryOrderReqd		= RPacketQoS::EDeliveryOrderUnspecified;
       
 13049 			qoSR99Requested.iMinDeliverErroneousSDU		= RPacketQoS::EErroneousSDUDeliveryUnspecified;
       
 13050 			qoSR99Requested.iMinAcceptableMaxSDUSize	= 10;
       
 13051 			qoSR99Requested.iMinAcceptableMaxRate		= bitRate;
       
 13052 			qoSR99Requested.iMaxBER						= RPacketQoS::EBERUnspecified;
       
 13053 			qoSR99Requested.iMaxSDUErrorRatio			= RPacketQoS::ESDUErrorRatioUnspecified;
       
 13054 			qoSR99Requested.iMinTrafficHandlingPriority	= RPacketQoS::ETrafficPriorityUnspecified;
       
 13055 			qoSR99Requested.iMaxTransferDelay			= 4000;
       
 13056 			qoSR99Requested.iMinGuaranteedRate			= bitRate;
       
 13057 
       
 13058 			qoSR99Requested.iReqTrafficClass			= RPacketQoS::ETrafficClassInteractive;
       
 13059 			qoSR99Requested.iReqDeliveryOrderReqd		= RPacketQoS::EDeliveryOrderNotRequired;
       
 13060 			qoSR99Requested.iReqDeliverErroneousSDU		= RPacketQoS::EErroneousSDUDeliveryNotRequired;
       
 13061 			qoSR99Requested.iReqMaxSDUSize				= 1500;
       
 13062 			bitRate.iDownlinkRate = 104;
       
 13063 			bitRate.iUplinkRate = 104;
       
 13064 			qoSR99Requested.iReqMaxRate					= bitRate;
       
 13065 			qoSR99Requested.iReqBER			 			= RPacketQoS::EBERFourPerThousand;
       
 13066 			qoSR99Requested.iReqSDUErrorRatio 			= RPacketQoS::ESDUErrorRatioOnePerThousand;
       
 13067 			qoSR99Requested.iReqTrafficHandlingPriority	= RPacketQoS::ETrafficPriority3;
       
 13068 			qoSR99Requested.iReqTransferDelay			= 1600;
       
 13069 			bitRate.iDownlinkRate = 10;
       
 13070 			bitRate.iUplinkRate = 10;
       
 13071 			qoSR99Requested.iReqGuaranteedRate			= bitRate;
       
 13072 			contextQoS.SetProfileParameters(setProfileParametersStatus ,qoSR99RequestedPkg);
       
 13073 			break;
       
 13074 
       
 13075 		case EQoSR5: // R5
       
 13076 			qoSR5Requested.iMinTrafficClass				= RPacketQoS::ETrafficClassUnspecified;
       
 13077 			qoSR5Requested.iMinDeliveryOrderReqd		= RPacketQoS::EDeliveryOrderUnspecified;
       
 13078 			qoSR5Requested.iMinDeliverErroneousSDU		= RPacketQoS::EErroneousSDUDeliveryUnspecified;
       
 13079 			qoSR5Requested.iMinAcceptableMaxSDUSize		= 10;
       
 13080 			qoSR5Requested.iMinAcceptableMaxRate		= bitRate;
       
 13081 			qoSR5Requested.iMaxBER						= RPacketQoS::EBERUnspecified;
       
 13082 			qoSR5Requested.iMaxSDUErrorRatio			= RPacketQoS::ESDUErrorRatioUnspecified;
       
 13083 			qoSR5Requested.iMinTrafficHandlingPriority	= RPacketQoS::ETrafficPriorityUnspecified;
       
 13084 			qoSR5Requested.iMaxTransferDelay			= 0;
       
 13085 			qoSR5Requested.iMinGuaranteedRate			= bitRate;
       
 13086 			
       
 13087 			qoSR5Requested.iReqTrafficClass				= RPacketQoS::ETrafficClassInteractive;
       
 13088 			qoSR5Requested.iReqDeliveryOrderReqd		= RPacketQoS::EDeliveryOrderNotRequired;
       
 13089 			qoSR5Requested.iReqDeliverErroneousSDU		= RPacketQoS::EErroneousSDUDeliveryNotRequired;
       
 13090 			qoSR5Requested.iReqMaxSDUSize				= 1500;
       
 13091 			bitRate.iDownlinkRate = 64;
       
 13092 			bitRate.iUplinkRate = 16;
       
 13093 			qoSR5Requested.iReqMaxRate					= bitRate;
       
 13094 			qoSR5Requested.iReqBER			 			= RPacketQoS::EBERFourPerThousand;
       
 13095 			qoSR5Requested.iReqSDUErrorRatio 			= RPacketQoS::ESDUErrorRatioOnePerTenThousand;
       
 13096 			qoSR5Requested.iReqTrafficHandlingPriority	= RPacketQoS::ETrafficPriority3;
       
 13097 			qoSR5Requested.iReqTransferDelay			= 1600;
       
 13098 			qoSR5Requested.iReqGuaranteedRate			= bitRate;
       
 13099 			qoSR5Requested.iSignallingIndication		= qosCapsR5.iSignallingIndication;
       
 13100 			qoSR5Requested.iSourceStatisticsDescriptor	= RPacketQoS::ESourceStatisticsDescriptorUnknown;
       
 13101 			contextQoS.SetProfileParameters(setProfileParametersStatus ,qoSR5RequestedPkg);
       
 13102 			break;
       
 13103 		}
       
 13104 
       
 13105     ASSERT_EQUALS(WaitForRequestWithTimeOut(setProfileParametersStatus, ETimeLong), KErrNone, _L("RPacketQoS::SetProfileParameters timed out"));
       
 13106 	ASSERT_EQUALS(setProfileParametersStatus.Int(), KErrNone, _L("RPacketQoS::SetProfileParameters returned with an error"));
       
 13107 
       
 13108 	// Set the context config with RPacketContext::SetConfig 
       
 13109 	TExtEtelRequestStatus setConfigStatus(primaryPacketContext, EPacketContextSetConfig);	
       
 13110 	CleanupStack::PushL(setConfigStatus);
       
 13111 	RPacketContext::TContextConfigGPRS setConfigGprs;
       
 13112 	TPckg<RPacketContext::TContextConfigGPRS> setConfigPkgGprs(setConfigGprs);
       
 13113 	RPacketContext::TContextConfigR99_R4 setConfigR99;
       
 13114 	TPckg<RPacketContext::TContextConfigR99_R4> setConfigPkgR99(setConfigR99);
       
 13115 	RPacketContext::TContextConfig_R5 setConfigR5;
       
 13116 	TPckg<RPacketContext::TContextConfig_R5> setConfigPkgR5(setConfigR5);
       
 13117 
       
 13118 	switch(aQoSCapType)
       
 13119 		{
       
 13120 		case EQoSGPRS: // GPRS
       
 13121 			setConfigGprs.iAccessPointName.Copy(aApn);
       
 13122 			setConfigGprs.iProtocolConfigOption.iAuthInfo.iUsername.Copy(aUser);
       
 13123 			setConfigGprs.iProtocolConfigOption.iAuthInfo.iPassword.Copy(aPwd);
       
 13124 			primaryPacketContext.SetConfig(setConfigStatus, setConfigPkgGprs);
       
 13125 			break;
       
 13126 		
       
 13127 		case EQoSR4: // R99_R4
       
 13128 			setConfigR99.iAccessPointName.Copy(aApn);
       
 13129 			setConfigR99.iProtocolConfigOption.iAuthInfo.iUsername.Copy(aUser);
       
 13130 			setConfigR99.iProtocolConfigOption.iAuthInfo.iPassword.Copy(aPwd);
       
 13131 			primaryPacketContext.SetConfig(setConfigStatus, setConfigPkgR99);
       
 13132 			break;
       
 13133 
       
 13134 		case EQoSR5: // R5
       
 13135 			setConfigR5.iAccessPointName.Copy(aApn);
       
 13136 			setConfigR5.iProtocolConfigOption.iAuthInfo.iUsername.Copy(aUser);
       
 13137 			setConfigR5.iProtocolConfigOption.iAuthInfo.iPassword.Copy(aPwd);
       
 13138 			primaryPacketContext.SetConfig(setConfigStatus, setConfigPkgR5);
       
 13139 			break;
       
 13140 		}
       
 13141 		
       
 13142 	ASSERT_EQUALS(WaitForRequestWithTimeOut(setConfigStatus, ETimeLong), KErrNone, _L("RPacketContext::SetConfig timed out"));
       
 13143 	ASSERT_EQUALS(setConfigStatus.Int(), KErrNone, _L("RPacketContext::SetConfig returned with an error"));
       
 13144 
       
 13145 	// Post notification for RPacketQoS::NotifyProfileChanged
       
 13146 	TExtEtelRequestStatus notifyProfileChangedStatus(contextQoS, EPacketQoSNotifyProfileChanged);
       
 13147 	CleanupStack::PushL(notifyProfileChangedStatus);
       
 13148 	RPacketQoS::TQoSGPRSNegotiated qoSGPRSNegotiated;
       
 13149 	TPckg<RPacketQoS::TQoSGPRSNegotiated> qoSGPRSNegotiatedPkg(qoSGPRSNegotiated);
       
 13150 	RPacketQoS::TQoSR99_R4Negotiated qoSR99Negotiated;
       
 13151 	TPckg<RPacketQoS::TQoSR99_R4Negotiated> qoSR99NegotiatedPkg(qoSR99Negotiated);
       
 13152 	RPacketQoS::TQoSR5Negotiated qoSR5Negotiated;
       
 13153 	TPckg<RPacketQoS::TQoSR5Negotiated> qoSR5NegotiatedPkg(qoSR5Negotiated);
       
 13154 
       
 13155 	switch(aQoSCapType)
       
 13156 		{
       
 13157 		case EQoSGPRS: // GPRS
       
 13158 			contextQoS.NotifyProfileChanged(notifyProfileChangedStatus, qoSGPRSNegotiatedPkg);
       
 13159 			break;
       
 13160 		
       
 13161 		case EQoSR4: // R99_R4
       
 13162 			contextQoS.NotifyProfileChanged(notifyProfileChangedStatus, qoSR99NegotiatedPkg);
       
 13163 			break;
       
 13164 
       
 13165 		case EQoSR5: // R5
       
 13166 			contextQoS.NotifyProfileChanged(notifyProfileChangedStatus, qoSR5NegotiatedPkg);
       
 13167 			break;
       
 13168 		}
       
 13169 
       
 13170 	// Activate the primary context with RPacketContext::Activate. 
       
 13171 	TExtEtelRequestStatus contextActivateStatus(primaryPacketContext, EPacketContextActivate);
       
 13172 	CleanupStack::PushL(contextActivateStatus);
       
 13173 	primaryPacketContext.Activate(contextActivateStatus);
       
 13174 	ASSERT_EQUALS(WaitForRequestWithTimeOut(contextActivateStatus, ETimeLong), KErrNone, _L("RPacketContext::Activate timed out."));
       
 13175 	ASSERT_EQUALS(contextActivateStatus.Int(), KErrNone, _L("RPacketContext::Activate returned with error status."));
       
 13176 
       
 13177 	// Check RPacketQoS::NotifyProfileChanged returns aProfile of type TQoSGPRSNegotiated/TQoSR99_R4Negotiated/TQoSR5Negotiated with same as the requested values used in SetProfileParameters.
       
 13178 	ASSERT_EQUALS(WaitForRequestWithTimeOut(notifyProfileChangedStatus, ETimeLong), KErrNone, _L("RPacketQoS::NotifyProfileChanged timed out"));
       
 13179 	ASSERT_EQUALS(notifyProfileChangedStatus.Int(), KErrNone, _L("RPacketQoS::NotifyProfileChanged returned with error status."));
       
 13180 
       
 13181 	switch(aQoSCapType)
       
 13182 		{
       
 13183 		case EQoSGPRS: // GPRS
       
 13184 			ASSERT_EQUALS(qoSGPRSNegotiated.iDelay, qoSGPRSRequested.iReqDelay, _L("RPacketQoS::NotifyProfileChanged did not return with same iDelay as used in SetProfileParameters"));	
       
 13185 			ASSERT_EQUALS(qoSGPRSNegotiated.iMeanThroughput, qoSGPRSRequested.iReqMeanThroughput, _L("RPacketQoS::NotifyProfileChanged did not return with same iMeanThroughput as used in SetProfileParameters"));
       
 13186 			ASSERT_EQUALS(qoSGPRSNegotiated.iPeakThroughput, qoSGPRSRequested.iReqPeakThroughput, _L("RPacketQoS::NotifyProfileChanged did not return with same iPeakThroughput as used in SetProfileParameters"));	
       
 13187 			ASSERT_EQUALS(qoSGPRSNegotiated.iPrecedence, qoSGPRSRequested.iReqPrecedence, _L("RPacketQoS::NotifyProfileChanged did not return with same iPrecedence as used in SetProfileParameters"));
       
 13188 			ASSERT_EQUALS(qoSGPRSNegotiated.iReliability, qoSGPRSRequested.iReqReliability, _L("RPacketQoS::NotifyProfileChanged did not return with same iReliability as used in SetProfileParameters"));
       
 13189 			break;
       
 13190 		
       
 13191 		case EQoSR4: // R99_R4
       
 13192 			ASSERT_EQUALS(qoSR99Negotiated.iTrafficClass, qoSR99Requested.iReqTrafficClass, _L("RPacketQoS::NotifyProfileChanged did not return with same iTrafficClass as used in SetProfileParameters"));
       
 13193 			ASSERT_EQUALS(qoSR99Negotiated.iDeliveryOrderReqd, qoSR99Requested.iReqDeliveryOrderReqd,  _L("RPacketQoS::NotifyProfileChanged did not return with same iDeliveryOrderReqd as used in SetProfileParameters"));
       
 13194 			ASSERT_EQUALS(qoSR99Negotiated.iDeliverErroneousSDU, qoSR99Requested.iReqDeliverErroneousSDU, _L("RPacketQoS::NotifyProfileChanged did not return with same iDeliverErroneousSDU as used in SetProfileParameters"));
       
 13195 			ASSERT_EQUALS(qoSR99Negotiated.iMaxSDUSize, qoSR99Requested.iReqMaxSDUSize, _L("RPacketQoS::NotifyProfileChanged did not return with same iMaxSDUSize as used in SetProfileParameters"));
       
 13196 			ASSERT_EQUALS(qoSR99Negotiated.iMaxRate.iDownlinkRate, qoSR99Requested.iReqMaxRate.iDownlinkRate, _L("RPacketQoS::NotifyProfileChanged did not return with same iMaxRate.iDownlinkRate as used in SetProfileParameters"));
       
 13197 			ASSERT_EQUALS(qoSR99Negotiated.iMaxRate.iUplinkRate, qoSR99Requested.iReqMaxRate.iUplinkRate, _L("RPacketQoS::NotifyProfileChanged did not return with same iMaxRate.iUplinkRate as used in SetProfileParameters"));
       
 13198 			ASSERT_EQUALS(qoSR99Negotiated.iBER, qoSR99Requested.iReqBER, _L("RPacketQoS::NotifyProfileChanged did not return with same iBER as used in SetProfileParameters"));
       
 13199 			ASSERT_EQUALS(qoSR99Negotiated.iSDUErrorRatio, qoSR99Requested.iReqSDUErrorRatio, _L("RPacketQoS::NotifyProfileChanged did not return with same iSDUErrorRatio as used in SetProfileParameters"));
       
 13200 			ASSERT_EQUALS(qoSR99Negotiated.iTrafficHandlingPriority, qoSR99Requested.iReqTrafficHandlingPriority, _L("RPacketQoS::NotifyProfileChanged did not return with same iTrafficHandlingPriority as used in SetProfileParameters"));
       
 13201 			ASSERT_EQUALS(qoSR99Negotiated.iTransferDelay, qoSR99Requested.iReqTransferDelay, _L("RPacketQoS::NotifyProfileChanged did not return with same iTransferDelay as used in SetProfileParameters"));
       
 13202 			ASSERT_EQUALS(qoSR99Negotiated.iGuaranteedRate.iDownlinkRate, qoSR99Requested.iReqGuaranteedRate.iDownlinkRate, _L("RPacketQoS::NotifyProfileChanged did not return with same iGuaranteedRate.iDownlinkRate as used in SetProfileParameters"));
       
 13203 			ASSERT_EQUALS(qoSR99Negotiated.iGuaranteedRate.iUplinkRate, qoSR99Requested.iReqGuaranteedRate.iUplinkRate, _L("RPacketQoS::NotifyProfileChanged did not return with same iGuaranteedRate.iUplinkRate as used in SetProfileParameters"));
       
 13204 			break;
       
 13205 
       
 13206 		case EQoSR5: // R5
       
 13207 			ASSERT_EQUALS(qoSR5Negotiated.iTrafficClass, qoSR5Requested.iReqTrafficClass, _L("RPacketQoS::NotifyProfileChanged did not return with same iTrafficClass as used in SetProfileParameters"));
       
 13208 			ASSERT_EQUALS(qoSR5Negotiated.iDeliveryOrderReqd, qoSR5Requested.iReqDeliveryOrderReqd, _L("RPacketQoS::NotifyProfileChanged did not return with same iDeliveryOrderReqd as used in SetProfileParameters"));
       
 13209 			ASSERT_EQUALS(qoSR5Negotiated.iDeliverErroneousSDU, qoSR5Requested.iReqDeliverErroneousSDU, _L("RPacketQoS::NotifyProfileChanged did not return with same iDeliverErroneousSDU as used in SetProfileParameters"));
       
 13210 			ASSERT_EQUALS(qoSR5Negotiated.iMaxSDUSize, qoSR5Requested.iReqMaxSDUSize, _L("RPacketQoS::NotifyProfileChanged did not return with same iMaxSDUSize as used in SetProfileParameters"));
       
 13211 			ASSERT_EQUALS(qoSR5Negotiated.iMaxRate.iDownlinkRate, qoSR5Requested.iReqMaxRate.iDownlinkRate, _L("RPacketQoS::NotifyProfileChanged did not return with same iMaxRate.iDownlinkRate as used in SetProfileParameters"));
       
 13212 			ASSERT_EQUALS(qoSR5Negotiated.iMaxRate.iUplinkRate, qoSR5Requested.iReqMaxRate.iUplinkRate, _L("RPacketQoS::NotifyProfileChanged did not return with same iMaxRate.iUplinkRate as used in SetProfileParameters"));
       
 13213 			ASSERT_EQUALS(qoSR5Negotiated.iBER, qoSR5Requested.iReqBER, _L("RPacketQoS::NotifyProfileChanged did not return with same iBER as used in SetProfileParameters"));
       
 13214 			ASSERT_EQUALS(qoSR5Negotiated.iSDUErrorRatio, qoSR5Requested.iReqSDUErrorRatio, _L("RPacketQoS::NotifyProfileChanged did not return with same iSDUErrorRatio as used in SetProfileParameters"));
       
 13215 			ASSERT_EQUALS(qoSR5Negotiated.iTrafficHandlingPriority, qoSR5Requested.iReqTrafficHandlingPriority, _L("RPacketQoS::NotifyProfileChanged did not return with same iTrafficHandlingPriority as used in SetProfileParameters"));
       
 13216 			ASSERT_EQUALS(qoSR5Negotiated.iTransferDelay, qoSR5Requested.iReqTransferDelay, _L("RPacketQoS::NotifyProfileChanged did not return with same iTransferDelay as used in SetProfileParameters"));
       
 13217 			ASSERT_EQUALS(qoSR5Negotiated.iGuaranteedRate.iDownlinkRate, qoSR5Requested.iReqGuaranteedRate.iDownlinkRate, _L("RPacketQoS::NotifyProfileChanged did not return with same iGuaranteedRate.iDownlinkRate as used in SetProfileParameters"));
       
 13218 			ASSERT_EQUALS(qoSR5Negotiated.iGuaranteedRate.iUplinkRate, qoSR5Requested.iReqGuaranteedRate.iUplinkRate,  _L("RPacketQoS::NotifyProfileChanged did not return with same iGuaranteedRate.iUplinkRate as used in SetProfileParameters"));
       
 13219 			ASSERT_EQUALS(qoSR5Negotiated.iSignallingIndication, qoSR5Requested.iSignallingIndication, _L("RPacketQoS::NotifyProfileChanged did not return with same iSignallingIndication as used in SetProfileParameters"));
       
 13220 			ASSERT_EQUALS(qoSR5Negotiated.iSourceStatisticsDescriptor, qoSR5Requested.iSourceStatisticsDescriptor, _L("RPacketQoS::NotifyProfileChanged did not return with same iSourceStatisticsDescriptor as used in SetProfileParameters"));
       
 13221 			break;
       
 13222 		}
       
 13223 
       
 13224 	// Check RPacketQoS::GetProfileParameters returns aProfile of type TQoSGPRSNegotiated/TQoSR99_R4Negotiated/TQoSR5Negotiated with same as the requested values used in SetProfileParameters.
       
 13225 	TExtEtelRequestStatus getProfileParametersStatus(contextQoS, EPacketQoSGetProfileParams);
       
 13226 	CleanupStack::PushL(getProfileParametersStatus);
       
 13227 
       
 13228 	switch(aQoSCapType)
       
 13229 		{
       
 13230 		case EQoSGPRS: // GPRS
       
 13231 			contextQoS.GetProfileParameters(getProfileParametersStatus, qoSGPRSNegotiatedPkg);
       
 13232 			break;
       
 13233 		
       
 13234 		case EQoSR4: // R99_R4
       
 13235 			contextQoS.GetProfileParameters(getProfileParametersStatus, qoSR99NegotiatedPkg);
       
 13236 			break;
       
 13237 
       
 13238 		case EQoSR5: // R5
       
 13239 			contextQoS.GetProfileParameters(getProfileParametersStatus, qoSR5NegotiatedPkg);
       
 13240 			break;
       
 13241 		}
       
 13242 
       
 13243 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getProfileParametersStatus, ETimeLong), KErrNone, _L("RPacketQoS::GetProfileParameters timed out"));
       
 13244 	ASSERT_EQUALS(getProfileParametersStatus.Int(), KErrNone, _L("RPacketQoS::GetProfileParameters returned with an error"));
       
 13245 
       
 13246 	switch(aQoSCapType)
       
 13247 		{
       
 13248 		case EQoSGPRS: // GPRS
       
 13249 			ASSERT_EQUALS(qoSGPRSNegotiated.iDelay, qoSGPRSRequested.iReqDelay, _L("RPacketQoS::NotifyProfileChanged did not return with same iDelay as used in SetProfileParameters"));	
       
 13250 			ASSERT_EQUALS(qoSGPRSNegotiated.iMeanThroughput, qoSGPRSRequested.iReqMeanThroughput, _L("RPacketQoS::NotifyProfileChanged did not return with same iMeanThroughput as used in SetProfileParameters"));
       
 13251 			ASSERT_EQUALS(qoSGPRSNegotiated.iPeakThroughput, qoSGPRSRequested.iReqPeakThroughput, _L("RPacketQoS::NotifyProfileChanged did not return with same iPeakThroughput as used in SetProfileParameters"));	
       
 13252 			ASSERT_EQUALS(qoSGPRSNegotiated.iPrecedence, qoSGPRSRequested.iReqPrecedence, _L("RPacketQoS::NotifyProfileChanged did not return with same iPrecedence as used in SetProfileParameters"));
       
 13253 			ASSERT_EQUALS(qoSGPRSNegotiated.iReliability, qoSGPRSRequested.iReqReliability, _L("RPacketQoS::NotifyProfileChanged did not return with same iReliability as used in SetProfileParameters"));
       
 13254 			break;
       
 13255 		
       
 13256 		case EQoSR4: // R99_R4
       
 13257 			ASSERT_EQUALS(qoSR99Negotiated.iTrafficClass, qoSR99Requested.iReqTrafficClass, _L("RPacketQoS::GetProfileParameters did not return with same iTrafficClass as used in SetProfileParameters"));
       
 13258 			ASSERT_EQUALS(qoSR99Negotiated.iDeliveryOrderReqd, qoSR99Requested.iReqDeliveryOrderReqd, _L("RPacketQoS::GetProfileParameters did not return with same iDeliveryOrderReqd as used in SetProfileParameters"));
       
 13259 			ASSERT_EQUALS(qoSR99Negotiated.iDeliverErroneousSDU, qoSR99Requested.iReqDeliverErroneousSDU, _L("RPacketQoS::GetProfileParameters did not return with same iDeliverErroneousSDU as used in SetProfileParameters"));
       
 13260 			ASSERT_EQUALS(qoSR99Negotiated.iMaxSDUSize, qoSR99Requested.iReqMaxSDUSize, _L("RPacketQoS::GetProfileParameters did not return with same iMaxSDUSize as used in SetProfileParameters"));
       
 13261 			ASSERT_EQUALS(qoSR99Negotiated.iMaxRate.iDownlinkRate, qoSR99Requested.iReqMaxRate.iDownlinkRate, _L("RPacketQoS::GetProfileParameters did not return with same iMaxRate.iDownlinkRate as used in SetProfileParameters"));
       
 13262 			ASSERT_EQUALS(qoSR99Negotiated.iMaxRate.iUplinkRate, qoSR99Requested.iReqMaxRate.iUplinkRate, _L("RPacketQoS::GetProfileParameters did not return with same iMaxRate.iUplinkRate as used in SetProfileParameters"));
       
 13263 			ASSERT_EQUALS(qoSR99Negotiated.iBER, qoSR99Requested.iReqBER, _L("RPacketQoS::GetProfileParameters did not return with same iBER as used in SetProfileParameters"));
       
 13264 			ASSERT_EQUALS(qoSR99Negotiated.iSDUErrorRatio, qoSR99Requested.iReqSDUErrorRatio, _L("RPacketQoS::GetProfileParameters did not return with same iSDUErrorRatio as used in SetProfileParameters"));
       
 13265 			ASSERT_EQUALS(qoSR99Negotiated.iTrafficHandlingPriority, qoSR99Requested.iReqTrafficHandlingPriority, _L("RPacketQoS::GetProfileParameters did not return with same iTrafficHandlingPriority as used in SetProfileParameters"));
       
 13266 			ASSERT_EQUALS(qoSR99Negotiated.iTransferDelay, qoSR99Requested.iReqTransferDelay, _L("RPacketQoS::GetProfileParameters did not return with same iTransferDelay as used in SetProfileParameters"));
       
 13267 			ASSERT_EQUALS(qoSR99Negotiated.iGuaranteedRate.iDownlinkRate, qoSR99Requested.iReqGuaranteedRate.iDownlinkRate, _L("RPacketQoS::GetProfileParameters did not return with same iGuaranteedRate.iDownlinkRate as used in SetProfileParameters"));
       
 13268 			ASSERT_EQUALS(qoSR99Negotiated.iGuaranteedRate.iUplinkRate,qoSR99Requested.iReqGuaranteedRate.iUplinkRate,  _L("RPacketQoS::GetProfileParameters did not return with same iGuaranteedRate.iUplinkRate as used in SetProfileParameters"));
       
 13269 			break;
       
 13270 
       
 13271 		case EQoSR5: // R5
       
 13272 			ASSERT_EQUALS(qoSR5Negotiated.iTrafficClass, qoSR5Requested.iReqTrafficClass, _L("RPacketQoS::GetProfileParameters did not return with same iTrafficClass as used in SetProfileParameters"));
       
 13273 			ASSERT_EQUALS(qoSR5Negotiated.iDeliveryOrderReqd, qoSR5Requested.iReqDeliveryOrderReqd, _L("RPacketQoS::GetProfileParameters did not return with same iDeliveryOrderReqd as used in SetProfileParameters"));
       
 13274 			ASSERT_EQUALS(qoSR5Negotiated.iDeliverErroneousSDU, qoSR5Requested.iReqDeliverErroneousSDU, _L("RPacketQoS::GetProfileParameters did not return with same iDeliverErroneousSDU as used in SetProfileParameters"));
       
 13275 			ASSERT_EQUALS(qoSR5Negotiated.iMaxSDUSize, qoSR5Requested.iReqMaxSDUSize, _L("RPacketQoS::GetProfileParameters did not return with same iMaxSDUSize as used in SetProfileParameters"));
       
 13276 			ASSERT_EQUALS(qoSR5Negotiated.iMaxRate.iDownlinkRate, qoSR5Requested.iReqMaxRate.iDownlinkRate, _L("RPacketQoS::GetProfileParameters did not return with same iMaxRate.iDownlinkRate as used in SetProfileParameters"));
       
 13277 			ASSERT_EQUALS(qoSR5Negotiated.iMaxRate.iUplinkRate, qoSR5Requested.iReqMaxRate.iUplinkRate, _L("RPacketQoS::GetProfileParameters did not return with same iMaxRate.iUplinkRate as used in SetProfileParameters"));
       
 13278 			ASSERT_EQUALS(qoSR5Negotiated.iBER, qoSR5Requested.iReqBER, _L("RPacketQoS::GetProfileParameters did not return with same iBER as used in SetProfileParameters"));
       
 13279 			ASSERT_EQUALS(qoSR5Negotiated.iSDUErrorRatio, qoSR5Requested.iReqSDUErrorRatio, _L("RPacketQoS::GetProfileParameters did not return with same iSDUErrorRatio as used in SetProfileParameters"));
       
 13280 			ASSERT_EQUALS(qoSR5Negotiated.iTrafficHandlingPriority, qoSR5Requested.iReqTrafficHandlingPriority, _L("RPacketQoS::GetProfileParameters did not return with same iTrafficHandlingPriority as used in SetProfileParameters"));
       
 13281 			ASSERT_EQUALS(qoSR5Negotiated.iTransferDelay, qoSR5Requested.iReqTransferDelay, _L("RPacketQoS::GetProfileParameters did not return with same iTransferDelay as used in SetProfileParameters"));
       
 13282 			ASSERT_EQUALS(qoSR5Negotiated.iGuaranteedRate.iDownlinkRate, qoSR5Requested.iReqGuaranteedRate.iDownlinkRate, _L("RPacketQoS::GetProfileParameters did not return with same iGuaranteedRate.iDownlinkRate as used in SetProfileParameters"));
       
 13283 			ASSERT_EQUALS(qoSR5Negotiated.iGuaranteedRate.iUplinkRate, qoSR5Requested.iReqGuaranteedRate.iUplinkRate, _L("RPacketQoS::GetProfileParameters did not return with same iGuaranteedRate.iUplinkRate as used in SetProfileParameters"));
       
 13284 			ASSERT_EQUALS(qoSR5Negotiated.iSignallingIndication, qoSR5Requested.iSignallingIndication, _L("RPacketQoS::GetProfileParameters did not return with same iSignallingIndication as used in SetProfileParameters"));
       
 13285 			ASSERT_EQUALS(qoSR5Negotiated.iSourceStatisticsDescriptor, qoSR5Requested.iSourceStatisticsDescriptor, _L("RPacketQoS::GetProfileParameters did not return with same iSourceStatisticsDescriptor as used in SetProfileParameters"));
       
 13286 			break;
       
 13287 		}
       
 13288 
       
 13289 	// Release primary packet context QoS
       
 13290 	iEtelSessionMgr.ReleasePrimaryPacketContextQoS(KMainServer,
       
 13291 											KMainPhone, 
       
 13292 											KMainPacketService, 
       
 13293 											KPrimaryPacketContext1);
       
 13294 
       
 13295 	// Release primary packet context
       
 13296 	iEtelSessionMgr.ReleasePrimaryPacketContext(KMainServer,
       
 13297 											KMainPhone, 
       
 13298 											KMainPacketService, 
       
 13299 											KPrimaryPacketContext1);
       
 13300 
       
 13301 	// Pop
       
 13302 	// setProfileParametersStatus
       
 13303 	// setConfigStatus
       
 13304 	// notifyProfileChangedStatus
       
 13305 	// contextActivateStatus
       
 13306 	// getProfileParametersStatus
       
 13307 	CleanupStack::PopAndDestroy(5, &setProfileParametersStatus);
       
 13308 
       
 13309 	}
       
 13310 
       
 13311 
       
 13312 TPtrC CCTSYIntegrationTestPacketContext0058::GetTestStepName()
       
 13313 /**
       
 13314  * @return The test step name.
       
 13315  */
       
 13316 	{
       
 13317 	return _L("CCTSYIntegrationTestPacketContext0058");
       
 13318 	}
       
 13319 
       
 13320 
       
 13321 
       
 13322 CCTSYIntegrationTestPacketContext0059::CCTSYIntegrationTestPacketContext0059(CEtelSessionMgr& aEtelSessionMgr)
       
 13323 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
 13324 /**
       
 13325  * Constructor.
       
 13326  */
       
 13327 	{
       
 13328 	SetTestStepName(CCTSYIntegrationTestPacketContext0059::GetTestStepName());
       
 13329 	}
       
 13330 
       
 13331 CCTSYIntegrationTestPacketContext0059::~CCTSYIntegrationTestPacketContext0059()
       
 13332 /**
       
 13333  * Destructor.
       
 13334  */
       
 13335 	{
       
 13336 	}
       
 13337 
       
 13338 TVerdict CCTSYIntegrationTestPacketContext0059::doTestStepL()
       
 13339 /**
       
 13340  * @SYMTestCaseID BA-CTSY-INT-PKTC-0059
       
 13341  * @SYMFssID BA/CTSY/PKTC-0059
       
 13342  * @SYMTestCaseDesc Activate a PDP context with requested QoS is better than subscriber QoS (success scenario).
       
 13343  * @SYMTestPriority High
       
 13344  * @SYMTestActions RPacketQoS::NotifyProfileChanged, RPacketQoS::GetProfileParameters, RPacketContext::SetConfig, RPacketQoS::SetProfileParameters, RPacketQoS::GetProfileCapabilities
       
 13345  * @SYMTestExpectedResults Pass - A PDP context with subscribed QoS could be activated.
       
 13346  * @SYMTestType CIT
       
 13347  * @SYMTestCaseDependencies live/automatic
       
 13348  *
       
 13349  * Reason for test: Verify negotiated QoS same as that requested.
       
 13350  *
       
 13351  * @return - TVerdict code
       
 13352  */
       
 13353 	{
       
 13354 
       
 13355 	////////////////////////////////////////////////////////////////
       
 13356 	// SET UP
       
 13357 	////////////////////////////////////////////////////////////////
       
 13358 
       
 13359 	// Call TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL		
       
 13360     RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
 13361 	CHECK_EQUALS_L(iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(phone), KErrNone, _L("TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL returned with an error"));
       
 13362 
       
 13363     // Get packet service
       
 13364 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, KMainPhone, KMainPacketService);
       
 13365 
       
 13366     // Ensure phone is attached to the packet service
       
 13367     SetAttachModeToWhenPossibleAndWaitForAttachL(packetService);
       
 13368     
       
 13369 
       
 13370 	////////////////////////////////////////////////////////////////
       
 13371 	// SET UP END
       
 13372 	////////////////////////////////////////////////////////////////
       
 13373 	
       
 13374 	StartTest();
       
 13375 	
       
 13376 	////////////////////////////////////////////////////////////////
       
 13377 	// TEST START
       
 13378 	////////////////////////////////////////////////////////////////
       
 13379 	
       
 13380 	// Get network info from phone
       
 13381 	TExtEtelRequestStatus getNetworkStatus(phone, EMobilePhoneGetCurrentNetwork);
       
 13382 	CleanupStack::PushL(getNetworkStatus);
       
 13383 	RMobilePhone::TMobilePhoneNetworkInfoV1 info;
       
 13384 	RMobilePhone::TMobilePhoneNetworkInfoV1Pckg infopckg(info);
       
 13385 	phone.GetCurrentNetwork(getNetworkStatus, infopckg);
       
 13386 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getNetworkStatus, ETimeLong), KErrNone, _L("RMobilePhone::GetCurrentNetwork timed out"));
       
 13387 	ASSERT_EQUALS(getNetworkStatus.Int(), KErrNone, _L("RMobilePhone::GetCurrentNetwork returned an error"));
       
 13388 
       
 13389 	TPtrC apn, user, pwd;
       
 13390 	iPacketServiceTestHelper.GetGprsSettings(info, apn, user, pwd);
       
 13391 	
       
 13392 	// == Activate a PDP context with the requested QoS better than subscribed QoS == 
       
 13393 	DEBUG_PRINTF1(_L("== GPRS =="));
       
 13394 	DoTest0059L(apn, user, pwd, EQoSGPRS);
       
 13395 
       
 13396 	// ===  Repeat test for R99_R4 ===
       
 13397 	// Repeat test with TQoSCapsR99_R4 instead of TQoSCapsGPRS, TQoSR99_R4Requested instead of TQoSGPRSRequested and TQoSR99_R4Negotiated instead of TQoSGPRSNegotiated 	
       
 13398 	DEBUG_PRINTF1(_L("== R99_R4 =="));
       
 13399 	DoTest0059L(apn, user, pwd, EQoSR4);
       
 13400 
       
 13401 	// ===  Repeat test for R5 ===
       
 13402 	// Repeat test with TQoSCapsR5 instead of TQoSCapsGPRS, TQoSR5Requested instead of TQoSGPRSRequested, and TQoSR5Negotiated instead of TQoSGPRSNegotiated 	
       
 13403 	DEBUG_PRINTF1(_L("== R5 =="));
       
 13404 	DoTest0059L(apn, user, pwd, EQoSR5);
       
 13405 	
       
 13406 	////////////////////////////////////////////////////////////////
       
 13407 	// TEST END
       
 13408 	////////////////////////////////////////////////////////////////
       
 13409 
       
 13410     StartCleanup();
       
 13411     
       
 13412     //PopAndDestroy
       
 13413     //getNetWorkStatus
       
 13414     CleanupStack::PopAndDestroy(1, &getNetworkStatus);
       
 13415 	
       
 13416 	return TestStepResult();
       
 13417 	}
       
 13418 	
       
 13419 void CCTSYIntegrationTestPacketContext0059::DoTest0059L(TPtrC& aApn, TPtrC& aUser, TPtrC& aPwd, TInt aQoSCapType)
       
 13420 	{
       
 13421 	/**
       
 13422 	 * Activate a PDP context with the requested QOS better to the subscribed QoS.
       
 13423 	 * @param aQoSCapType Gprs / R99_R4 / R5.
       
 13424 	 */
       
 13425 	
       
 13426 	// Open a new primary context. 	
       
 13427 	RPacketContext& primaryPacketContext = iEtelSessionMgr.GetPrimaryPacketContextL(
       
 13428 											KMainServer,
       
 13429 											KMainPhone,
       
 13430 											KMainPacketService,
       
 13431 											KPrimaryPacketContext1);
       
 13432 											 	
       
 13433 	//Open a new QoS
       
 13434 	RPacketQoS& contextQoS = iEtelSessionMgr.GetPrimaryPacketContextQoSL(
       
 13435 											KMainServer,
       
 13436 											KMainPhone,
       
 13437 											KMainPacketService,
       
 13438 											KPrimaryPacketContext1);
       
 13439 
       
 13440 	//Get the QoS profile capabilities with RPacketQoS::GetProfileCapabilities with aProfileCaps of type TQoSCapsGPRS/TQoSCapsR99_R4/TQoSCapsR5			
       
 13441 	RPacketQoS::TQoSCapsGPRS qosCapsGPRS;
       
 13442 	RPacketQoS::TQoSCapsR99_R4 qosCapsR99;
       
 13443 	RPacketQoS::TQoSCapsR5 qosCapsR5;
       
 13444 
       
 13445 	switch(aQoSCapType)
       
 13446 		{
       
 13447 			case EQoSGPRS:
       
 13448 					GetProfileCapsL(contextQoS, qosCapsGPRS);
       
 13449 					break;
       
 13450 					
       
 13451 			case EQoSR4:		
       
 13452 					GetProfileCapsL(contextQoS, qosCapsR99);
       
 13453 					break;
       
 13454 					
       
 13455 			case EQoSR5:		
       
 13456 					GetProfileCapsL(contextQoS, qosCapsR5);					
       
 13457 					break;
       
 13458 		}
       
 13459 		
       
 13460 	RPacketQoS::TQoSGPRSRequested qosReqCapsGPRS;
       
 13461 	TPckg<RPacketQoS::TQoSGPRSRequested> qosReqCapsGPRSPckg(qosReqCapsGPRS);	
       
 13462 	RPacketQoS::TQoSR99_R4Requested qosReqCapsR99;
       
 13463 	TPckg<RPacketQoS::TQoSR99_R4Requested> qosReqCapsR99Pckg(qosReqCapsR99);	
       
 13464 	RPacketQoS::TQoSR5Requested qosReqCapsR5;
       
 13465 	TPckg<RPacketQoS::TQoSR5Requested> qosReqCapsR5Pckg(qosReqCapsR5);
       
 13466 	
       
 13467 	// Set the minimum requested QoS profile parameters to contain lower(worse) values than those that were returned from GetProfileCapabilities by using SetProfileParameters
       
 13468 	//with aProfile of type TQoSGPRSRequested/TQoSR99_R4Requested/TQoSR5Requested.	
       
 13469 	switch(aQoSCapType)
       
 13470 	{
       
 13471 	
       
 13472 		case EQoSGPRS:																	
       
 13473 				//Min caps			
       
 13474 				qosReqCapsGPRS.iMinDelay = RPacketQoS::EUnspecifiedDelayClass;		
       
 13475 				qosReqCapsGPRS.iMinMeanThroughput =  RPacketQoS::EUnspecifiedMeanThroughput;	
       
 13476 				qosReqCapsGPRS.iMinPeakThroughput = RPacketQoS::EUnspecifiedPeakThroughput;	
       
 13477 				qosReqCapsGPRS.iMinPrecedence = RPacketQoS::EUnspecifiedPrecedence;
       
 13478 				qosReqCapsGPRS.iMinReliability = RPacketQoS::EUnspecifiedReliabilityClass;
       
 13479 						
       
 13480 				//Req caps
       
 13481 				qosReqCapsGPRS.iReqDelay = RPacketQoS::EDelayClass4;
       
 13482 				qosReqCapsGPRS.iReqMeanThroughput =  RPacketQoS::EMeanThroughput100;
       
 13483 				qosReqCapsGPRS.iReqPeakThroughput = RPacketQoS::EPeakThroughput1000;
       
 13484 				qosReqCapsGPRS.iReqPrecedence = RPacketQoS::EPriorityLowPrecedence;
       
 13485 				qosReqCapsGPRS.iReqReliability = RPacketQoS::EReliabilityClass1;				
       
 13486 				break;
       
 13487 				
       
 13488 		case EQoSR4:	
       
 13489 				//min values 				
       
 13490 				qosReqCapsR99.iMinTrafficClass = RPacketQoS::ETrafficClassUnspecified;
       
 13491 				qosReqCapsR99.iMinDeliveryOrderReqd = RPacketQoS::EDeliveryOrderUnspecified;
       
 13492 				qosReqCapsR99.iMinDeliverErroneousSDU = RPacketQoS::EErroneousSDUDeliveryUnspecified;
       
 13493 				qosReqCapsR99.iMinAcceptableMaxSDUSize = 1000;
       
 13494 				qosReqCapsR99.iMinAcceptableMaxRate.iDownlinkRate = 0;
       
 13495 				qosReqCapsR99.iMinAcceptableMaxRate.iUplinkRate = 0;
       
 13496 				qosReqCapsR99.iMaxBER =  RPacketQoS::EBERUnspecified;
       
 13497 				qosReqCapsR99.iMaxSDUErrorRatio = RPacketQoS::ESDUErrorRatioUnspecified;
       
 13498 				qosReqCapsR99.iMinTrafficHandlingPriority = RPacketQoS::ETrafficPriorityUnspecified;
       
 13499 				qosReqCapsR99.iMaxTransferDelay = 4000;
       
 13500 				qosReqCapsR99.iMinGuaranteedRate.iDownlinkRate = 1;
       
 13501 				qosReqCapsR99.iMinGuaranteedRate.iUplinkRate =  1;
       
 13502 	
       
 13503 				//req values 						
       
 13504 				qosReqCapsR99.iReqTrafficClass = RPacketQoS::ETrafficClassConversational;
       
 13505 				qosReqCapsR99.iReqDeliveryOrderReqd = RPacketQoS::EDeliveryOrderRequired;
       
 13506 				qosReqCapsR99.iReqDeliverErroneousSDU = RPacketQoS::EErroneousSDUDeliveryNotRequired;
       
 13507 				qosReqCapsR99.iReqMaxSDUSize = 1500;
       
 13508 				qosReqCapsR99.iReqMaxRate.iDownlinkRate = 16;
       
 13509 				qosReqCapsR99.iReqMaxRate.iUplinkRate = 16;	
       
 13510 				qosReqCapsR99.iReqBER = RPacketQoS::EBERFourPerThousand;
       
 13511 				qosReqCapsR99.iReqSDUErrorRatio = RPacketQoS::ESDUErrorRatioOnePerThousand;	
       
 13512 				qosReqCapsR99.iReqTrafficHandlingPriority = RPacketQoS::ETrafficPriority3;		
       
 13513 				qosReqCapsR99.iReqTransferDelay = 1000;
       
 13514 				qosReqCapsR99.iReqGuaranteedRate.iDownlinkRate = 16;	
       
 13515 				qosReqCapsR99.iReqGuaranteedRate.iUplinkRate = 16;					
       
 13516 				break;
       
 13517 		
       
 13518 		case EQoSR5:						
       
 13519 				//min values
       
 13520 				qosReqCapsR5.iMinTrafficClass = RPacketQoS::ETrafficClassUnspecified;		
       
 13521 				qosReqCapsR5.iMinDeliveryOrderReqd = RPacketQoS::EDeliveryOrderUnspecified;
       
 13522 				qosReqCapsR5.iMinDeliverErroneousSDU = RPacketQoS::EErroneousSDUDeliveryUnspecified;				
       
 13523 				qosReqCapsR5.iMinAcceptableMaxSDUSize = 1000;				
       
 13524 				qosReqCapsR5.iMinAcceptableMaxRate.iDownlinkRate = 0;							
       
 13525 				qosReqCapsR5.iMinAcceptableMaxRate.iUplinkRate = 0;							
       
 13526 				qosReqCapsR5.iMaxBER =  RPacketQoS::EBERUnspecified;	
       
 13527 				qosReqCapsR5.iMaxSDUErrorRatio = RPacketQoS::ESDUErrorRatioUnspecified;			
       
 13528 				qosReqCapsR5.iMinTrafficHandlingPriority = RPacketQoS::ETrafficPriorityUnspecified;		
       
 13529 				qosReqCapsR5.iMaxTransferDelay = 4000;		
       
 13530 				qosReqCapsR5.iMinGuaranteedRate.iDownlinkRate =  1;							
       
 13531 				qosReqCapsR5.iMinGuaranteedRate.iUplinkRate =  1;
       
 13532 											
       
 13533 				//req values 							
       
 13534 				qosReqCapsR5.iReqTrafficClass = RPacketQoS::ETrafficClassInteractive;
       
 13535 				qosReqCapsR5.iReqDeliveryOrderReqd = RPacketQoS::EDeliveryOrderRequired;
       
 13536 				qosReqCapsR5.iReqDeliverErroneousSDU = RPacketQoS::EErroneousSDUDeliveryRequired;
       
 13537 				qosReqCapsR5.iReqMaxSDUSize = 1500;
       
 13538 				qosReqCapsR5.iReqMaxRate.iDownlinkRate = 16;
       
 13539 				qosReqCapsR5.iReqMaxRate.iUplinkRate = 16;
       
 13540 				qosReqCapsR5.iReqBER = RPacketQoS::EBERFivePerHundred;
       
 13541 				qosReqCapsR5.iReqSDUErrorRatio = RPacketQoS::ESDUErrorRatioOnePerMillion;
       
 13542 				qosReqCapsR5.iReqTrafficHandlingPriority = RPacketQoS::ETrafficPriorityUnspecified;
       
 13543 				qosReqCapsR5.iReqTransferDelay = 1000;
       
 13544 				qosReqCapsR5.iReqGuaranteedRate.iDownlinkRate = 16;	
       
 13545 				qosReqCapsR5.iReqGuaranteedRate.iUplinkRate = 16;
       
 13546 				qosReqCapsR5.iSignallingIndication = EFalse;
       
 13547 				qosReqCapsR5.iSourceStatisticsDescriptor = RPacketQoS::ESourceStatisticsDescriptorUnknown;						
       
 13548 				break;	
       
 13549 												
       
 13550 	}
       
 13551 	
       
 13552 	//Set profile parameters	
       
 13553 	TExtEtelRequestStatus reqStatusSetProfileParams(contextQoS,EPacketQoSSetProfileParams);
       
 13554 	CleanupStack::PushL(reqStatusSetProfileParams);
       
 13555 	
       
 13556 	switch(aQoSCapType)
       
 13557 	{
       
 13558 	
       
 13559 		case EQoSGPRS:
       
 13560 				contextQoS.SetProfileParameters(reqStatusSetProfileParams,qosReqCapsGPRSPckg );	
       
 13561 				break;
       
 13562 				
       
 13563 		case EQoSR4:		
       
 13564 				contextQoS.SetProfileParameters(reqStatusSetProfileParams, qosReqCapsR99Pckg);
       
 13565 				break;
       
 13566 				
       
 13567 		case EQoSR5:		
       
 13568 				contextQoS.SetProfileParameters(reqStatusSetProfileParams, qosReqCapsR5Pckg);					
       
 13569 				break;
       
 13570 				
       
 13571 	}
       
 13572 		
       
 13573 	ASSERT_EQUALS(WaitForRequestWithTimeOut(reqStatusSetProfileParams, ETimeMedium), KErrNone, _L("RPacketQoS::SetProfileParameters timed out."));						
       
 13574 	ASSERT_EQUALS(reqStatusSetProfileParams.Int(), KErrNone, _L("RPacketQoS::SetProfileParameters returned with error status."));
       
 13575 
       
 13576 	//post notifier for NotifyProfileChanged
       
 13577 	TExtEtelRequestStatus reqStatusNotifyProfileCh(contextQoS,EPacketQoSNotifyProfileChanged);
       
 13578 	CleanupStack::PushL(reqStatusNotifyProfileCh);
       
 13579 	
       
 13580 	RPacketQoS::TQoSGPRSNegotiated qosNegCapsGPRS;
       
 13581 	TPckg<RPacketQoS::TQoSGPRSNegotiated> qosNegCapsGPRSPckg(qosNegCapsGPRS);
       
 13582 	RPacketQoS::TQoSR99_R4Negotiated qosNegCapsR99;
       
 13583 	TPckg<RPacketQoS::TQoSR99_R4Negotiated> qosNegCapsR99Pckg(qosNegCapsR99);
       
 13584 	RPacketQoS::TQoSR5Negotiated qosNegCapsR5;
       
 13585 	TPckg<RPacketQoS::TQoSR5Negotiated> qosNegCapsR5Pckg(qosNegCapsR5);
       
 13586 	
       
 13587 	switch(aQoSCapType)
       
 13588 	{
       
 13589 	
       
 13590 		case EQoSGPRS:
       
 13591 				contextQoS.NotifyProfileChanged(reqStatusNotifyProfileCh,qosNegCapsGPRSPckg );	
       
 13592 				break;
       
 13593 				
       
 13594 		case EQoSR4:		
       
 13595 				contextQoS.NotifyProfileChanged(reqStatusNotifyProfileCh, qosNegCapsR99Pckg);
       
 13596 				break;
       
 13597 				
       
 13598 		case EQoSR5:		
       
 13599 				contextQoS.NotifyProfileChanged(reqStatusNotifyProfileCh, qosNegCapsR5Pckg);					
       
 13600 				break;
       
 13601 				
       
 13602 	}
       
 13603 	
       
 13604 	// Set the context config with RPacketContext::SetConfig 
       
 13605 	TExtEtelRequestStatus setConfigStatus(primaryPacketContext, EPacketContextSetConfig);	
       
 13606 	CleanupStack::PushL(setConfigStatus);	
       
 13607 	
       
 13608 	RPacketContext::TContextConfigGPRS setConfigGprs;
       
 13609 	TPckg<RPacketContext::TContextConfigGPRS> setConfigPkgGprs(setConfigGprs);
       
 13610 	RPacketContext::TContextConfigR99_R4 setConfigR99;
       
 13611 	TPckg<RPacketContext::TContextConfigR99_R4> setConfigPkgR99(setConfigR99);
       
 13612 	RPacketContext::TContextConfig_R5 setConfigR5;
       
 13613 	TPckg<RPacketContext::TContextConfig_R5> setConfigPkgR5(setConfigR5);
       
 13614 
       
 13615 	switch(aQoSCapType)
       
 13616 		{
       
 13617 		case EQoSGPRS: // GPRS
       
 13618 			setConfigGprs.iAccessPointName.Copy(aApn);
       
 13619 			setConfigGprs.iProtocolConfigOption.iAuthInfo.iUsername.Copy(aUser);
       
 13620 			setConfigGprs.iProtocolConfigOption.iAuthInfo.iPassword.Copy(aPwd);
       
 13621 			primaryPacketContext.SetConfig(setConfigStatus, setConfigPkgGprs);
       
 13622 			break;
       
 13623 		
       
 13624 		case EQoSR4: // R99_R4
       
 13625 			setConfigR99.iAccessPointName.Copy(aApn);
       
 13626 			setConfigR99.iProtocolConfigOption.iAuthInfo.iUsername.Copy(aUser);
       
 13627 			setConfigR99.iProtocolConfigOption.iAuthInfo.iPassword.Copy(aPwd);
       
 13628 			primaryPacketContext.SetConfig(setConfigStatus, setConfigPkgR99);
       
 13629 			break;
       
 13630 
       
 13631 		case EQoSR5: // R5
       
 13632 			setConfigR5.iAccessPointName.Copy(aApn);
       
 13633 			setConfigR5.iProtocolConfigOption.iAuthInfo.iUsername.Copy(aUser);
       
 13634 			setConfigR5.iProtocolConfigOption.iAuthInfo.iPassword.Copy(aPwd);
       
 13635 			primaryPacketContext.SetConfig(setConfigStatus, setConfigPkgR5);
       
 13636 			break;
       
 13637 		}
       
 13638 		
       
 13639 	ASSERT_EQUALS(WaitForRequestWithTimeOut(setConfigStatus, ETimeLong), KErrNone, _L("RPacketContext::SetConfig timed out"));
       
 13640 	ASSERT_EQUALS(setConfigStatus.Int(), KErrNone, _L("RPacketContext::SetConfig returned with an error"));
       
 13641 
       
 13642 	//Activate the primary context with RPacketContext::Activate. 
       
 13643 	TExtEtelRequestStatus contextActivateStatus(primaryPacketContext, EPacketContextActivate);
       
 13644 	CleanupStack::PushL(contextActivateStatus);
       
 13645 	primaryPacketContext.Activate(contextActivateStatus);	
       
 13646 	ASSERT_EQUALS(WaitForRequestWithTimeOut(contextActivateStatus, ETimeLong), KErrNone, _L("RPacketContext::Activate timed out."));
       
 13647 	ASSERT_EQUALS(contextActivateStatus.Int(), KErrNone, _L("RPacketContext::Activate returned with error status."));
       
 13648 	
       
 13649 	//Check RPacketQoS::NotifyProfileChanged returns aProfile of type TQoSGPRSNegotiated/TQoSR99_R4Negotiated/TQoSR5Negotiated 
       
 13650 	//with higher(better) value as the requested minimum value used with SetProfileParameters	
       
 13651 	ASSERT_EQUALS(WaitForRequestWithTimeOut(reqStatusNotifyProfileCh, ETimeMedium), KErrNone, _L("RPacketQoS::NotifyProfileChanged timed out."));						
       
 13652 	ASSERT_EQUALS(reqStatusNotifyProfileCh.Int(), KErrNone, _L("RPacketQoS::NotifyProfileChanged returned with error status."));
       
 13653 		
       
 13654 	switch(aQoSCapType)
       
 13655 	{
       
 13656 	
       
 13657 		case EQoSGPRS:	
       
 13658 														
       
 13659 				ASSERT_TRUE(qosNegCapsGPRS.iDelay > qosReqCapsGPRS.iMinDelay, _L("Negotiated QoS iDelay is not better than minimun requested Qos iDelay"));
       
 13660 				ASSERT_TRUE(qosNegCapsGPRS.iMeanThroughput > qosReqCapsGPRS.iMinMeanThroughput, _L("Negotiated QoS iMeanThroughput is not better than minimun requested Qos iMeanThroughput"));
       
 13661 				ASSERT_TRUE(qosNegCapsGPRS.iPeakThroughput > qosReqCapsGPRS.iMinPeakThroughput, _L("Negotiated QoS iPeakThroughput is not better than minimun requested Qos iPeakThroughput"));
       
 13662 				ASSERT_TRUE(qosNegCapsGPRS.iPrecedence > qosReqCapsGPRS.iMinPrecedence, _L("Negotiated QoS iPrecedence is not better than minimun requested Qos iPrecedence"));
       
 13663 				ASSERT_TRUE(qosNegCapsGPRS.iReliability > qosReqCapsGPRS.iMinReliability, _L("Negotiated QoS iPrecedence is not better than minimun requested Qos iPrecedence"));
       
 13664 				break;
       
 13665 				
       
 13666 		case EQoSR4:	
       
 13667 				
       
 13668 				ASSERT_TRUE(qosNegCapsR99.iTrafficClass > qosReqCapsR99.iMinTrafficClass, _L("Negotiated QoS iTrafficClass is not better than minimun requested Qos iTrafficClass"));
       
 13669 				ASSERT_TRUE(qosNegCapsR99.iDeliveryOrderReqd > qosReqCapsR99.iMinDeliveryOrderReqd, _L("Negotiated QoS iDeliveryOrderReqd is not better than minimun requested Qos iDeliveryOrderReqd"));
       
 13670 				ASSERT_TRUE(qosNegCapsR99.iDeliverErroneousSDU > qosReqCapsR99.iMinDeliverErroneousSDU, _L("Negotiated QoS iDeliverErroneousSDU is not better than minimun requested Qos iDeliverErroneousSDU"));
       
 13671 				ASSERT_TRUE(qosNegCapsR99.iMaxSDUSize > qosReqCapsR99.iMinAcceptableMaxSDUSize, _L("Negotiated QoS iMaxSDUSize is not better than minimun requested Qos iMaxSDUSize"));
       
 13672 				ASSERT_TRUE(qosNegCapsR99.iMaxRate.iDownlinkRate > qosReqCapsR99.iMinAcceptableMaxRate.iDownlinkRate, _L("Negotiated QoS iMaxRate.iDownlinkRate is not better than minimun requested Qos iMaxRate.iDownlinkRate"));
       
 13673 				ASSERT_TRUE(qosNegCapsR99.iMaxRate.iUplinkRate > qosReqCapsR99.iMinAcceptableMaxRate.iUplinkRate, _L("Negotiated QoS iMaxRate.iUplinkRate is not better than minimun requested Qos iMaxRate.iUplinkRate"));
       
 13674 				ASSERT_TRUE(qosNegCapsR99.iBER > qosReqCapsR99.iMaxBER, _L("Negotiated QoS iMaxSDUSize is not better than minimun requested Qos iMaxSDUSize"));
       
 13675 				ASSERT_TRUE(qosNegCapsR99.iSDUErrorRatio > qosReqCapsR99.iMaxSDUErrorRatio, _L("Negotiated QoS iSDUErrorRatio is not better than minimun requested Qos iSDUErrorRatio"));
       
 13676 				ASSERT_TRUE(qosNegCapsR99.iTrafficHandlingPriority > qosReqCapsR99.iMinTrafficHandlingPriority, _L("Negotiated QoS iTrafficHandlingPriority is not better than minimun requested Qos iTrafficHandlingPriority"));
       
 13677 				ASSERT_TRUE(qosNegCapsR99.iTransferDelay < qosReqCapsR99.iMaxTransferDelay, _L("Negotiated QoS iTransferDelay is not better than minimun requested Qos iTransferDelay"));
       
 13678 				ASSERT_TRUE(qosNegCapsR99.iGuaranteedRate.iDownlinkRate > qosReqCapsR99.iMinGuaranteedRate.iDownlinkRate, _L("Negotiated QoS iGuaranteedRate.iDownlinkRate is not better than minimun requested Qos iGuaranteedRate.iDownlinkRate"));
       
 13679 				ASSERT_TRUE(qosNegCapsR99.iGuaranteedRate.iUplinkRate > qosReqCapsR99.iMinGuaranteedRate.iUplinkRate, _L("Negotiated QoS iGuaranteedRate.iUplinkRate is not better than minimun requested Qos iGuaranteedRate.iUplinkRate"));
       
 13680 				break;
       
 13681 				
       
 13682 		case EQoSR5:
       
 13683 									
       
 13684 				ASSERT_TRUE(qosNegCapsR5.iTrafficClass > qosReqCapsR5.iMinTrafficClass, _L("Negotiated QoS iTrafficClass is not better than minimun requested Qos iTrafficClass"));
       
 13685 				ASSERT_TRUE(qosNegCapsR5.iDeliveryOrderReqd > qosReqCapsR5.iMinDeliveryOrderReqd, _L("Negotiated QoS iDeliveryOrderReqd is not better than minimun requested Qos iDeliveryOrderReqd"));
       
 13686 				ASSERT_TRUE(qosNegCapsR5.iDeliverErroneousSDU > qosReqCapsR5.iMinDeliverErroneousSDU, _L("Negotiated QoS iDeliverErroneousSDU is not better than minimun requested Qos iDeliverErroneousSDU"));
       
 13687 				ASSERT_TRUE(qosNegCapsR5.iMaxSDUSize > qosReqCapsR5.iMinAcceptableMaxSDUSize, _L("Negotiated QoS iMaxSDUSize is not better than minimun requested Qos iMaxSDUSize"));
       
 13688 				ASSERT_TRUE(qosNegCapsR5.iMaxRate.iDownlinkRate > qosReqCapsR5.iMinAcceptableMaxRate.iDownlinkRate, _L("Negotiated QoS iMaxRate.iDownlinkRate is not better than minimun requested Qos iMaxRate.iDownlinkRate"));
       
 13689 				ASSERT_TRUE(qosNegCapsR5.iMaxRate.iUplinkRate > qosReqCapsR5.iMinAcceptableMaxRate.iUplinkRate, _L("Negotiated QoS iMaxRate.iUplinkRate is not better than minimun requested Qos iMaxRate.iUplinkRate"));
       
 13690 				ASSERT_TRUE(qosNegCapsR5.iBER > qosReqCapsR5.iMaxBER, _L("Negotiated QoS iMaxSDUSize is not better than minimun requested Qos iMaxSDUSize"));
       
 13691 				ASSERT_TRUE(qosNegCapsR5.iSDUErrorRatio > qosReqCapsR5.iMaxSDUErrorRatio, _L("Negotiated QoS iSDUErrorRatio is not better than minimun requested Qos iSDUErrorRatio"));
       
 13692 				ASSERT_TRUE(qosNegCapsR5.iTrafficHandlingPriority > qosReqCapsR5.iMinTrafficHandlingPriority, _L("Negotiated QoS iTrafficHandlingPriority is not better than minimun requested Qos iTrafficHandlingPriority"));
       
 13693 				ASSERT_TRUE(qosNegCapsR5.iTransferDelay < qosReqCapsR5.iMaxTransferDelay, _L("Negotiated QoS iTransferDelay is not better than minimun requested Qos iTransferDelay"));
       
 13694 				ASSERT_TRUE(qosNegCapsR5.iGuaranteedRate.iDownlinkRate > qosReqCapsR5.iMinGuaranteedRate.iDownlinkRate, _L("Negotiated QoS iGuaranteedRate.iDownlinkRate is not better than minimun requested Qos iGuaranteedRate.iDownlinkRate"));
       
 13695 				ASSERT_TRUE(qosNegCapsR5.iGuaranteedRate.iUplinkRate > qosReqCapsR5.iMinGuaranteedRate.iUplinkRate, _L("Negotiated QoS iGuaranteedRate.iUplinkRate is not better than minimun requested Qos iGuaranteedRate.iUplinkRate"));		
       
 13696 				break;
       
 13697 				
       
 13698 	}
       
 13699 	
       
 13700 	RPacketQoS::TQoSGPRSNegotiated qosNegCapsNumberTwoGPRS;
       
 13701 	TPckg<RPacketQoS::TQoSGPRSNegotiated> qosNegCapsNumberTwoGPRSPckg(qosNegCapsNumberTwoGPRS);
       
 13702 	RPacketQoS::TQoSR99_R4Negotiated qosNegCapsNumberTwoR99;
       
 13703 	TPckg<RPacketQoS::TQoSR99_R4Negotiated> qosNegCapsNumberTwoR99Pckg(qosNegCapsNumberTwoR99);
       
 13704 	RPacketQoS::TQoSR5Negotiated qosNegCapsNumberTwoR5;
       
 13705 	TPckg<RPacketQoS::TQoSR5Negotiated> qosNegCapsNumberTwoR5Pckg(qosNegCapsNumberTwoR5);
       
 13706 		
       
 13707 	//Check RPacketQoS::GetProfileParameters returns aProfile of type TQoSGPRSNegotiated/TQoSR99_R4Negotiated/TQoSR5Negotiated 
       
 13708 	//with higher(better) value as the requested minimum value used with SetProfileParameters
       
 13709 	TExtEtelRequestStatus reqStatusGetProfileParams(contextQoS,EPacketQoSGetProfileParams);
       
 13710 	CleanupStack::PushL(reqStatusGetProfileParams);
       
 13711 	
       
 13712 	switch(aQoSCapType)
       
 13713 	{
       
 13714 	
       
 13715 		case EQoSGPRS:
       
 13716 				contextQoS.GetProfileParameters(reqStatusGetProfileParams, qosNegCapsNumberTwoGPRSPckg);	
       
 13717 				break;
       
 13718 				
       
 13719 		case EQoSR4:		
       
 13720 				contextQoS.GetProfileParameters(reqStatusGetProfileParams, qosNegCapsNumberTwoR99Pckg);
       
 13721 				break;
       
 13722 				
       
 13723 		case EQoSR5:		
       
 13724 				contextQoS.GetProfileParameters(reqStatusGetProfileParams, qosNegCapsNumberTwoR5Pckg);					
       
 13725 				break;
       
 13726 				
       
 13727 	}
       
 13728 		
       
 13729 	ASSERT_EQUALS(WaitForRequestWithTimeOut(reqStatusGetProfileParams, ETimeMedium), KErrNone, _L("RPacketQoS::GetProfileParameters timed out."));						
       
 13730 	ASSERT_EQUALS(reqStatusGetProfileParams.Int(), KErrNone, _L("RPacketQoS::GetProfileParameters returned with error status."));
       
 13731 	
       
 13732 	switch(aQoSCapType)
       
 13733 	{
       
 13734 	
       
 13735 		case EQoSGPRS:
       
 13736 		
       
 13737 				ASSERT_TRUE(qosNegCapsNumberTwoGPRS.iDelay > qosReqCapsGPRS.iMinDelay, _L("Negotiated QoS iDelay is not better than minimun requested Qos iDelay"));
       
 13738 				ASSERT_TRUE(qosNegCapsNumberTwoGPRS.iMeanThroughput > qosReqCapsGPRS.iMinMeanThroughput, _L("Negotiated QoS iMeanThroughput is not better than minimun requested Qos iMeanThroughput"));
       
 13739 				ASSERT_TRUE(qosNegCapsNumberTwoGPRS.iPeakThroughput > qosReqCapsGPRS.iMinPeakThroughput, _L("Negotiated QoS iPeakThroughput is not better than minimun requested Qos iPeakThroughput"));
       
 13740 				ASSERT_TRUE(qosNegCapsNumberTwoGPRS.iPrecedence > qosReqCapsGPRS.iMinPrecedence, _L("Negotiated QoS iPrecedence is not better than minimun requested Qos iPrecedence"));
       
 13741 				ASSERT_TRUE(qosNegCapsNumberTwoGPRS.iReliability > qosReqCapsGPRS.iMinReliability, _L("Negotiated QoS iPrecedence is not better than minimun requested Qos iPrecedence"));
       
 13742 				break;
       
 13743 		
       
 13744 		case EQoSR4:
       
 13745 		
       
 13746 				ASSERT_TRUE(qosNegCapsNumberTwoR99.iTrafficClass > qosReqCapsR99.iMinTrafficClass, _L("Negotiated QoS iTrafficClass is not better than minimun requested Qos iTrafficClass"));
       
 13747 				ASSERT_TRUE(qosNegCapsNumberTwoR99.iDeliveryOrderReqd > qosReqCapsR99.iMinDeliveryOrderReqd, _L("Negotiated QoS iDeliveryOrderReqd is not better than minimun requested Qos iDeliveryOrderReqd"));
       
 13748 				ASSERT_TRUE(qosNegCapsNumberTwoR99.iDeliverErroneousSDU > qosReqCapsR99.iMinDeliverErroneousSDU, _L("Negotiated QoS iDeliverErroneousSDU is not better than minimun requested Qos iDeliverErroneousSDU"));
       
 13749 				ASSERT_TRUE(qosNegCapsNumberTwoR99.iMaxSDUSize > qosReqCapsR99.iMinAcceptableMaxSDUSize, _L("Negotiated QoS iMaxSDUSize is not better than minimun requested Qos iMaxSDUSize"));
       
 13750 				ASSERT_TRUE(qosNegCapsNumberTwoR99.iMaxRate.iDownlinkRate > qosReqCapsR99.iMinAcceptableMaxRate.iDownlinkRate, _L("Negotiated QoS iMaxRate.iDownlinkRate is not better than minimun requested Qos iMaxRate.iDownlinkRate"));
       
 13751 				ASSERT_TRUE(qosNegCapsNumberTwoR99.iMaxRate.iUplinkRate > qosReqCapsR99.iMinAcceptableMaxRate.iUplinkRate, _L("Negotiated QoS iMaxRate.iUplinkRate is not better than minimun requested Qos iMaxRate.iUplinkRate"));
       
 13752 				ASSERT_TRUE(qosNegCapsNumberTwoR99.iBER > qosReqCapsR99.iMaxBER, _L("Negotiated QoS iMaxSDUSize is not better than minimun requested Qos iMaxSDUSize"));
       
 13753 				ASSERT_TRUE(qosNegCapsNumberTwoR99.iSDUErrorRatio > qosReqCapsR99.iMaxSDUErrorRatio, _L("Negotiated QoS iSDUErrorRatio is not better than minimun requested Qos iSDUErrorRatio"));
       
 13754 				ASSERT_TRUE(qosNegCapsNumberTwoR99.iTrafficHandlingPriority > qosReqCapsR99.iMinTrafficHandlingPriority, _L("Negotiated QoS iTrafficHandlingPriority is not better than minimun requested Qos iTrafficHandlingPriority"));
       
 13755 				ASSERT_TRUE(qosNegCapsNumberTwoR99.iTransferDelay < qosReqCapsR99.iMaxTransferDelay, _L("Negotiated QoS iTransferDelay is not better than minimun requested Qos iTransferDelay"));
       
 13756 				ASSERT_TRUE(qosNegCapsNumberTwoR99.iGuaranteedRate.iDownlinkRate > qosReqCapsR99.iMinGuaranteedRate.iDownlinkRate, _L("Negotiated QoS iGuaranteedRate.iDownlinkRate is not better than minimun requested Qos iGuaranteedRate.iDownlinkRate"));
       
 13757 				ASSERT_TRUE(qosNegCapsNumberTwoR99.iGuaranteedRate.iUplinkRate > qosReqCapsR99.iMinGuaranteedRate.iUplinkRate, _L("Negotiated QoS iGuaranteedRate.iUplinkRate is not better than minimun requested Qos iGuaranteedRate.iUplinkRate"));
       
 13758 				break;
       
 13759 				
       
 13760 		case EQoSR5:
       
 13761 				
       
 13762 				ASSERT_TRUE(qosNegCapsNumberTwoR5.iTrafficClass > qosReqCapsR5.iMinTrafficClass, _L("Negotiated QoS iTrafficClass is not better than minimun requested Qos iTrafficClass"));
       
 13763 				ASSERT_TRUE(qosNegCapsNumberTwoR5.iDeliveryOrderReqd > qosReqCapsR5.iMinDeliveryOrderReqd, _L("Negotiated QoS iDeliveryOrderReqd is not better than minimun requested Qos iDeliveryOrderReqd"));
       
 13764 				ASSERT_TRUE(qosNegCapsNumberTwoR5.iDeliverErroneousSDU > qosReqCapsR5.iMinDeliverErroneousSDU, _L("Negotiated QoS iDeliverErroneousSDU is not better than minimun requested Qos iDeliverErroneousSDU"));
       
 13765 				ASSERT_TRUE(qosNegCapsNumberTwoR5.iMaxSDUSize > qosReqCapsR5.iMinAcceptableMaxSDUSize, _L("Negotiated QoS iMaxSDUSize is not better than minimun requested Qos iMaxSDUSize"));
       
 13766 				ASSERT_TRUE(qosNegCapsNumberTwoR5.iMaxRate.iDownlinkRate > qosReqCapsR5.iMinAcceptableMaxRate.iDownlinkRate, _L("Negotiated QoS iMaxRate.iDownlinkRate is not better than minimun requested Qos iMaxRate.iDownlinkRate"));
       
 13767 				ASSERT_TRUE(qosNegCapsNumberTwoR5.iMaxRate.iUplinkRate > qosReqCapsR5.iMinAcceptableMaxRate.iUplinkRate, _L("Negotiated QoS iMaxRate.iUplinkRate is not better than minimun requested Qos iMaxRate.iUplinkRate"));
       
 13768 				ASSERT_TRUE(qosNegCapsNumberTwoR5.iBER > qosReqCapsR5.iMaxBER, _L("Negotiated QoS iMaxSDUSize is not better than minimun requested Qos iMaxSDUSize"));
       
 13769 				ASSERT_TRUE(qosNegCapsNumberTwoR5.iSDUErrorRatio > qosReqCapsR5.iMaxSDUErrorRatio, _L("Negotiated QoS iSDUErrorRatio is not better than minimun requested Qos iSDUErrorRatio"));
       
 13770 				ASSERT_TRUE(qosNegCapsNumberTwoR5.iTrafficHandlingPriority > qosReqCapsR5.iMinTrafficHandlingPriority, _L("Negotiated QoS iTrafficHandlingPriority is not better than minimun requested Qos iTrafficHandlingPriority"));
       
 13771 				ASSERT_TRUE(qosNegCapsNumberTwoR5.iTransferDelay < qosReqCapsR5.iMaxTransferDelay, _L("Negotiated QoS iTransferDelay is not better than minimun requested Qos iTransferDelay"));
       
 13772 				ASSERT_TRUE(qosNegCapsNumberTwoR5.iGuaranteedRate.iDownlinkRate > qosReqCapsR5.iMinGuaranteedRate.iDownlinkRate, _L("Negotiated QoS iGuaranteedRate.iDownlinkRate is not better than minimun requested Qos iGuaranteedRate.iDownlinkRate"));
       
 13773 				ASSERT_TRUE(qosNegCapsNumberTwoR5.iGuaranteedRate.iUplinkRate > qosReqCapsR5.iMinGuaranteedRate.iUplinkRate, _L("Negotiated QoS iGuaranteedRate.iUplinkRate is not better than minimun requested Qos iGuaranteedRate.iUplinkRate"));		
       
 13774 				break;
       
 13775 							
       
 13776 	}
       
 13777 				
       
 13778 	//Release QoS
       
 13779 	iEtelSessionMgr.ReleasePrimaryPacketContextQoS(KMainServer,
       
 13780 											KMainPhone, 
       
 13781 											KMainPacketService, 
       
 13782 											KPrimaryPacketContext1);
       
 13783 	
       
 13784 			
       
 13785 	// Release packet context
       
 13786 	iEtelSessionMgr.ReleasePrimaryPacketContext(KMainServer,
       
 13787 											KMainPhone, 
       
 13788 											KMainPacketService, 
       
 13789 											KPrimaryPacketContext1);
       
 13790 	
       
 13791 	//PopAndDestroy
       
 13792 	//reqStatusSetProfileParams
       
 13793 	//reqStatusNotifyProfileCh
       
 13794 	//setConfigStatus
       
 13795 	//contextActivateStatus
       
 13796 	//reqStatusGetProfileParams	
       
 13797 	
       
 13798 	CleanupStack::PopAndDestroy(5,&reqStatusSetProfileParams);
       
 13799 
       
 13800 
       
 13801 	}
       
 13802 
       
 13803 TPtrC CCTSYIntegrationTestPacketContext0059::GetTestStepName()
       
 13804 /**
       
 13805  * @return The test step name.
       
 13806  */
       
 13807 	{
       
 13808 	return _L("CCTSYIntegrationTestPacketContext0059");
       
 13809 	}
       
 13810 
       
 13811 
       
 13812 
       
 13813 CCTSYIntegrationTestPacketContext0060::CCTSYIntegrationTestPacketContext0060(CEtelSessionMgr& aEtelSessionMgr)
       
 13814 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
 13815 /**
       
 13816  * Constructor.
       
 13817  */
       
 13818 	{
       
 13819 	SetTestStepName(CCTSYIntegrationTestPacketContext0060::GetTestStepName());
       
 13820 	}
       
 13821 
       
 13822 CCTSYIntegrationTestPacketContext0060::~CCTSYIntegrationTestPacketContext0060()
       
 13823 /**
       
 13824  * Destructor.
       
 13825  */
       
 13826 	{
       
 13827 	}
       
 13828 
       
 13829 TVerdict CCTSYIntegrationTestPacketContext0060::doTestStepL()
       
 13830 /**
       
 13831  * @SYMTestCaseID BA-CTSY-INT-PKTC-0060
       
 13832  * @SYMFssID BA/CTSY/PKTC-0060
       
 13833  * @SYMTestCaseDesc Activate a PDP context can be activated with requested QOS better than subscribed QOS (failure scenario).
       
 13834  * @SYMTestPriority High
       
 13835  * @SYMTestActions RPacketQos::SetProfileParameters, RPacketContext::Activate, RPacketQos::GetProfileParameters
       
 13836  * @SYMTestExpectedResults Pass - A PDP context with subscribed QoS could be activated. Negotiated QoS lower than requested.
       
 13837  * @SYMTestType CIT
       
 13838  * @SYMTestCaseDependencies live/automatic
       
 13839  *
       
 13840  * Reason for test: Verify negotiated QoS lower than that requested.
       
 13841  *
       
 13842  * @return - TVerdict code
       
 13843  */
       
 13844 	{
       
 13845 
       
 13846 	////////////////////////////////////////////////////////////////
       
 13847 	// SET UP
       
 13848 	////////////////////////////////////////////////////////////////
       
 13849 
       
 13850 												 
       
 13851 	// Call TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL		
       
 13852     RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
 13853 	CHECK_EQUALS_L(iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(phone), KErrNone, _L("TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL returned with an error"));
       
 13854     
       
 13855     // Get packet service
       
 13856 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, KMainPhone, KMainPacketService);
       
 13857     	
       
 13858     // Ensure phone is attached to the packet service
       
 13859     SetAttachModeToWhenPossibleAndWaitForAttachL(packetService);
       
 13860   
       
 13861     	
       
 13862 	////////////////////////////////////////////////////////////////
       
 13863 	// SET UP END
       
 13864 	////////////////////////////////////////////////////////////////
       
 13865 	
       
 13866 	StartTest();
       
 13867 	
       
 13868 	////////////////////////////////////////////////////////////////
       
 13869 	// TEST START
       
 13870 	////////////////////////////////////////////////////////////////
       
 13871 		
       
 13872 	// Get network info from phone
       
 13873 	TExtEtelRequestStatus getNetworkStatus(phone, EMobilePhoneGetCurrentNetwork);
       
 13874 	CleanupStack::PushL(getNetworkStatus);
       
 13875 	RMobilePhone::TMobilePhoneNetworkInfoV1 info;
       
 13876 	RMobilePhone::TMobilePhoneNetworkInfoV1Pckg infopckg(info);
       
 13877 	phone.GetCurrentNetwork(getNetworkStatus, infopckg);
       
 13878 
       
 13879 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getNetworkStatus, ETimeLong), KErrNone, _L("RMobilePhone::GetCurrentNetwork timed out"));
       
 13880 	ASSERT_EQUALS(getNetworkStatus.Int(), KErrNone, _L("RMobilePhone::GetCurrentNetwork returned an error"));
       
 13881 
       
 13882 	TPtrC apn, user, pwd;
       
 13883 	iPacketServiceTestHelper.GetGprsSettings(info, apn, user, pwd);
       
 13884 
       
 13885 	// == Activate a PDP context with the requested QOS better than subscribed QOS (failure scenario) by using TQoSCapsGPRS, TQoSGPRSRequested, TQoSGPRSNegotiated   ==
       
 13886 	DEBUG_PRINTF1(_L("== GPRS =="));		
       
 13887 	DoTest0060L(apn, user, pwd, EQoSGPRS);
       
 13888 		
       
 13889 	// ===  Repeat test for R99_R4 ===
       
 13890 	// Repeat test with TQoSCapsR99_R4 instead of TQoSCapsGPRS, TQoSR99_R4Requested instead of TQoSGPRSRequested and TQoSR99_R4Negotiated instead of TQoSGPRSNegotiated 
       
 13891 	DEBUG_PRINTF1(_L("== R99_R4 =="));
       
 13892 	DoTest0060L(apn, user, pwd, EQoSR4);
       
 13893 	
       
 13894 	// ===  Repeat test for R5 ===
       
 13895 	// Repeat test with TQoSCapsR5 instead of TQoSCapsGPRS, TQoSR5Requested instead of TQoSGPRSRequested, and TQoSR5Negotiated instead of TQoSGPRSNegotiated 
       
 13896 	DEBUG_PRINTF1(_L("== R5 =="));
       
 13897 	DoTest0060L(apn, user, pwd, EQoSR5);
       
 13898 	
       
 13899 
       
 13900 	////////////////////////////////////////////////////////////////
       
 13901 	// TEST END
       
 13902 	////////////////////////////////////////////////////////////////
       
 13903 
       
 13904     StartCleanup();
       
 13905 	
       
 13906 	// Pop
       
 13907 	// getNetworkStatus
       
 13908 	CleanupStack::PopAndDestroy(1, &getNetworkStatus);
       
 13909 	
       
 13910 	return TestStepResult();
       
 13911 	}
       
 13912 
       
 13913 void CCTSYIntegrationTestPacketContext0060::DoTest0060L( TPtrC& aApn, TPtrC& aUser, TPtrC& aPwd, TInt aQoSCapType )
       
 13914 /**
       
 13915  * Activates primary packet context with default context parameters.
       
 13916  * @param aNetworkType Gprs / R99_R4 / R5.
       
 13917  */
       
 13918     {
       
 13919 		
       
 13920  	// Open a new primary context. 
       
 13921 	RPacketContext& packetContext = iEtelSessionMgr.GetPrimaryPacketContextL(
       
 13922 												KMainServer,
       
 13923 												KMainPhone,
       
 13924 												KMainPacketService,
       
 13925 												KPrimaryPacketContext1);
       
 13926 			
       
 13927 	// Open a new QoS from the primary context												
       
 13928 	RPacketQoS& packetQoS = iEtelSessionMgr.GetPrimaryPacketContextQoSL(
       
 13929 												KMainServer,
       
 13930 												KMainPhone,
       
 13931 												KMainPacketService, 
       
 13932 												KPrimaryPacketContext1);
       
 13933 	
       
 13934     //Get the QoS profile capabilities with RPacketQoS::GetProfileCapabilities with aProfileCaps of type TQoSCapsGPRS/TQoSCapsR99_R4/TQoSCapsR5			
       
 13935 	RPacketQoS::TQoSCapsGPRS qosCapsGPRS;
       
 13936 	RPacketQoS::TQoSCapsR99_R4 qosCapsR99;
       
 13937 	RPacketQoS::TQoSCapsR5 qosCapsR5;
       
 13938 
       
 13939 	switch(aQoSCapType)
       
 13940 		{
       
 13941 			case EQoSGPRS:
       
 13942 					GetProfileCapsL(packetQoS, qosCapsGPRS);
       
 13943 					break;
       
 13944 					
       
 13945 			case EQoSR4:		
       
 13946 					GetProfileCapsL(packetQoS, qosCapsR99);
       
 13947 					break;
       
 13948 					
       
 13949 			case EQoSR5:		
       
 13950 					GetProfileCapsL(packetQoS, qosCapsR5);					
       
 13951 					break;
       
 13952 		}
       
 13953 		
       
 13954 		
       
 13955 	// Set the minimum requested QoS profile parameters to lower than what was returned from GetProfileCapabilities using RPacketQoS::SetProfileParameters
       
 13956 	// with aProfile of type TQoSGPRSRequested/TQoSR99_R4Requested/TQoSR5Requested.
       
 13957 	// Set all iMin... to a lower value than that returned by GetProfileCapabilities and all iReq... to a maximum value allowable by the API. 
       
 13958 	RPacketQoS::TQoSGPRSRequested qosGprsRequested;
       
 13959 	TPckg<RPacketQoS::TQoSGPRSRequested> qosGprsReqPckg(qosGprsRequested);
       
 13960 	RPacketQoS::TQoSR99_R4Requested qosR99_R4Requested;
       
 13961 	TPckg<RPacketQoS::TQoSR99_R4Requested> qosR99_R4ReqPckg(qosR99_R4Requested);	
       
 13962 	RPacketQoS::TQoSR5Requested qosR5Requested;
       
 13963 	TPckg<RPacketQoS::TQoSR5Requested> qosR5ReqPckg(qosR5Requested);
       
 13964 	RPacketQoS::TBitRate bitRate;
       
 13965 	bitRate.iDownlinkRate = 0;
       
 13966 	bitRate.iUplinkRate = 0;
       
 13967 	
       
 13968 	TExtEtelRequestStatus setProfileParamStatus(packetQoS, EPacketQoSSetProfileParams);
       
 13969 	CleanupStack::PushL(setProfileParamStatus);	
       
 13970 
       
 13971 	switch(aQoSCapType)
       
 13972 		{
       
 13973 		case EQoSGPRS: // GPRS	
       
 13974 		//Min caps		
       
 13975 		qosGprsRequested.iMinDelay 			= RPacketQoS::EUnspecifiedDelayClass;
       
 13976 		qosGprsRequested.iMinMeanThroughput = RPacketQoS::EUnspecifiedMeanThroughput;
       
 13977 		qosGprsRequested.iMinPeakThroughput = RPacketQoS::EUnspecifiedPeakThroughput;
       
 13978 		qosGprsRequested.iMinPrecedence 	= RPacketQoS::EUnspecifiedPrecedence;
       
 13979 		qosGprsRequested.iMinReliability 	= RPacketQoS::EUnspecifiedReliabilityClass;
       
 13980 		//Request caps
       
 13981 		qosGprsRequested.iReqDelay          = RPacketQoS::EDelayClass1;
       
 13982 		qosGprsRequested.iReqMeanThroughput = RPacketQoS::EMeanThroughput50000000;
       
 13983 		qosGprsRequested.iReqPeakThroughput = RPacketQoS::EPeakThroughput256000;
       
 13984 		qosGprsRequested.iReqReliability    = RPacketQoS::EReliabilityClass1;
       
 13985 		qosGprsRequested.iReqPrecedence     = RPacketQoS::EPriorityHighPrecedence;
       
 13986 		packetQoS.SetProfileParameters(setProfileParamStatus, qosGprsReqPckg);
       
 13987 		break;
       
 13988 			
       
 13989 		case EQoSR4: // R99_R4
       
 13990 		//Min caps
       
 13991 		qosR99_R4Requested.iMinTrafficClass				= RPacketQoS::ETrafficClassUnspecified;
       
 13992 		qosR99_R4Requested.iMinDeliveryOrderReqd		= RPacketQoS::EDeliveryOrderUnspecified;
       
 13993 		qosR99_R4Requested.iMinDeliverErroneousSDU		= RPacketQoS::EErroneousSDUNoDetection;
       
 13994 		qosR99_R4Requested.iMinAcceptableMaxSDUSize		= 10;
       
 13995 		qosR99_R4Requested.iMinAcceptableMaxRate		= bitRate;
       
 13996 		qosR99_R4Requested.iMaxBER						= RPacketQoS::EBERUnspecified;
       
 13997 		qosR99_R4Requested.iMaxSDUErrorRatio			= RPacketQoS::ESDUErrorRatioUnspecified;
       
 13998 		qosR99_R4Requested.iMinTrafficHandlingPriority	= RPacketQoS::ETrafficPriorityUnspecified;
       
 13999 		qosR99_R4Requested.iMaxTransferDelay			= 4000;
       
 14000 		qosR99_R4Requested.iMinGuaranteedRate			= bitRate;
       
 14001 		//Request caps
       
 14002 		qosR99_R4Requested.iReqTrafficClass				= RPacketQoS::ETrafficClassConversational;
       
 14003 		qosR99_R4Requested.iReqDeliveryOrderReqd		= RPacketQoS::EDeliveryOrderRequired;
       
 14004 		qosR99_R4Requested.iReqDeliverErroneousSDU		= RPacketQoS::EErroneousSDUNoDetection;
       
 14005 		qosR99_R4Requested.iReqMaxSDUSize				= 1520;
       
 14006 		bitRate.iDownlinkRate = 16000;
       
 14007 		bitRate.iUplinkRate = 16000;
       
 14008 		qosR99_R4Requested.iReqMaxRate					= bitRate;
       
 14009 		qosR99_R4Requested.iReqBER						= RPacketQoS::EBERSixPerHundredMillion;
       
 14010 		qosR99_R4Requested.iReqSDUErrorRatio 			= RPacketQoS::ESDUErrorRatioOnePerMillion;
       
 14011 		qosR99_R4Requested.iReqTrafficHandlingPriority	= RPacketQoS::ETrafficPriority1;
       
 14012 		qosR99_R4Requested.iReqTransferDelay			= 10;
       
 14013 		qosR99_R4Requested.iReqGuaranteedRate			= bitRate;
       
 14014 		packetQoS.SetProfileParameters(setProfileParamStatus, qosR99_R4ReqPckg);
       
 14015 		break;
       
 14016 		
       
 14017 		case EQoSR5: // R5
       
 14018 		//Min caps
       
 14019 		qosR5Requested.iMinTrafficClass				= RPacketQoS::ETrafficClassUnspecified;
       
 14020 		qosR5Requested.iMinDeliveryOrderReqd		= RPacketQoS::EDeliveryOrderUnspecified;
       
 14021 		qosR5Requested.iMinDeliverErroneousSDU		= RPacketQoS::EErroneousSDUDeliveryUnspecified;
       
 14022 		qosR5Requested.iMinAcceptableMaxSDUSize		= 10;
       
 14023 		qosR5Requested.iMinAcceptableMaxRate		= bitRate;
       
 14024 		qosR5Requested.iMaxBER						= RPacketQoS::EBERUnspecified;
       
 14025 		qosR5Requested.iMaxSDUErrorRatio			= RPacketQoS::ESDUErrorRatioUnspecified;
       
 14026 		qosR5Requested.iMinTrafficHandlingPriority	= RPacketQoS::ETrafficPriorityUnspecified;
       
 14027 		qosR5Requested.iMaxTransferDelay			= 0;
       
 14028 		qosR5Requested.iMinGuaranteedRate			= bitRate;
       
 14029 		//Request caps
       
 14030 		qosR5Requested.iReqTrafficClass				= RPacketQoS::ETrafficClassConversational;
       
 14031 		qosR5Requested.iReqDeliveryOrderReqd		= RPacketQoS::EDeliveryOrderRequired;
       
 14032 		qosR5Requested.iReqDeliverErroneousSDU		= RPacketQoS::EErroneousSDUNoDetection;
       
 14033 		qosR5Requested.iReqMaxSDUSize				= 1520;
       
 14034 		bitRate.iDownlinkRate = 16000;
       
 14035 		bitRate.iUplinkRate = 16000;
       
 14036 		qosR5Requested.iReqMaxRate					= bitRate;
       
 14037 		qosR5Requested.iReqBER						= RPacketQoS::EBERSixPerHundredMillion;
       
 14038 		qosR5Requested.iReqSDUErrorRatio 			= RPacketQoS::ESDUErrorRatioOnePerMillion;
       
 14039 		qosR5Requested.iReqTrafficHandlingPriority	= RPacketQoS::ETrafficPriority1;
       
 14040 		qosR5Requested.iReqTransferDelay			= 10;
       
 14041 		qosR5Requested.iReqGuaranteedRate			= bitRate;
       
 14042 		qosR5Requested.iSignallingIndication		= ETrue;
       
 14043 		qosR5Requested.iSourceStatisticsDescriptor	= RPacketQoS::ESourceStatisticsDescriptorSpeech;
       
 14044 		packetQoS.SetProfileParameters(setProfileParamStatus, qosR5ReqPckg);
       
 14045 		break;
       
 14046 		}
       
 14047 
       
 14048 	ASSERT_EQUALS(WaitForRequestWithTimeOut(setProfileParamStatus, ETimeMedium), KErrNone, _L("RPacketQoS::SetProfileParameters timed out."));						
       
 14049 	ASSERT_EQUALS(setProfileParamStatus.Int(), KErrNone, _L("RPacketQoS::SetProfileParameters returned with error status."));
       
 14050 
       
 14051 	// Set the context config with RPacketContext::SetConfig 
       
 14052 	RPacketContext::TContextConfigGPRS gprsConfig;
       
 14053 	TPckg<RPacketContext::TContextConfigGPRS> gprsConfigPk(gprsConfig);
       
 14054 	RPacketContext::TContextConfigR99_R4 r99_r4Config;
       
 14055 	TPckg<RPacketContext::TContextConfigR99_R4> r99_r4ConfigPk(r99_r4Config);
       
 14056 	RPacketContext::TContextConfig_R5 r5Config;
       
 14057 	TPckg<RPacketContext::TContextConfig_R5> r5ConfigPk(r5Config);
       
 14058 	
       
 14059 	TExtEtelRequestStatus setConfigStatus(packetContext, EPacketContextSetConfig);	
       
 14060 	CleanupStack::PushL(setConfigStatus);
       
 14061 
       
 14062 	switch(aQoSCapType)
       
 14063 		{
       
 14064 		case EQoSGPRS: // GPRS	
       
 14065 		gprsConfig.iAccessPointName.Copy(aApn);
       
 14066 		gprsConfig.iProtocolConfigOption.iAuthInfo.iUsername.Copy(aUser);
       
 14067 		gprsConfig.iProtocolConfigOption.iAuthInfo.iPassword.Copy(aPwd);
       
 14068 		packetContext.SetConfig(setConfigStatus, gprsConfigPk);
       
 14069 		break;
       
 14070 		
       
 14071 		case EQoSR4: // R99_R4	
       
 14072 		r99_r4Config.iAccessPointName.Copy(aApn);
       
 14073 		r99_r4Config.iProtocolConfigOption.iAuthInfo.iUsername.Copy(aUser);
       
 14074 		r99_r4Config.iProtocolConfigOption.iAuthInfo.iPassword.Copy(aPwd);
       
 14075 		packetContext.SetConfig(setConfigStatus, r99_r4ConfigPk);
       
 14076 		break;
       
 14077 		
       
 14078 		case EQoSR5: // R5 
       
 14079 		r5Config.iAccessPointName.Copy(aApn);
       
 14080 		r5Config.iProtocolConfigOption.iAuthInfo.iUsername.Copy(aUser);
       
 14081 		r5Config.iProtocolConfigOption.iAuthInfo.iPassword.Copy(aPwd);
       
 14082 		packetContext.SetConfig(setConfigStatus, r5ConfigPk);
       
 14083 		break;
       
 14084 		}
       
 14085 
       
 14086 	ASSERT_EQUALS(WaitForRequestWithTimeOut(setConfigStatus, ETimeLong), KErrNone, _L("RPacketContext::SetConfig timed out"));
       
 14087 	ASSERT_EQUALS(setConfigStatus.Int(), KErrNone, _L("RPacketContext::SetConfig returned with error status."));
       
 14088 	
       
 14089 	//post notifier for NotifyProfileChanged
       
 14090 	TExtEtelRequestStatus notifyProfileChangedStatus (packetQoS, EPacketQoSNotifyProfileChanged);
       
 14091 	CleanupStack::PushL(notifyProfileChangedStatus);
       
 14092 	RPacketQoS::TQoSGPRSNegotiated gprsNegotiatedQoSValues;
       
 14093 	TPckg<RPacketQoS::TQoSGPRSNegotiated> gprsNegotiatedQoSPk(gprsNegotiatedQoSValues);
       
 14094 	RPacketQoS::TQoSR99_R4Negotiated r99_r4NegotiatedQoSValues;
       
 14095 	TPckg<RPacketQoS::TQoSR99_R4Negotiated> r99_r4NegotiatedQoSPk(r99_r4NegotiatedQoSValues);
       
 14096 	RPacketQoS::TQoSR5Negotiated r5NegotiatedQoSValues;
       
 14097 	TPckg<RPacketQoS::TQoSR5Negotiated> r5NegotiatedQoSPk(r5NegotiatedQoSValues);
       
 14098 	
       
 14099 	switch(aQoSCapType)
       
 14100 		{
       
 14101 		case EQoSGPRS: // GPRS
       
 14102 		packetQoS.NotifyProfileChanged(notifyProfileChangedStatus, gprsNegotiatedQoSPk);
       
 14103 		break;
       
 14104 		
       
 14105 		case EQoSR4: // R99_R4
       
 14106 		packetQoS.NotifyProfileChanged(notifyProfileChangedStatus, r99_r4NegotiatedQoSPk);
       
 14107 		break;
       
 14108 
       
 14109 		case EQoSR5: // R5
       
 14110 		packetQoS.NotifyProfileChanged(notifyProfileChangedStatus, r5NegotiatedQoSPk);
       
 14111 		break;
       
 14112 		} 
       
 14113 				
       
 14114 	// Activate the primary context with RPacketContext::Activate. 
       
 14115 	TExtEtelRequestStatus contextActivateStatus(packetContext, EPacketContextActivate);
       
 14116 	CleanupStack::PushL(contextActivateStatus);
       
 14117 	packetContext.Activate(contextActivateStatus);
       
 14118 	
       
 14119 	ASSERT_EQUALS(WaitForRequestWithTimeOut(contextActivateStatus, ETimeLong), KErrNone, _L("RPacketContext::Activate timed out."));
       
 14120 	ASSERT_EQUALS(contextActivateStatus.Int(), KErrNone, _L("RPacketContext::Activate returned with error status."));
       
 14121 	
       
 14122 	// Check RPacketQoS::NotifyProfileChanged returns aProfile of type TQoSGPRSNegotiated/TQoSR99_R4Negotiated/TQoSR5Negotiated with lower values than the requested values used in SetProfileParameters.
       
 14123 	ASSERT_EQUALS(WaitForRequestWithTimeOut(notifyProfileChangedStatus, ETimeLong), KErrNone, _L("RPacketQoS::NotifyProfileChanged timed out"));
       
 14124 	ASSERT_EQUALS(notifyProfileChangedStatus.Int(), KErrNone, _L("RPacketQoS::NotifyProfileChanged returned with error status."));
       
 14125 
       
 14126 	switch(aQoSCapType)
       
 14127 		{
       
 14128 		case EQoSGPRS: // GPRS	
       
 14129 		ASSERT_TRUE(gprsNegotiatedQoSValues.iDelay > qosGprsRequested.iReqDelay, _L("RPacketQoS::NotifyProfileChanged did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iDelay."));
       
 14130 		// Network returns EMeanThroughputBestEffort (0x80000) which is is higher than best EMeanThroughput50000000 (0x40000). That is why comparison must be this way
       
 14131 		ASSERT_TRUE(gprsNegotiatedQoSValues.iMeanThroughput > qosGprsRequested.iReqMeanThroughput, _L("RPacketQoS::NotifyProfileChanged did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iMeanThroughput."));	
       
 14132 		ASSERT_TRUE(gprsNegotiatedQoSValues.iPeakThroughput < qosGprsRequested.iReqPeakThroughput, _L("RPacketQoS::NotifyProfileChanged did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iPeakThroughput."));		
       
 14133 		ASSERT_TRUE(gprsNegotiatedQoSValues.iReliability > qosGprsRequested.iReqReliability, _L("RPacketQoS::NotifyProfileChanged did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iReliability."));
       
 14134 		ASSERT_TRUE(gprsNegotiatedQoSValues.iPrecedence > qosGprsRequested.iReqPrecedence, _L("RPacketQoS::NotifyProfileChanged did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iPrecedence."));
       
 14135 		break;
       
 14136 		
       
 14137 		case EQoSR4: // R99_R4			
       
 14138 		ASSERT_TRUE(r99_r4NegotiatedQoSValues.iTrafficClass > qosR99_R4Requested.iReqTrafficClass, _L("RPacketQoS::NotifyProfileChanged did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iTrafficClass"));
       
 14139 		ASSERT_TRUE(r99_r4NegotiatedQoSValues.iDeliveryOrderReqd > qosR99_R4Requested.iReqDeliveryOrderReqd, _L("RPacketQoS::NotifyProfileChanged did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iDeliveryOrderReqd."));	
       
 14140 		ASSERT_TRUE(r99_r4NegotiatedQoSValues.iDeliverErroneousSDU > qosR99_R4Requested.iReqDeliverErroneousSDU, _L("RPacketQoS::NotifyProfileChanged did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iDeliverErroneousSDU."));								
       
 14141 		ASSERT_TRUE(r99_r4NegotiatedQoSValues.iMaxSDUSize < qosR99_R4Requested.iReqMaxSDUSize, _L("RPacketQoS::NotifyProfileChanged did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iMaxSDUSize."));
       
 14142 		ASSERT_TRUE(r99_r4NegotiatedQoSValues.iMaxRate.iDownlinkRate < qosR99_R4Requested.iReqMaxRate.iDownlinkRate, _L("RPacketQoS::NotifyProfileChanged did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iMaxRate.iDownlinkRate"));
       
 14143 		ASSERT_TRUE(r99_r4NegotiatedQoSValues.iMaxRate.iUplinkRate < qosR99_R4Requested.iReqMaxRate.iUplinkRate, _L("RPacketQoS::NotifyProfileChanged did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iMaxRate.iUplinkRate"));
       
 14144 		ASSERT_TRUE(r99_r4NegotiatedQoSValues.iBER < qosR99_R4Requested.iReqBER, _L("RPacketQoS::NotifyProfileChanged did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iBER."));
       
 14145 		ASSERT_TRUE(r99_r4NegotiatedQoSValues.iSDUErrorRatio < qosR99_R4Requested.iReqSDUErrorRatio, _L("RPacketQoS::NotifyProfileChanged did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iSDUErrorRatio."));
       
 14146 		ASSERT_TRUE(r99_r4NegotiatedQoSValues.iTrafficHandlingPriority > qosR99_R4Requested.iReqTrafficHandlingPriority, _L("RPacketQoS::NotifyProfileChanged did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iTrafficHandlingPriority."));	
       
 14147 		ASSERT_TRUE(r99_r4NegotiatedQoSValues.iTransferDelay > qosR99_R4Requested.iReqTransferDelay, _L("RPacketQoS::NotifyProfileChanged did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iTransferDelay"));
       
 14148 		ASSERT_TRUE(r99_r4NegotiatedQoSValues.iGuaranteedRate.iDownlinkRate < qosR99_R4Requested.iReqGuaranteedRate.iDownlinkRate, _L("RPacketQoS::NotifyProfileChanged did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iGuaranteedRate.iDownlinkRate"));
       
 14149 		ASSERT_TRUE(r99_r4NegotiatedQoSValues.iGuaranteedRate.iUplinkRate < qosR99_R4Requested.iReqGuaranteedRate.iUplinkRate, _L("RPacketQoS::NotifyProfileChanged did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iGuaranteedRate.iUplinkRate"));
       
 14150 		break;
       
 14151 
       
 14152 		case EQoSR5: // R5		
       
 14153 		ASSERT_TRUE(r5NegotiatedQoSValues.iTrafficClass > qosR5Requested.iReqTrafficClass, _L("RPacketQoS::NotifyProfileChanged did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iTrafficClass"));
       
 14154 		ASSERT_TRUE(r5NegotiatedQoSValues.iDeliveryOrderReqd > qosR5Requested.iReqDeliveryOrderReqd, _L("RPacketQoS::NotifyProfileChanged did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iDeliveryOrderReqd."));	
       
 14155 		ASSERT_TRUE(r5NegotiatedQoSValues.iDeliverErroneousSDU > qosR5Requested.iReqDeliverErroneousSDU, _L("RPacketQoS::NotifyProfileChanged did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iDeliverErroneousSDU."));								
       
 14156 		ASSERT_TRUE(r5NegotiatedQoSValues.iMaxSDUSize < qosR5Requested.iReqMaxSDUSize, _L("RPacketQoS::NotifyProfileChanged did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iMaxSDUSize."));
       
 14157 		ASSERT_TRUE(r5NegotiatedQoSValues.iMaxRate.iDownlinkRate < qosR5Requested.iReqMaxRate.iDownlinkRate, _L("RPacketQoS::NotifyProfileChanged did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iMaxRate.iDownlinkRate"));
       
 14158 		ASSERT_TRUE(r5NegotiatedQoSValues.iMaxRate.iUplinkRate < qosR5Requested.iReqMaxRate.iUplinkRate, _L("RPacketQoS::NotifyProfileChanged did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iMaxRate.iUplinkRate"));
       
 14159 		ASSERT_TRUE(r5NegotiatedQoSValues.iBER < qosR5Requested.iReqBER, _L("RPacketQoS::NotifyProfileChanged did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iBER."));
       
 14160 		ASSERT_TRUE(r5NegotiatedQoSValues.iSDUErrorRatio < qosR5Requested.iReqSDUErrorRatio, _L("RPacketQoS::NotifyProfileChanged did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iSDUErrorRatio."));
       
 14161 		ASSERT_TRUE(r5NegotiatedQoSValues.iTrafficHandlingPriority > qosR5Requested.iReqTrafficHandlingPriority, _L("RPacketQoS::NotifyProfileChanged did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iTrafficHandlingPriority."));	
       
 14162 		ASSERT_TRUE(r5NegotiatedQoSValues.iTransferDelay > qosR5Requested.iReqTransferDelay, _L("RPacketQoS::NotifyProfileChanged did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iTransferDelay"));
       
 14163 		ASSERT_TRUE(r5NegotiatedQoSValues.iGuaranteedRate.iDownlinkRate < qosR5Requested.iReqGuaranteedRate.iDownlinkRate, _L("RPacketQoS::NotifyProfileChanged did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iGuaranteedRate.iDownlinkRate"));
       
 14164 		ASSERT_TRUE(r5NegotiatedQoSValues.iGuaranteedRate.iUplinkRate < qosR5Requested.iReqGuaranteedRate.iUplinkRate, _L("RPacketQoS::NotifyProfileChanged did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iGuaranteedRate.iUplinkRate"));
       
 14165 		ASSERT_TRUE(r5NegotiatedQoSValues.iSignallingIndication < qosR5Requested.iSignallingIndication, _L("RPacketQoS::NotifyProfileChanged did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iSignallingIndication."));
       
 14166 		ASSERT_TRUE(r5NegotiatedQoSValues.iSourceStatisticsDescriptor < qosR5Requested.iSourceStatisticsDescriptor, _L("RPacketQoS::NotifyProfileChanged did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iSourceStatisticsDescriptor."));				
       
 14167 		break;	
       
 14168 		}	
       
 14169 			
       
 14170 	// Check RPacketQoS::GetProfileParameters returns aProfile of type TQoSGPRSNegotiated/TQoSR99_R4Negotiated/TQoSR5Negotiated with lower values than the requested values used in SetProfileParameters.
       
 14171 	TExtEtelRequestStatus getProfileParametersStatus (packetQoS, EPacketQoSGetProfileParams);
       
 14172 	CleanupStack::PushL(getProfileParametersStatus);
       
 14173 	
       
 14174 	switch(aQoSCapType)
       
 14175 		{
       
 14176 		case EQoSGPRS: // GPRS	
       
 14177 		packetQoS.GetProfileParameters(getProfileParametersStatus, gprsNegotiatedQoSPk);
       
 14178 		ASSERT_EQUALS(WaitForRequestWithTimeOut(getProfileParametersStatus, ETimeLong), KErrNone, _L("RPacketQoS::GetProfileParameters timed out"));
       
 14179 		ASSERT_EQUALS(getProfileParametersStatus.Int(), KErrNone, _L("RPacketQoS::GetProfileParameters returned with an error"));
       
 14180 		ASSERT_TRUE(gprsNegotiatedQoSValues.iDelay > qosGprsRequested.iReqDelay, _L("RPacketQoS::GetProfileParameters did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iDelay."));
       
 14181 		// Network returns EMeanThroughputBestEffort (0x80000) which is is higher than best EMeanThroughput50000000 (0x40000). That is why comparison must be this way
       
 14182 		ASSERT_TRUE(gprsNegotiatedQoSValues.iMeanThroughput > qosGprsRequested.iReqMeanThroughput, _L("RPacketQoS::GetProfileParameters did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iMeanThroughput."));	
       
 14183 		ASSERT_TRUE(gprsNegotiatedQoSValues.iPeakThroughput < qosGprsRequested.iReqPeakThroughput, _L("RPacketQoS::GetProfileParameters did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iPeakThroughput."));		
       
 14184 		ASSERT_TRUE(gprsNegotiatedQoSValues.iReliability > qosGprsRequested.iReqReliability, _L("RPacketQoS::GetProfileParameters did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iReliability."));
       
 14185 		ASSERT_TRUE(gprsNegotiatedQoSValues.iPrecedence > qosGprsRequested.iReqPrecedence, _L("RPacketQoS::GetProfileParameters did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iPrecedence."));
       
 14186 		break;
       
 14187 		
       
 14188 		case EQoSR4: // R99_R4
       
 14189 		packetQoS.GetProfileParameters(getProfileParametersStatus, r99_r4NegotiatedQoSPk);
       
 14190 		ASSERT_EQUALS(WaitForRequestWithTimeOut(getProfileParametersStatus, ETimeLong), KErrNone, _L("RPacketQoS::GetProfileParameters timed out"));
       
 14191 		ASSERT_EQUALS(getProfileParametersStatus.Int(), KErrNone, _L("RPacketQoS::GetProfileParameters returned with an error"));
       
 14192 		ASSERT_TRUE(r99_r4NegotiatedQoSValues.iTrafficClass > qosR99_R4Requested.iReqTrafficClass, _L("RPacketQoS::GetProfileParameters did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iTrafficClass"));
       
 14193 		ASSERT_TRUE(r99_r4NegotiatedQoSValues.iDeliveryOrderReqd > qosR99_R4Requested.iReqDeliveryOrderReqd, _L("RPacketQoS::GetProfileParameters did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iDeliveryOrderReqd."));	
       
 14194 		ASSERT_TRUE(r99_r4NegotiatedQoSValues.iDeliverErroneousSDU > qosR99_R4Requested.iReqDeliverErroneousSDU, _L("RPacketQoS::GetProfileParameters did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iDeliverErroneousSDU."));								
       
 14195 		ASSERT_TRUE(r99_r4NegotiatedQoSValues.iMaxSDUSize < qosR99_R4Requested.iReqMaxSDUSize, _L("RPacketQoS::GetProfileParameters did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iMaxSDUSize."));
       
 14196 		ASSERT_TRUE(r99_r4NegotiatedQoSValues.iMaxRate.iDownlinkRate < qosR99_R4Requested.iReqMaxRate.iDownlinkRate, _L("RPacketQoS::GetProfileParameters did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iMaxRate.iDownlinkRate"));
       
 14197 		ASSERT_TRUE(r99_r4NegotiatedQoSValues.iMaxRate.iUplinkRate < qosR99_R4Requested.iReqMaxRate.iUplinkRate, _L("RPacketQoS::GetProfileParameters did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iMaxRate.iUplinkRate"));
       
 14198 		ASSERT_TRUE(r99_r4NegotiatedQoSValues.iBER < qosR99_R4Requested.iReqBER, _L("RPacketQoS::GetProfileParameters did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iBER."));
       
 14199 		ASSERT_TRUE(r99_r4NegotiatedQoSValues.iSDUErrorRatio < qosR99_R4Requested.iReqSDUErrorRatio, _L("RPacketQoS::GetProfileParameters did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iSDUErrorRatio."));
       
 14200 		ASSERT_TRUE(r99_r4NegotiatedQoSValues.iTrafficHandlingPriority > qosR99_R4Requested.iReqTrafficHandlingPriority, _L("RPacketQoS::GetProfileParameters did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iTrafficHandlingPriority."));	
       
 14201 		ASSERT_TRUE(r99_r4NegotiatedQoSValues.iTransferDelay > qosR99_R4Requested.iReqTransferDelay, _L("RPacketQoS::GetProfileParameters did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iTransferDelay"));
       
 14202 		ASSERT_TRUE(r99_r4NegotiatedQoSValues.iGuaranteedRate.iDownlinkRate < qosR99_R4Requested.iReqGuaranteedRate.iDownlinkRate, _L("RPacketQoS::GetProfileParameters did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iGuaranteedRate.iDownlinkRate"));
       
 14203 		ASSERT_TRUE(r99_r4NegotiatedQoSValues.iGuaranteedRate.iUplinkRate < qosR99_R4Requested.iReqGuaranteedRate.iUplinkRate, _L("RPacketQoS::GetProfileParameters did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iGuaranteedRate.iUplinkRate"));
       
 14204 		break;
       
 14205 		
       
 14206 		case EQoSR5: // R5
       
 14207 		packetQoS.GetProfileParameters(getProfileParametersStatus, r5NegotiatedQoSPk);
       
 14208 		ASSERT_EQUALS(WaitForRequestWithTimeOut(getProfileParametersStatus, ETimeLong), KErrNone, _L("RPacketQoS::GetProfileParameters timed out"));
       
 14209 		ASSERT_EQUALS(getProfileParametersStatus.Int(), KErrNone, _L("RPacketQoS::GetProfileParameters returned with an error"));
       
 14210 		ASSERT_TRUE(r5NegotiatedQoSValues.iTrafficClass > qosR5Requested.iReqTrafficClass, _L("RPacketQoS::GetProfileParameters did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iTrafficClass"));
       
 14211 		ASSERT_TRUE(r5NegotiatedQoSValues.iDeliveryOrderReqd > qosR5Requested.iReqDeliveryOrderReqd, _L("RPacketQoS::GetProfileParameters did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iDeliveryOrderReqd."));	
       
 14212 		ASSERT_TRUE(r5NegotiatedQoSValues.iDeliverErroneousSDU > qosR5Requested.iReqDeliverErroneousSDU, _L("RPacketQoS::GetProfileParameters did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iDeliverErroneousSDU."));								
       
 14213 		ASSERT_TRUE(r5NegotiatedQoSValues.iMaxSDUSize < qosR5Requested.iReqMaxSDUSize, _L("RPacketQoS::GetProfileParameters did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iMaxSDUSize."));
       
 14214 		ASSERT_TRUE(r5NegotiatedQoSValues.iMaxRate.iDownlinkRate < qosR5Requested.iReqMaxRate.iDownlinkRate, _L("RPacketQoS::GetProfileParameters did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iMaxRate.iDownlinkRate"));
       
 14215 		ASSERT_TRUE(r5NegotiatedQoSValues.iMaxRate.iUplinkRate < qosR5Requested.iReqMaxRate.iUplinkRate, _L("RPacketQoS::GetProfileParameters did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iMaxRate.iUplinkRate"));
       
 14216 		ASSERT_TRUE(r5NegotiatedQoSValues.iBER < qosR5Requested.iReqBER, _L("RPacketQoS::GetProfileParameters did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iBER."));
       
 14217 		ASSERT_TRUE(r5NegotiatedQoSValues.iSDUErrorRatio < qosR5Requested.iReqSDUErrorRatio, _L("RPacketQoS::GetProfileParameters did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iSDUErrorRatio."));
       
 14218 		ASSERT_TRUE(r5NegotiatedQoSValues.iTrafficHandlingPriority > qosR5Requested.iReqTrafficHandlingPriority, _L("RPacketQoS::GetProfileParameters did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iTrafficHandlingPriority."));	
       
 14219 		ASSERT_TRUE(r5NegotiatedQoSValues.iTransferDelay > qosR5Requested.iReqTransferDelay, _L("RPacketQoS::GetProfileParameters did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iTransferDelay"));
       
 14220 		ASSERT_TRUE(r5NegotiatedQoSValues.iGuaranteedRate.iDownlinkRate < qosR5Requested.iReqGuaranteedRate.iDownlinkRate, _L("RPacketQoS::GetProfileParameters did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iGuaranteedRate.iDownlinkRate"));
       
 14221 		ASSERT_TRUE(r5NegotiatedQoSValues.iGuaranteedRate.iUplinkRate < qosR5Requested.iReqGuaranteedRate.iUplinkRate, _L("RPacketQoS::GetProfileParameters did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iGuaranteedRate.iUplinkRate"));
       
 14222 		ASSERT_TRUE(r5NegotiatedQoSValues.iSignallingIndication < qosR5Requested.iSignallingIndication, _L("RPacketQoS::GetProfileParameters did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iSignallingIndication."));
       
 14223 		ASSERT_TRUE(r5NegotiatedQoSValues.iSourceStatisticsDescriptor < qosR5Requested.iSourceStatisticsDescriptor, _L("RPacketQoS::GetProfileParameters did not return lower profile value than requested value used in RPacketQoS::SetProfileParameters with iSourceStatisticsDescriptor."));				
       
 14224 		break;
       
 14225 		}
       
 14226 		
       
 14227 	//Release QoS
       
 14228 	iEtelSessionMgr.ReleasePrimaryPacketContextQoS(KMainServer,
       
 14229 											KMainPhone, 
       
 14230 											KMainPacketService, 
       
 14231 											KPrimaryPacketContext1);
       
 14232 
       
 14233 	// Release packet context
       
 14234 	iEtelSessionMgr.ReleasePrimaryPacketContext(KMainServer,
       
 14235 											KMainPhone, 
       
 14236 											KMainPacketService, 
       
 14237 											KPrimaryPacketContext1);
       
 14238 
       
 14239 	// Pop
       
 14240 	// setProfileParamStatus
       
 14241 	// setConfigStatus
       
 14242 	// notifyProfileChangedStatus
       
 14243 	// contextActivateStatus
       
 14244 	// getProfileParametersStatus
       
 14245 	CleanupStack::PopAndDestroy(5, &setProfileParamStatus);		
       
 14246     }
       
 14247  
       
 14248 TPtrC CCTSYIntegrationTestPacketContext0060::GetTestStepName()
       
 14249 /**
       
 14250  * @return The test step name.
       
 14251  */
       
 14252 	{
       
 14253 	return _L("CCTSYIntegrationTestPacketContext0060");
       
 14254 	}
       
 14255 
       
 14256 
       
 14257 
       
 14258 CCTSYIntegrationTestPacketContext0061::CCTSYIntegrationTestPacketContext0061(CEtelSessionMgr& aEtelSessionMgr)
       
 14259 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
 14260 /**
       
 14261  * Constructor.
       
 14262  */
       
 14263 	{
       
 14264 	SetTestStepName(CCTSYIntegrationTestPacketContext0061::GetTestStepName());
       
 14265 	}
       
 14266 
       
 14267 CCTSYIntegrationTestPacketContext0061::~CCTSYIntegrationTestPacketContext0061()
       
 14268 /**
       
 14269  * Destructor.
       
 14270  */
       
 14271 	{
       
 14272 	}
       
 14273 
       
 14274 TVerdict CCTSYIntegrationTestPacketContext0061::doTestStepL()
       
 14275 /**
       
 14276  * @SYMTestCaseID BA-CTSY-INT-PKTC-0061
       
 14277  * @SYMFssID BA/CTSY/PKTC-0061
       
 14278  * @SYMTestCaseDesc Initialise a context.
       
 14279  * @SYMTestPriority High
       
 14280  * @SYMTestActions RPacketContext::InitialiseContext, RPacketContext::GetStatus, RPacketContext::AddPacketFilter, RPacketContext::NotifyStatusChange, RPacketContext::SetConfig, RPacketQoS::OpenNewQoS, RPacketQoS::GetProfileCapabilities, RPacketQoS::SetProfileParameters, RPacketContext::OpenNewSecondaryContext
       
 14281  * @SYMTestExpectedResults Pass - RPacketContext::InitialiseContext returns TDataChannelV2 information.
       
 14282  * @SYMTestType CIT
       
 14283  * @SYMTestCaseDependencies live/automatic
       
 14284  *
       
 14285  * Reason for test: Verify comm port information received.
       
 14286  *
       
 14287  * @return - TVerdict code
       
 14288  */
       
 14289 	{
       
 14290 
       
 14291 	////////////////////////////////////////////////////////////////
       
 14292 	// SET UP
       
 14293 	////////////////////////////////////////////////////////////////
       
 14294 
       
 14295 	
       
 14296 	// Ensure phone is attached to the packet service. 
       
 14297 
       
 14298 
       
 14299 	////////////////////////////////////////////////////////////////
       
 14300 	// SET UP END
       
 14301 	////////////////////////////////////////////////////////////////
       
 14302 	
       
 14303 	StartTest();
       
 14304 	
       
 14305 	////////////////////////////////////////////////////////////////
       
 14306 	// TEST START
       
 14307 	////////////////////////////////////////////////////////////////
       
 14308 	
       
 14309 	
       
 14310 	// Open a new primary context. 
       
 14311 
       
 14312 	// Initialise the context with RPacketContext::InitialiseContext 
       
 14313 
       
 14314 	// Check RPacketContext::InitialiseContext returns TDataChannelV2::iChannelId of length > 0
       
 14315 	// Check RPacketContext::InitialiseContext returns TDataChannelV2::iCsy of length > 0
       
 14316 	// Check RPacketContext::InitialiseContext returns TDataChannelV2::iPort of length > 0
       
 14317 
       
 14318 	// Set a valid context config using RPacketContext::SetConfig 
       
 14319 
       
 14320 	// Activate the context 
       
 14321 
       
 14322 	// Check RPacketContext::NotifyStatusChange completes with EStatusActivating -> EStatusActive
       
 14323 
       
 14324 	// Check RPacketContext::GetStatus returns EStatusActive
       
 14325 
       
 14326 	// Open a new secondary context 
       
 14327 
       
 14328 	// Initialise the secondary context with RPacketContext::InitialiseContext 
       
 14329 
       
 14330 	// Check RPacketContext::InitialiseContext for the secondary context returns TDataChannelV2::iChannelId of length > 0
       
 14331 	// Check RPacketContext::InitialiseContext for the secondary context returns TDataChannelV2::iCsy of length > 0
       
 14332 	// Check RPacketContext::InitialiseContext for the secondary context returns TDataChannelV2::iPort of length > 0
       
 14333 
       
 14334 	// ===  Add packet filter ===
       
 14335 
       
 14336 	// Add a TPacketFilterV2 packet filter to the secondary context using RPacketContext::AddPacketFilter 
       
 14337 
       
 14338 	// ===  Add QoS ===
       
 14339 
       
 14340 	// Open a new QoS from the secondary context 
       
 14341 
       
 14342 	// Get GPRS QoS profile capabilities with RPacketQoS::GetProfileCapabilities 
       
 14343 
       
 14344 	// Set requested profile parameters with RPacketQoS::SetProfileParameters and TQoSGPRSRequested with parameters within range returned by RPacketQoS::GetProfileCapabilities 
       
 14345 
       
 14346 	// Activate the secondary context with RPacketContext::Activate 
       
 14347 
       
 14348 	// Check RPacketContext::NotifyStatusChange for the secondary context completes with EStatusActivating -> EStatusActive
       
 14349 
       
 14350 	// Check RPacketContext::GetStatus for the secondary context returns EStatusActive
       
 14351 
       
 14352 	
       
 14353 	////////////////////////////////////////////////////////////////
       
 14354 	// TEST END
       
 14355 	////////////////////////////////////////////////////////////////
       
 14356 
       
 14357     StartCleanup();
       
 14358 	
       
 14359 	// Put any required test clean up here, then remove this comment
       
 14360 	
       
 14361 	return TestStepResult();
       
 14362 	}
       
 14363 
       
 14364 TPtrC CCTSYIntegrationTestPacketContext0061::GetTestStepName()
       
 14365 /**
       
 14366  * @return The test step name.
       
 14367  */
       
 14368 	{
       
 14369 	return _L("CCTSYIntegrationTestPacketContext0061");
       
 14370 	}
       
 14371 
       
 14372 
       
 14373 
       
 14374 CCTSYIntegrationTestPacketContext0062::CCTSYIntegrationTestPacketContext0062(CEtelSessionMgr& aEtelSessionMgr)
       
 14375 	: CCTSYIntegrationTestPacketContextBase(aEtelSessionMgr)
       
 14376 /**
       
 14377  * Constructor.
       
 14378  */
       
 14379 	{
       
 14380 	SetTestStepName(CCTSYIntegrationTestPacketContext0062::GetTestStepName());
       
 14381 	}
       
 14382 
       
 14383 CCTSYIntegrationTestPacketContext0062::~CCTSYIntegrationTestPacketContext0062()
       
 14384 /**
       
 14385  * Destructor.
       
 14386  */
       
 14387 	{
       
 14388 	}
       
 14389 
       
 14390 TVerdict CCTSYIntegrationTestPacketContext0062::doTestStepL()
       
 14391 /**
       
 14392  * @SYMTestCaseID BA-CTSY-INT-PKTC-0062
       
 14393  * @SYMFssID BA/CTSY/PKTC-0062
       
 14394  * @SYMTestCaseDesc Ensure change in QoS from network is handled correct when new QoS is not acceptable.
       
 14395  * @SYMTestPriority High
       
 14396  * @SYMTestActions 
       
 14397  * @SYMTestExpectedResults Pass - Context is deactivated.
       
 14398  * @SYMTestType CIT
       
 14399  * @SYMTestCaseDependencies simulated/manual
       
 14400  *
       
 14401  * Reason for test: Verify context is deactivated.
       
 14402  *
       
 14403  * @return - TVerdict code
       
 14404  */
       
 14405 	{
       
 14406 
       
 14407 	////////////////////////////////////////////////////////////////
       
 14408 	// SET UP
       
 14409 	////////////////////////////////////////////////////////////////
       
 14410 
       
 14411 	
       
 14412 	// Ensure there is a primary PDP context active. 
       
 14413 
       
 14414 
       
 14415 	////////////////////////////////////////////////////////////////
       
 14416 	// SET UP END
       
 14417 	////////////////////////////////////////////////////////////////
       
 14418 	
       
 14419 	StartTest();
       
 14420 	
       
 14421 	////////////////////////////////////////////////////////////////
       
 14422 	// TEST START
       
 14423 	////////////////////////////////////////////////////////////////
       
 14424 	
       
 14425 	
       
 14426 	// Simulator sends a modify PDP context request message with a QoS that is not acceptable to the phone.  
       
 14427 
       
 14428 	// Check RPacketContext::NotifyStatusChange completes with EStatusInactive
       
 14429 
       
 14430 	
       
 14431 	////////////////////////////////////////////////////////////////
       
 14432 	// TEST END
       
 14433 	////////////////////////////////////////////////////////////////
       
 14434 
       
 14435     StartCleanup();
       
 14436 	
       
 14437 	// Put any required test clean up here, then remove this comment
       
 14438 	
       
 14439 	return TestStepResult();
       
 14440 	}
       
 14441 
       
 14442 TPtrC CCTSYIntegrationTestPacketContext0062::GetTestStepName()
       
 14443 /**
       
 14444  * @return The test step name.
       
 14445  */
       
 14446 	{
       
 14447 	return _L("CCTSYIntegrationTestPacketContext0062");
       
 14448 	}
       
 14449 
       
 14450 
       
 14451