networkprotocolmodules/suplprotocolmodule/SuplProtocol/test/src/molr17Step.cpp
changeset 0 9cfd9a3ee49c
equal deleted inserted replaced
-1:000000000000 0:9cfd9a3ee49c
       
     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 molr17Step.cpp
       
    20  @internalTechnology
       
    21 */
       
    22 #include "molr17Step.h"
       
    23 #include "te_suplprotocolsuitedefs.h"
       
    24 
       
    25 Cmolr17Step::~Cmolr17Step()
       
    26 	{
       
    27 	}
       
    28 
       
    29 Cmolr17Step::Cmolr17Step()
       
    30 	{
       
    31 	SetTestStepName(Kmolr17Step);
       
    32 	}
       
    33 
       
    34 /**
       
    35  * @return - TVerdict code
       
    36  * Override of base class virtual
       
    37  */
       
    38 TVerdict Cmolr17Step::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 an unexpected SUPL POS after SUPL RESPONSE.
       
    54 
       
    55 @return TVerdict test result code
       
    56 */
       
    57 TVerdict Cmolr17Step::doTestStepL()
       
    58 	{
       
    59 	
       
    60 	INFO_PRINTF1(_L("\t********************************************************************"));
       
    61 	INFO_PRINTF1(_L("\tMOLR unexpected SUPL POS after SUPL RESPONSE"));
       
    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 	
       
    96 	// Inject a SUPL RESPONSE
       
    97 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL RESPONSE <- NET"));
       
    98 	CSuplMessageBase* resp = BuildSuplResponseL(TPositionModuleInfo::ETechnologyTerminal | TPositionModuleInfo::ETechnologyAssisted);
       
    99 	iNetworkObserver->InjectSuplMessage(iNetworkObserver->SessionId(), resp);
       
   100 
       
   101 	// Inject a SUPL POS with some of the Assistance data requested - this is
       
   102 	// not expected in an MOLR call and SUPL state machine should terminate the
       
   103 	// session
       
   104 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL POS - RRLP Assitance Data <- NET"));
       
   105 	CSuplMessageBase* suplPos = BuildSuplPosAssitDataL(EAssistanceDataAquisitionAssistance|EAssistanceDataBadSatList, EFalse);
       
   106 	iNetworkObserver->InjectSuplMessage(iNetworkObserver->SessionId(), suplPos);
       
   107 
       
   108 	// Check gateway receives Location Request
       
   109 	INFO_PRINTF1(_L("\tLBS <- ProcessLocationRequest()"));
       
   110 	if (EFail == CheckGatewayCallbackL(
       
   111 				CSuplGatewayObserver::EProcessLocationRequest) ||
       
   112 		MLbsNetworkProtocolObserver::EServiceSelfLocation != iGatewayObserver->LocType())
       
   113 		{
       
   114 		SetTestStepResult(EFail);
       
   115 		return TestStepResult();
       
   116 		}
       
   117 	
       
   118 	// Check the Connection Manager receives a request to send a SUPL END 
       
   119 	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::ESendSuplEndSendReq))
       
   120 		{
       
   121 		SetTestStepResult(EFail);
       
   122 		return TestStepResult();
       
   123 		}
       
   124 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL END -> NET"));
       
   125 
       
   126 	// Check gateway receives a session complete indication
       
   127 	if (EFail == CheckGatewayCallbackL(
       
   128 				CSuplGatewayObserver::EProcessSessionComplete))
       
   129 		{
       
   130 		SetTestStepResult(EFail);
       
   131 		return TestStepResult();
       
   132 		}
       
   133 	INFO_PRINTF1(_L("\tLBS <- ProcessSessionComplete"));
       
   134 
       
   135 	// Check Connection Manager receives a disconnection request
       
   136 	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::EDisconnectReq))
       
   137 		{
       
   138 		SetTestStepResult(EFail);
       
   139 		return TestStepResult();
       
   140 		}
       
   141 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t DisconnectRequest -> NET"));
       
   142 	
       
   143 	// Check if more observer activity takes place
       
   144 	if (iGatewayObserver->IsMoreObserverActivity() ||
       
   145 	iNetworkObserver->IsMoreObserverActivity())
       
   146 	{
       
   147 	SetTestStepResult(EFail);
       
   148 	return TestStepResult();
       
   149 	}
       
   150 	INFO_PRINTF1(_L("- END -"));
       
   151 	
       
   152 	SetTestStepResult(EPass);
       
   153 	return TestStepResult();
       
   154 	}
       
   155 
       
   156 
       
   157 /**
       
   158  * @return - TVerdict code
       
   159  * Override of base class virtual
       
   160  */
       
   161 TVerdict Cmolr17Step::doTestStepPostambleL()
       
   162 	{
       
   163 	delete iModule;
       
   164 
       
   165 	// Call base class method for post test actions	
       
   166 	CTe_suplprotocolSuiteStepBase::doTestStepPostambleL();
       
   167 	return TestStepResult();
       
   168 	}