networkprotocolmodules/suplprotocolmodule/SuplProtocol/test/src/molr13Step.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 molr13Step.cpp
       
    20  @internalTechnology
       
    21 */
       
    22 #include "molr13Step.h"
       
    23 #include "te_suplprotocolsuitedefs.h"
       
    24 
       
    25 Cmolr13Step::~Cmolr13Step()
       
    26 	{
       
    27 	}
       
    28 
       
    29 Cmolr13Step::Cmolr13Step()
       
    30 	{
       
    31 	SetTestStepName(Kmolr13Step);
       
    32 	}
       
    33 
       
    34 /**
       
    35  * @return - TVerdict code
       
    36  * Override of base class virtual
       
    37  */
       
    38 TVerdict Cmolr13Step::doTestStepPreambleL()
       
    39 
       
    40 	{
       
    41 	 
       
    42 	// Call base class method for pre test actions	
       
    43 	CTe_suplprotocolSuiteStepBase::doTestStepPreambleL();
       
    44  
       
    45 	TLbsNetProtocolModuleParams param(*iGatewayObserver);
       
    46 	iModule = CSuplGatewayInterface::NewL(reinterpret_cast<TAny*>(&param));
       
    47  
       
    48 	return TestStepResult();
       
    49 	}
       
    50 
       
    51 /** Perform CMoLrStep1 test step.
       
    52 This test verifies that the SUPL Protocol Module correctly handles 
       
    53 a timeout waiting for a SUPL POS after sending a SUPL POS INIT.
       
    54 
       
    55 @return TVerdict test result code
       
    56 */
       
    57 TVerdict Cmolr13Step::doTestStepL()
       
    58 	{
       
    59 	
       
    60 	INFO_PRINTF1(_L("\t********************************************************************"));
       
    61 	INFO_PRINTF1(_L("\tMOLR times out waiting for message after SUPL POS INIT"));
       
    62 	INFO_PRINTF1(_L("\t********************************************************************"));
       
    63 	INFO_PRINTF1(_L("- START -"));
       
    64 	// Initiate MO-LR
       
    65 	TLbsNetSessionId sessionId1(TUid::Uid(0x87654321), 0x1111);
       
    66 	TLbsNetPosRequestOptionsAssistance options1;
       
    67 	options1.SetNewClientConnected(ETrue);
       
    68 	TLbsNetPosRequestQuality quality1;
       
    69 	options1.SetRequestQuality(quality1);
       
    70 	TLbsAsistanceDataGroup dataRequestMask1 = EAssistanceDataBadSatList;
       
    71 	options1.SetDataRequestMask(dataRequestMask1);
       
    72 	INFO_PRINTF1(_L("\tLBS -> RequestSelfLocation"));
       
    73 	iModule->RequestSelfLocation(sessionId1, options1);
       
    74 
       
    75 	// Check Connection Manager receives a request for connecting
       
    76 	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::EConnectReq))
       
    77 		{
       
    78 		SetTestStepResult(EFail);
       
    79 		return TestStepResult();
       
    80 		}
       
    81 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t ConnectionRequest -> NET"));
       
    82 
       
    83 	// Simulate the connection is up (inject that event)
       
    84 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t Connected <- NET"));
       
    85     iNetworkObserver->InjectConnectedIndication(iNetworkObserver->SessionId());
       
    86 	
       
    87 	// Check Connection Manager receives a request to send a SUPL START
       
    88 	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::ESuplStartSendReq))
       
    89 	{
       
    90 	SetTestStepResult(EFail);
       
    91 	return TestStepResult();
       
    92 	}
       
    93 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL START -> NET"));
       
    94 	
       
    95 	// Inject a SUPL RESPONSE
       
    96 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL RESPONSE <- NET"));
       
    97 	CSuplMessageBase* resp = BuildSuplResponseL(TPositionModuleInfo::ETechnologyTerminal | TPositionModuleInfo::ETechnologyAssisted);
       
    98 	iNetworkObserver->InjectSuplMessage(iNetworkObserver->SessionId(), resp);
       
    99 	
       
   100 	// Check gateway receives Location Request
       
   101 	INFO_PRINTF1(_L("\tLBS <- ProcessLocationRequest()"));
       
   102 	if (EFail == CheckGatewayCallbackL(
       
   103 				CSuplGatewayObserver::EProcessLocationRequest) ||
       
   104 		MLbsNetworkProtocolObserver::EServiceSelfLocation != iGatewayObserver->LocType())
       
   105 		{
       
   106 		SetTestStepResult(EFail);
       
   107 		return TestStepResult();
       
   108 		}
       
   109 		
       
   110 	// LBS Requests assistance data
       
   111 	INFO_PRINTF1(_L("\tLBS -> RequestAssistanceData ()"));
       
   112 	TLbsNetSessionIdArray dummyIdArray;		
       
   113 	iModule->RequestAssistanceData(dataRequestMask1, dummyIdArray);
       
   114 	
       
   115 	// Check Connection Manager receives a request to send a SUPL POS INIT
       
   116 	// with the assistance data mask requested by the gateway
       
   117 	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::ESendSuplPosInitSendReq))
       
   118 	{
       
   119 	SetTestStepResult(EFail);
       
   120 	return TestStepResult();
       
   121 	}
       
   122 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL POS INIT -> NET"));
       
   123 
       
   124 	// Do not inject a message from Connection Manager after SUPL POS INIT
       
   125 	// to provoke a protocol timeout
       
   126 
       
   127 	// Check the Connection Manager receives a request to send a SUPL END 
       
   128 	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::ESendSuplEndSendReq))
       
   129 		{
       
   130 		SetTestStepResult(EFail);
       
   131 		return TestStepResult();
       
   132 		}
       
   133 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL END -> NET"));
       
   134 
       
   135 	// Check gateway receives a session complete indication
       
   136 	if (EFail == CheckGatewayCallbackL(
       
   137 				CSuplGatewayObserver::EProcessSessionComplete))
       
   138 		{
       
   139 		SetTestStepResult(EFail);
       
   140 		return TestStepResult();
       
   141 		}
       
   142 	INFO_PRINTF1(_L("\tLBS <- ProcessSessionComplete"));
       
   143 
       
   144 	// Check Connection Manager receives a disconnection request
       
   145 	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::EDisconnectReq))
       
   146 		{
       
   147 		SetTestStepResult(EFail);
       
   148 		return TestStepResult();
       
   149 		}
       
   150 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t DisconnectRequest -> NET"));
       
   151 	
       
   152 	// Check if more observer activity takes place
       
   153 	if (iGatewayObserver->IsMoreObserverActivity() ||
       
   154 	iNetworkObserver->IsMoreObserverActivity())
       
   155 	{
       
   156 	SetTestStepResult(EFail);
       
   157 	return TestStepResult();
       
   158 	}
       
   159 	INFO_PRINTF1(_L("- END -"));
       
   160 	
       
   161 	SetTestStepResult(EPass);
       
   162 	return TestStepResult();
       
   163 
       
   164 	}
       
   165 
       
   166 
       
   167 /**
       
   168  * @return - TVerdict code
       
   169  * Override of base class virtual
       
   170  */
       
   171 TVerdict Cmolr13Step::doTestStepPostambleL()
       
   172 	{
       
   173 	delete iModule;
       
   174 
       
   175 	// Call base class method for post test actions	
       
   176 	CTe_suplprotocolSuiteStepBase::doTestStepPostambleL();
       
   177 	return TestStepResult();
       
   178 	}