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