networkprotocolmodules/suplprotocolmodule/SuplProtocol/test/src/mtlr13Step.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 mtlr13Step.cpp
       
    20  @internalTechnology
       
    21 */
       
    22 #include "mtlr13Step.h"
       
    23 #include "te_suplprotocolsuitedefs.h"
       
    24 
       
    25 /**
       
    26  Destructor
       
    27  */
       
    28 Cmtlr13Step::~Cmtlr13Step()
       
    29 
       
    30 	{
       
    31 	}
       
    32 
       
    33 /**
       
    34  Constructor
       
    35  */
       
    36 Cmtlr13Step::Cmtlr13Step()
       
    37 	{
       
    38 	SetTestStepName(Kmtlr13Step);
       
    39 	}
       
    40 
       
    41 /**
       
    42  @return - TVerdict code
       
    43  Override of base class virtual
       
    44  */
       
    45 TVerdict Cmtlr13Step::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 	// components for generating incoming SMS SUPL INIT
       
    54 	iSuplPush = CLbsSuplPush::NewL(ELbsSuplPushChannelSMS, *this);
       
    55 	iSuplInitGenerator = CSuplInitGenerator::NewL();
       
    56 
       
    57 	return TestStepResult();
       
    58 	}
       
    59 
       
    60 
       
    61 /** Perform Cmtlr13Step test step.
       
    62 
       
    63 This test verifies that the SUPL Protocol Module correctly handles 
       
    64 a SUPL INIT with SLP Mode element set to NON-Proxy.
       
    65 
       
    66 Expected behaviour is for the message to be silently dropped.
       
    67 
       
    68 @return TVerdict test result code
       
    69 */
       
    70 TVerdict Cmtlr13Step::doTestStepL()
       
    71 	{
       
    72 	INFO_PRINTF1(_L("\t********************************************************************"));
       
    73 	INFO_PRINTF1(_L("\tMTLR - SLP MODE is NON-PROXY (expect it to be silently dropped      "));
       
    74 	INFO_PRINTF1(_L("\t********************************************************************"));
       
    75 	INFO_PRINTF1(_L("- START -"));	
       
    76 	
       
    77 
       
    78 	// Initiate MT-LR
       
    79 	// Generate received SUPL INIT message (test message content #0)
       
    80 	TPtr8 messagePtr(iReceiveBuffer.Des());
       
    81 	TInt err = iSuplInitGenerator->GenerateSuplInitL(1, messagePtr);
       
    82 	if (err != KErrNone)
       
    83 		{
       
    84 		SetTestStepResult(EFail);
       
    85 		return TestStepResult();
       
    86 		}
       
    87 
       
    88 
       
    89 	// Inject SUPL INIT using the SUPL Push API
       
    90 	INFO_PRINTF1(_L("\tLBS (SuplPush) -> OnSuplInit()"));
       
    91 	TLbsSuplPushRequestId reqId = 12345;
       
    92 	TPtrC8 message(messagePtr);
       
    93 	iSuplPush->SuplInit(reqId, message, 0);
       
    94 	
       
    95 
       
    96 	// Check if more observer activity takes place
       
    97 	if (iGatewayObserver->IsMoreObserverActivity() ||
       
    98 	iNetworkObserver->IsMoreObserverActivity())
       
    99 		{
       
   100 		SetTestStepResult(EFail);
       
   101 		return TestStepResult();
       
   102 		}
       
   103 	INFO_PRINTF1(_L("- END -"));
       
   104 	
       
   105 
       
   106 	SetTestStepResult(EPass);
       
   107 	return TestStepResult();
       
   108 	}
       
   109 
       
   110 
       
   111 /**
       
   112  * @return - TVerdict code
       
   113  * Override of base class virtual
       
   114  */
       
   115 TVerdict Cmtlr13Step::doTestStepPostambleL()
       
   116 	{
       
   117 	delete iModule;
       
   118 
       
   119 	delete iSuplPush;
       
   120 	delete iSuplInitGenerator;
       
   121 
       
   122 	// Call base class method for post test actions	
       
   123 	CTe_suplprotocolSuiteStepBase::doTestStepPostambleL();
       
   124 	return TestStepResult();
       
   125 	}
       
   126 
       
   127 
       
   128 /**
       
   129 Overrides the pure virtual MLbsSuplPushObserver::OnSuplInitComplete.
       
   130 Receives the result of the message sending.
       
   131 	
       
   132 @param aError [In] The error code or KErrNone if successful.
       
   133 
       
   134 @see MTe_LbsSuplSmsTriggerSenderObserver::OnMessageSent
       
   135 @see CTe_LbsSuplSmsTriggerSender::SendMessage
       
   136 */
       
   137 void Cmtlr13Step::OnSuplInitComplete(TLbsSuplPushChannel /*aChannel*/, TLbsSuplPushRequestId /*aReqId*/, TInt aError, TInt /*aReserved*/)
       
   138 	{
       
   139 	iSmsSendError = aError;
       
   140 	if (iSmsSendError != KErrNone)
       
   141 		{
       
   142 		User::Invariant();
       
   143 		}
       
   144 	}
       
   145