networkprotocolmodules/suplprotocolmodule/SuplProtocol/test/src/molr28Step.cpp
changeset 36 b47902b73a93
parent 0 9cfd9a3ee49c
equal deleted inserted replaced
35:a2efdd544abf 36:b47902b73a93
       
     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 // Example CTestStep derived implementation
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file molr28Step.cpp
       
    20  @internalTechnology
       
    21 */
       
    22 #include "molr28Step.h"
       
    23 #include "te_suplprotocolsuitedefs.h"
       
    24 
       
    25 /**
       
    26  Destructor
       
    27  */
       
    28 Cmolr28Step::~Cmolr28Step()
       
    29 
       
    30 	{
       
    31 	}
       
    32 
       
    33 /**
       
    34  Constructor
       
    35  */
       
    36 Cmolr28Step::Cmolr28Step()
       
    37 	{
       
    38 	SetTestStepName(Kmolr28Step);
       
    39 	}
       
    40 
       
    41 /**
       
    42  @return - TVerdict code
       
    43  Override of base class virtual
       
    44  */
       
    45 TVerdict Cmolr28Step::doTestStepPreambleL()
       
    46 	{
       
    47 	// Call base class method for pre test actions	
       
    48 	CTe_suplprotocolSuiteStepBase::doTestStepPreambleL();
       
    49 	 
       
    50 	TLbsNetProtocolModuleParams param(*iGatewayObserver);
       
    51 	iModule = CSuplGatewayInterface::NewL(reinterpret_cast<TAny*>(&param));
       
    52 	
       
    53 	return TestStepResult();
       
    54 	}
       
    55 
       
    56 
       
    57 /** Perform CMoLrStep28 test step.
       
    58 
       
    59 This test verifies that the SUPL Protocol Module correctly performs
       
    60 conflict control of a second MO-LR being received while a previous
       
    61 MO-LR is in progress
       
    62 
       
    63 @return TVerdict test result code
       
    64 */
       
    65 TVerdict Cmolr28Step::doTestStepL()
       
    66 	{
       
    67 	
       
    68  	
       
    69 	INFO_PRINTF1(_L("\t********************************************************************"));
       
    70 	INFO_PRINTF1(_L("\tMOLR basic procedure followed - Assistance Data in RRLP message"));
       
    71 	INFO_PRINTF1(_L("\t********************************************************************"));
       
    72 	INFO_PRINTF1(_L("- START -"));	
       
    73 	
       
    74 	// Initiate MO-LR
       
    75 	TLbsNetSessionId sessionId1(TUid::Uid(0x87654321), 0x1111);
       
    76 	TLbsNetPosRequestOptionsAssistance options1;
       
    77 	options1.SetNewClientConnected(ETrue);
       
    78 	TLbsNetPosRequestQuality quality1;
       
    79 	options1.SetRequestQuality(quality1);
       
    80 	TLbsAsistanceDataGroup dataRequestMask1 = EAssistanceDataBadSatList;
       
    81 	options1.SetDataRequestMask(dataRequestMask1);
       
    82 	INFO_PRINTF1(_L("\tLBS -> RequestSelfLocation"));
       
    83 	iModule->RequestSelfLocation(sessionId1, options1);
       
    84 
       
    85 	// Check Connection Manager receives a request for connecting
       
    86 	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::EConnectReq))
       
    87 		{
       
    88 		SetTestStepResult(EFail);
       
    89 		return TestStepResult();
       
    90 		}
       
    91 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t ConnectionRequest -> NET"));
       
    92 
       
    93 
       
    94 	// Simulate the connection is up (inject that event)
       
    95 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t Connected <- NET"));
       
    96     iNetworkObserver->InjectConnectedIndication(iNetworkObserver->SessionId());
       
    97 	
       
    98 	// Check Connection Manager receives a request to send a SUPL START
       
    99 	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::ESuplStartSendReq))
       
   100 	{
       
   101 	SetTestStepResult(EFail);
       
   102 	return TestStepResult();
       
   103 	}
       
   104 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL START -> NET"));
       
   105 	
       
   106 	// Inject a SUPL RESPONSE
       
   107 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL RESPONSE <- NET"));
       
   108 	CSuplMessageBase* resp = BuildSuplResponseL(TPositionModuleInfo::ETechnologyTerminal | TPositionModuleInfo::ETechnologyAssisted);
       
   109 	iNetworkObserver->InjectSuplMessage(iNetworkObserver->SessionId(), resp);
       
   110 	
       
   111 
       
   112 	// Check gateway receives Location Request
       
   113 	INFO_PRINTF1(_L("\tLBS <- ProcessLocationRequest()"));
       
   114 	if (EFail == CheckGatewayCallbackL(
       
   115 				CSuplGatewayObserver::EProcessLocationRequest) ||
       
   116 		MLbsNetworkProtocolObserver::EServiceSelfLocation != iGatewayObserver->LocType())
       
   117 		{
       
   118 		SetTestStepResult(EFail);
       
   119 		return TestStepResult();
       
   120 		}
       
   121 		
       
   122 	// LBS Requests assistance data
       
   123 	INFO_PRINTF1(_L("\tLBS -> RequestAssistanceData ()"));
       
   124 	TLbsNetSessionIdArray dummyIdArray;	
       
   125 	iModule->RequestAssistanceData(dataRequestMask1, dummyIdArray);
       
   126 	
       
   127 	
       
   128 	// Check Connection Manager receives a request to send a SUPL POS INIT
       
   129 	// with the assistance data mask requested by the gateway
       
   130 	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::ESendSuplPosInitSendReq))
       
   131 	{
       
   132 	SetTestStepResult(EFail);
       
   133 	return TestStepResult();
       
   134 	}
       
   135 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL POS INIT -> NET"));
       
   136 	
       
   137 	// Attempt to Initiate a second MO-LR
       
   138 	TLbsNetSessionId sessionId2(TUid::Uid(0x12345678), 0x2222);
       
   139 	TLbsNetPosRequestOptionsAssistance options2;
       
   140 	options2.SetNewClientConnected(ETrue);
       
   141 	TLbsNetPosRequestQuality quality2;
       
   142 	options2.SetRequestQuality(quality2);
       
   143 	TLbsAsistanceDataGroup dataRequestMask2 = EAssistanceDataBadSatList;
       
   144 	options1.SetDataRequestMask(dataRequestMask2);
       
   145 	INFO_PRINTF1(_L("\tLBS -> RequestSelfLocation"));
       
   146 	iModule->RequestSelfLocation(sessionId2, options2);
       
   147 	
       
   148 	// Check gateway session completed
       
   149 	if (EFail == CheckGatewayCallbackL(
       
   150 				CSuplGatewayObserver::EProcessSessionComplete))
       
   151 		{
       
   152 		SetTestStepResult(EFail);
       
   153 		return TestStepResult();
       
   154 		}
       
   155 	INFO_PRINTF1(_L("\tLBS <- ProcessSessionComplete"));
       
   156 
       
   157 	// Check session ID == sessionId2
       
   158 	TLbsNetSessionId completedSessionId = iGatewayObserver->SessionIdValue();
       
   159 	if (completedSessionId != sessionId2)
       
   160 		{
       
   161 		SetTestStepResult(EFail);
       
   162 		return TestStepResult();
       
   163 		}
       
   164 
       
   165 	// check completion reason == KErrServerBusy
       
   166 	TInt completionReason = iGatewayObserver->SessionCloseReason();
       
   167 	if (KErrServerBusy != completionReason)
       
   168 		{
       
   169 		SetTestStepResult(EFail);
       
   170 		return TestStepResult();
       
   171 		}
       
   172 
       
   173 	// Inject a SUPL POS with some of the Assistance data requested
       
   174 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL POS - RRLP Assitance Data <- NET"));
       
   175 	CSuplMessageBase* suplPos = BuildSuplPosAssitDataL(EAssistanceDataAquisitionAssistance|EAssistanceDataBadSatList, EFalse);
       
   176 	iNetworkObserver->InjectSuplMessage(iNetworkObserver->SessionId(), suplPos);	
       
   177 
       
   178 
       
   179 
       
   180 	// Check gateway receives the assistance data types requested.
       
   181 	INFO_PRINTF1(_L("\tLBS <- ProcessAssistanceData()"));
       
   182 	if (EFail == CheckGatewayCallbackL(
       
   183 				CSuplGatewayObserver::EProcessAssistanceData) ||
       
   184 		(dataRequestMask1 & iGatewayObserver->AssistanceDataSetMask() != dataRequestMask1))
       
   185 		{
       
   186 		SetTestStepResult(EFail);
       
   187 		return TestStepResult();
       
   188 		}
       
   189 	
       
   190 	// Check the Connection Manager receives a request to send a SUPL POS (ack to assistance data)
       
   191 	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::ESendSuplPosSendReq))
       
   192 		{
       
   193 		SetTestStepResult(EFail);
       
   194 		return TestStepResult();
       
   195 		}
       
   196 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL POS - RRLP Assistance Data Ack -> NET"));
       
   197 
       
   198 	
       
   199 	// Inject a SUPL END (without position)
       
   200 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL END <- NET"));
       
   201 	CSuplMessageBase* suplEnd = BuildSuplEndL(EFalse);
       
   202 	iNetworkObserver->InjectSuplMessage(iNetworkObserver->SessionId(), suplEnd);
       
   203 	
       
   204 	// Check gateway session completed
       
   205 	if (EFail == CheckGatewayCallbackL(
       
   206 				CSuplGatewayObserver::EProcessSessionComplete))
       
   207 		{
       
   208 		SetTestStepResult(EFail);
       
   209 		return TestStepResult();
       
   210 		}
       
   211 	INFO_PRINTF1(_L("\tLBS <- ProcessSessionComplete"));
       
   212 	
       
   213 	// Check session ID == sessionId1
       
   214 	if (iGatewayObserver->SessionIdValue() != sessionId1)
       
   215 		{
       
   216 		SetTestStepResult(EFail);
       
   217 		return TestStepResult();
       
   218 		}
       
   219 
       
   220 	// check completion reason == KErrNone
       
   221 	if (KErrNone != iGatewayObserver->SessionCloseReason())
       
   222 		{
       
   223 		SetTestStepResult(EFail);
       
   224 		return TestStepResult();
       
   225 		}
       
   226 
       
   227 	// Check Connection Manager receives a disconnection request
       
   228 	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::EDisconnectReq))
       
   229 		{
       
   230 		SetTestStepResult(EFail);
       
   231 		return TestStepResult();
       
   232 		}
       
   233 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t DisconnectRequest -> NET"));
       
   234 	
       
   235 	// Check if more observer activity takes place
       
   236 	if (iGatewayObserver->IsMoreObserverActivity() ||
       
   237 	iNetworkObserver->IsMoreObserverActivity())
       
   238 	{
       
   239 	SetTestStepResult(EFail);
       
   240 	return TestStepResult();
       
   241 	}
       
   242 	INFO_PRINTF1(_L("- END -"));
       
   243 	
       
   244 	SetTestStepResult(EPass);
       
   245 	return TestStepResult();
       
   246 	
       
   247 }
       
   248 
       
   249 
       
   250 /**
       
   251  * @return - TVerdict code
       
   252  * Override of base class virtual
       
   253  */
       
   254 TVerdict Cmolr28Step::doTestStepPostambleL()
       
   255 	{
       
   256 	delete iModule;
       
   257 
       
   258 	// Call base class method for post test actions	
       
   259 	CTe_suplprotocolSuiteStepBase::doTestStepPostambleL();
       
   260 	return TestStepResult();
       
   261 	}