networkprotocolmodules/suplprotocolmodule/SuplProtocol/test/src/molr29Step.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 molr29Step.cpp
       
    20  @internalTechnology
       
    21 */
       
    22 #include "molr29Step.h"
       
    23 #include "te_suplprotocolsuitedefs.h"
       
    24 
       
    25 /**
       
    26  Destructor
       
    27  */
       
    28 Cmolr29Step::~Cmolr29Step()
       
    29 
       
    30 	{
       
    31 	}
       
    32 
       
    33 /**
       
    34  Constructor
       
    35  */
       
    36 Cmolr29Step::Cmolr29Step()
       
    37 	{
       
    38 	SetTestStepName(Kmolr29Step);
       
    39 	}
       
    40 
       
    41 /**
       
    42  @return - TVerdict code
       
    43  Override of base class virtual
       
    44  */
       
    45 TVerdict Cmolr29Step::doTestStepPreambleL()
       
    46 	{
       
    47 	// Call base class method for pre test actions	
       
    48 	CTe_suplprotocolSuiteStepBase::doTestStepPreambleL();
       
    49 	 
       
    50 	TLbsNetProtocolModuleParams param(*iGatewayObserver);
       
    51 	iModule = CSuplGatewayInterface::NewL(reinterpret_cast<TAny*>(&param));
       
    52 	
       
    53 	
       
    54 	//Clear the repository that keeps the host settings
       
    55 	//CRepository* rep = CRepository::NewL(KLbsHostSettingsSuplStoreId);
       
    56 	//CleanupStack::PushL(rep);
       
    57 	//User::LeaveIfError(rep->Reset());
       
    58 	//CleanupStack::PopAndDestroy(rep);
       
    59 
       
    60 	//CLbsHostSettingsStore* slpSettingsStore = CLbsHostSettingsStore::NewL(KLbsHostSettingsSuplStoreId);
       
    61 	//CleanupStack::PushL(slpSettingsStore);
       
    62 	
       
    63 	// Create a "user-provisioned" entry which is the default host.
       
    64 	// This will be the host selected by this testcase and most testcases
       
    65 	// following, so it is intentionally not erased in the postamble.
       
    66 	//INFO_PRINTF1(_L("[User-provisioned default host created]"));
       
    67 	//TLbsHostSettingsSupl defaultSettings;
       
    68 	//TLbsHostNameAddress defHostAddr((TText8*)"supl.thirdparty.com");
       
    69 	//TLbsHostName defHostName((TText8*)"defSuplServer");
       
    70 	//TLbsProviderId defHostProvider ((TText8*)"provider");
       
    71 	//TLbsHostSettingsId defSettingsId; 
       
    72 	//defaultSettings.SetHostNameAddress(defHostAddr);
       
    73 	//defaultSettings.SetName(defHostName);
       
    74 	//defaultSettings.SetProviderId(defHostProvider);
       
    75 	//defaultSettings.SetPortId(KLbsSuplUseDefaultPortId);
       
    76 	//TLbsHostCreatorId KTestMadeUpUid = {0x101010};
       
    77 	//defaultSettings.SetConnectionPoint(1,TLbsHostSettingsSupl::ELbsConnectionTypeNap);
       
    78 	//defaultSettings.SetAuthModesMOLR(TLbsHostSettingsSupl::EAuthTls);
       
    79 	//defaultSettings.SetAuthModesMTLR(TLbsHostSettingsSupl::EAuthTls);
       
    80 	
       
    81 //	if (KErrNone != slpSettingsStore->CreateHostSettings(defaultSettings, KTestMadeUpUid, defSettingsId))
       
    82 //		{
       
    83 //		SetTestStepResult(EFail);
       
    84 //		return TestStepResult();					
       
    85 //		}
       
    86 		
       
    87 //	if (KErrNone != slpSettingsStore->SetDefaultHostSettings(defSettingsId))
       
    88 //		{
       
    89 //		SetTestStepResult(EFail);
       
    90 //		return TestStepResult();					
       
    91 //		}
       
    92 		
       
    93 //	CleanupStack::PopAndDestroy(slpSettingsStore);
       
    94 	
       
    95 	 
       
    96 	return TestStepResult();
       
    97 	}
       
    98 
       
    99 
       
   100 /** Perform CMoLrStep1 test step.
       
   101 This test verifies that the SUPL Protocol Module correctly handles 
       
   102 an MO-LR Self Locate Terminal Based sequence (assistance data
       
   103 delivered via an RRLP payload).
       
   104 
       
   105 @return TVerdict test result code
       
   106 */
       
   107 TVerdict Cmolr29Step::doTestStepL()
       
   108 	{
       
   109 	
       
   110  	
       
   111 	INFO_PRINTF1(_L("\t********************************************************************"));
       
   112 	INFO_PRINTF1(_L("\tMOLR basic procedure followed - Assistance Data in RRLP message"));
       
   113 	INFO_PRINTF1(_L("\t********************************************************************"));
       
   114 	INFO_PRINTF1(_L("- START -"));	
       
   115 	
       
   116 	// Initiate MO-LR
       
   117 	TLbsNetSessionId sessionId1(TUid::Uid(0x87654321), 0x1111);
       
   118 	TLbsNetPosRequestOptionsAssistance options1;
       
   119 	options1.SetNewClientConnected(ETrue);
       
   120 	TLbsNetPosRequestQuality quality1;
       
   121 	options1.SetRequestQuality(quality1);
       
   122 	TLbsAsistanceDataGroup dataRequestMask1 = EAssistanceDataBadSatList;
       
   123 	options1.SetDataRequestMask(dataRequestMask1);
       
   124 	INFO_PRINTF1(_L("\tLBS -> RequestSelfLocation"));
       
   125 	iModule->RequestSelfLocation(sessionId1, options1);
       
   126 
       
   127 	// Check Connection Manager receives a request for connecting
       
   128 	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::EConnectReq))
       
   129 		{
       
   130 		SetTestStepResult(EFail);
       
   131 		return TestStepResult();
       
   132 		}
       
   133 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t ConnectionRequest -> NET"));
       
   134 
       
   135 
       
   136 	// Simulate the connection is up (inject that event)
       
   137 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t Connected <- NET"));
       
   138     iNetworkObserver->InjectConnectedIndication(iNetworkObserver->SessionId());
       
   139 	
       
   140 	// Check Connection Manager receives a request to send a SUPL START
       
   141 	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::ESuplStartSendReq))
       
   142 	{
       
   143 	SetTestStepResult(EFail);
       
   144 	return TestStepResult();
       
   145 	}
       
   146 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL START -> NET"));
       
   147 
       
   148 	// Inject a SUPL END (with error)
       
   149 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL END <- NET"));
       
   150 	CSuplMessageBase* suplEnd = BuildSuplEndL(EFalse, KErrCancel);
       
   151 	iNetworkObserver->InjectSuplMessage(iNetworkObserver->SessionId(), suplEnd);
       
   152 
       
   153 	// Check gateway session completes AND a notification of assistance data
       
   154 	// error has been received for the 
       
   155 	if (EFail == CheckGatewayCallbackL(CSuplGatewayObserver::EProcessSessionComplete))
       
   156 		{
       
   157 		SetTestStepResult(EFail);
       
   158 		return TestStepResult();
       
   159 		}
       
   160 	INFO_PRINTF1(_L("\tLBS <- ProcessSessionComplete"));
       
   161 
       
   162 	// Check Connection Manager receives a disconnection request
       
   163 	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::EDisconnectReq))
       
   164 		{
       
   165 		SetTestStepResult(EFail);
       
   166 		return TestStepResult();
       
   167 		}
       
   168 	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t DisconnectRequest -> NET"));
       
   169 
       
   170 
       
   171 	// ****************** Check that an assistance data error report has been sent to LBS
       
   172 	// Note: this happened just after EProcessSessionComplete and before EDisconnectReq above,
       
   173 	// but since it happens in the same RunL loop as EProcessSessionComplete, it can't be detected
       
   174 	// as an independent callback with CheckGatewayCallbackL. Therefore, all we can do is check that
       
   175 	// assistance data error was reported at some point.
       
   176 	if ((KErrNotFound != iGatewayObserver->AssistanceDataError()) ||
       
   177 		(EAssistanceDataBadSatList & iGatewayObserver->AssistanceDataErrorMask() != EAssistanceDataBadSatList) 
       
   178 		)
       
   179 		{
       
   180 		SetTestStepResult(EFail);
       
   181 		return TestStepResult();
       
   182 		}
       
   183 	INFO_PRINTF1(_L("\tLBS <- ProcessAssistanceData(KErrNotFound)"));
       
   184 	
       
   185 	// Check if more observer activity takes place
       
   186 	if (iGatewayObserver->IsMoreObserverActivity() ||
       
   187 	iNetworkObserver->IsMoreObserverActivity())
       
   188 	{
       
   189 	SetTestStepResult(EFail);
       
   190 	return TestStepResult();
       
   191 	}
       
   192 	INFO_PRINTF1(_L("- END -"));
       
   193 	
       
   194 	SetTestStepResult(EPass);
       
   195 	return TestStepResult();
       
   196 	
       
   197 }
       
   198 
       
   199 
       
   200 /**
       
   201  * @return - TVerdict code
       
   202  * Override of base class virtual
       
   203  */
       
   204 TVerdict Cmolr29Step::doTestStepPostambleL()
       
   205 	{
       
   206 	delete iModule;
       
   207 
       
   208 	// Call base class method for post test actions	
       
   209 	CTe_suplprotocolSuiteStepBase::doTestStepPostambleL();
       
   210 	return TestStepResult();
       
   211 	}