sl@0
|
1 |
// Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// t_logsimid.cpp - Log event tests using the SimId event property
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
#include <s32file.h>
|
sl@0
|
18 |
#include <s32mem.h>
|
sl@0
|
19 |
#include <e32math.h>
|
sl@0
|
20 |
#include <bautils.h>
|
sl@0
|
21 |
#include <logview.h>
|
sl@0
|
22 |
#include <logcli.h>
|
sl@0
|
23 |
#include "t_logutil2.h"
|
sl@0
|
24 |
#include "LogServSqlStrings.h"
|
sl@0
|
25 |
|
sl@0
|
26 |
RTest TheTest(_L("t_logsimid"));
|
sl@0
|
27 |
|
sl@0
|
28 |
#ifdef SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM
|
sl@0
|
29 |
|
sl@0
|
30 |
const TLogId KEvId1 = 101;
|
sl@0
|
31 |
_LIT(KEvDesc1, "Event Type Description 1");
|
sl@0
|
32 |
_LIT(KEvRemote1, "Remote Party 1");
|
sl@0
|
33 |
|
sl@0
|
34 |
//Event type related
|
sl@0
|
35 |
//KLogCallEventType is used in order to use the "recent list" related functionality on the server side
|
sl@0
|
36 |
//(KEvDirection1 value also plays important role)
|
sl@0
|
37 |
const TUid KEvTypeUid = {KLogCallEventType};
|
sl@0
|
38 |
//KEvDirection1 together with the KEvTypeUid guarantee that the properties of events being added match the conditions of one
|
sl@0
|
39 |
//of the LogEng server recent lists and thus the "recent list" related functionality on the server side will be used.
|
sl@0
|
40 |
_LIT(KEvDirection1, "Missed call");
|
sl@0
|
41 |
|
sl@0
|
42 |
_LIT(KEvStatus1, "Status 1");
|
sl@0
|
43 |
_LIT(KEvSubject1, "Subject 1");
|
sl@0
|
44 |
_LIT(KEvNumber1, "11119999");
|
sl@0
|
45 |
const TLogDurationType KEvDurationType1 = 1;
|
sl@0
|
46 |
const TLogDuration KEvDuration1 = 1000;
|
sl@0
|
47 |
const TLogContactItemId KEvContact1 = 1010;
|
sl@0
|
48 |
const TLogLink KEvLink1 = 2000;
|
sl@0
|
49 |
_LIT8(KEvData1, "ABCDEFGH 1");
|
sl@0
|
50 |
const TLogFlags KEvFlags1 = 0x5;
|
sl@0
|
51 |
const TSimId KEvSimId1 = 3000000910U;//Bigger than KMaxTInt, to check that SQL statement formatting works as expected
|
sl@0
|
52 |
|
sl@0
|
53 |
const TInt KDiffEvCount = 10;
|
sl@0
|
54 |
const TLogDurationType KEvDurationType2 = 2;
|
sl@0
|
55 |
_LIT(KEvNumber2, "22226666");
|
sl@0
|
56 |
|
sl@0
|
57 |
const TUid KEvTypeUidLoggingDisabled = {0x447422};
|
sl@0
|
58 |
|
sl@0
|
59 |
//The default max log size is 1000. But the test timeouts on hardware with max log size of 1000.
|
sl@0
|
60 |
const TInt KMaxLogSize = 200;
|
sl@0
|
61 |
const TInt KMaxPlusEvCount = 100; //Added events count on top of the max log size
|
sl@0
|
62 |
|
sl@0
|
63 |
TInt TheAddedEventCount = -1;
|
sl@0
|
64 |
TInt TheMaxLogSize = -1;
|
sl@0
|
65 |
|
sl@0
|
66 |
enum TLogViewSimId {ELogWithoutSimId, ELogWithSimId, ELogIgnoreSimId, ELogDiffEvents};
|
sl@0
|
67 |
|
sl@0
|
68 |
TLogId TheEvId = -1;
|
sl@0
|
69 |
|
sl@0
|
70 |
void DoTestEvent1(const CLogEvent& aEvent)
|
sl@0
|
71 |
{
|
sl@0
|
72 |
TEST(aEvent.Id() == KEvId1);
|
sl@0
|
73 |
TEST(aEvent.EventType() == KEvTypeUid);
|
sl@0
|
74 |
TEST(aEvent.RemoteParty() == KEvRemote1);
|
sl@0
|
75 |
TEST(aEvent.Direction() == KEvDirection1);
|
sl@0
|
76 |
TEST(aEvent.DurationType() == KEvDurationType1);
|
sl@0
|
77 |
TEST(aEvent.Duration() == KEvDuration1);
|
sl@0
|
78 |
TEST(aEvent.Status() == KEvStatus1);
|
sl@0
|
79 |
TEST(aEvent.Subject() == KEvSubject1);
|
sl@0
|
80 |
TEST(aEvent.Number() == KEvNumber1);
|
sl@0
|
81 |
TEST(aEvent.Contact() == KEvContact1);
|
sl@0
|
82 |
TEST(aEvent.Link() == KEvLink1);
|
sl@0
|
83 |
TEST(aEvent.Description() == KEvDesc1);
|
sl@0
|
84 |
TEST(aEvent.Flags() == KEvFlags1);
|
sl@0
|
85 |
TEST(aEvent.Data() == KEvData1);
|
sl@0
|
86 |
TEST(aEvent.SimId() == KEvSimId1);
|
sl@0
|
87 |
}
|
sl@0
|
88 |
|
sl@0
|
89 |
void DoTestFilter1(const CLogFilter& aFilter)
|
sl@0
|
90 |
{
|
sl@0
|
91 |
TEST(aFilter.EventType() == KEvTypeUid);
|
sl@0
|
92 |
TEST(aFilter.RemoteParty() == KEvRemote1);
|
sl@0
|
93 |
TEST(aFilter.Direction() == KEvDirection1);
|
sl@0
|
94 |
TEST(aFilter.DurationType() == KEvDurationType1);
|
sl@0
|
95 |
TEST(aFilter.Status() == KEvStatus1);
|
sl@0
|
96 |
TEST(aFilter.Contact() == KEvContact1);
|
sl@0
|
97 |
TEST(aFilter.Number() == KEvNumber1);
|
sl@0
|
98 |
TEST(aFilter.Flags() == KEvFlags1);
|
sl@0
|
99 |
TEST(aFilter.SimId() == KEvSimId1);
|
sl@0
|
100 |
}
|
sl@0
|
101 |
|
sl@0
|
102 |
/**
|
sl@0
|
103 |
@SYMTestCaseID PDS-LOGENG-UT-4025
|
sl@0
|
104 |
@SYMTestCaseDesc CLogEvent API and SimId test.
|
sl@0
|
105 |
The test creates an event and checks that event Copy(), Internalize() and Externalize()
|
sl@0
|
106 |
operations work properly.
|
sl@0
|
107 |
@SYMTestActions CLogEvent API and SimId test.
|
sl@0
|
108 |
@SYMTestExpectedResults Test must not fail
|
sl@0
|
109 |
@SYMTestPriority Medium
|
sl@0
|
110 |
@SYMREQ REQ12746
|
sl@0
|
111 |
*/
|
sl@0
|
112 |
void LogEventApiTestL()
|
sl@0
|
113 |
{
|
sl@0
|
114 |
CLogEvent* event = CLogEvent::NewL();
|
sl@0
|
115 |
CleanupStack::PushL(event);
|
sl@0
|
116 |
|
sl@0
|
117 |
event->SetId(KEvId1);
|
sl@0
|
118 |
event->SetEventType(KEvTypeUid);
|
sl@0
|
119 |
event->SetRemoteParty(KEvRemote1);
|
sl@0
|
120 |
event->SetDirection(KEvDirection1);
|
sl@0
|
121 |
event->SetDurationType(KEvDurationType1);
|
sl@0
|
122 |
event->SetDuration(KEvDuration1);
|
sl@0
|
123 |
event->SetStatus(KEvStatus1);
|
sl@0
|
124 |
event->SetSubject(KEvSubject1);
|
sl@0
|
125 |
event->SetNumber(KEvNumber1);
|
sl@0
|
126 |
event->SetContact(KEvContact1);
|
sl@0
|
127 |
event->SetLink(KEvLink1);
|
sl@0
|
128 |
event->SetDescription(KEvDesc1);
|
sl@0
|
129 |
event->SetFlags(KEvFlags1);
|
sl@0
|
130 |
event->SetDataL(KEvData1);
|
sl@0
|
131 |
event->SetSimId( KEvSimId1);
|
sl@0
|
132 |
|
sl@0
|
133 |
//Copy event
|
sl@0
|
134 |
CLogEvent* event2 = CLogEvent::NewL();
|
sl@0
|
135 |
CleanupStack::PushL(event2);
|
sl@0
|
136 |
event2->CopyL(*event);
|
sl@0
|
137 |
DoTestEvent1(*event2);
|
sl@0
|
138 |
CleanupStack::PopAndDestroy(event2);
|
sl@0
|
139 |
|
sl@0
|
140 |
//Externalize event
|
sl@0
|
141 |
TBuf8<512> buf;
|
sl@0
|
142 |
RDesWriteStream strmOut;
|
sl@0
|
143 |
strmOut.Open(buf);
|
sl@0
|
144 |
event->ExternalizeL(strmOut);
|
sl@0
|
145 |
strmOut.CommitL();
|
sl@0
|
146 |
strmOut.Close();
|
sl@0
|
147 |
|
sl@0
|
148 |
//Internalize event
|
sl@0
|
149 |
CLogEvent* event3 = CLogEvent::NewL();
|
sl@0
|
150 |
CleanupStack::PushL(event3);
|
sl@0
|
151 |
RDesReadStream strmIn;
|
sl@0
|
152 |
strmIn.Open(buf);
|
sl@0
|
153 |
event3->InternalizeL(strmIn);
|
sl@0
|
154 |
strmIn.Close();
|
sl@0
|
155 |
DoTestEvent1(*event3);
|
sl@0
|
156 |
CleanupStack::PopAndDestroy(event3);
|
sl@0
|
157 |
|
sl@0
|
158 |
CleanupStack::PopAndDestroy(event);
|
sl@0
|
159 |
}
|
sl@0
|
160 |
|
sl@0
|
161 |
/**
|
sl@0
|
162 |
@SYMTestCaseID PDS-LOGENG-UT-4026
|
sl@0
|
163 |
@SYMTestCaseDesc CLogEvent API and SimId test.
|
sl@0
|
164 |
The test creates a filter and checks that filter Copy() operation work properly.
|
sl@0
|
165 |
@SYMTestActions CLogEvent API and SimId test.
|
sl@0
|
166 |
@SYMTestExpectedResults Test must not fail
|
sl@0
|
167 |
@SYMTestPriority Medium
|
sl@0
|
168 |
@SYMREQ REQ12747
|
sl@0
|
169 |
*/
|
sl@0
|
170 |
void LogFilterApiTestL()
|
sl@0
|
171 |
{
|
sl@0
|
172 |
CLogFilter* filter = CLogFilter::NewL();
|
sl@0
|
173 |
CleanupStack::PushL(filter);
|
sl@0
|
174 |
|
sl@0
|
175 |
filter->SetEventType(KEvTypeUid);
|
sl@0
|
176 |
filter->SetRemoteParty(KEvRemote1);
|
sl@0
|
177 |
filter->SetDirection(KEvDirection1);
|
sl@0
|
178 |
filter->SetDurationType(KEvDurationType1);
|
sl@0
|
179 |
filter->SetStatus(KEvStatus1);
|
sl@0
|
180 |
filter->SetContact(KEvContact1);
|
sl@0
|
181 |
filter->SetNumber(KEvNumber1);
|
sl@0
|
182 |
filter->SetFlags(KEvFlags1);
|
sl@0
|
183 |
filter->SetSimId( KEvSimId1);
|
sl@0
|
184 |
|
sl@0
|
185 |
//Copy filter
|
sl@0
|
186 |
CLogFilter* filter2 = CLogFilter::NewL();
|
sl@0
|
187 |
CleanupStack::PushL(filter2);
|
sl@0
|
188 |
filter2->Copy(*filter);
|
sl@0
|
189 |
DoTestFilter1(*filter2);
|
sl@0
|
190 |
CleanupStack::PopAndDestroy(filter2);
|
sl@0
|
191 |
|
sl@0
|
192 |
CleanupStack::PopAndDestroy(filter);
|
sl@0
|
193 |
}
|
sl@0
|
194 |
|
sl@0
|
195 |
void DoSetNewMaxLogSizeL(CLogClient& aClient, CTestActive& aActive)
|
sl@0
|
196 |
{
|
sl@0
|
197 |
//Check what is the max log size.
|
sl@0
|
198 |
TLogConfig config;
|
sl@0
|
199 |
aActive.StartL();
|
sl@0
|
200 |
aClient.GetConfig(config, aActive.iStatus);
|
sl@0
|
201 |
CActiveScheduler::Start();
|
sl@0
|
202 |
TEST2(aActive.iStatus.Int(), KErrNone);
|
sl@0
|
203 |
//Set new max log size
|
sl@0
|
204 |
config.iMaxLogSize = KMaxLogSize;
|
sl@0
|
205 |
aActive.StartL();
|
sl@0
|
206 |
aClient.ChangeConfig(config, aActive.iStatus);
|
sl@0
|
207 |
CActiveScheduler::Start();
|
sl@0
|
208 |
TEST2(aActive.iStatus.Int(), KErrNone);
|
sl@0
|
209 |
//Test the new max log size
|
sl@0
|
210 |
aActive.StartL();
|
sl@0
|
211 |
aClient.GetConfig(config, aActive.iStatus);
|
sl@0
|
212 |
CActiveScheduler::Start();
|
sl@0
|
213 |
TEST2(aActive.iStatus.Int(), KErrNone);
|
sl@0
|
214 |
TEST2(config.iMaxLogSize, KMaxLogSize);
|
sl@0
|
215 |
//
|
sl@0
|
216 |
TheMaxLogSize = config.iMaxLogSize;
|
sl@0
|
217 |
TheAddedEventCount = config.iMaxLogSize + KMaxPlusEvCount;
|
sl@0
|
218 |
}
|
sl@0
|
219 |
|
sl@0
|
220 |
/**
|
sl@0
|
221 |
@SYMTestCaseID PDS-LOGENG-UT-4027
|
sl@0
|
222 |
@SYMTestCaseDesc Add events test.
|
sl@0
|
223 |
The test adds events to the LogEng database. The events count is bigger than the
|
sl@0
|
224 |
max log size. Half of the events will be with non-zero SimId property.
|
sl@0
|
225 |
10 of the events will have different DurationType and Number values than the other events.
|
sl@0
|
226 |
Apart from checking that the "add event" opertaion works with the new SimId property, this
|
sl@0
|
227 |
test case also prepares data for the other "view event" test cases.
|
sl@0
|
228 |
@SYMTestActions Add events test.
|
sl@0
|
229 |
@SYMTestExpectedResults Test must not fail
|
sl@0
|
230 |
@SYMTestPriority Medium
|
sl@0
|
231 |
@SYMREQ REQ12746
|
sl@0
|
232 |
*/
|
sl@0
|
233 |
void LogAddEventsTestL()
|
sl@0
|
234 |
{
|
sl@0
|
235 |
CLogClient* client = CLogClient::NewL(theFs);
|
sl@0
|
236 |
CleanupStack::PushL(client);
|
sl@0
|
237 |
CTestActive* active = new(ELeave)CTestActive();
|
sl@0
|
238 |
CleanupStack::PushL(active);
|
sl@0
|
239 |
|
sl@0
|
240 |
//Set new max log size
|
sl@0
|
241 |
DoSetNewMaxLogSizeL(*client, *active);
|
sl@0
|
242 |
|
sl@0
|
243 |
//Add TheAddedEventCount events. Some of them with SimId, some - not.
|
sl@0
|
244 |
//This certainly will involve some log purging operations when the log size reaches the max.
|
sl@0
|
245 |
CLogEvent* event = CLogEvent::NewL();
|
sl@0
|
246 |
CleanupStack::PushL(event);
|
sl@0
|
247 |
event->SetEventType(KLogCallEventTypeUid);
|
sl@0
|
248 |
event->SetRemoteParty(KEvRemote1);
|
sl@0
|
249 |
event->SetDirection(KEvDirection1);
|
sl@0
|
250 |
event->SetDurationType(KEvDurationType1);
|
sl@0
|
251 |
event->SetDuration(KEvDuration1);
|
sl@0
|
252 |
event->SetStatus(KEvStatus1);
|
sl@0
|
253 |
event->SetSubject(KEvSubject1);
|
sl@0
|
254 |
event->SetNumber(KEvNumber1);
|
sl@0
|
255 |
event->SetContact(KEvContact1);
|
sl@0
|
256 |
event->SetLink(KEvLink1);
|
sl@0
|
257 |
event->SetDescription(KEvDesc1);
|
sl@0
|
258 |
event->SetFlags(KEvFlags1);
|
sl@0
|
259 |
event->SetDataL(KEvData1);
|
sl@0
|
260 |
|
sl@0
|
261 |
TTime st_time;
|
sl@0
|
262 |
st_time.UniversalTime();
|
sl@0
|
263 |
|
sl@0
|
264 |
TheTest.Printf(_L("Added events:\n"));
|
sl@0
|
265 |
TInt diffEvCount = KDiffEvCount;
|
sl@0
|
266 |
for(TInt i=0;i<TheAddedEventCount;++i)
|
sl@0
|
267 |
{
|
sl@0
|
268 |
event->SetSimId(KLogNullSimId);
|
sl@0
|
269 |
event->SetDurationType(KEvDurationType1);
|
sl@0
|
270 |
event->SetNumber(KEvNumber1);
|
sl@0
|
271 |
if((i %2) == 0)
|
sl@0
|
272 |
{
|
sl@0
|
273 |
event->SetSimId(KEvSimId1);
|
sl@0
|
274 |
if((i > TheMaxLogSize / 2 + 1) && (i % 10) == 0 && --diffEvCount >= 0)
|
sl@0
|
275 |
{//Add after the second half because when the log grows above the max log size, the first events will be deleted
|
sl@0
|
276 |
event->SetDurationType(KEvDurationType2);
|
sl@0
|
277 |
event->SetNumber(KEvNumber2);
|
sl@0
|
278 |
}
|
sl@0
|
279 |
}
|
sl@0
|
280 |
active->StartL();
|
sl@0
|
281 |
client->AddEvent(*event, active->iStatus);
|
sl@0
|
282 |
CActiveScheduler::Start();
|
sl@0
|
283 |
TEST(!active->IsActive());
|
sl@0
|
284 |
TEST2(active->iStatus.Int(), KErrNone);
|
sl@0
|
285 |
if((i % 50) == 0)
|
sl@0
|
286 |
{
|
sl@0
|
287 |
TheTest.Printf(_L("%d\r"), i);
|
sl@0
|
288 |
}
|
sl@0
|
289 |
}
|
sl@0
|
290 |
TheTest.Printf(_L("%d\n"), TheAddedEventCount);
|
sl@0
|
291 |
|
sl@0
|
292 |
TTime end_time;
|
sl@0
|
293 |
end_time.UniversalTime();
|
sl@0
|
294 |
|
sl@0
|
295 |
CleanupStack::PopAndDestroy(event);
|
sl@0
|
296 |
|
sl@0
|
297 |
CleanupStack::PopAndDestroy(active);
|
sl@0
|
298 |
CleanupStack::PopAndDestroy(client);
|
sl@0
|
299 |
|
sl@0
|
300 |
TTimeIntervalMicroSeconds us = end_time.MicroSecondsFrom(st_time);
|
sl@0
|
301 |
TheTest.Printf(_L("%d events added. Time: %ld milliseconds\n"), TheAddedEventCount, us.Int64() / 1000);
|
sl@0
|
302 |
}
|
sl@0
|
303 |
|
sl@0
|
304 |
void DoSetFilterL(TLogViewSimId aViewSimId, TInt aExpectedEventCount,
|
sl@0
|
305 |
CLogViewEvent& aLogView, CLogFilter& aLogFilter, CTestActive& aActive)
|
sl@0
|
306 |
{
|
sl@0
|
307 |
switch(aViewSimId)
|
sl@0
|
308 |
{
|
sl@0
|
309 |
case ELogWithoutSimId:
|
sl@0
|
310 |
aLogFilter.SetNullFields(ELogSimIdField);
|
sl@0
|
311 |
break;
|
sl@0
|
312 |
case ELogWithSimId:
|
sl@0
|
313 |
aLogFilter.SetSimId(KEvSimId1);
|
sl@0
|
314 |
break;
|
sl@0
|
315 |
case ELogDiffEvents:
|
sl@0
|
316 |
aLogFilter.SetSimId(KEvSimId1);
|
sl@0
|
317 |
aLogFilter.SetDurationType(KEvDurationType2);
|
sl@0
|
318 |
aLogFilter.SetNumber(KEvNumber2);
|
sl@0
|
319 |
break;
|
sl@0
|
320 |
case ELogIgnoreSimId:
|
sl@0
|
321 |
default:
|
sl@0
|
322 |
break;
|
sl@0
|
323 |
}
|
sl@0
|
324 |
TBool res = aLogView.SetFilterL(aLogFilter, aActive.iStatus);
|
sl@0
|
325 |
TEST(res);
|
sl@0
|
326 |
aActive.StartL();
|
sl@0
|
327 |
CActiveScheduler::Start();
|
sl@0
|
328 |
TEST2(aActive.iStatus.Int(), KErrNone);
|
sl@0
|
329 |
TInt count = aLogView.CountL();
|
sl@0
|
330 |
TheTest.Printf(_L("===Events count: %d\n"), count);
|
sl@0
|
331 |
TEST2(count, aExpectedEventCount);
|
sl@0
|
332 |
}
|
sl@0
|
333 |
|
sl@0
|
334 |
void DoTestViewEvent(TLogViewSimId aViewSimId, CLogViewEvent& aLogView)
|
sl@0
|
335 |
{
|
sl@0
|
336 |
const CLogEvent& e = aLogView.Event();
|
sl@0
|
337 |
TSimId simid = e.SimId();
|
sl@0
|
338 |
TLogDurationType durationType = e.DurationType();
|
sl@0
|
339 |
const TDesC& number = e.Number();
|
sl@0
|
340 |
switch(aViewSimId)
|
sl@0
|
341 |
{
|
sl@0
|
342 |
case ELogWithoutSimId:
|
sl@0
|
343 |
TEST2(simid, KLogNullSimId);
|
sl@0
|
344 |
break;
|
sl@0
|
345 |
case ELogWithSimId:
|
sl@0
|
346 |
TEST2U(simid, KEvSimId1);
|
sl@0
|
347 |
break;
|
sl@0
|
348 |
case ELogDiffEvents:
|
sl@0
|
349 |
TEST2U(simid, KEvSimId1);
|
sl@0
|
350 |
TEST2(durationType, KEvDurationType2);
|
sl@0
|
351 |
TEST(number == KEvNumber2);
|
sl@0
|
352 |
break;
|
sl@0
|
353 |
case ELogIgnoreSimId:
|
sl@0
|
354 |
default:
|
sl@0
|
355 |
break;
|
sl@0
|
356 |
}
|
sl@0
|
357 |
}
|
sl@0
|
358 |
|
sl@0
|
359 |
/**
|
sl@0
|
360 |
@SYMTestCaseID PDS-LOGENG-UT-4028
|
sl@0
|
361 |
@SYMTestCaseDesc View events test.
|
sl@0
|
362 |
The test case expects the LogEng database to be already filled with events.
|
sl@0
|
363 |
Depending what is the value of the aViewSimId, the test will prepare a view and
|
sl@0
|
364 |
set the view filter to filter in events without SimId, events with SimId, all events,
|
sl@0
|
365 |
or the events with different DurationType and Number property values. The purpose
|
sl@0
|
366 |
of the test is to check that the event filtering works as expected with the new SimId
|
sl@0
|
367 |
property.
|
sl@0
|
368 |
@SYMTestActions View events test.
|
sl@0
|
369 |
@SYMTestExpectedResults Test must not fail
|
sl@0
|
370 |
@SYMTestPriority Medium
|
sl@0
|
371 |
@SYMREQ REQ12746
|
sl@0
|
372 |
*/
|
sl@0
|
373 |
void LogViewEventsTestL(TLogViewSimId aViewSimId, TInt aExpectedEventCount)
|
sl@0
|
374 |
{
|
sl@0
|
375 |
CLogClient* client = CLogClient::NewL(theFs);
|
sl@0
|
376 |
CleanupStack::PushL(client);
|
sl@0
|
377 |
CTestActive* active = new(ELeave)CTestActive();
|
sl@0
|
378 |
CleanupStack::PushL(active);
|
sl@0
|
379 |
CLogViewEvent* view = CLogViewEvent::NewL(*client);
|
sl@0
|
380 |
CleanupStack::PushL(view);
|
sl@0
|
381 |
CLogFilter* filter = CLogFilter::NewL();
|
sl@0
|
382 |
CleanupStack::PushL(filter);
|
sl@0
|
383 |
|
sl@0
|
384 |
TTime st_time;
|
sl@0
|
385 |
st_time.UniversalTime();
|
sl@0
|
386 |
DoSetFilterL(aViewSimId, aExpectedEventCount, *view, *filter, *active);
|
sl@0
|
387 |
TTime end_time;
|
sl@0
|
388 |
end_time.UniversalTime();
|
sl@0
|
389 |
TTimeIntervalMicroSeconds us = end_time.MicroSecondsFrom(st_time);
|
sl@0
|
390 |
TheTest.Printf(_L("SetFilter(). Time: %ld milliseconds\n"), us.Int64() / 1000);
|
sl@0
|
391 |
|
sl@0
|
392 |
TInt count = 0;
|
sl@0
|
393 |
st_time.UniversalTime();
|
sl@0
|
394 |
if(view->FirstL(active->iStatus))
|
sl@0
|
395 |
{
|
sl@0
|
396 |
do
|
sl@0
|
397 |
{
|
sl@0
|
398 |
active->StartL();
|
sl@0
|
399 |
CActiveScheduler::Start();
|
sl@0
|
400 |
TEST2(active->iStatus.Int(), KErrNone);
|
sl@0
|
401 |
DoTestViewEvent(aViewSimId, *view);
|
sl@0
|
402 |
++count;
|
sl@0
|
403 |
}
|
sl@0
|
404 |
while(view->NextL(active->iStatus));
|
sl@0
|
405 |
}
|
sl@0
|
406 |
end_time.UniversalTime();
|
sl@0
|
407 |
us = end_time.MicroSecondsFrom(st_time);
|
sl@0
|
408 |
TheTest.Printf(_L("Event view walk completed. Events count: %d. Time: %ld milliseconds\n"), count, us.Int64() / 1000);
|
sl@0
|
409 |
|
sl@0
|
410 |
CleanupStack::PopAndDestroy(filter);
|
sl@0
|
411 |
CleanupStack::PopAndDestroy(view);
|
sl@0
|
412 |
CleanupStack::PopAndDestroy(active);
|
sl@0
|
413 |
CleanupStack::PopAndDestroy(client);
|
sl@0
|
414 |
}
|
sl@0
|
415 |
|
sl@0
|
416 |
//Add a new event type with "logging disabled"
|
sl@0
|
417 |
void DoAddEventTypeL(CLogClient& aClient, CTestActive& aActive)
|
sl@0
|
418 |
{
|
sl@0
|
419 |
CLogEventType* type = CLogEventType::NewL();
|
sl@0
|
420 |
CleanupStack::PushL(type);
|
sl@0
|
421 |
|
sl@0
|
422 |
type->SetUid(KEvTypeUidLoggingDisabled);
|
sl@0
|
423 |
type->SetDescription(_L("110111011011"));
|
sl@0
|
424 |
type->SetLoggingEnabled(EFalse);
|
sl@0
|
425 |
|
sl@0
|
426 |
aClient.AddEventType(*type, aActive.iStatus);
|
sl@0
|
427 |
aActive.StartL();
|
sl@0
|
428 |
CActiveScheduler::Start();
|
sl@0
|
429 |
TEST2(aActive.iStatus.Int(), KErrNone);
|
sl@0
|
430 |
|
sl@0
|
431 |
CleanupStack::PopAndDestroy(type);
|
sl@0
|
432 |
}
|
sl@0
|
433 |
|
sl@0
|
434 |
void doTestsL()
|
sl@0
|
435 |
{
|
sl@0
|
436 |
TestUtils::Initialize(_L("t_logsimid"));
|
sl@0
|
437 |
TestUtils::DeleteDatabaseL();
|
sl@0
|
438 |
//
|
sl@0
|
439 |
TheTest.Start(_L(" @SYMTestCaseID:PDS-LOGENG-UT-4025: CLogEvent API test"));
|
sl@0
|
440 |
LogEventApiTestL();
|
sl@0
|
441 |
TheTest.Next(_L(" @SYMTestCaseID:PDS-LOGENG-UT-4026: CLogFilter API test"));
|
sl@0
|
442 |
LogFilterApiTestL();
|
sl@0
|
443 |
TheTest.Next(_L(" @SYMTestCaseID:PDS-LOGENG-UT-4027: Add events test"));
|
sl@0
|
444 |
LogAddEventsTestL();
|
sl@0
|
445 |
TheTest.Next(_L(" @SYMTestCaseID:PDS-LOGENG-UT-4028: View events without SimId test"));
|
sl@0
|
446 |
LogViewEventsTestL(ELogWithoutSimId, TheMaxLogSize / 2);
|
sl@0
|
447 |
TheTest.Next(_L(" @SYMTestCaseID:PDS-LOGENG-UT-4028: View events with SimId test"));
|
sl@0
|
448 |
LogViewEventsTestL(ELogWithSimId, TheMaxLogSize / 2);
|
sl@0
|
449 |
TheTest.Next(_L(" @SYMTestCaseID:PDS-LOGENG-UT-4028: View events with or without SimId test"));
|
sl@0
|
450 |
LogViewEventsTestL(ELogIgnoreSimId, TheMaxLogSize);
|
sl@0
|
451 |
TheTest.Next(_L(" @SYMTestCaseID:PDS-LOGENG-UT-4028: More complex event view test"));
|
sl@0
|
452 |
LogViewEventsTestL(ELogDiffEvents, KDiffEvCount);
|
sl@0
|
453 |
//
|
sl@0
|
454 |
TestUtils::DeleteDatabaseL();
|
sl@0
|
455 |
}
|
sl@0
|
456 |
|
sl@0
|
457 |
#else//SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM
|
sl@0
|
458 |
|
sl@0
|
459 |
void doTestsL()
|
sl@0
|
460 |
{
|
sl@0
|
461 |
TestUtils::Initialize(_L("t_logsimid"));
|
sl@0
|
462 |
TheTest.Start(_L("The t_simid test cases are compiled only when SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM macro is defined!"));
|
sl@0
|
463 |
}
|
sl@0
|
464 |
|
sl@0
|
465 |
#endif//SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM
|