networkprotocolmodules/suplprotocolmodule/SuplProtocol/test/src/molr24Step.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 molr24Step.cpp
       
    20  @internalTechnology
       
    21 */
       
    22 #include "molr24Step.h"
       
    23 #include "te_suplprotocolsuitedefs.h"
       
    24 
       
    25 Cmolr24Step::~Cmolr24Step()
       
    26 	{
       
    27 	}
       
    28 
       
    29 Cmolr24Step::Cmolr24Step()
       
    30 	{
       
    31 	SetTestStepName(Kmolr24Step);
       
    32 	}
       
    33 
       
    34 /**
       
    35  * @return - TVerdict code
       
    36  * Override of base class virtual
       
    37  */
       
    38 TVerdict Cmolr24Step::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 Cell-Based MO-LR Self Locate sequence .
       
    54 
       
    55 @return TVerdict test result code
       
    56 */
       
    57 TVerdict Cmolr24Step::doTestStepL()
       
    58 	{
       
    59 	
       
    60 	INFO_PRINTF1(_L("\t********************************************************************"));
       
    61 	INFO_PRINTF1(_L("\tMOLR, Cell Based - basic procedure followed"));
       
    62 	INFO_PRINTF1(_L("\t********************************************************************"));
       
    63 	INFO_PRINTF1(_L("- START -"));
       
    64 	
       
    65 	// Initiate MO-LR
       
    66 	INFO_PRINTF1(_L("\tLBS -> RequestNetworkLocation"));
       
    67 	TLbsNetSessionId sessionId1(TUid::Uid(0x12345678), 0x1111);
       
    68 	TLbsNetPosRequestOptions options1;
       
    69 	options1.SetNewClientConnected(ETrue);
       
    70 	TLbsNetPosRequestQuality quality1;
       
    71 	options1.SetRequestQuality(quality1);
       
    72 	iModule->RequestNetworkLocation(sessionId1, options1);
       
    73 
       
    74     // Check Connection Manager receives a request for connecting
       
    75 	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::EConnectReq))
       
    76 		{
       
    77 		SetTestStepResult(EFail);
       
    78 		return TestStepResult();
       
    79 		}
       
    80 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t ConnectionRequest -> NET"));
       
    81 
       
    82 	// Simulate the connection is up (inject that event)
       
    83 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t Connected <- NET"));
       
    84     iNetworkObserver->InjectConnectedIndication(iNetworkObserver->SessionId());
       
    85 	
       
    86 	// Check Connection Manager receives a request to send a SUPL START
       
    87 	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::ESuplStartSendReq))
       
    88 	{
       
    89 	SetTestStepResult(EFail);
       
    90 	return TestStepResult();
       
    91 	}
       
    92 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL START -> NET"));
       
    93 	
       
    94 	// Inject a SUPL END (with position)
       
    95 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL END <- NET"));
       
    96 	CSuplMessageBase* suplEnd = BuildSuplEndL(ETrue);
       
    97 	iNetworkObserver->InjectSuplMessage(iNetworkObserver->SessionId(), suplEnd);
       
    98 
       
    99 	// Check gateway receives Location Update
       
   100 	INFO_PRINTF1(_L("\tLBS <- ProcessLocationUpdate()"));
       
   101 	if (EFail == CheckGatewayCallbackL(
       
   102 				CSuplGatewayObserver::EProcessLocationUpdate))
       
   103 		{
       
   104 		SetTestStepResult(EFail);
       
   105 		return TestStepResult();
       
   106 		}
       
   107 
       
   108 	// Check gateway receives a session complete indication
       
   109 	if (EFail == CheckGatewayCallbackL(
       
   110 				CSuplGatewayObserver::EProcessSessionComplete))
       
   111 		{
       
   112 		SetTestStepResult(EFail);
       
   113 		return TestStepResult();
       
   114 		}
       
   115 	INFO_PRINTF1(_L("\tLBS <- ProcessSessionComplete"));
       
   116 
       
   117 	// Check Connection Manager receives a disconnection request
       
   118 	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::EDisconnectReq))
       
   119 		{
       
   120 		SetTestStepResult(EFail);
       
   121 		return TestStepResult();
       
   122 		}
       
   123 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t DisconnectRequest -> NET"));
       
   124 	
       
   125 	// Check if more observer activity takes place
       
   126 	if (iGatewayObserver->IsMoreObserverActivity() ||
       
   127 	iNetworkObserver->IsMoreObserverActivity())
       
   128 	{
       
   129 	SetTestStepResult(EFail);
       
   130 	return TestStepResult();
       
   131 	}
       
   132 	INFO_PRINTF1(_L("- END -"));
       
   133 	
       
   134 	SetTestStepResult(EPass);
       
   135 	return TestStepResult();
       
   136 	}
       
   137 
       
   138 
       
   139 /**
       
   140  * @return - TVerdict code
       
   141  * Override of base class virtual
       
   142  */
       
   143 TVerdict Cmolr24Step::doTestStepPostambleL()
       
   144 	{
       
   145 	delete iModule;
       
   146 
       
   147 	// Call base class method for post test actions	
       
   148 	CTe_suplprotocolSuiteStepBase::doTestStepPostambleL();
       
   149 	return TestStepResult();
       
   150 	}