telephonyserverplugins/simtsy/test/Te_Sim/Te_SimPacketQoS.cpp
changeset 0 3553901f7fa8
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     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 //
       
    15 
       
    16 /**
       
    17  @file
       
    18 */
       
    19 
       
    20 #include "Te_SimPacketQoS.h"
       
    21 
       
    22 void CSimPacketQoSTest::TestFixtureLC(TUint aTestNumber)
       
    23 /**
       
    24  * Used to setup the test case 
       
    25  * Any test data or environment is configured here
       
    26  */ 
       
    27 {
       
    28 	//Setup TSY config to use config3.txt
       
    29 	CreateConfigFileL(_L("c:\\config3.txt"));
       
    30 	SetTestNumberL(aTestNumber);
       
    31 	
       
    32 	TInt ret = iPhone.Open(iTelServer,KPhoneName);
       
    33 	INFO_PRINTF2(_L("Result: %d"),ret);
       
    34 	TESTL(ret == KErrNone); 
       
    35 	INFO_PRINTF1(_L("Opened phone object"));
       
    36 	
       
    37 	//Create the packet connection
       
    38 	TESTL(iPacketService.Open(iPhone)==KErrNone);
       
    39 	INFO_PRINTF1(_L("Opened Packet object"));
       
    40 	
       
    41 	//Open a context
       
    42 	TName contextName;
       
    43 	TESTL(iPacketContext.OpenNewContext(iPacketService, contextName)==KErrNone);
       
    44 
       
    45 	// set Release99 Qos Profile Params
       
    46 	TName r99QosName;
       
    47 	TESTL(iPacketQoS.OpenNewQoS(iPacketContext, r99QosName)==KErrNone);
       
    48 	INFO_PRINTF1(_L("Opened Rel99 QoS object"));
       
    49 
       
    50 	//Setting for QoS
       
    51 	iR99QoSParameters.iReqTrafficClass = RPacketQoS::ETrafficClassStreaming; // 0x04
       
    52 	iR99QoSParameters.iMinTrafficClass = RPacketQoS::ETrafficClassConversational; // 0x02
       
    53 	iR99QoSParameters.iReqDeliveryOrderReqd = RPacketQoS::EDeliveryOrderNotRequired; // 0x04
       
    54 	iR99QoSParameters.iMinDeliveryOrderReqd = RPacketQoS::EDeliveryOrderRequired;	// 0x02
       
    55 	iR99QoSParameters.iReqDeliverErroneousSDU = RPacketQoS::EErroneousSDUDeliveryNotRequired; // 0x08
       
    56 	iR99QoSParameters.iMinDeliverErroneousSDU = RPacketQoS::EErroneousSDUDeliveryRequired; // 0x04
       
    57 	iR99QoSParameters.iReqMaxSDUSize = KReq; // 4	
       
    58 	iR99QoSParameters.iMinAcceptableMaxSDUSize = KMin; // 2
       
    59 	iR99QoSParameters.iReqMaxRate.iUplinkRate = KMin;	// between 0 - 1840
       
    60 	iR99QoSParameters.iReqMaxRate.iDownlinkRate = KMin;
       
    61 	iR99QoSParameters.iMinAcceptableMaxRate.iUplinkRate = KReq;
       
    62 	iR99QoSParameters.iMinAcceptableMaxRate.iDownlinkRate = KMin-1; // between 0 - 1840	
       
    63 	iR99QoSParameters.iReqBER = RPacketQoS::EBEROnePerHundred;	// 0x04
       
    64 	iR99QoSParameters.iMaxBER = RPacketQoS::EBERFivePerHundred;	// 0x02
       
    65 	iR99QoSParameters.iReqSDUErrorRatio = RPacketQoS::ESDUErrorRatioSevenPerThousand; // 0x08
       
    66 	iR99QoSParameters.iMaxSDUErrorRatio = RPacketQoS::ESDUErrorRatioOnePerHundred;	// 0x04
       
    67 	iR99QoSParameters.iReqTrafficHandlingPriority = RPacketQoS::ETrafficPriority2; // 0x04
       
    68 	iR99QoSParameters.iMinTrafficHandlingPriority = RPacketQoS::ETrafficPriority1; // 0x02
       
    69 	iR99QoSParameters.iReqTransferDelay = KReq;
       
    70 	iR99QoSParameters.iMaxTransferDelay = KMin;
       
    71 	iR99QoSParameters.iReqGuaranteedRate.iUplinkRate = KReq;
       
    72 	iR99QoSParameters.iReqGuaranteedRate.iDownlinkRate = KMin;
       
    73 	iR99QoSParameters.iMinGuaranteedRate.iUplinkRate = KReq;
       
    74 	iR99QoSParameters.iMinGuaranteedRate.iDownlinkRate = KMin;
       
    75 
       
    76 	INFO_PRINTF1(_L("Populated Rel99 QoS parameters"));
       
    77 }
       
    78 
       
    79 //Use for tearing down the test case
       
    80 void CSimPacketQoSTest::TearDownL()
       
    81 /**
       
    82  * Used to setup the test case 
       
    83  * Any unloading or closing is here
       
    84  */ 
       
    85 {
       
    86 	iPacketQoS.Close();
       
    87 	iPacketContext.Close();
       
    88 	iPacketService.Close();
       
    89 	iPhone.Close();
       
    90 }
       
    91 
       
    92 
       
    93 CSetQoSDelayOnFirstSet::CSetQoSDelayOnFirstSet() 
       
    94 	{ 
       
    95 	// store the name of this test case
       
    96 	// this is the name that is used by the script file
       
    97 	SetTestStepName(_L("SetQoSDelayOnFirstSet"));
       
    98 	}
       
    99 
       
   100  TVerdict CSetQoSDelayOnFirstSet::doTestStepL()
       
   101 /**
       
   102 
       
   103 */
       
   104 {	
       
   105 	// This test has been disabled whilst a submission goes in to MCL
       
   106 	/*
       
   107 	TestFixtureLC(12);
       
   108 	TRequestStatus reqStatus;
       
   109 	TPckg<RPacketQoS::TQoSR99_R4Requested> r99QoSRequestPckg(iR99QoSParameters);
       
   110 
       
   111 	//Get a time stamp
       
   112 	TTime startTime;
       
   113 	startTime.UniversalTime();
       
   114 
       
   115 	//Set the QoS profiles
       
   116 	iPacketQoS.SetProfileParameters(reqStatus, r99QoSRequestPckg);
       
   117 	User::WaitForRequest(reqStatus);
       
   118 	TESTL(reqStatus.Int()==KErrNone);
       
   119 
       
   120 	//Get a time stamp
       
   121 	TTime endTime;
       
   122 	endTime.UniversalTime();
       
   123 	TTimeIntervalSeconds secondsElapsed;
       
   124 	endTime.SecondsFrom(startTime, secondsElapsed);
       
   125 	TESTL(secondsElapsed.Int()==5);
       
   126 	
       
   127 	TearDownL();
       
   128 	*/
       
   129 	return TestStepResult();
       
   130 }
       
   131 
       
   132 CSetQoSDelayOnThirdSet::CSetQoSDelayOnThirdSet() 
       
   133 	{ 
       
   134 	// store the name of this test case
       
   135 	// this is the name that is used by the script file
       
   136 	SetTestStepName(_L("SetQoSDelayOnThirdSet"));
       
   137 	}
       
   138 
       
   139  TVerdict CSetQoSDelayOnThirdSet::doTestStepL()
       
   140 /**
       
   141 
       
   142 */
       
   143 {	
       
   144 	TestFixtureLC(13);
       
   145 	TRequestStatus reqStatus;
       
   146 	TPckg<RPacketQoS::TQoSR99_R4Requested> r99QoSRequestPckg(iR99QoSParameters);
       
   147 
       
   148 	//Set the qos
       
   149 	iPacketQoS.SetProfileParameters(reqStatus, r99QoSRequestPckg);
       
   150 	User::WaitForRequest(reqStatus);
       
   151 	TESTL(reqStatus.Int()==KErrNone);
       
   152 	//Set the qos again (2)
       
   153 	iR99QoSParameters.iMinGuaranteedRate.iDownlinkRate = KMin -1;
       
   154 	iPacketQoS.SetProfileParameters(reqStatus, r99QoSRequestPckg);
       
   155 	User::WaitForRequest(reqStatus);
       
   156 	TESTL(reqStatus.Int()==KErrNone);
       
   157 	//Get a time stamp
       
   158 	TTime startTime;
       
   159 	startTime.UniversalTime();
       
   160 	//Set the qos again (3)	
       
   161 	TRequestStatus requestWhileDelay;
       
   162 	iR99QoSParameters.iMinGuaranteedRate.iDownlinkRate = KMin;
       
   163 	iR99QoSParameters.iReqGuaranteedRate.iDownlinkRate = KMin-1;
       
   164 	iPacketQoS.SetProfileParameters(requestWhileDelay, r99QoSRequestPckg);
       
   165 	User::WaitForRequest(requestWhileDelay);
       
   166 	TESTL(requestWhileDelay.Int()==KErrNone);
       
   167 	//Get another time stamp
       
   168 	TTime endTime;
       
   169 	endTime.UniversalTime();
       
   170 	TTimeIntervalSeconds secondsElapsed;
       
   171 	endTime.SecondsFrom(startTime, secondsElapsed);
       
   172 	TESTL(secondsElapsed.Int()==7);
       
   173 
       
   174 	TearDownL();
       
   175 
       
   176 	return TestStepResult();
       
   177 }
       
   178 
       
   179 CSetQoSDelayUnset::CSetQoSDelayUnset() 
       
   180 	{ 
       
   181 	// store the name of this test case
       
   182 	// this is the name that is used by the script file
       
   183 	SetTestStepName(_L("SetQoSDelayUnset"));
       
   184 	}
       
   185 
       
   186  TVerdict CSetQoSDelayUnset::doTestStepL()
       
   187 /**
       
   188 
       
   189 */
       
   190 {	
       
   191 	TestFixtureLC(14);
       
   192 	TRequestStatus reqStatus;
       
   193 	TPckg<RPacketQoS::TQoSR99_R4Requested> r99QoSRequestPckg(iR99QoSParameters);
       
   194 
       
   195 	//Get a time stamp
       
   196 	TTime startTime;
       
   197 	startTime.UniversalTime();
       
   198 
       
   199 	//Set the QoS profiles
       
   200 	iPacketQoS.SetProfileParameters(reqStatus, r99QoSRequestPckg);
       
   201 	User::WaitForRequest(reqStatus);
       
   202 	TESTL(reqStatus.Int()==KErrNone);
       
   203 
       
   204 	//Get a time stamp
       
   205 	TTime endTime;
       
   206 	endTime.UniversalTime();
       
   207 	TTimeIntervalSeconds secondsElapsed;
       
   208 	endTime.SecondsFrom(startTime, secondsElapsed);
       
   209 	TESTL(secondsElapsed.Int()==0);
       
   210 	
       
   211 	TearDownL();
       
   212 
       
   213 	return TestStepResult();
       
   214 }
       
   215 
       
   216 CSetQoSNegativeDelay::CSetQoSNegativeDelay() 
       
   217 	{ 
       
   218 	// store the name of this test case
       
   219 	// this is the name that is used by the script file
       
   220 	SetTestStepName(_L("SetQoSNegativeDelay"));
       
   221 	}
       
   222 
       
   223  TVerdict CSetQoSNegativeDelay::doTestStepL()
       
   224 /**
       
   225 
       
   226 */
       
   227 {	
       
   228 	TestFixtureLC(15);
       
   229 	TRequestStatus reqStatus;
       
   230 	TPckg<RPacketQoS::TQoSR99_R4Requested> r99QoSRequestPckg(iR99QoSParameters);
       
   231 
       
   232 	//Get a time stamp
       
   233 	TTime startTime;
       
   234 	startTime.UniversalTime();
       
   235 
       
   236 	//Set the QoS profiles
       
   237 	iPacketQoS.SetProfileParameters(reqStatus, r99QoSRequestPckg);
       
   238 	User::WaitForRequest(reqStatus);
       
   239 	TESTL(reqStatus.Int()==KErrNone);
       
   240 
       
   241 	//Get a time stamp
       
   242 	TTime endTime;
       
   243 	endTime.UniversalTime();
       
   244 	TTimeIntervalSeconds secondsElapsed;
       
   245 	endTime.SecondsFrom(startTime, secondsElapsed);
       
   246 	TESTL(secondsElapsed.Int()==0);
       
   247 	
       
   248 	TearDownL();
       
   249 
       
   250 	return TestStepResult();
       
   251 }
       
   252 
       
   253