|
1 /* |
|
2 * Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Tests for thread creation & Process priority. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef C_COMASUPLTHREADPROCESSTEST_H |
|
19 #define C_COMASUPLTHREADPROCESSTEST_H |
|
20 |
|
21 #include "epos_comasuplpostestercategory.h" |
|
22 |
|
23 /** |
|
24 * Tests for thread creation & Process priority. |
|
25 * |
|
26 * Provides the number of threads which were created but not killed. |
|
27 * |
|
28 * @lib epos_comasuplpostestermodulecfg.lib |
|
29 * @since S60 v3.1 |
|
30 */ |
|
31 class COMASuplThreadProcessTest:public COMASuplPosTesterCategory |
|
32 { |
|
33 public: |
|
34 static COMASuplThreadProcessTest* NewL( |
|
35 COMASuplPosTesterCategory* aCallBack = NULL); |
|
36 ~COMASuplThreadProcessTest(); |
|
37 private: |
|
38 COMASuplThreadProcessTest(COMASuplPosTesterCategory* aCallBack); |
|
39 void ConstructL(); |
|
40 |
|
41 /** |
|
42 * From COMASuplPosTesterCategory |
|
43 * Starts testing for the test class |
|
44 * |
|
45 * @since S60 v3.1 |
|
46 */ |
|
47 void StartTestingL(); |
|
48 public: |
|
49 /** |
|
50 * From COMASuplPosTesterCategory |
|
51 * Handles completion of asynchronous request |
|
52 * |
|
53 * @since S60 v3.1 |
|
54 */ |
|
55 void RunL(); |
|
56 |
|
57 /** |
|
58 * From COMASuplPosTesterCategory |
|
59 * Handles cancellation of asynchronous request |
|
60 * |
|
61 * @since S60 v3.1 |
|
62 */ |
|
63 void DoCancel(); |
|
64 |
|
65 /** |
|
66 * From COMASuplPosTesterCategory |
|
67 * Handles leave from RunL, aborts testing. |
|
68 * |
|
69 * @since S60 v3.1 |
|
70 * @param aError Errorcode of leaving |
|
71 */ |
|
72 TInt RunError(TInt aError); |
|
73 |
|
74 /** |
|
75 * Gets number of threads associated with the current process, |
|
76 * name of process and priority of the process. |
|
77 * |
|
78 * @since S60 v3.1 |
|
79 * @param aThreadCount Gets the number of threads associated with |
|
80 * current process |
|
81 * @param aPriority Priority of current process. |
|
82 * @param aProcessName Name of current process. |
|
83 * @return void |
|
84 */ |
|
85 void ReadStatusL(TInt& aThreadCount, TProcessPriority& aPriority |
|
86 , TFullName& aProcessName); |
|
87 |
|
88 /** |
|
89 * Gets number of threads associated with the a process, |
|
90 * |
|
91 * @since S60 v3.1 |
|
92 * @param aProcessName Name of process whose associated threads |
|
93 * are to be counted. |
|
94 * @return TInt number of threads associated with aProcessName. |
|
95 */ |
|
96 void CountThreadsL(const TFullName& aProcessName, TInt& aThreadCount); |
|
97 |
|
98 /** |
|
99 * Appends '*' before and after aProcessName. |
|
100 * |
|
101 * @since S60 v3.1 |
|
102 * @param aSearchString A descriptor containing "*aProcessName*" |
|
103 * @param aProcessName Name of the process. |
|
104 * @return void |
|
105 */ |
|
106 void PrepareSearchStringL(HBufC*& aSearchString |
|
107 , const TFullName& aProcessName); |
|
108 |
|
109 /** |
|
110 * Stores number of threads associated with the current process, |
|
111 * name of process and priority of the process before starting tests.. |
|
112 * |
|
113 * @since S60 v3.1 |
|
114 * @return void |
|
115 */ |
|
116 void StatusBeforeTestsL(); |
|
117 |
|
118 /** |
|
119 * Stores number of threads associated with the current process, |
|
120 * name of process and priority of the process after starting tests.. |
|
121 * |
|
122 * @since S60 v3.1 |
|
123 * @return void |
|
124 */ |
|
125 void StatusAfterTestsL(); |
|
126 |
|
127 /** |
|
128 * Matches number of threads associated with the a process, |
|
129 * name of process and priority of the process after starting tests |
|
130 * with the same stored before starting tests. |
|
131 * |
|
132 * @since S60 v3.1 |
|
133 * @return void |
|
134 */ |
|
135 TBool MatchAndLogStatus(); |
|
136 |
|
137 private: |
|
138 /* |
|
139 * Number of threads before executing test. |
|
140 */ |
|
141 TInt iThreadCountBeforeTests; |
|
142 |
|
143 /* |
|
144 * Number of threads after executing test. |
|
145 */ |
|
146 TInt iThreadCountAfterTests; |
|
147 |
|
148 /* |
|
149 * Priority of process before executing test. |
|
150 */ |
|
151 TProcessPriority iProcessPriorityBeforeTests; |
|
152 |
|
153 /* |
|
154 * Priority of process after executing test. |
|
155 */ |
|
156 TProcessPriority iProcessPriorityAfterTests; |
|
157 |
|
158 /* |
|
159 * Name of process before executing test. |
|
160 */ |
|
161 TFullName iProcessNameBeforeTests; |
|
162 |
|
163 /* |
|
164 * Name of process after executing test. |
|
165 */ |
|
166 TFullName iProcessNameAfterTests; |
|
167 }; |
|
168 #endif |