networkprotocolmodules/suplprotocolmodule/SuplProtocol/test/src/molr1Step.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 molr1Step.cpp
       
    20  @internalTechnology
       
    21 */
       
    22 #include "molr1Step.h"
       
    23 #include "te_suplprotocolsuitedefs.h"
       
    24 
       
    25 /**
       
    26  Destructor
       
    27  */
       
    28 Cmolr1Step::~Cmolr1Step()
       
    29 
       
    30 	{
       
    31 	}
       
    32 
       
    33 /**
       
    34  Constructor
       
    35  */
       
    36 Cmolr1Step::Cmolr1Step()
       
    37 	{
       
    38 	SetTestStepName(Kmolr1Step);
       
    39 	}
       
    40 
       
    41 /**
       
    42  @return - TVerdict code
       
    43  Override of base class virtual
       
    44  */
       
    45 TVerdict Cmolr1Step::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 	
       
    54 	//Clear the repository that keeps the host settings
       
    55 	//CRepository* rep = CRepository::NewL(KLbsHostSettingsSuplStoreId);
       
    56 	//CleanupStack::PushL(rep);
       
    57 	//User::LeaveIfError(rep->Reset());
       
    58 	//CleanupStack::PopAndDestroy(rep);
       
    59 
       
    60 	//CLbsHostSettingsStore* slpSettingsStore = CLbsHostSettingsStore::NewL(KLbsHostSettingsSuplStoreId);
       
    61 	//CleanupStack::PushL(slpSettingsStore);
       
    62 	
       
    63 	// Create a "user-provisioned" entry which is the default host.
       
    64 	// This will be the host selected by this testcase and most testcases
       
    65 	// following, so it is intentionally not erased in the postamble.
       
    66 	//INFO_PRINTF1(_L("[User-provisioned default host created]"));
       
    67 	//TLbsHostSettingsSupl defaultSettings;
       
    68 	//TLbsHostNameAddress defHostAddr((TText8*)"supl.thirdparty.com");
       
    69 	//TLbsHostName defHostName((TText8*)"defSuplServer");
       
    70 	//TLbsProviderId defHostProvider ((TText8*)"provider");
       
    71 	//TLbsHostSettingsId defSettingsId; 
       
    72 	//defaultSettings.SetHostNameAddress(defHostAddr);
       
    73 	//defaultSettings.SetName(defHostName);
       
    74 	//defaultSettings.SetProviderId(defHostProvider);
       
    75 	//defaultSettings.SetPortId(KLbsSuplUseDefaultPortId);
       
    76 	//TLbsHostCreatorId KTestMadeUpUid = {0x101010};
       
    77 	//defaultSettings.SetConnectionPoint(1,TLbsHostSettingsSupl::ELbsConnectionTypeNap);
       
    78 	//defaultSettings.SetAuthModesMOLR(TLbsHostSettingsSupl::EAuthTls);
       
    79 	//defaultSettings.SetAuthModesMTLR(TLbsHostSettingsSupl::EAuthTls);
       
    80 	
       
    81 //	if (KErrNone != slpSettingsStore->CreateHostSettings(defaultSettings, KTestMadeUpUid, defSettingsId))
       
    82 //		{
       
    83 //		SetTestStepResult(EFail);
       
    84 //		return TestStepResult();					
       
    85 //		}
       
    86 		
       
    87 //	if (KErrNone != slpSettingsStore->SetDefaultHostSettings(defSettingsId))
       
    88 //		{
       
    89 //		SetTestStepResult(EFail);
       
    90 //		return TestStepResult();					
       
    91 //		}
       
    92 		
       
    93 //	CleanupStack::PopAndDestroy(slpSettingsStore);
       
    94 	
       
    95 	 
       
    96 	return TestStepResult();
       
    97 	}
       
    98 
       
    99 
       
   100 /** Perform CMoLrStep1 test step.
       
   101 This test verifies that the SUPL Protocol Module correctly handles 
       
   102 an MO-LR Self Locate Terminal Based sequence (assistance data
       
   103 delivered via an RRLP payload).
       
   104 
       
   105 @return TVerdict test result code
       
   106 */
       
   107 TVerdict Cmolr1Step::doTestStepL()
       
   108 	{
       
   109 	
       
   110  	
       
   111 	INFO_PRINTF1(_L("\t********************************************************************"));
       
   112 	INFO_PRINTF1(_L("\tMOLR basic procedure followed - Assistance Data in RRLP message"));
       
   113 	INFO_PRINTF1(_L("\t********************************************************************"));
       
   114 	INFO_PRINTF1(_L("- START -"));	
       
   115 	
       
   116 	// Initiate MO-LR
       
   117 	TLbsNetSessionId sessionId1(TUid::Uid(0x87654321), 0x1111);
       
   118 	TLbsNetPosRequestOptionsAssistance options1;
       
   119 	options1.SetNewClientConnected(ETrue);
       
   120 	TLbsNetPosRequestQuality quality1;
       
   121 	options1.SetRequestQuality(quality1);
       
   122 	TLbsAsistanceDataGroup dataRequestMask1 = EAssistanceDataBadSatList;
       
   123 	options1.SetDataRequestMask(dataRequestMask1);
       
   124 	INFO_PRINTF1(_L("\tLBS -> RequestSelfLocation"));
       
   125 	iModule->RequestSelfLocation(sessionId1, options1);
       
   126 
       
   127 	// Check Connection Manager receives a request for connecting
       
   128 	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::EConnectReq))
       
   129 		{
       
   130 		SetTestStepResult(EFail);
       
   131 		return TestStepResult();
       
   132 		}
       
   133 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t ConnectionRequest -> NET"));
       
   134 
       
   135 
       
   136 	// Simulate the connection is up (inject that event)
       
   137 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t Connected <- NET"));
       
   138     iNetworkObserver->InjectConnectedIndication(iNetworkObserver->SessionId());
       
   139 	
       
   140 	// Check Connection Manager receives a request to send a SUPL START
       
   141 	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::ESuplStartSendReq))
       
   142 	{
       
   143 	SetTestStepResult(EFail);
       
   144 	return TestStepResult();
       
   145 	}
       
   146 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL START -> NET"));
       
   147 	
       
   148 	// Inject a SUPL RESPONSE
       
   149 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL RESPONSE <- NET"));
       
   150 	CSuplMessageBase* resp = BuildSuplResponseL(TPositionModuleInfo::ETechnologyTerminal | TPositionModuleInfo::ETechnologyAssisted);
       
   151 	iNetworkObserver->InjectSuplMessage(iNetworkObserver->SessionId(), resp);
       
   152 	
       
   153 
       
   154 	// Check gateway receives Location Request
       
   155 	INFO_PRINTF1(_L("\tLBS <- ProcessLocationRequest()"));
       
   156 	if (EFail == CheckGatewayCallbackL(
       
   157 				CSuplGatewayObserver::EProcessLocationRequest) ||
       
   158 		MLbsNetworkProtocolObserver::EServiceSelfLocation != iGatewayObserver->LocType())
       
   159 		{
       
   160 		SetTestStepResult(EFail);
       
   161 		return TestStepResult();
       
   162 		}
       
   163 		
       
   164 	// LBS Requests assistance data
       
   165 	INFO_PRINTF1(_L("\tLBS -> RequestAssistanceData ()"));
       
   166 	TLbsNetSessionIdArray dummyIdArray;	
       
   167 	iModule->RequestAssistanceData(dataRequestMask1, dummyIdArray);
       
   168 	
       
   169 	
       
   170 	// Check Connection Manager receives a request to send a SUPL POS INIT
       
   171 	// with the assistance data mask requested by the gateway
       
   172 	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::ESendSuplPosInitSendReq))
       
   173 	{
       
   174 	SetTestStepResult(EFail);
       
   175 	return TestStepResult();
       
   176 	}
       
   177 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL POS INIT -> NET"));
       
   178 
       
   179 	// Inject a SUPL POS with some of the Assistance data requested
       
   180 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL POS - RRLP Assitance Data <- NET"));
       
   181 	CSuplMessageBase* suplPos = BuildSuplPosAssitDataL(EAssistanceDataAquisitionAssistance|EAssistanceDataBadSatList, EFalse);
       
   182 	iNetworkObserver->InjectSuplMessage(iNetworkObserver->SessionId(), suplPos);	
       
   183 
       
   184 
       
   185 
       
   186 	// Check gateway receives the assistance data types requested.
       
   187 	INFO_PRINTF1(_L("\tLBS <- ProcessAssistanceData()"));
       
   188 	if (EFail == CheckGatewayCallbackL(
       
   189 				CSuplGatewayObserver::EProcessAssistanceData) ||
       
   190 		(dataRequestMask1 & iGatewayObserver->AssistanceDataSetMask() != dataRequestMask1))
       
   191 		{
       
   192 		SetTestStepResult(EFail);
       
   193 		return TestStepResult();
       
   194 		}
       
   195 	
       
   196 	// Check the Connection Manager receives a request to send a SUPL POS (ack to assistance data)
       
   197 	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::ESendSuplPosSendReq))
       
   198 		{
       
   199 		SetTestStepResult(EFail);
       
   200 		return TestStepResult();
       
   201 		}
       
   202 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL POS - RRLP Assistance Data Ack -> NET"));
       
   203 
       
   204 	
       
   205 	// Inject a SUPL END (without position)
       
   206 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL END <- NET"));
       
   207 	CSuplMessageBase* suplEnd = BuildSuplEndL(EFalse);
       
   208 	iNetworkObserver->InjectSuplMessage(iNetworkObserver->SessionId(), suplEnd);
       
   209 	
       
   210 	// Check gateway session completed
       
   211 	if (EFail == CheckGatewayCallbackL(
       
   212 				CSuplGatewayObserver::EProcessSessionComplete))
       
   213 		{
       
   214 		SetTestStepResult(EFail);
       
   215 		return TestStepResult();
       
   216 		}
       
   217 	INFO_PRINTF1(_L("\tLBS <- ProcessSessionComplete"));
       
   218 
       
   219 	// Check Connection Manager receives a disconnection request
       
   220 	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::EDisconnectReq))
       
   221 		{
       
   222 		SetTestStepResult(EFail);
       
   223 		return TestStepResult();
       
   224 		}
       
   225 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t DisconnectRequest -> NET"));
       
   226 	
       
   227 	// Check if more observer activity takes place
       
   228 	if (iGatewayObserver->IsMoreObserverActivity() ||
       
   229 	iNetworkObserver->IsMoreObserverActivity())
       
   230 	{
       
   231 	SetTestStepResult(EFail);
       
   232 	return TestStepResult();
       
   233 	}
       
   234 	INFO_PRINTF1(_L("- END -"));
       
   235 	
       
   236 	SetTestStepResult(EPass);
       
   237 	return TestStepResult();
       
   238 	
       
   239 }
       
   240 
       
   241 
       
   242 /**
       
   243  * @return - TVerdict code
       
   244  * Override of base class virtual
       
   245  */
       
   246 TVerdict Cmolr1Step::doTestStepPostambleL()
       
   247 	{
       
   248 	delete iModule;
       
   249 
       
   250 	// Call base class method for post test actions	
       
   251 	CTe_suplprotocolSuiteStepBase::doTestStepPostambleL();
       
   252 	return TestStepResult();
       
   253 	}