networkprotocolmodules/suplprotocolmodule/SuplProtocol/test/src/molr32Step.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 molr32Step.cpp
       
    20  @internalTechnology
       
    21 */
       
    22 #include "molr32Step.h"
       
    23 #include "Te_suplprotocolSuiteDefs.h"
       
    24 
       
    25 /**
       
    26  Destructor
       
    27  */
       
    28 Cmolr32Step::~Cmolr32Step()
       
    29 
       
    30 	{
       
    31 	}
       
    32 
       
    33 /**
       
    34  Constructor
       
    35  */
       
    36 Cmolr32Step::Cmolr32Step()
       
    37 	{
       
    38 	SetTestStepName(Kmolr32Step);
       
    39 	}
       
    40 
       
    41 /**
       
    42  @return - TVerdict code
       
    43  Override of base class virtual
       
    44  */
       
    45 TVerdict Cmolr32Step::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 CMoLrStep1 test step.
       
    58 This test verifies that the SUPL Protocol Module correctly handles 
       
    59 an MO-LR Self Locate Terminal Based sequence. Assistance data is
       
    60 partially delivered whith an RRLP assistance data message and then complemented
       
    61 with more assistance data received in an RRLP Measure Position Request.
       
    62 
       
    63 This test also ensures that Reference Location is one of the assistance data
       
    64 types requested by LBS after SUPL RESPONSE. The test verifies that a reference
       
    65 location is delivered to LBS if it is received from the network in the 
       
    66 Reference Location assistance data type.
       
    67 
       
    68 @return TVerdict test result code
       
    69 */
       
    70 TVerdict Cmolr32Step::doTestStepL()
       
    71 	{
       
    72  	
       
    73 	INFO_PRINTF1(_L("\t********************************************************************"));
       
    74 	INFO_PRINTF1(_L("\tMOLR - session cancelled due unsupported pos method in RRLP request"));
       
    75 	INFO_PRINTF1(_L("\t********************************************************************"));
       
    76 	INFO_PRINTF1(_L("- START -"));
       
    77 	// Initiate MO-LR
       
    78 	TLbsNetSessionId sessionId1(TUid::Uid(0x87654332), 0x1111);
       
    79 	TLbsNetPosRequestOptionsAssistance options1;
       
    80 	options1.SetNewClientConnected(ETrue);
       
    81 	TLbsNetPosRequestQuality quality1;
       
    82 	options1.SetRequestQuality(quality1);
       
    83 	TLbsAsistanceDataGroup dataRequestMask1 = EAssistanceDataBadSatList;
       
    84 	TLbsAsistanceDataGroup dataRequestMask2 = EAssistanceDataReferenceLocation;
       
    85 	// Request both sets of assitance data. They'll be delivered in different
       
    86 	// SUPL POS messages later on in the test.
       
    87 	TLbsAsistanceDataGroup dataRequestMask = dataRequestMask1|dataRequestMask2;
       
    88 	options1.SetDataRequestMask(dataRequestMask); 
       
    89 	INFO_PRINTF1(_L("\tLBS -> RequestSelfLocation"));
       
    90 	iModule->RequestSelfLocation(sessionId1, options1);
       
    91 
       
    92 	// Check Connection Manager receives a request for connecting
       
    93 	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::EConnectReq))
       
    94 		{
       
    95 		SetTestStepResult(EFail);
       
    96 		return TestStepResult();
       
    97 		}
       
    98 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t ConnectionRequest -> NET"));
       
    99 
       
   100 
       
   101 	// Simulate the connection is up (inject that event)
       
   102 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t Connected <- NET"));
       
   103     iNetworkObserver->InjectConnectedIndication(iNetworkObserver->SessionId());
       
   104 	
       
   105 	// Check Connection Manager receives a request to send a SUPL START
       
   106 	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::ESuplStartSendReq))
       
   107 	{
       
   108 	SetTestStepResult(EFail);
       
   109 	return TestStepResult();
       
   110 	}
       
   111 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL START -> NET"));
       
   112 	
       
   113 	// Inject a SUPL RESPONSE
       
   114 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL RESPONSE <- NET"));
       
   115 	CSuplMessageBase* resp = BuildSuplResponseL(TPositionModuleInfo::ETechnologyTerminal | TPositionModuleInfo::ETechnologyAssisted);
       
   116 	iNetworkObserver->InjectSuplMessage(iNetworkObserver->SessionId(), resp);
       
   117 	
       
   118 
       
   119 	// Check gateway receives Location Request
       
   120 	INFO_PRINTF1(_L("\tLBS <- ProcessLocationRequest()"));
       
   121 	if (EFail == CheckGatewayCallbackL(
       
   122 				CSuplGatewayObserver::EProcessLocationRequest) ||
       
   123 		MLbsNetworkProtocolObserver::EServiceSelfLocation != iGatewayObserver->LocType())
       
   124 		{
       
   125 		SetTestStepResult(EFail);
       
   126 		return TestStepResult();
       
   127 		}
       
   128 		
       
   129 	// LBS Requests assistance data
       
   130 	INFO_PRINTF1(_L("\tLBS -> RequestAssistanceData ()"));
       
   131 	TLbsNetSessionIdArray dummyIdArray;		
       
   132 	iModule->RequestAssistanceData(dataRequestMask, dummyIdArray);
       
   133 	
       
   134 	// Check Connection Manager receives a request to send a SUPL POS INIT
       
   135 	// with the assistance data mask requested by the gateway
       
   136 	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::ESendSuplPosInitSendReq))
       
   137 	{
       
   138 	SetTestStepResult(EFail);
       
   139 	return TestStepResult();
       
   140 	}
       
   141 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL POS INIT -> NET"));
       
   142 
       
   143 	// Inject a SUPL POS (RRLP ASSIST DATA) with some of the Assistance data requested
       
   144 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL POS - RRLP Assitance Data <- NET"));
       
   145 	CSuplMessageBase* suplPos = BuildSuplPosAssitDataL(dataRequestMask2, ETrue); // ETrue = more assistance data underway
       
   146 	iNetworkObserver->InjectSuplMessage(iNetworkObserver->SessionId(), suplPos);	
       
   147 
       
   148 	// Check the Connection Manager receives a request to send a SUPL POS (ack to assistance data)
       
   149 	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::ESendSuplPosSendReq))
       
   150 		{
       
   151 		SetTestStepResult(EFail);
       
   152 		return TestStepResult();
       
   153 		}
       
   154 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL POS - RRLP Assistance Data Ack -> NET"));
       
   155 
       
   156     // *************************************************************************************
       
   157 	// Inject a SUPL POS (RRLP MEASURE POSITION REQUEST) with
       
   158 	// an unsupported positioning method (KLbsPositioningMeansEotd)
       
   159 	//**************************************************************************************
       
   160 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL POS - RRLP Measure Position Request <- NET"));
       
   161 	suplPos = BuildSuplPosRequestL(TPositionModuleInfo::ETechnologyTerminal | TPositionModuleInfo::ETechnologyAssisted, dataRequestMask1, KLbsPositioningMeansEotd);
       
   162 	iNetworkObserver->InjectSuplMessage(iNetworkObserver->SessionId(), suplPos);	
       
   163 
       
   164 
       
   165 	// The assitance data and reference location carried by the rrlp request is sent to
       
   166 	// LBS (the actual request won't).
       
   167 	
       
   168 	// Check gateway receives the assistance data types contained in both SUPL POS messages
       
   169 	// received earlier.
       
   170 	if (EFail == CheckGatewayCallbackL(CSuplGatewayObserver::EProcessAssistanceData) ||
       
   171 		(dataRequestMask & iGatewayObserver->AssistanceDataSetMask() != dataRequestMask) )
       
   172 		{
       
   173 		SetTestStepResult(EFail);
       
   174 		return TestStepResult();
       
   175 		}
       
   176 	
       
   177 	// Ref Loc has been requested. Make sure it's been notified	(the callback mechanism does
       
   178 	// not work well because EProcessAssistanceData overwrites EProcessLocationUpdate as they
       
   179 	// happen in the same RunL of the SUPL Protocol). Instead, a flag has to be checked after
       
   180 	// having received EProcessAssistanceData above
       
   181 	if (!iGatewayObserver->IsRefLocNotified())
       
   182 		{
       
   183 		SetTestStepResult(EFail);
       
   184 		return TestStepResult();			
       
   185 		}
       
   186 	
       
   187 	// Reference Location is reported before Assistance Data...if we got this far,
       
   188 	// both ref loc and assist data have been notified:
       
   189 	INFO_PRINTF1(_L("\tLBS <- ProcessLocationUpdate(Reference Location)"));
       
   190 	INFO_PRINTF1(_L("\tLBS <- ProcessAssistanceData()"));
       
   191 	
       
   192 	// Check the Connection Manager receives a request to send a SUPL END 
       
   193 	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::ESendSuplEndSendReq))
       
   194 		{
       
   195 		SetTestStepResult(EFail);
       
   196 		return TestStepResult();
       
   197 		}
       
   198 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL END -> NET"));
       
   199 
       
   200 	// Check gateway session completed
       
   201 	if (EFail == CheckGatewayCallbackL(
       
   202 				CSuplGatewayObserver::EProcessSessionComplete))
       
   203 		{
       
   204 		SetTestStepResult(EFail);
       
   205 		return TestStepResult();
       
   206 		}
       
   207 	INFO_PRINTF1(_L("\tLBS <- ProcessSessionComplete"));
       
   208 
       
   209 	// Check Connection Manager receives a disconnection request
       
   210 	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::EDisconnectReq))
       
   211 		{
       
   212 		SetTestStepResult(EFail);
       
   213 		return TestStepResult();
       
   214 		}
       
   215 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t DisconnectRequest -> NET"));
       
   216 	
       
   217 	// Check if more observer activity takes place
       
   218 	if (iGatewayObserver->IsMoreObserverActivity() ||
       
   219 	iNetworkObserver->IsMoreObserverActivity())
       
   220 	{
       
   221 	SetTestStepResult(EFail);
       
   222 	return TestStepResult();
       
   223 	}
       
   224 	INFO_PRINTF1(_L("- END -"));
       
   225 	
       
   226 	SetTestStepResult(EPass);
       
   227 	return TestStepResult();	
       
   228 }
       
   229 
       
   230 
       
   231 /**
       
   232  * @return - TVerdict code
       
   233  * Override of base class virtual
       
   234  */
       
   235 TVerdict Cmolr32Step::doTestStepPostambleL()
       
   236 	{
       
   237 	delete iModule;
       
   238 
       
   239 	// Call base class method for post test actions	
       
   240 	CTe_suplprotocolSuiteStepBase::doTestStepPostambleL();
       
   241 	return TestStepResult();
       
   242 	}