networkprotocolmodules/suplprotocolmodule/SuplProtocol/test/src/molr25Step.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 molr25Step.cpp
       
    20  @internalTechnology
       
    21 */
       
    22 #include "molr25Step.h"
       
    23 #include "te_suplprotocolsuitedefs.h"
       
    24 
       
    25 Cmolr25Step::~Cmolr25Step()
       
    26 	{
       
    27 	}
       
    28 
       
    29 Cmolr25Step::Cmolr25Step()
       
    30 	{
       
    31 	SetTestStepName(Kmolr25Step);
       
    32 	}
       
    33 
       
    34 /**
       
    35  * @return - TVerdict code
       
    36  * Override of base class virtual
       
    37  */
       
    38 TVerdict Cmolr25Step::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 Cmolr25Step::doTestStepL()
       
    58 	{
       
    59 	
       
    60 	INFO_PRINTF1(_L("\t********************************************************************"));
       
    61 	INFO_PRINTF1(_L("\tMOLR, Cell Based - cancelled by user after SUPL START"));
       
    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 	iModule->CancelNetworkLocation(sessionId1, KErrCancel);
       
    95 
       
    96 	// Check the Connection Manager receives a request to send a SUPL END 
       
    97 	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::ESendSuplEndSendReq))
       
    98 		{
       
    99 		SetTestStepResult(EFail);
       
   100 		return TestStepResult();
       
   101 		}
       
   102 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL END -> NET"));
       
   103 		
       
   104 	// Check gateway session completed
       
   105 	if (EFail == CheckGatewayCallbackL(
       
   106 				CSuplGatewayObserver::EProcessSessionComplete))
       
   107 		{
       
   108 		SetTestStepResult(EFail);
       
   109 		return TestStepResult();
       
   110 		}
       
   111 	INFO_PRINTF1(_L("\tLBS <- ProcessSessionComplete"));
       
   112 
       
   113 	// Check Connection Manager receives a disconnection request
       
   114 	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::EDisconnectReq))
       
   115 		{
       
   116 		SetTestStepResult(EFail);
       
   117 		return TestStepResult();
       
   118 		}
       
   119 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t DisconnectRequest -> NET"));
       
   120 	
       
   121 	// Check if more observer activity takes place
       
   122 	if (iGatewayObserver->IsMoreObserverActivity() ||
       
   123 	iNetworkObserver->IsMoreObserverActivity())
       
   124 	{
       
   125 	SetTestStepResult(EFail);
       
   126 	return TestStepResult();
       
   127 	}
       
   128 	INFO_PRINTF1(_L("- END -"));
       
   129 	
       
   130 	SetTestStepResult(EPass);
       
   131 	return TestStepResult();
       
   132 	}
       
   133 
       
   134 
       
   135 /**
       
   136  * @return - TVerdict code
       
   137  * Override of base class virtual
       
   138  */
       
   139 TVerdict Cmolr25Step::doTestStepPostambleL()
       
   140 	{
       
   141 	delete iModule;
       
   142 
       
   143 	// Call base class method for post test actions	
       
   144 	CTe_suplprotocolSuiteStepBase::doTestStepPostambleL();
       
   145 	return TestStepResult();
       
   146 	}