|
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 #include "Te_SimPacketTestStepBase.h" |
|
17 |
|
18 TVerdict CSimPacketTestStepBase::doTestStepPreambleL() |
|
19 { |
|
20 __UHEAP_MARK; |
|
21 |
|
22 TInt ret = iTelServer.Connect(); |
|
23 if (ret!=KErrNone) |
|
24 { |
|
25 INFO_PRINTF1(_L("Failed to connect to telephony server")); |
|
26 User::Leave(ret); |
|
27 } |
|
28 ret=iTelServer.LoadPhoneModule(KSimtsyName); |
|
29 if (ret!=KErrNone) |
|
30 { |
|
31 INFO_PRINTF1(_L("Failed to load phone module")); |
|
32 iTelServer.Close(); |
|
33 User::Leave(ret); |
|
34 } |
|
35 |
|
36 return TestStepResult(); |
|
37 } |
|
38 |
|
39 TVerdict CSimPacketTestStepBase::doTestStepPostambleL() |
|
40 { |
|
41 iTelServer.UnloadPhoneModule(KSimtsyName); |
|
42 iTelServer.Close(); |
|
43 |
|
44 __UHEAP_MARKEND; |
|
45 return TestStepResult(); |
|
46 } |
|
47 |
|
48 void CSimPacketTestStepBase::CleanUp(TAny *aPtr) |
|
49 /** |
|
50 * Calls iLine.Close() & iCall.Close in leave case. |
|
51 * @param this poiter pass cleanup stack when calls the function |
|
52 */ |
|
53 { |
|
54 CSimPacketTestStepBase* ptr = ((CSimPacketTestStepBase*)aPtr) ; |
|
55 //3 lines to be sure |
|
56 ptr->iPacketService.Close() ; |
|
57 ptr->iPacketContext[0].Close() ; |
|
58 ptr->iPacketContext[1].Close() ; |
|
59 ptr->iPhone.Close() ; |
|
60 } |
|
61 |
|
62 CSimPacketTestStepBase::operator TCleanupItem() |
|
63 /** |
|
64 * Makes TCleanupItem from current instance of CTestSimPacketStep |
|
65 */ |
|
66 { |
|
67 return TCleanupItem(CSimPacketTestStepBase::CleanUp,this); |
|
68 } |
|
69 |
|
70 |
|
71 void CSimPacketTestStepBase::TestConfigParamsL(RPacketQoS::TQoSGPRSNegotiated& aArg1, RPacketQoS::TQoSGPRSNegotiated& aArg2) |
|
72 /** |
|
73 * This tests that the arguments are the same. |
|
74 */ |
|
75 |
|
76 { |
|
77 TESTL(aArg1.iPrecedence == aArg2.iPrecedence); |
|
78 TESTL(aArg1.iDelay == aArg2.iDelay); |
|
79 TESTL(aArg1.iReliability == aArg2.iReliability); |
|
80 TESTL(aArg1.iPeakThroughput == aArg2.iPeakThroughput); |
|
81 TESTL(aArg1.iMeanThroughput == aArg2.iMeanThroughput); |
|
82 } |
|
83 |
|
84 void CSimPacketTestStepBase::TestConfigParamsL(RPacketContext::TContextConfigGPRS& aArg1, RPacketContext::TContextConfigGPRS& aArg2) |
|
85 { |
|
86 TESTL(aArg1.iPdpType == aArg2.iPdpType); |
|
87 TESTL(aArg1.iAccessPointName == aArg2.iAccessPointName ); |
|
88 TESTL(aArg1.iPdpCompression == aArg2.iPdpCompression); |
|
89 TESTL(aArg1.iPdpAddress == aArg2.iPdpAddress); |
|
90 TESTL(aArg1.iAnonymousAccessReqd == aArg2.iAnonymousAccessReqd); |
|
91 TESTL(aArg1.iUseEdge == aArg2.iUseEdge); |
|
92 |
|
93 } |
|
94 |
|
95 void CSimPacketTestStepBase::SetSimtsyTestNumberL(TInt aTestNumber) |
|
96 /** |
|
97 * Sets the test number which is to be executed from the config file |
|
98 */ |
|
99 { |
|
100 INFO_PRINTF2(_L("Changing the Test Number to %d"),aTestNumber); |
|
101 TInt ret = RProperty::Set(KUidPSSimTsyCategory, KPSSimTsyTestNumber, aTestNumber); |
|
102 TEST(ret == KErrNone); |
|
103 } |
|
104 |
|
105 void CSimPacketTestStepBase::WaitWithTimeout(TRequestStatus& aStatus, TInt aNumberOfMicroSeconds) |
|
106 /** |
|
107 * Timeout function |
|
108 */ |
|
109 { |
|
110 TRequestStatus timerStatus; |
|
111 RTimer timer ; |
|
112 timer.CreateLocal() ; |
|
113 timer.After(timerStatus,aNumberOfMicroSeconds); |
|
114 |
|
115 User::WaitForRequest(aStatus, timerStatus); |
|
116 if (timerStatus == KRequestPending) |
|
117 { |
|
118 timer.Cancel(); |
|
119 User::WaitForRequest(timerStatus); |
|
120 } |
|
121 else |
|
122 { |
|
123 INFO_PRINTF1(_L("Time is over!!!")) ; |
|
124 } |
|
125 timer.Close() ; |
|
126 } |