diff -r 000000000000 -r 9cfd9a3ee49c networkprotocolmodules/suplprotocolmodule/SuplProtocol/test/src/mtlr8Step.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/networkprotocolmodules/suplprotocolmodule/SuplProtocol/test/src/mtlr8Step.cpp Tue Feb 02 01:50:39 2010 +0200 @@ -0,0 +1,217 @@ +// Copyright (c) 2005-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 mtlr8Step.cpp + @internalTechnology +*/ +#include "mtlr8Step.h" +#include "te_suplprotocolsuitedefs.h" + +/** + Destructor + */ +Cmtlr8Step::~Cmtlr8Step() + + { + } + +/** + Constructor + */ +Cmtlr8Step::Cmtlr8Step() + { + SetTestStepName(Kmtlr8Step); + } + +/** + @return - TVerdict code + Override of base class virtual + */ +TVerdict Cmtlr8Step::doTestStepPreambleL() + { + // Call base class method for pre test actions + CTe_suplprotocolSuiteStepBase::doTestStepPreambleL(); + + TLbsNetProtocolModuleParams param(*iGatewayObserver); + iModule = CSuplGatewayInterface::NewL(reinterpret_cast(¶m)); + + // components for generating incoming SMS SUPL INIT + iSuplPush = CLbsSuplPush::NewL(ELbsSuplPushChannelSMS, *this); + iSuplInitGenerator = CSuplInitGenerator::NewL(); + + return TestStepResult(); + } + + +/** Perform Cmtlr8Step test step. + +This test verifies that the SUPL Protocol Module correctly handles +an MT-LR Network requested for which the requested positioning method is +eCid. + +@return TVerdict test result code +*/ +TVerdict Cmtlr8Step::doTestStepL() + { + INFO_PRINTF1(_L("\t********************************************************************")); + INFO_PRINTF1(_L("\tMTLR basic procedure followed - eCid positioning")); + INFO_PRINTF1(_L("\t********************************************************************")); + INFO_PRINTF1(_L("- START -")); + + // Initiate MT-LR + // Generate received SUPL INIT message (test message content #4) + TPtr8 messagePtr(iReceiveBuffer.Des()); + TInt err = iSuplInitGenerator->GenerateSuplInitL(4, messagePtr); + if (err != KErrNone) + { + SetTestStepResult(EFail); + return TestStepResult(); + } + + // Inject SUPL INIT using the SUPL Push API + INFO_PRINTF1(_L("\tLBS (SuplPush) -> OnSuplInit()")); + TLbsSuplPushRequestId reqId = 12345; + TPtrC8 message(messagePtr); + iSuplPush->SuplInit(reqId, message, 0); + + // ************ + // should check that the EProcessLocationRequest specifies "no preferred method" + // as a location request for eCID should not be injected into LBS. + // LBS Should kick off a location request in whatever its preferred method is (assume TB) + // ************ + + // Check Gateway receives a Privacy request and Location Request + INFO_PRINTF1(_L("\tLBS <- ProcessLocationRequest()")); + if (EFail == CheckGatewayCallbackL(CSuplGatewayObserver::EProcessLocationRequest) || + !iGatewayObserver->IsPrivReqReceived() || + MLbsNetworkProtocolObserver::EServiceMobileTerminated != iGatewayObserver->LocType() ) + { + SetTestStepResult(EFail); + return TestStepResult(); + } + + // LBS delivers privacy response + INFO_PRINTF1(_L("\tLBS -> RespondPrivacyRequest ()")); + CLbsNetworkProtocolBase::TLbsPrivacyResponse privacyResponse = CLbsNetworkProtocolBase::EPrivacyResponseAccepted; + iModule->RespondPrivacyRequest(iGatewayObserver->SessionIdValue(), privacyResponse, 0); + + // 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()); + + // LBS Requests assistance data + INFO_PRINTF1(_L("\tLBS -> RequestAssistanceData ()")); + TLbsAsistanceDataGroup dataRequestMask1 = EAssistanceDataBadSatList; + 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")); + + // ************ + // Test assumes that SLP is happy with the information received in the POS INIT + // namely the Cell ID information. Therefore it terminates the SUPL negotiation. + // ************ + + + // 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 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 Cmtlr8Step::doTestStepPostambleL() + { + delete iModule; + + delete iSuplPush; + delete iSuplInitGenerator; + + // Call base class method for post test actions + CTe_suplprotocolSuiteStepBase::doTestStepPostambleL(); + return TestStepResult(); + } + + +/** +Overrides the pure virtual MLbsSuplPushObserver::OnSuplInitComplete. +Receives the result of the message sending. + +@param aError [In] The error code or KErrNone if successful. + +@see MTe_LbsSuplSmsTriggerSenderObserver::OnMessageSent +@see CTe_LbsSuplSmsTriggerSender::SendMessage +*/ +void Cmtlr8Step::OnSuplInitComplete(TLbsSuplPushChannel /*aChannel*/, TLbsSuplPushRequestId /*aReqId*/, TInt aError, TInt /*aReserved*/) + { + iSmsSendError = aError; + if (iSmsSendError != KErrNone) + { + User::Invariant(); + } + } +