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