0
|
1 |
/*------------------------------------------------------------------
|
|
2 |
-
|
|
3 |
* Software Name : UserEmulator
|
|
4 |
* Version : v4.2.1309
|
|
5 |
*
|
|
6 |
* Copyright (c) 2009 France Telecom. All rights reserved.
|
|
7 |
* This software is distributed under the License
|
|
8 |
* "Eclipse Public License - v 1.0" the text of which is available
|
|
9 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
10 |
*
|
|
11 |
* Initial Contributors:
|
|
12 |
* France Telecom
|
|
13 |
*
|
|
14 |
* Contributors:
|
|
15 |
*------------------------------------------------------------------
|
|
16 |
-
|
|
17 |
* File Name: RandomTest.h
|
|
18 |
*
|
|
19 |
* Created: 13/08/2009
|
|
20 |
* Author(s): Marcell Kiss, Reshma Sandeep Das
|
|
21 |
*
|
|
22 |
* Description:
|
|
23 |
* This class is used to perform random test on applications or
|
|
24 |
* on the system generally
|
|
25 |
*------------------------------------------------------------------
|
|
26 |
-
|
|
27 |
*
|
|
28 |
*/
|
|
29 |
#ifndef RANDOMTEST_H_
|
|
30 |
#define RANDOMTEST_H_
|
|
31 |
|
|
32 |
// System Includes
|
|
33 |
#include <W32STD.H>
|
|
34 |
#include <APGCLI.H>
|
|
35 |
#include <E32BASE.H>
|
|
36 |
// User Includes
|
|
37 |
#include "Settings.h"
|
|
38 |
#include "Logger.h"
|
|
39 |
#include "UserEmulatorApplication.h"
|
|
40 |
#include "Constants.h"
|
|
41 |
#include "GlobalCapturer.h"
|
|
42 |
|
|
43 |
// Class Declaration
|
|
44 |
|
|
45 |
/**
|
|
46 |
* Implements random test run. Active object.
|
|
47 |
*/
|
|
48 |
class CRandomTest: public CActive
|
|
49 |
{
|
|
50 |
public:
|
|
51 |
|
|
52 |
/**
|
|
53 |
* Static constructor
|
|
54 |
* @param aObserver Key observer interface
|
|
55 |
* @param aRWsSession Reference to window server session
|
|
56 |
* @param aSettings Reference to Setting class
|
|
57 |
* @param aSession Reference to session with the application architecture server.
|
|
58 |
* @param aLogger Reference to logger object
|
|
59 |
* @return CRandomTest* A pointer to the newly allocated CRandomTest class.
|
|
60 |
* NULL, if the class cannot be created
|
|
61 |
*/
|
|
62 |
static CRandomTest* NewL(MKeyObserver& aObserver,RWsSession& aRWsSession,
|
|
63 |
CSettings& aSettings,RApaLsSession& aSession,CLogger& aLogger);
|
|
64 |
/**
|
|
65 |
* Static constructor. On return the instance is left to the CleanupStack
|
|
66 |
* @param aObserver Key observer interface
|
|
67 |
* @param aRWsSession Reference to window server session
|
|
68 |
* @param aSettings Reference to Setting class
|
|
69 |
* @param aSession Reference to session with the application architecture server.
|
|
70 |
* @param aLogger Reference to logger object
|
|
71 |
* @return CRandomTest* A pointer to the newly allocated CRandomTest class.
|
|
72 |
* NULL, if the class cannot be created
|
|
73 |
*/
|
|
74 |
static CRandomTest* NewLC(MKeyObserver& aObserver,RWsSession& aRWsSession,
|
|
75 |
CSettings& aSettings,RApaLsSession& aSession,CLogger& aLogger);
|
|
76 |
/**
|
|
77 |
* Destructor
|
|
78 |
*/
|
|
79 |
~CRandomTest();
|
|
80 |
public:
|
|
81 |
/**
|
|
82 |
* Initialises and starts random test
|
|
83 |
*/
|
|
84 |
void StartRandomTestL();
|
|
85 |
/**
|
|
86 |
* Stops random test
|
|
87 |
*/
|
|
88 |
void StopRandomTest();
|
|
89 |
/**
|
|
90 |
* Restarts random test active object
|
|
91 |
*/
|
|
92 |
void RestartRandomTest();
|
|
93 |
/**
|
|
94 |
* Cancels random test active object
|
|
95 |
*/
|
|
96 |
void CancelRandomTest();
|
|
97 |
protected:
|
|
98 |
/**
|
|
99 |
* RunL from CActive class
|
|
100 |
*/
|
|
101 |
void RunL();
|
|
102 |
/**
|
|
103 |
* DoCancel from CActive class
|
|
104 |
*/
|
|
105 |
void DoCancel();
|
|
106 |
private:
|
|
107 |
/**
|
|
108 |
* Constructor
|
|
109 |
* @param aObserver Key observer interface
|
|
110 |
* @param aRWsSession Reference to window server session
|
|
111 |
* @param aSettings Reference to Setting class
|
|
112 |
* @param aSession Reference to session with the application architecture server.
|
|
113 |
* @param aLogger Reference to logger object
|
|
114 |
*/
|
|
115 |
CRandomTest(MKeyObserver& aObserver,RWsSession& aRWsSession,CSettings& aSettings,RApaLsSession& aSession,CLogger& aLogger);
|
|
116 |
/**
|
|
117 |
* Second phase constructor
|
|
118 |
*/
|
|
119 |
void ConstructL();
|
|
120 |
/**
|
|
121 |
* Test list check
|
|
122 |
*/
|
|
123 |
TBool IsUidInTestList(TUid aUid);
|
|
124 |
private:
|
|
125 |
/**
|
|
126 |
* RTimer object member
|
|
127 |
*/
|
|
128 |
RTimer iTimer;
|
|
129 |
/**
|
|
130 |
* Reference to window server session
|
|
131 |
*/
|
|
132 |
RWsSession* iRWsSession;
|
|
133 |
/**
|
|
134 |
* Reference to Settings class
|
|
135 |
*/
|
|
136 |
CSettings& iSettings;
|
|
137 |
/**
|
|
138 |
* Reference to key observer interface
|
|
139 |
*/
|
|
140 |
MKeyObserver& iObserver;
|
|
141 |
/**
|
|
142 |
* Reference to session with the application architecture server.
|
|
143 |
*/
|
|
144 |
RApaLsSession& iSession;
|
|
145 |
/**
|
|
146 |
* Buffer. Contains last app's name on foreground (for logging)
|
|
147 |
*/
|
|
148 |
TBuf<KBuffer512> iLastAppName;
|
|
149 |
/**
|
|
150 |
* Reference to Logger object
|
|
151 |
*/
|
|
152 |
CLogger& iLogger;
|
|
153 |
/**
|
|
154 |
* Counts how many times one application runs. (If multiple test applications are running by random test)
|
|
155 |
*/
|
|
156 |
TInt iAppTestCounter;
|
|
157 |
/**
|
|
158 |
* Counts test steps and logs one app. name only if it's in foreground for a long time.
|
|
159 |
*/
|
|
160 |
TInt iAppNameLoggingCounter;
|
|
161 |
/**
|
|
162 |
* Random tester sends Ok button press event according to this counter.
|
|
163 |
*/
|
|
164 |
TInt iCounterForOkButton;
|
|
165 |
/**
|
|
166 |
* Flag. Shows if there was at least one valid app uid (True if there was one)
|
|
167 |
*/
|
|
168 |
TBool iCantStartAppToTest;
|
|
169 |
/**
|
|
170 |
* Array of random test UIDs
|
|
171 |
*/
|
|
172 |
RArray<TUid> iSlotUIDs;
|
|
173 |
};
|
|
174 |
|
|
175 |
#endif // RANDOMTEST_H_
|