telephonyserver/etelpacketdata/Te_EtelPacket/TE_EtelPacketMbmsService.cpp
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // EtelPacketMbmsService.cpp
       
    15 // This contains EtelPacket TestCase 
       
    16 // 
       
    17 //
       
    18 
       
    19 // Symbian OS includes
       
    20 #include <e32base.h>
       
    21 #include <etelpckt.h>
       
    22 #include "pcktretrieve.h"
       
    23 #include <pcktcs.h>
       
    24 #include "Te_EtelPacketTestStepBase.h"
       
    25 #include "testdef.h"
       
    26 #include "Te_EtelPacketMbmsService.h"
       
    27 #include "Te_etelpckt_defs.h"
       
    28 
       
    29 // constructor
       
    30 CTestMbmsService::CTestMbmsService()
       
    31 {
       
    32 	// store the name of this test case
       
    33 	SetTestStepName(_L("MBMS_SERVICE"));
       
    34 }
       
    35 
       
    36 // destructor
       
    37 CTestMbmsService::~CTestMbmsService()
       
    38 {
       
    39 }
       
    40 
       
    41 TVerdict CTestMbmsService::doTestStepPreambleL()
       
    42 	{
       
    43 	CTestStepEtelPacket::doTestStepPreambleL();
       
    44 	__UHEAP_MARK;
       
    45 	iTestScheduler=new (ELeave) CActiveScheduler;
       
    46 	CActiveScheduler::Install(iTestScheduler);
       
    47 			
       
    48 	TInt ret=iPhone.Open(iTelServer,DPCKTTSY_PHONE_NAME);
       
    49 	if(ret != KErrNone)
       
    50 		{
       
    51 		INFO_PRINTF1(_L("Failed to open phone"));
       
    52 		User::Leave(ret);
       
    53 		}
       
    54 	ret=iPcktService.Open(iPhone);
       
    55 	if(ret != KErrNone)
       
    56 		{
       
    57 		INFO_PRINTF1(_L("Failed to open packet service"));
       
    58 		User::Leave(ret);
       
    59 		}
       
    60 	return TestStepResult();
       
    61 	}
       
    62 TVerdict CTestMbmsService::doTestStepPostambleL()
       
    63 	{
       
    64 	iPcktService.Close();
       
    65 	iPhone.Close();
       
    66 	delete iTestScheduler;
       
    67 	__UHEAP_MARKEND;
       
    68 	CTestStepEtelPacket::doTestStepPostambleL();
       
    69 	return TestStepResult();
       
    70 	}
       
    71 enum TVerdict CTestMbmsService::doTestStepL( void )
       
    72 /**
       
    73  * Test step to check MBMS service availability functionality
       
    74  */
       
    75 	{
       
    76 	TestMbmsUpdateServiceL();
       
    77 	TestMbmsRetrieveServiceListL();
       
    78 	TestMbmsServicesEnumerationL();
       
    79 	return TestStepResult();
       
    80 	}
       
    81 
       
    82 void CTestMbmsService::TestMbmsUpdateServiceL()
       
    83 	{
       
    84 	/**
       
    85 	 * Add new services to be monitored to the service availability list.
       
    86 	 */
       
    87 	RPacketService::TMbmsServiceAvailabilityV1 aMbmsService;
       
    88 	CPcktMbmsMonitoredServiceList* aServiceList= CPcktMbmsMonitoredServiceList::NewL();
       
    89 	CleanupStack::PushL(aServiceList);
       
    90 	TRequestStatus aReqStatusMonitorList;
       
    91 	TMbmsAction aMbmsAction=EAddEntries;
       
    92 	//First Service
       
    93 	aMbmsService.iTmgi.SetServiceId(DPCKTTSY_MBMS_SERVICEID_ONE); 
       
    94 	aMbmsService.iTmgi.SetMCC(DPCKTTSY_MBMS_MCC_ONE);
       
    95 	aMbmsService.iTmgi.SetMNC(DPCKTTSY_MBMS_MNC_ONE);
       
    96 	aMbmsService.iMbmsServiceMode = DPCKTTSY_MBMS_SERVICEMODE_ONE;
       
    97 	aMbmsService.iMbmsAccessBearer = DPCKTTSY_MBMS_ACCESSBEARER_ONE;
       
    98 	aServiceList->AddEntryL(aMbmsService);
       
    99 	//Second Service
       
   100 	aMbmsService.iTmgi.SetServiceId(DPCKTTSY_MBMS_SERVICEID_TWO); 
       
   101 	aMbmsService.iTmgi.SetMCC(DPCKTTSY_MBMS_MCC_TWO);
       
   102 	aMbmsService.iTmgi.SetMNC(DPCKTTSY_MBMS_MNC_TWO);
       
   103 	aMbmsService.iMbmsServiceMode = DPCKTTSY_MBMS_SERVICEMODE_TWO;
       
   104 	aMbmsService.iMbmsAccessBearer = DPCKTTSY_MBMS_ACCESSBEARER_TWO;
       
   105 	aServiceList->AddEntryL(aMbmsService);	
       
   106 	//Third Service
       
   107 	aMbmsService.iTmgi.SetServiceId(DPCKTTSY_MBMS_SERVICEID_THREE); 
       
   108 	aMbmsService.iTmgi.SetMCC(DPCKTTSY_MBMS_MCC_THREE);
       
   109 	aMbmsService.iTmgi.SetMNC(DPCKTTSY_MBMS_MNC_THREE);
       
   110 	aMbmsService.iMbmsServiceMode = DPCKTTSY_MBMS_SERVICEMODE_THREE;
       
   111 	aMbmsService.iMbmsAccessBearer = DPCKTTSY_MBMS_ACCESSBEARER_THREE;
       
   112 	aServiceList->AddEntryL(aMbmsService);
       
   113 	
       
   114 	iPcktService.UpdateMbmsMonitorServiceListL(aReqStatusMonitorList, aMbmsAction, aServiceList);
       
   115 	User::WaitForRequest(aReqStatusMonitorList);
       
   116 	TESTL(aReqStatusMonitorList == KErrNone);
       
   117 	INFO_PRINTF1(_L("Added 3 services to the Monitor list - Completed"));
       
   118 	
       
   119 	/**
       
   120 	 * Cancel UpdateMbmsMonitorServiceListL 
       
   121 	 */
       
   122 	TRequestStatus aReqStatusMonitorListCancel;
       
   123 	iPcktService.UpdateMbmsMonitorServiceListL(aReqStatusMonitorListCancel, aMbmsAction, aServiceList);
       
   124 	iPcktService.CancelAsyncRequest(EPacketUpdateMbmsMonitorServiceList);
       
   125 	User::WaitForRequest(aReqStatusMonitorListCancel);
       
   126 	CleanupStack::PopAndDestroy(aServiceList); 
       
   127 	TESTL(aReqStatusMonitorListCancel == KErrCancel);
       
   128 	INFO_PRINTF1(_L("Cancellation of addition to the Monitor list - CANCELLED"));
       
   129 	
       
   130 	/**
       
   131 	 * Remove selected services from the service availability list.
       
   132 	 */
       
   133 	TRequestStatus aReqStatusMonitorListRemove;
       
   134 	aServiceList= CPcktMbmsMonitoredServiceList::NewL();
       
   135 	CleanupStack::PushL(aServiceList);
       
   136 	aMbmsAction=ERemoveEntries;
       
   137 	aMbmsService.iTmgi.SetServiceId(DPCKTTSY_MBMS_SERVICEID_TWO); 
       
   138 	aMbmsService.iTmgi.SetMCC(DPCKTTSY_MBMS_MCC_TWO);
       
   139 	aMbmsService.iTmgi.SetMNC(DPCKTTSY_MBMS_MNC_TWO);
       
   140 	aMbmsService.iMbmsServiceMode = DPCKTTSY_MBMS_SERVICEMODE_TWO;
       
   141 	aMbmsService.iMbmsAccessBearer = DPCKTTSY_MBMS_ACCESSBEARER_TWO;
       
   142 	aServiceList->AddEntryL(aMbmsService);
       
   143 	
       
   144 	iPcktService.UpdateMbmsMonitorServiceListL (aReqStatusMonitorListRemove, aMbmsAction, aServiceList);
       
   145 	User::WaitForRequest(aReqStatusMonitorListRemove);
       
   146 	CleanupStack::PopAndDestroy(aServiceList);
       
   147 	TESTL(aReqStatusMonitorListRemove == KErrNone);
       
   148 	INFO_PRINTF1(_L("Removed a service from the Monitor list - Completed"));
       
   149 	
       
   150 	/**
       
   151 	 * Remove an invalid, single, service entry from the service availability list
       
   152 	 */
       
   153 	TRequestStatus aReqStatusMonitorListRemoveOneInvalid;
       
   154 	aServiceList= CPcktMbmsMonitoredServiceList::NewL();
       
   155 	CleanupStack::PushL(aServiceList);
       
   156 	aMbmsAction=ERemoveEntries;
       
   157 	aMbmsService.iTmgi.SetServiceId(DPCKTTSY_MBMS_SERVICEID_INVALID); 
       
   158 	aMbmsService.iTmgi.SetMCC(DPCKTTSY_MBMS_MCC_INVALID);
       
   159 	aMbmsService.iTmgi.SetMNC(DPCKTTSY_MBMS_MNC_INVALID);
       
   160 	aMbmsService.iMbmsServiceMode = DPCKTTSY_MBMS_SERVICEMODE_INVALID;
       
   161 	aMbmsService.iMbmsAccessBearer = DPCKTTSY_MBMS_ACCESSBEARER_INVALID;
       
   162 	aServiceList->AddEntryL(aMbmsService);
       
   163 	
       
   164 	iPcktService.UpdateMbmsMonitorServiceListL (aReqStatusMonitorListRemoveOneInvalid, aMbmsAction, aServiceList);
       
   165 	User::WaitForRequest(aReqStatusMonitorListRemoveOneInvalid);
       
   166 	CleanupStack::PopAndDestroy(aServiceList);
       
   167 	TESTL(aReqStatusMonitorListRemoveOneInvalid == KErrNotFound);
       
   168 	INFO_PRINTF1(_L("Removed an invalid service entry from the Monitor list - Completed"));
       
   169 	
       
   170 	/**
       
   171 	 * Remove a list of services from the service availability list. A few of them are invalid services
       
   172 	 */
       
   173 	aServiceList= CPcktMbmsMonitoredServiceList::NewL();
       
   174 	CleanupStack::PushL(aServiceList);
       
   175 	//TRequestStatus aReqStatusMonitorList;
       
   176 	aMbmsAction=ERemoveEntries;
       
   177 	//First Service
       
   178 	aMbmsService.iTmgi.SetServiceId(DPCKTTSY_MBMS_SERVICEID_ONE); 
       
   179 	aMbmsService.iTmgi.SetMCC(DPCKTTSY_MBMS_MCC_ONE);
       
   180 	aMbmsService.iTmgi.SetMNC(DPCKTTSY_MBMS_MNC_ONE);
       
   181 	aMbmsService.iMbmsServiceMode = DPCKTTSY_MBMS_SERVICEMODE_ONE;
       
   182 	aMbmsService.iMbmsAccessBearer = DPCKTTSY_MBMS_ACCESSBEARER_ONE;
       
   183 	aServiceList->AddEntryL(aMbmsService);
       
   184 	//Second Service
       
   185 	aMbmsService.iTmgi.SetServiceId(DPCKTTSY_MBMS_SERVICEID_INVALID); 
       
   186 	aMbmsService.iTmgi.SetMCC(DPCKTTSY_MBMS_MCC_INVALID);
       
   187 	aMbmsService.iTmgi.SetMNC(DPCKTTSY_MBMS_MNC_INVALID);
       
   188 	aMbmsService.iMbmsServiceMode = DPCKTTSY_MBMS_SERVICEMODE_INVALID;
       
   189 	aMbmsService.iMbmsAccessBearer = DPCKTTSY_MBMS_ACCESSBEARER_INVALID;
       
   190 	aServiceList->AddEntryL(aMbmsService);	
       
   191 	//Third Service
       
   192 	aMbmsService.iTmgi.SetServiceId(DPCKTTSY_MBMS_SERVICEID_THREE); 
       
   193 	aMbmsService.iTmgi.SetMCC(DPCKTTSY_MBMS_MCC_THREE);
       
   194 	aMbmsService.iTmgi.SetMNC(DPCKTTSY_MBMS_MNC_THREE);
       
   195 	aMbmsService.iMbmsServiceMode = DPCKTTSY_MBMS_SERVICEMODE_THREE;
       
   196 	aMbmsService.iMbmsAccessBearer = DPCKTTSY_MBMS_ACCESSBEARER_THREE;
       
   197 	aServiceList->AddEntryL(aMbmsService);
       
   198 	
       
   199 	iPcktService.UpdateMbmsMonitorServiceListL (aReqStatusMonitorList, aMbmsAction, aServiceList);
       
   200 	User::WaitForRequest(aReqStatusMonitorList);
       
   201 	CleanupStack::PopAndDestroy(aServiceList);
       
   202 	TESTL(aReqStatusMonitorList == KErrMbmsImpreciseServiceEntries);
       
   203 	INFO_PRINTF1(_L("Removal of list of entries (2nd entry invalid) - Completed"));
       
   204 		
       
   205 	/**
       
   206 	 * Remove all services from the service availability list.
       
   207 	 */
       
   208 	TRequestStatus aReqStatusMonitorListRemoveAll;
       
   209 	aMbmsAction=ERemoveAllEntries;
       
   210 	iPcktService.UpdateMbmsMonitorServiceListL (aReqStatusMonitorListRemoveAll, aMbmsAction);
       
   211 	User::WaitForRequest(aReqStatusMonitorListRemoveAll);
       
   212 	TESTL(aReqStatusMonitorListRemoveAll == KErrNone);
       
   213 	INFO_PRINTF1(_L("Removed all services from the Monitor list - Completed"));
       
   214 	}
       
   215 
       
   216 void CTestMbmsService::TestMbmsRetrieveServiceListL()
       
   217 	{
       
   218 	/**
       
   219 	 * Receive notification on MBMS service availability
       
   220 	 */
       
   221 	TRequestStatus reqStatusMbmsService;
       
   222 	iPcktService.NotifyMbmsServiceAvailabilityChange(reqStatusMbmsService);
       
   223 	User::WaitForRequest(reqStatusMbmsService);
       
   224 	TESTL(reqStatusMbmsService == KErrNone);
       
   225 	INFO_PRINTF1(_L("Receive notification about a change in monitor service list - Completed"));
       
   226 	
       
   227 	/**
       
   228 	 * Cancel the service availability notification
       
   229 	 */
       
   230 	iPcktService.NotifyMbmsServiceAvailabilityChange(reqStatusMbmsService);
       
   231 	iPcktService.CancelAsyncRequest(EPacketNotifyMbmsServiceAvailabilityChange);
       
   232 	User::WaitForRequest(reqStatusMbmsService);
       
   233 	TESTL(reqStatusMbmsService == KErrCancel);
       
   234 	INFO_PRINTF1(_L("Cancellation of notification about a change in monitor service list - CANCELLED"));
       
   235 	
       
   236 	/**
       
   237 	 * Retrieve MBMS service list.
       
   238 	 */
       
   239 	CTestRetrieveEtelPacketMonitorServices *pRetrieve = CTestRetrieveEtelPacketMonitorServices::NewLC(iPcktService,this);
       
   240   	TBool startReqd = ETrue;
       
   241   	// To test the 2 phase retrieval of CRetrievePcktMbmsMonitoredServices 
       
   242   	pRetrieve->TestRetrieve(startReqd);
       
   243    	//Delete test object
       
   244   	CleanupStack::PopAndDestroy();
       
   245   	INFO_PRINTF1(_L("Retreive MBMS monitor list - Completed"));
       
   246   	
       
   247   	/**
       
   248 	 * Cancel retrieval of the MBMS service list
       
   249 	 */
       
   250   	pRetrieve = CTestRetrieveEtelPacketMonitorServices::NewLC(iPcktService,this);
       
   251   	pRetrieve->TestRetrieve(startReqd);
       
   252   	pRetrieve->TestCancel();
       
   253   	//Delete test object
       
   254   	CleanupStack::PopAndDestroy(); //pRetrieve
       
   255   	INFO_PRINTF1(_L("Cancel retreival of MBMS monitor list - Completed"));
       
   256   	}
       
   257 
       
   258 //
       
   259 
       
   260 CTestMbmsService::CTestRetrieveEtelPacketMonitorServices* CTestMbmsService::CTestRetrieveEtelPacketMonitorServices::NewLC(RPacketService& aService, CTestMbmsService* aTestService)
       
   261 	{
       
   262 	CTestRetrieveEtelPacketMonitorServices* monitorService=new(ELeave) CTestRetrieveEtelPacketMonitorServices(aService,aTestService);
       
   263 	CleanupStack::PushL(monitorService);
       
   264 	monitorService->ConstructL();
       
   265 	return monitorService;
       
   266 	}
       
   267 	  
       
   268 CTestMbmsService::CTestRetrieveEtelPacketMonitorServices::CTestRetrieveEtelPacketMonitorServices(RPacketService& aService,CTestMbmsService* aTestService)
       
   269 : CActive(EPriorityNormal), iService(aService),iTestService(aTestService)
       
   270 {}
       
   271 	 
       
   272 void CTestMbmsService::CTestRetrieveEtelPacketMonitorServices::ConstructL()
       
   273 	{
       
   274 	CActiveScheduler::Add(this);
       
   275 	iRetrieve=CRetrievePcktMbmsMonitoredServices::NewL(iService);
       
   276 	iCanceller=new (ELeave) CTestCanceller(this);
       
   277 	}
       
   278     
       
   279 CTestMbmsService::CTestRetrieveEtelPacketMonitorServices::~CTestRetrieveEtelPacketMonitorServices()
       
   280 	{
       
   281 	Cancel();
       
   282 	delete iRetrieve;
       
   283 	delete iCanceller;
       
   284 	}
       
   285 
       
   286 void CTestMbmsService::CTestRetrieveEtelPacketMonitorServices::Start()
       
   287 	{
       
   288 	iRetrieve->Start(iStatus);
       
   289 	//Test the CompleteIfInUse case of Start API
       
   290 	TRequestStatus tmpStatus;
       
   291 	iRetrieve->Start(tmpStatus);
       
   292 	User::WaitForRequest(tmpStatus);
       
   293 	iTestService->TEST(tmpStatus.Int() == KErrInUse);
       
   294 	SetActive();
       
   295 	}       
       
   296 
       
   297 void CTestMbmsService::CTestRetrieveEtelPacketMonitorServices::RunL()
       
   298 	{
       
   299 	TInt ret=iStatus.Int();
       
   300 	User::LeaveIfError(ret);
       
   301 	ret=CheckMonitorServicesResultsL();
       
   302 	User::LeaveIfError(ret);
       
   303 	ret=CheckMonitorServicesErrorResultsL();
       
   304 	User::LeaveIfError(ret);
       
   305 	CActiveScheduler::Stop();
       
   306 	}
       
   307 
       
   308 void CTestMbmsService::CTestRetrieveEtelPacketMonitorServices::TestCancel()
       
   309 	{
       
   310 	Start();
       
   311 	CTestCanceller* cancelMbmsService = RetrieveCancelPtr();
       
   312 	cancelMbmsService->Call();
       
   313 
       
   314 	CActiveScheduler::Start();
       
   315 	TBool cancelled = (iStatus == KErrCancel);
       
   316 
       
   317 	// Ensure that AO can be used after its previous transaction was cancelled
       
   318 	Start();
       
   319 	CActiveScheduler::Start();
       
   320 
       
   321 	if (cancelled)
       
   322 		{
       
   323 		iTestService->INFO_PRINTF1(_L("Cancelled retrieval of MBMS service List"));
       
   324 		iTestService->INFO_PRINTF1(_L("CRetrievePcktMbmsMonitoredServices (async & cancel (Cancelled Request)) - CANCELLED"));
       
   325 		}
       
   326 	else
       
   327 		{
       
   328 		iTestService->INFO_PRINTF1(_L("CRetrievePcktMbmsMonitoredServices (async & cancel (Request Not Cancelled))- COMPLETED"));
       
   329 		}	
       
   330 	} 
       
   331 	
       
   332 CTestCanceller* CTestMbmsService::CTestRetrieveEtelPacketMonitorServices::RetrieveCancelPtr()
       
   333 	{
       
   334 	return iCanceller;
       
   335 	}
       
   336 
       
   337 void CTestMbmsService::CTestRetrieveEtelPacketMonitorServices::DoCancel()
       
   338 	{
       
   339 	iRetrieve->Cancel();
       
   340 	}       
       
   341   
       
   342 TInt CTestMbmsService::CTestRetrieveEtelPacketMonitorServices::CheckMonitorServicesResultsL()
       
   343 	{
       
   344 	TInt ret=KErrNone;
       
   345 
       
   346 	CPcktMbmsMonitoredServiceList* mbmsList =NULL;
       
   347 	TInt leaveCode=KErrNone;
       
   348 	TRAP(leaveCode, mbmsList=iRetrieve->RetrieveListL(););
       
   349 
       
   350 	//Check that a list is returned back to the test
       
   351 	iTestService->TESTL(mbmsList!=NULL);
       
   352 
       
   353 if (mbmsList)
       
   354 	{
       
   355 	//Check that the number of entries in the list is as expected
       
   356 	iTestService->TESTL(mbmsList->Enumerate()==DPCKTTSY_MBMS_SERVICELIST_COUNT_ADD);
       
   357 	// Get each entry
       
   358 	RPacketService::TMbmsServiceAvailabilityV1 entry;
       
   359 	for (TInt index=0; index < DPCKTTSY_MBMS_SERVICELIST_COUNT_ADD; index++)
       
   360 			{
       
   361 			TRAPD(ret,entry=mbmsList->GetEntryL(index));
       
   362 				if (ret != KErrNone)
       
   363 					break;
       
   364 			switch (index)
       
   365 				{
       
   366 			case 0:
       
   367 				iTestService->TESTL(entry.iMbmsServiceMode == DPCKTTSY_MBMS_SERVICEMODE_ONE);
       
   368 				iTestService->TESTL(entry.iMbmsAccessBearer == DPCKTTSY_MBMS_ACCESSBEARER_ONE);
       
   369 				iTestService->TESTL(entry.iMbmsAvailabilityStatus == DPCKTTSY_MBMS_AVAILABILITYSTATUS_ONE);
       
   370 				iTestService->TESTL(entry.iTmgi.GetMCC() == DPCKTTSY_MBMS_MCC_ONE);
       
   371 				iTestService->TESTL(entry.iTmgi.GetMNC() == DPCKTTSY_MBMS_MNC_ONE);
       
   372 				iTestService->TESTL(entry.iTmgi.GetServiceId() == DPCKTTSY_MBMS_SERVICEID_ONE);
       
   373 				break;
       
   374 				
       
   375 			case 1:
       
   376 			iTestService->TESTL(entry.iMbmsServiceMode == DPCKTTSY_MBMS_SERVICEMODE_TWO);
       
   377 			iTestService->TESTL(entry.iMbmsAccessBearer == DPCKTTSY_MBMS_ACCESSBEARER_TWO);
       
   378 			iTestService->TESTL(entry.iMbmsAvailabilityStatus == DPCKTTSY_MBMS_AVAILABILITYSTATUS_TWO);
       
   379 			iTestService->TESTL(entry.iTmgi.GetMCC() == DPCKTTSY_MBMS_MCC_TWO);
       
   380 			iTestService->TESTL(entry.iTmgi.GetMNC() == DPCKTTSY_MBMS_MNC_TWO);
       
   381 			iTestService->TESTL(entry.iTmgi.GetServiceId() == DPCKTTSY_MBMS_SERVICEID_TWO);
       
   382 				break;
       
   383 			
       
   384 			case 2:
       
   385 			default:
       
   386 			iTestService->TESTL(entry.iMbmsServiceMode == DPCKTTSY_MBMS_SERVICEMODE_THREE);
       
   387 			iTestService->TESTL(entry.iMbmsAccessBearer == DPCKTTSY_MBMS_ACCESSBEARER_THREE);
       
   388 			iTestService->TESTL(entry.iMbmsAvailabilityStatus == DPCKTTSY_MBMS_AVAILABILITYSTATUS_THREE);
       
   389 			iTestService->TESTL(entry.iTmgi.GetMCC() == DPCKTTSY_MBMS_MCC_THREE);
       
   390 			iTestService->TESTL(entry.iTmgi.GetMNC() == DPCKTTSY_MBMS_MNC_THREE);
       
   391 			iTestService->TESTL(entry.iTmgi.GetServiceId() == DPCKTTSY_MBMS_SERVICEID_THREE);
       
   392 				break;
       
   393 				}
       
   394 		}
       
   395 	delete mbmsList;
       
   396 	}
       
   397 return ret;
       
   398 }
       
   399 
       
   400 TInt CTestMbmsService::CTestRetrieveEtelPacketMonitorServices::CheckMonitorServicesErrorResultsL()
       
   401 	{
       
   402 	TInt ret=KErrGeneral;
       
   403 	
       
   404 	CPcktMbmsMonitoredServiceList* mbmsList =NULL;
       
   405 	TInt leaveCode=KErrNone;
       
   406 	CRetrievePcktMbmsMonitoredServices* pRetrieveMbmsMonitorList = CRetrievePcktMbmsMonitoredServices::NewL(iService);
       
   407 	CleanupStack::PushL(pRetrieveMbmsMonitorList);
       
   408 	TRAP(leaveCode, mbmsList=iRetrieve->RetrieveListL(););
       
   409 	CleanupStack::PopAndDestroy();
       
   410 	
       
   411 	//Check that a list is returned back to the test
       
   412 	if((leaveCode == KErrNotFound) && (mbmsList==NULL))
       
   413 		{
       
   414 		ret = KErrNone;
       
   415 		}
       
   416 	
       
   417 	return ret;
       
   418 	}
       
   419 
       
   420 
       
   421 void CTestMbmsService::CTestRetrieveEtelPacketMonitorServices::TestRetrieve(TBool aStartReqd)
       
   422 	{
       
   423 	if(aStartReqd)
       
   424 		{
       
   425 		Start();
       
   426 		}
       
   427 	CActiveScheduler::Start();
       
   428 	}
       
   429 void CTestMbmsService::TestMbmsServicesEnumerationL()
       
   430 	{
       
   431 	/**
       
   432 	 * Get the current and max number of active services.
       
   433 	 */
       
   434 	TRequestStatus activeServicesStatus;
       
   435 	TInt currrentActiveServices, maxActiveServices;
       
   436 	iPcktService.EnumerateMbmsActiveServiceList(activeServicesStatus, currrentActiveServices, maxActiveServices);
       
   437 	User::WaitForRequest(activeServicesStatus);
       
   438 	TESTL(currrentActiveServices == DPCKTTSY_MBMS_ACTIVESERVICE_NUMBER_OF_CONTEXTS);
       
   439 	TESTL(maxActiveServices == DPCKTTSY_MBMS_ACTIVESERVICE_MAX_NUMBER_OF_CONTEXTS);
       
   440 	TESTL(activeServicesStatus == KErrNone);
       
   441 	INFO_PRINTF1(_L("Enumerate MBMS active services - Completed"));
       
   442 	
       
   443 	/**
       
   444 	 * Test to cancel EnumerateMbmsActiveServiceList API
       
   445 	 */
       
   446 	TRequestStatus activeServicesStatusCancel;
       
   447 	iPcktService.EnumerateMbmsActiveServiceList(activeServicesStatusCancel, currrentActiveServices, maxActiveServices);
       
   448 	iPcktService.CancelAsyncRequest(EPacketEnumerateMbmsActiveServiceList); //EPacketEnumerateMbmsActiveServiceList
       
   449 	User::WaitForRequest(activeServicesStatusCancel);
       
   450 	TESTL(activeServicesStatusCancel == KErrCancel);
       
   451 	INFO_PRINTF1(_L("Cancel Enumerate MBMS active services - CANCELLED"));
       
   452 		
       
   453 	/**
       
   454 	 * Get the current and max number of monitor services.
       
   455 	 */
       
   456 	TRequestStatus monitorServicesStatus;
       
   457 	iPcktService.EnumerateMbmsMonitorServiceList(monitorServicesStatus, currrentActiveServices, maxActiveServices);
       
   458 	User::WaitForRequest(monitorServicesStatus);
       
   459 	TESTL(currrentActiveServices == DPCKTTSY_MBMS_MONITORSERVICE_NUMBER_OF_CONTEXTS);
       
   460 	TESTL(maxActiveServices == DPCKTTSY_MBMS_MONITORSERVICE_MAX_NUMBER_OF_CONTEXTS);
       
   461 	TESTL(monitorServicesStatus == KErrNone);
       
   462 	INFO_PRINTF1(_L("Enumerate MBMS monitor services - Completed"));
       
   463 	
       
   464 	/**
       
   465 	 * Test to cancel EnumerateMbmsMonitorServiceList API
       
   466 	 */
       
   467 	TRequestStatus monitorServicesStatusCancel;
       
   468 	iPcktService.EnumerateMbmsMonitorServiceList(monitorServicesStatusCancel, currrentActiveServices, maxActiveServices);
       
   469 	iPcktService.CancelAsyncRequest(EPacketEnumerateMbmsMonitorServiceList);
       
   470 	User::WaitForRequest(monitorServicesStatusCancel);
       
   471 	TESTL(monitorServicesStatusCancel == KErrCancel);
       
   472 	INFO_PRINTF1(_L("Cancel Enumerate MBMS monitor services - CANCELLED"));
       
   473 	}
       
   474