networkprotocolmodules/suplprotocolmodule/SuplProtocol/test/src/molr22Step.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 molr22Step.cpp
       
    20  @internalTechnology
       
    21 */
       
    22 #include "molr22Step.h"
       
    23 #include "te_suplprotocolsuitedefs.h"
       
    24 
       
    25 /**
       
    26  Destructor
       
    27  */
       
    28 Cmolr22Step::~Cmolr22Step()
       
    29 
       
    30 	{
       
    31 	}
       
    32 
       
    33 /**
       
    34  Constructor
       
    35  */
       
    36 Cmolr22Step::Cmolr22Step()
       
    37 	{
       
    38 	SetTestStepName(Kmolr22Step);
       
    39 	}
       
    40 
       
    41 /**
       
    42  @return - TVerdict code
       
    43  Override of base class virtual
       
    44  */
       
    45 TVerdict Cmolr22Step::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 error notification from the RRLP state machine and the SUPL
       
    60 session is terminated with SUPL END.
       
    61 
       
    62 The RRLP error notification is induced by not injecting a Location
       
    63 Response from LBS before the MaxFixTime expires.
       
    64 
       
    65 @return TVerdict test result code
       
    66 */
       
    67 TVerdict Cmolr22Step::doTestStepL()
       
    68 	{
       
    69  	
       
    70 	INFO_PRINTF1(_L("\t********************************************************************"));
       
    71 	INFO_PRINTF1(_L("\tMOLR session terminated after RRLP error (LBS results timer expiry)"));
       
    72 	INFO_PRINTF1(_L("\t********************************************************************"));
       
    73 	INFO_PRINTF1(_L("- START -"));
       
    74 	// Initiate MO-LR
       
    75 	TLbsNetSessionId sessionId1(TUid::Uid(0x87654322), 0x1111);
       
    76 	TLbsNetPosRequestOptionsAssistance options1;
       
    77 	options1.SetNewClientConnected(ETrue);
       
    78 	TLbsNetPosRequestQuality quality1;
       
    79 	options1.SetRequestQuality(quality1);
       
    80 	TLbsAsistanceDataGroup dataRequestMask1 = EAssistanceDataBadSatList;
       
    81 	TLbsAsistanceDataGroup dataRequestMask2 = EAssistanceDataReferenceLocation;
       
    82 	// Request both sets of assitance data. They'll be delivered in different
       
    83 	// SUPL POS messages later on in the test.
       
    84 	TLbsAsistanceDataGroup dataRequestMask = dataRequestMask1|dataRequestMask2;
       
    85 	options1.SetDataRequestMask(dataRequestMask); 
       
    86 	INFO_PRINTF1(_L("\tLBS -> RequestSelfLocation"));
       
    87 	iModule->RequestSelfLocation(sessionId1, options1);
       
    88 
       
    89 	// Check Connection Manager receives a request for connecting
       
    90 	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::EConnectReq))
       
    91 		{
       
    92 		SetTestStepResult(EFail);
       
    93 		return TestStepResult();
       
    94 		}
       
    95 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t ConnectionRequest -> NET"));
       
    96 
       
    97 
       
    98 	// Simulate the connection is up (inject that event)
       
    99 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t Connected <- NET"));
       
   100     iNetworkObserver->InjectConnectedIndication(iNetworkObserver->SessionId());
       
   101 	
       
   102 	// Check Connection Manager receives a request to send a SUPL START
       
   103 	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::ESuplStartSendReq))
       
   104 	{
       
   105 	SetTestStepResult(EFail);
       
   106 	return TestStepResult();
       
   107 	}
       
   108 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL START -> NET"));
       
   109 	
       
   110 	// Inject a SUPL RESPONSE
       
   111 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL RESPONSE <- NET"));
       
   112 	CSuplMessageBase* resp = BuildSuplResponseL(TPositionModuleInfo::ETechnologyTerminal | TPositionModuleInfo::ETechnologyAssisted);
       
   113 	iNetworkObserver->InjectSuplMessage(iNetworkObserver->SessionId(), resp);
       
   114 	
       
   115 
       
   116 	// Check gateway receives Location Request
       
   117 	INFO_PRINTF1(_L("\tLBS <- ProcessLocationRequest()"));
       
   118 	if (EFail == CheckGatewayCallbackL(
       
   119 				CSuplGatewayObserver::EProcessLocationRequest) ||
       
   120 		MLbsNetworkProtocolObserver::EServiceSelfLocation != iGatewayObserver->LocType())
       
   121 		{
       
   122 		SetTestStepResult(EFail);
       
   123 		return TestStepResult();
       
   124 		}
       
   125 		
       
   126 	// LBS Requests assistance data
       
   127 	INFO_PRINTF1(_L("\tLBS -> RequestAssistanceData ()"));
       
   128 	TLbsNetSessionIdArray dummyIdArray;
       
   129 	iModule->RequestAssistanceData(dataRequestMask, dummyIdArray);
       
   130 	
       
   131 	// Check Connection Manager receives a request to send a SUPL POS INIT
       
   132 	// with the assistance data mask requested by the gateway
       
   133 	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::ESendSuplPosInitSendReq))
       
   134 	{
       
   135 	SetTestStepResult(EFail);
       
   136 	return TestStepResult();
       
   137 	}
       
   138 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL POS INIT -> NET"));
       
   139 
       
   140 	// Inject a SUPL POS (RRLP ASSIST DATA) with some of the Assistance data requested
       
   141 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL POS - RRLP Assitance Data <- NET"));
       
   142 	CSuplMessageBase* suplPos = BuildSuplPosAssitDataL(dataRequestMask2, ETrue); // ETrue = more assistance data underway
       
   143 	iNetworkObserver->InjectSuplMessage(iNetworkObserver->SessionId(), suplPos);	
       
   144 
       
   145 	// Check the Connection Manager receives a request to send a SUPL POS (ack to assistance data)
       
   146 	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::ESendSuplPosSendReq))
       
   147 		{
       
   148 		SetTestStepResult(EFail);
       
   149 		return TestStepResult();
       
   150 		}
       
   151 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL POS - RRLP Assistance Data Ack -> NET"));
       
   152 
       
   153 	// Inject a SUPL POS (RRLP MEASURE POSITION REQUEST) wich carries
       
   154 	// assistance data
       
   155 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL POS - RRLP Measure Position Request <- NET"));
       
   156 	suplPos = BuildSuplPosRequestL(TPositionModuleInfo::ETechnologyTerminal | TPositionModuleInfo::ETechnologyAssisted, dataRequestMask1);
       
   157 	iNetworkObserver->InjectSuplMessage(iNetworkObserver->SessionId(), suplPos);	
       
   158 
       
   159 	// Check gateway receives a reference location due to having requested
       
   160 	// and received assistance data type Reference Location
       
   161 	// TBD !!!
       
   162 	// Check gateway receives the assistance data types contained in both SUPL POS messages
       
   163 	// received earlier.
       
   164 	INFO_PRINTF1(_L("\tLBS <- ProcessAssistanceData()"));
       
   165 	if (EFail == CheckGatewayCallbackL(
       
   166 				CSuplGatewayObserver::EProcessAssistanceData) ||
       
   167 		(dataRequestMask & iGatewayObserver->AssistanceDataSetMask() != dataRequestMask))
       
   168 		{
       
   169 		SetTestStepResult(EFail);
       
   170 		return TestStepResult();
       
   171 		}
       
   172 	
       
   173 	// Check gateway receives a location request (due to the RRLP Measure Position Request)
       
   174 	//
       
   175 	INFO_PRINTF1(_L("\tLBS <- ProcessLocationRequest()"));
       
   176 	if (EFail == CheckGatewayCallbackL(
       
   177 				CSuplGatewayObserver::EProcessLocationRequest) ||
       
   178 		MLbsNetworkProtocolObserver::EServiceSelfLocation != iGatewayObserver->LocType())
       
   179 		{
       
   180 		SetTestStepResult(EFail);
       
   181 		return TestStepResult();
       
   182 		}
       
   183 
       
   184 	// ****************************************************************************************
       
   185 	// Do not fake LBS sending results (position) to SPM.
       
   186 	// By omitting a call to iModule->RespondLocationRequest(sessionId1,KErrNone,mobilePosInfo)
       
   187 	// the RRLP state machine will time out waiting for LBS results after aprox 3 seconds 
       
   188 	// (max fix time set in BuildSuplPosRequestL()). The time out should result in an error
       
   189 	// notification to SUPL Protocol state machine, which should cancel the SUPL session.
       
   190 	// ****************************************************************************************
       
   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 Cmolr22Step::doTestStepPostambleL()
       
   236 	{
       
   237 	delete iModule;
       
   238 
       
   239 	// Call base class method for post test actions	
       
   240 	CTe_suplprotocolSuiteStepBase::doTestStepPostambleL();
       
   241 	return TestStepResult();
       
   242 	}