networkprotocolmodules/suplprotocolmodule/SuplProtocol/test/src/molr14Step.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 molr14Step.cpp
       
    20  @internalTechnology
       
    21 */
       
    22 #include "molr14Step.h"
       
    23 #include "te_suplprotocolsuitedefs.h"
       
    24 
       
    25 Cmolr14Step::~Cmolr14Step()
       
    26 	{
       
    27 	}
       
    28 
       
    29 Cmolr14Step::Cmolr14Step()
       
    30 	{
       
    31 	SetTestStepName(Kmolr14Step);
       
    32 	}
       
    33 
       
    34 /**
       
    35  * @return - TVerdict code
       
    36  * Override of base class virtual                                    
       
    37  */
       
    38 TVerdict Cmolr14Step::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 CMoLrStep14 test step.
       
    52 This test verifies that the SUPL Protocol Module correctly handles 
       
    53 a connection error indication after sending a SUPL POS INIT.
       
    54 
       
    55 @return TVerdict test result code
       
    56 */
       
    57 TVerdict Cmolr14Step::doTestStepL()
       
    58 	{
       
    59 	
       
    60 	INFO_PRINTF1(_L("\t********************************************************************"));
       
    61 	INFO_PRINTF1(_L("\tMOLR connection error 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 	// Fake Connection Manager sending a Connection Error indication
       
   125 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t Connection Error (ESecurityInsufficient) <- NET"));
       
   126     iNetworkObserver->InjectConnectionErrorIndication(iNetworkObserver->SessionId(), MSuplConnectionManagerObserver::ESecurityInsufficient);
       
   127 
       
   128 	// Check gateway session completed
       
   129 	if (EFail == CheckGatewayCallbackL(
       
   130 				CSuplGatewayObserver::EProcessSessionComplete))
       
   131 		{
       
   132 		SetTestStepResult(EFail);
       
   133 		return TestStepResult();
       
   134 		}
       
   135 	INFO_PRINTF1(_L("\tLBS <- ProcessSessionComplete"));
       
   136 
       
   137 	// Check Connection Manager receives a disconnection request
       
   138 	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::EDisconnectReq))
       
   139 		{
       
   140 		SetTestStepResult(EFail);
       
   141 		return TestStepResult();
       
   142 		}
       
   143 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t DisconnectRequest -> NET"));
       
   144 	
       
   145 	// Check if more observer activity takes place
       
   146 	if (iGatewayObserver->IsMoreObserverActivity() ||
       
   147 	iNetworkObserver->IsMoreObserverActivity())
       
   148 	{
       
   149 	SetTestStepResult(EFail);
       
   150 	return TestStepResult();
       
   151 	}
       
   152 	INFO_PRINTF1(_L("- END -"));
       
   153 	
       
   154 	SetTestStepResult(EPass);
       
   155 	return TestStepResult();
       
   156 	}
       
   157 
       
   158 
       
   159 /**
       
   160  * @return - TVerdict code
       
   161  * Override of base class virtual
       
   162  */
       
   163 TVerdict Cmolr14Step::doTestStepPostambleL()
       
   164 	{
       
   165 	delete iModule;
       
   166 
       
   167 	// Call base class method for post test actions	
       
   168 	CTe_suplprotocolSuiteStepBase::doTestStepPostambleL();
       
   169 	return TestStepResult();
       
   170 	}