telephonyserverplugins/common_tsy/test/integration/src/tlocationservicestsytesthelper.cpp
changeset 0 3553901f7fa8
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2007-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 //
       
    15 
       
    16 #include "tlocationservicestsytesthelper.h" 
       
    17 
       
    18 
       
    19 
       
    20 /**
       
    21 * Constructor
       
    22 */	
       
    23 TLocationServicesTsyTestHelper::TLocationServicesTsyTestHelper(CCTSYIntegrationTestSuiteStepBase& aTestStep)
       
    24 			: TTsyTestHelperBase( aTestStep )
       
    25 	{
       
    26 	}
       
    27 /**
       
    28 * Notify reset for RMobileLocationServices::NotifyMtlr
       
    29 */	
       
    30 void TLocationServicesTsyTestHelper::WaitForMobileLocationServicesNotifyMtlr( 
       
    31 				RMobileLocationServices& aMobileLocationServices,
       
    32 				TEtelRequestBase& aRequestStatus,
       
    33 				TCmpBase<RMobileLocationServices::TNotifyMtlrV7> &aNotifyMtlrV7,
       
    34 				TInt aWantedStatus )
       
    35 
       
    36 	{
       
    37 	// Wait for the request to complete	
       
    38 	TInt err = iTestStep.WaitForRequestWithTimeOut(aRequestStatus, ETimeShort);	
       
    39 	ASSERT_EQUALS(err, KErrNone, _L("RMobileLocationServices::NotifyMtlr did not complete"))
       
    40 	
       
    41 	while (	err == KErrNone && aRequestStatus.Int() == KErrNone  	
       
    42 							&& !aNotifyMtlrV7.IsEqual(ENoLogError) )
       
    43 		{
       
    44 		// Request has completed with incorrect result. Consume any outstanding
       
    45 		// Repost notification until timeout or we get the right result.		
       
    46 		RMobileLocationServices::TNotifyMtlrV7Pckg pkgParam( aNotifyMtlrV7.GetValue() );
       
    47 		aMobileLocationServices.NotifyMtlr(aRequestStatus, pkgParam);
       
    48 		err = iTestStep.WaitForRequestWithTimeOut(aRequestStatus, ETimeShort);
       
    49 		}
       
    50 
       
    51 	ASSERT_EQUALS(aRequestStatus.Int(), aWantedStatus, _L("RMobileLocationServices::NotifyMtlr Wrong completion status"))	
       
    52 	ASSERT_TRUE(aNotifyMtlrV7.IsEqual(ELogError), 
       
    53 				_L("RMobileLocationServices::NotifyMtlr Wrong result"))	
       
    54 	
       
    55 	// Cancel request if it is still pending	
       
    56 	if (aRequestStatus.Int() == KRequestPending)	
       
    57 		{
       
    58 		aRequestStatus.Cancel();
       
    59 		}
       
    60 	}
       
    61 
       
    62 		
       
    63 /**
       
    64 * Notify reset for RMobileLocationServices::NotifyMeasurementControl
       
    65 */	
       
    66 void TLocationServicesTsyTestHelper::WaitForMobileLocationServicesNotifyMeasurementControl( 
       
    67 				RMobileLocationServices& aMobileLocationServices,
       
    68 				TEtelRequestBase& aRequestStatus,
       
    69 				TCmpBase<RMobileLocationServices::TMeasurementControlV7> &aMeasurementControlV7,
       
    70 				TInt aWantedStatus )
       
    71 
       
    72 	{
       
    73 	// Wait for the request to complete	
       
    74 	TInt err = iTestStep.WaitForRequestWithTimeOut(aRequestStatus, ETimeShort);	
       
    75 	ASSERT_EQUALS(err, KErrNone, _L("RMobileLocationServices::NotifyMeasurementControl did not complete"))
       
    76 	
       
    77 	while (	err == KErrNone && aRequestStatus.Int() == KErrNone  	
       
    78 							&& !aMeasurementControlV7.IsEqual(ENoLogError) )
       
    79 		{
       
    80 		// Request has completed with incorrect result. Consume any outstanding
       
    81 		// Repost notification until timeout or we get the right result.		
       
    82 		RMobileLocationServices::TMeasurementControlV7Pckg pkgParam( aMeasurementControlV7.GetValue() );
       
    83 		aMobileLocationServices.NotifyMeasurementControl(aRequestStatus, pkgParam);
       
    84 		err = iTestStep.WaitForRequestWithTimeOut(aRequestStatus, ETimeShort);
       
    85 		}
       
    86 
       
    87 	ASSERT_EQUALS(aRequestStatus.Int(), aWantedStatus, _L("RMobileLocationServices::NotifyMeasurementControl Wrong completion status"))	
       
    88 	ASSERT_TRUE(aMeasurementControlV7.IsEqual(ELogError), 
       
    89 				_L("RMobileLocationServices::NotifyMeasurementControl Wrong result"))	
       
    90 	
       
    91 	// Cancel request if it is still pending	
       
    92 	if (aRequestStatus.Int() == KRequestPending)	
       
    93 		{
       
    94 		aRequestStatus.Cancel();
       
    95 		}
       
    96 	}
       
    97 
       
    98