|
1 // Copyright (c) 2001-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 the License "Symbian Foundation License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 |
|
17 |
|
18 // INCLUDES |
|
19 #include "ctlbsclientpostp193.h" |
|
20 #include "ctlbsposclientholder.h" |
|
21 #include <e32keys.h> |
|
22 |
|
23 // CONSTANTS |
|
24 |
|
25 // ================= MEMBER FUNCTIONS ======================= |
|
26 |
|
27 // --------------------------------------------------------- |
|
28 // Constructor. |
|
29 // --------------------------------------------------------- |
|
30 CT_LbsClientPosTp193::CT_LbsClientPosTp193(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) |
|
31 { |
|
32 _LIT(KTestName, "TP193 - Maximum number of Clients"); |
|
33 SetTestStepName(KTestName); |
|
34 } |
|
35 |
|
36 // --------------------------------------------------------- |
|
37 // Destructor. |
|
38 // --------------------------------------------------------- |
|
39 CT_LbsClientPosTp193::~CT_LbsClientPosTp193() |
|
40 { |
|
41 } |
|
42 |
|
43 // --------------------------------------------------------- |
|
44 // CT_LbsClientPosTp193::CloseTest |
|
45 // Always called after the test, even if the test leaves |
|
46 // (other items were commented in a header). |
|
47 // --------------------------------------------------------- |
|
48 // |
|
49 void CT_LbsClientPosTp193::CloseTest() |
|
50 { |
|
51 } |
|
52 |
|
53 // --------------------------------------------------------- |
|
54 // CT_LbsClientPosTp193::StartL |
|
55 // |
|
56 // (other items were commented in a header). |
|
57 // --------------------------------------------------------- |
|
58 // |
|
59 void CT_LbsClientPosTp193::StartL() |
|
60 { |
|
61 SetupPsyL(iUidTestPsy2); |
|
62 |
|
63 User::After(2000000); |
|
64 |
|
65 const TInt KNrOfClients = 25; |
|
66 CT_LbsPosClientHolder* clients = CT_LbsPosClientHolder::NewLC(KNrOfClients,iUidTestPsy2); |
|
67 |
|
68 TTime starttime,stoptime; |
|
69 |
|
70 starttime.UniversalTime(); |
|
71 |
|
72 clients->MakeRequests(); |
|
73 |
|
74 stoptime.UniversalTime(); |
|
75 |
|
76 // Substract total delay incurred due to TestPsy2...i.e 2sec |
|
77 TInt duration=stoptime.Int64()-starttime.Int64()-2000000; |
|
78 |
|
79 _LIT(KMessage,"25 simultaneous requests from 25 different sessions with a psy completed in %d microsec"); |
|
80 TBuf<256> message; |
|
81 message.Format(KMessage,duration); |
|
82 INFO_PRINTF1(message); |
|
83 |
|
84 if(duration>3000000) |
|
85 { |
|
86 _LIT(KTime, "Time taken>3 sec"); |
|
87 INFO_PRINTF1(KTime); |
|
88 } |
|
89 |
|
90 //check the result of the request |
|
91 //only KErrNoMemory or KErrNone is allowed. |
|
92 // CONSTANTS |
|
93 |
|
94 TPositionInfo position[KNrOfClients]; |
|
95 |
|
96 TTimeIntervalMicroSeconds reqTime[KNrOfClients]; |
|
97 TInt status; |
|
98 TBool error = EFalse; |
|
99 TBuf<150> buf; |
|
100 |
|
101 //some printing mostly used for information purpose. |
|
102 for (TInt i = 0; i < KNrOfClients; i++) |
|
103 { |
|
104 clients->GetResult(status, position[i], reqTime[i], i); |
|
105 if (status != 0) |
|
106 { |
|
107 _LIT(KError, "The position requested could not be retrieved, status = %d"); |
|
108 buf.Format(KError, status); |
|
109 ERR_PRINTF1(buf); |
|
110 if (status != -4) |
|
111 { |
|
112 error = ETrue; |
|
113 } |
|
114 } |
|
115 _LIT(KReqMsg, "client %d request time: %d"); |
|
116 |
|
117 buf.Format(KReqMsg, i, reqTime[i].Int64()); |
|
118 INFO_PRINTF1(buf); |
|
119 _LIT(KSeparator, "********"); |
|
120 INFO_PRINTF1(KSeparator); |
|
121 } |
|
122 |
|
123 if (error) |
|
124 { |
|
125 _LIT(KErrorCode, "The requests was not completed with KErrNoMemory or KErrNone"); |
|
126 LogErrorAndLeaveL(KErrorCode); |
|
127 } |
|
128 CleanupStack::PopAndDestroy(clients); //clients |
|
129 } |