networkprotocolmodules/suplprotocolmodule/SuplProtocol/test/src/molr4Step.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 molr4Step.cpp
       
    20  @internalTechnology
       
    21 */
       
    22 #include "molr4Step.h"
       
    23 #include "te_suplprotocolsuitedefs.h"
       
    24 
       
    25 /**
       
    26  * Destructor
       
    27  */
       
    28 Cmolr4Step::~Cmolr4Step()
       
    29 
       
    30 	{
       
    31 	}
       
    32 	
       
    33 /**
       
    34  * Constructor
       
    35  */
       
    36 Cmolr4Step::Cmolr4Step()
       
    37 
       
    38 	{
       
    39 	SetTestStepName(Kmolr4Step);
       
    40 	}
       
    41 	
       
    42 /**
       
    43  * @return - TVerdict code
       
    44  * Override of base class virtual
       
    45  */
       
    46 TVerdict Cmolr4Step::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 /** Perform CMoLrStep3 test step.
       
    59 This test verifies that the SUPL Protocol Module correctly handles 
       
    60 MO-LR Self Locate cancellation.
       
    61 Cancellation occurs after state machine receives connection indication but
       
    62 before it sends a SUPL START.
       
    63 
       
    64 @return TVerdict test result code
       
    65 */
       
    66 TVerdict Cmolr4Step::doTestStepL()
       
    67 
       
    68 	{
       
    69 	INFO_PRINTF1(_L("\t********************************************************************"));
       
    70 	INFO_PRINTF1(_L("\tMOLR cancelled by LBS before SUPL START"));
       
    71 	INFO_PRINTF1(_L("\t********************************************************************"));
       
    72 	INFO_PRINTF1(_L("- START -"));
       
    73 	// Initiate MO-LR
       
    74 	TLbsNetSessionId sessionId1(TUid::Uid(0x87654321), 0x1111);
       
    75 	TLbsNetPosRequestOptionsAssistance options1;
       
    76 	options1.SetNewClientConnected(ETrue);
       
    77 	TLbsNetPosRequestQuality quality1;
       
    78 	options1.SetRequestQuality(quality1);
       
    79 	TLbsAsistanceDataGroup dataRequestMask1 = EAssistanceDataBadSatList;
       
    80 	options1.SetDataRequestMask(dataRequestMask1);
       
    81 	INFO_PRINTF1(_L("\tLBS -> RequestSelfLocation"));
       
    82 	iModule->RequestSelfLocation(sessionId1, options1);
       
    83 
       
    84 	// Check Connection Manager receives a request for connecting
       
    85 	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::EConnectReq))
       
    86 		{
       
    87 		SetTestStepResult(EFail);
       
    88 		return TestStepResult();
       
    89 		}
       
    90 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t ConnectionRequest -> NET"));
       
    91 
       
    92 	// Simulate the connection is up (inject that event)
       
    93 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t Connected <- NET"));
       
    94     iNetworkObserver->InjectConnectedIndication(iNetworkObserver->SessionId());
       
    95 
       
    96 	// LBS Cancels MO-LR
       
    97 	INFO_PRINTF1(_L("\tLBS -> CancelSelfLocation"));	
       
    98 	iModule->CancelSelfLocation(sessionId1, KErrCancel);
       
    99 
       
   100 	// Check gateway session completed
       
   101 	if (EFail == CheckGatewayCallbackL(
       
   102 				CSuplGatewayObserver::EProcessSessionComplete))
       
   103 		{
       
   104 		SetTestStepResult(EFail);
       
   105 		return TestStepResult();
       
   106 		}
       
   107 	INFO_PRINTF1(_L("\tLBS <- ProcessSessionComplete"));
       
   108 
       
   109 	// Check Connection Manager receives a disconnection request
       
   110 	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::EDisconnectReq))
       
   111 		{
       
   112 		SetTestStepResult(EFail);
       
   113 		return TestStepResult();
       
   114 		}
       
   115 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t DisconnectRequest -> NET"));
       
   116 	
       
   117 	// Check if more observer activity takes place
       
   118 	if (iGatewayObserver->IsMoreObserverActivity() ||
       
   119 	iNetworkObserver->IsMoreObserverActivity())
       
   120 	{
       
   121 	SetTestStepResult(EFail);
       
   122 	return TestStepResult();
       
   123 	}
       
   124 	INFO_PRINTF1(_L("- END -"));
       
   125 	
       
   126 	SetTestStepResult(EPass);
       
   127 	return TestStepResult();
       
   128 	}
       
   129 
       
   130 
       
   131 /**
       
   132  * @return - TVerdict code
       
   133  * Override of base class virtual
       
   134  */
       
   135 TVerdict Cmolr4Step::doTestStepPostambleL()
       
   136 
       
   137 	{
       
   138 	delete iModule;
       
   139 
       
   140 	// Call base class method for post test actions	
       
   141 	CTe_suplprotocolSuiteStepBase::doTestStepPostambleL();
       
   142 	return TestStepResult();
       
   143 	}