diff -r 000000000000 -r 9cfd9a3ee49c networkprotocolmodules/suplprotocolmodule/SuplProtocol/test/src/molr28Step.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/networkprotocolmodules/suplprotocolmodule/SuplProtocol/test/src/molr28Step.cpp Tue Feb 02 01:50:39 2010 +0200 @@ -0,0 +1,261 @@ +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Example CTestStep derived implementation +// +// + +/** + @file molr28Step.cpp + @internalTechnology +*/ +#include "molr28Step.h" +#include "te_suplprotocolsuitedefs.h" + +/** + Destructor + */ +Cmolr28Step::~Cmolr28Step() + + { + } + +/** + Constructor + */ +Cmolr28Step::Cmolr28Step() + { + SetTestStepName(Kmolr28Step); + } + +/** + @return - TVerdict code + Override of base class virtual + */ +TVerdict Cmolr28Step::doTestStepPreambleL() + { + // Call base class method for pre test actions + CTe_suplprotocolSuiteStepBase::doTestStepPreambleL(); + + TLbsNetProtocolModuleParams param(*iGatewayObserver); + iModule = CSuplGatewayInterface::NewL(reinterpret_cast(¶m)); + + return TestStepResult(); + } + + +/** Perform CMoLrStep28 test step. + +This test verifies that the SUPL Protocol Module correctly performs +conflict control of a second MO-LR being received while a previous +MO-LR is in progress + +@return TVerdict test result code +*/ +TVerdict Cmolr28Step::doTestStepL() + { + + + INFO_PRINTF1(_L("\t********************************************************************")); + INFO_PRINTF1(_L("\tMOLR basic procedure followed - Assistance Data in RRLP message")); + INFO_PRINTF1(_L("\t********************************************************************")); + INFO_PRINTF1(_L("- START -")); + + // Initiate MO-LR + TLbsNetSessionId sessionId1(TUid::Uid(0x87654321), 0x1111); + TLbsNetPosRequestOptionsAssistance options1; + options1.SetNewClientConnected(ETrue); + TLbsNetPosRequestQuality quality1; + options1.SetRequestQuality(quality1); + TLbsAsistanceDataGroup dataRequestMask1 = EAssistanceDataBadSatList; + options1.SetDataRequestMask(dataRequestMask1); + INFO_PRINTF1(_L("\tLBS -> RequestSelfLocation")); + iModule->RequestSelfLocation(sessionId1, options1); + + // Check Connection Manager receives a request for connecting + if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::EConnectReq)) + { + SetTestStepResult(EFail); + return TestStepResult(); + } + INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t ConnectionRequest -> NET")); + + + // Simulate the connection is up (inject that event) + INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t Connected <- NET")); + iNetworkObserver->InjectConnectedIndication(iNetworkObserver->SessionId()); + + // Check Connection Manager receives a request to send a SUPL START + if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::ESuplStartSendReq)) + { + SetTestStepResult(EFail); + return TestStepResult(); + } + INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL START -> NET")); + + // Inject a SUPL RESPONSE + INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL RESPONSE <- NET")); + CSuplMessageBase* resp = BuildSuplResponseL(TPositionModuleInfo::ETechnologyTerminal | TPositionModuleInfo::ETechnologyAssisted); + iNetworkObserver->InjectSuplMessage(iNetworkObserver->SessionId(), resp); + + + // Check gateway receives Location Request + INFO_PRINTF1(_L("\tLBS <- ProcessLocationRequest()")); + if (EFail == CheckGatewayCallbackL( + CSuplGatewayObserver::EProcessLocationRequest) || + MLbsNetworkProtocolObserver::EServiceSelfLocation != iGatewayObserver->LocType()) + { + SetTestStepResult(EFail); + return TestStepResult(); + } + + // LBS Requests assistance data + INFO_PRINTF1(_L("\tLBS -> RequestAssistanceData ()")); + TLbsNetSessionIdArray dummyIdArray; + iModule->RequestAssistanceData(dataRequestMask1, dummyIdArray); + + + // Check Connection Manager receives a request to send a SUPL POS INIT + // with the assistance data mask requested by the gateway + if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::ESendSuplPosInitSendReq)) + { + SetTestStepResult(EFail); + return TestStepResult(); + } + INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL POS INIT -> NET")); + + // Attempt to Initiate a second MO-LR + TLbsNetSessionId sessionId2(TUid::Uid(0x12345678), 0x2222); + TLbsNetPosRequestOptionsAssistance options2; + options2.SetNewClientConnected(ETrue); + TLbsNetPosRequestQuality quality2; + options2.SetRequestQuality(quality2); + TLbsAsistanceDataGroup dataRequestMask2 = EAssistanceDataBadSatList; + options1.SetDataRequestMask(dataRequestMask2); + INFO_PRINTF1(_L("\tLBS -> RequestSelfLocation")); + iModule->RequestSelfLocation(sessionId2, options2); + + // Check gateway session completed + if (EFail == CheckGatewayCallbackL( + CSuplGatewayObserver::EProcessSessionComplete)) + { + SetTestStepResult(EFail); + return TestStepResult(); + } + INFO_PRINTF1(_L("\tLBS <- ProcessSessionComplete")); + + // Check session ID == sessionId2 + TLbsNetSessionId completedSessionId = iGatewayObserver->SessionIdValue(); + if (completedSessionId != sessionId2) + { + SetTestStepResult(EFail); + return TestStepResult(); + } + + // check completion reason == KErrServerBusy + TInt completionReason = iGatewayObserver->SessionCloseReason(); + if (KErrServerBusy != completionReason) + { + SetTestStepResult(EFail); + return TestStepResult(); + } + + // Inject a SUPL POS with some of the Assistance data requested + INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL POS - RRLP Assitance Data <- NET")); + CSuplMessageBase* suplPos = BuildSuplPosAssitDataL(EAssistanceDataAquisitionAssistance|EAssistanceDataBadSatList, EFalse); + iNetworkObserver->InjectSuplMessage(iNetworkObserver->SessionId(), suplPos); + + + + // Check gateway receives the assistance data types requested. + INFO_PRINTF1(_L("\tLBS <- ProcessAssistanceData()")); + if (EFail == CheckGatewayCallbackL( + CSuplGatewayObserver::EProcessAssistanceData) || + (dataRequestMask1 & iGatewayObserver->AssistanceDataSetMask() != dataRequestMask1)) + { + SetTestStepResult(EFail); + return TestStepResult(); + } + + // Check the Connection Manager receives a request to send a SUPL POS (ack to assistance data) + if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::ESendSuplPosSendReq)) + { + SetTestStepResult(EFail); + return TestStepResult(); + } + INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL POS - RRLP Assistance Data Ack -> NET")); + + + // Inject a SUPL END (without position) + INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL END <- NET")); + CSuplMessageBase* suplEnd = BuildSuplEndL(EFalse); + iNetworkObserver->InjectSuplMessage(iNetworkObserver->SessionId(), suplEnd); + + // Check gateway session completed + if (EFail == CheckGatewayCallbackL( + CSuplGatewayObserver::EProcessSessionComplete)) + { + SetTestStepResult(EFail); + return TestStepResult(); + } + INFO_PRINTF1(_L("\tLBS <- ProcessSessionComplete")); + + // Check session ID == sessionId1 + if (iGatewayObserver->SessionIdValue() != sessionId1) + { + SetTestStepResult(EFail); + return TestStepResult(); + } + + // check completion reason == KErrNone + if (KErrNone != iGatewayObserver->SessionCloseReason()) + { + SetTestStepResult(EFail); + return TestStepResult(); + } + + // Check Connection Manager receives a disconnection request + if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::EDisconnectReq)) + { + SetTestStepResult(EFail); + return TestStepResult(); + } + INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t DisconnectRequest -> NET")); + + // Check if more observer activity takes place + if (iGatewayObserver->IsMoreObserverActivity() || + iNetworkObserver->IsMoreObserverActivity()) + { + SetTestStepResult(EFail); + return TestStepResult(); + } + INFO_PRINTF1(_L("- END -")); + + SetTestStepResult(EPass); + return TestStepResult(); + +} + + +/** + * @return - TVerdict code + * Override of base class virtual + */ +TVerdict Cmolr28Step::doTestStepPostambleL() + { + delete iModule; + + // Call base class method for post test actions + CTe_suplprotocolSuiteStepBase::doTestStepPostambleL(); + return TestStepResult(); + }