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