networkprotocolmodules/suplprotocolmodule/SuplProtocol/test/src/molr33Step.cpp
changeset 36 b47902b73a93
parent 0 9cfd9a3ee49c
equal deleted inserted replaced
35:a2efdd544abf 36:b47902b73a93
       
     1 // Copyright (c) 2005-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 molr33Step.cpp
       
    20  @internalTechnology
       
    21 */
       
    22 #include "molr33Step.h"
       
    23 #include "te_suplprotocolsuitedefs.h"
       
    24 
       
    25 /**
       
    26  Destructor
       
    27  */
       
    28 Cmolr33Step::~Cmolr33Step()
       
    29 
       
    30 	{
       
    31 	}
       
    32 
       
    33 /**
       
    34  Constructor
       
    35  */
       
    36 Cmolr33Step::Cmolr33Step()
       
    37 	{
       
    38 	SetTestStepName(Kmolr33Step);
       
    39 	}
       
    40 
       
    41 /**
       
    42  @return - TVerdict code
       
    43  Override of base class virtual
       
    44  */
       
    45 TVerdict Cmolr33Step::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
       
    60 delivered via an RRLP payload).
       
    61 
       
    62 @return TVerdict test result code
       
    63 */
       
    64 TVerdict Cmolr33Step::doTestStepL()
       
    65 	{
       
    66 	
       
    67 	INFO_PRINTF1(_L("\t********************************************************************"));
       
    68 	INFO_PRINTF1(_L("\tMOLR basic procedure followed - empty assistance data request"));
       
    69 	INFO_PRINTF1(_L("\t********************************************************************"));
       
    70 	INFO_PRINTF1(_L("- START -"));	
       
    71 	
       
    72 	// Initiate MO-LR
       
    73 	TLbsNetSessionId sessionId1(TUid::Uid(0x87654321), 0x1111);
       
    74 	TLbsNetPosRequestOptionsAssistance options1;
       
    75 	options1.SetNewClientConnected(ETrue);
       
    76 	TLbsNetPosRequestQuality quality1;
       
    77 	options1.SetRequestQuality(quality1);
       
    78 	TLbsAsistanceDataGroup dataRequestMask1 = 0;
       
    79 	options1.SetDataRequestMask(0);
       
    80 	INFO_PRINTF1(_L("\tLBS -> RequestSelfLocation"));
       
    81 	iModule->RequestSelfLocation(sessionId1, options1);
       
    82 
       
    83 	// Check Connection Manager receives a request for connecting
       
    84 	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::EConnectReq))
       
    85 		{
       
    86 		SetTestStepResult(EFail);
       
    87 		return TestStepResult();
       
    88 		}
       
    89 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t ConnectionRequest -> NET"));
       
    90 
       
    91 
       
    92 	// Simulate the connection is up (inject that event)
       
    93 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t Connected <- NET"));
       
    94     iNetworkObserver->InjectConnectedIndication(iNetworkObserver->SessionId());
       
    95 	
       
    96 	// Check Connection Manager receives a request to send a SUPL START
       
    97 	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::ESuplStartSendReq))
       
    98 	{
       
    99 	SetTestStepResult(EFail);
       
   100 	return TestStepResult();
       
   101 	}
       
   102 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL START -> NET"));
       
   103 	
       
   104 	// Inject a SUPL RESPONSE
       
   105 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL RESPONSE <- NET"));
       
   106 	CSuplMessageBase* resp = BuildSuplResponseL(TPositionModuleInfo::ETechnologyTerminal | TPositionModuleInfo::ETechnologyAssisted);
       
   107 	iNetworkObserver->InjectSuplMessage(iNetworkObserver->SessionId(), resp);
       
   108 	
       
   109 
       
   110 	// Check gateway receives Location Request
       
   111 	INFO_PRINTF1(_L("\tLBS <- ProcessLocationRequest()"));
       
   112 	if (EFail == CheckGatewayCallbackL(
       
   113 				CSuplGatewayObserver::EProcessLocationRequest) ||
       
   114 		MLbsNetworkProtocolObserver::EServiceSelfLocation != iGatewayObserver->LocType())
       
   115 		{
       
   116 		SetTestStepResult(EFail);
       
   117 		return TestStepResult();
       
   118 		}
       
   119 		
       
   120 	// LBS Requests empty assistance data
       
   121 	INFO_PRINTF1(_L("\tLBS -> RequestAssistanceData (empty)"));
       
   122 	TLbsNetSessionIdArray dummyIdArray;	
       
   123 	iModule->RequestAssistanceData(dataRequestMask1, dummyIdArray);
       
   124 	
       
   125 	
       
   126 	// Check Connection Manager receives a request to send a SUPL POS INIT
       
   127 	// with the assistance data mask requested by the gateway
       
   128 	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::ESendSuplPosInitSendReq))
       
   129 	{
       
   130 	SetTestStepResult(EFail);
       
   131 	return TestStepResult();
       
   132 	}
       
   133 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL POS INIT -> NET"));
       
   134 
       
   135 	// Inject a SUPL POS with some of the Assistance data requested
       
   136 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL POS - RRLP Assitance Data <- NET"));
       
   137 	CSuplMessageBase* suplPos = BuildSuplPosAssitDataL(EAssistanceDataAquisitionAssistance|EAssistanceDataBadSatList, EFalse);
       
   138 	iNetworkObserver->InjectSuplMessage(iNetworkObserver->SessionId(), suplPos);	
       
   139 
       
   140 
       
   141 
       
   142 	// Check gateway receives unsolicited assistance data.
       
   143 	INFO_PRINTF1(_L("\tLBS <- ProcessAssistanceData()"));
       
   144 	if (EFail == CheckGatewayCallbackL(
       
   145 				CSuplGatewayObserver::EProcessAssistanceData) ||
       
   146 		(dataRequestMask1 & iGatewayObserver->AssistanceDataSetMask() != dataRequestMask1))
       
   147 		{
       
   148 		SetTestStepResult(EFail);
       
   149 		return TestStepResult();
       
   150 		}
       
   151 	
       
   152 	// Check the Connection Manager receives a request to send a SUPL POS (ack to assistance data)
       
   153 	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::ESendSuplPosSendReq))
       
   154 		{
       
   155 		SetTestStepResult(EFail);
       
   156 		return TestStepResult();
       
   157 		}
       
   158 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL POS - RRLP Assistance Data Ack -> NET"));
       
   159 
       
   160 	
       
   161 	// Inject a SUPL END (without position)
       
   162 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL END <- NET"));
       
   163 	CSuplMessageBase* suplEnd = BuildSuplEndL(EFalse);
       
   164 	iNetworkObserver->InjectSuplMessage(iNetworkObserver->SessionId(), suplEnd);
       
   165 	
       
   166 	// Check gateway session completed
       
   167 	if (EFail == CheckGatewayCallbackL(
       
   168 				CSuplGatewayObserver::EProcessSessionComplete))
       
   169 		{
       
   170 		SetTestStepResult(EFail);
       
   171 		return TestStepResult();
       
   172 		}
       
   173 	INFO_PRINTF1(_L("\tLBS <- ProcessSessionComplete"));
       
   174 
       
   175 	// Check Connection Manager receives a disconnection request
       
   176 	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::EDisconnectReq))
       
   177 		{
       
   178 		SetTestStepResult(EFail);
       
   179 		return TestStepResult();
       
   180 		}
       
   181 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t DisconnectRequest -> NET"));
       
   182 	
       
   183 	// Check if more observer activity takes place
       
   184 	if (iGatewayObserver->IsMoreObserverActivity() ||
       
   185 	iNetworkObserver->IsMoreObserverActivity())
       
   186 	{
       
   187 	SetTestStepResult(EFail);
       
   188 	return TestStepResult();
       
   189 	}
       
   190 	INFO_PRINTF1(_L("- END -"));
       
   191 	
       
   192 	SetTestStepResult(EPass);
       
   193 	return TestStepResult();
       
   194 	
       
   195 }
       
   196 
       
   197 
       
   198 /**
       
   199  * @return - TVerdict code
       
   200  * Override of base class virtual
       
   201  */
       
   202 TVerdict Cmolr33Step::doTestStepPostambleL()
       
   203 	{
       
   204 	delete iModule;
       
   205 
       
   206 	// Call base class method for post test actions	
       
   207 	CTe_suplprotocolSuiteStepBase::doTestStepPostambleL();
       
   208 	return TestStepResult();
       
   209 	}