1 /* |
|
2 * ============================================================================ |
|
3 * Name : testrflextimer.cpp |
|
4 * Part of : src / testflextimer |
|
5 * Description : STIF test cases for RFlexTimer |
|
6 * Version : %version: 1 % |
|
7 * |
|
8 * Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
9 * All rights reserved. |
|
10 * This component and the accompanying materials are made available |
|
11 * under the terms of the License "Eclipse Public License v1.0" |
|
12 * which accompanies this distribution, and is available |
|
13 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
14 * |
|
15 * Initial Contributors: |
|
16 * Nokia Corporation - initial contribution. |
|
17 * |
|
18 * Contributors: |
|
19 * Nokia Corporation |
|
20 * ============================================================================ |
|
21 * Template version: 4.1 |
|
22 */ |
|
23 |
|
24 #include <e32debug.h> // for RDebug |
|
25 #include <rflextimer.h> // for RFlexTimer |
|
26 #include <stiftesteventinterface.h> // for TEventIf |
|
27 #include "testflextimer.h" // for global constants |
|
28 #include "testrflextimer.h" |
|
29 |
|
30 |
|
31 // ======== LOCAL FUNCTIONS ======== |
|
32 |
|
33 // ======== MEMBER FUNCTIONS ======== |
|
34 |
|
35 // --------------------------------------------------------------------------- |
|
36 // Constructor |
|
37 // --------------------------------------------------------------------------- |
|
38 // |
|
39 CTestRFlexTimer::CTestRFlexTimer() |
|
40 { |
|
41 } |
|
42 |
|
43 |
|
44 // --------------------------------------------------------------------------- |
|
45 // Destructor |
|
46 // --------------------------------------------------------------------------- |
|
47 // |
|
48 CTestRFlexTimer::~CTestRFlexTimer() |
|
49 { |
|
50 } |
|
51 |
|
52 |
|
53 // --------------------------------------------------------------------------- |
|
54 // ___ ____ _ ____ _ _ ____ _ _ ____ ____ _ _ ____ |
|
55 // | \ |___ | |__| \_/ | |__| |___ | |_/ [__ |
|
56 // |__/ |___ |___ | | | |___ | | |___ |___ | \_ ___] |
|
57 // |
|
58 // --------------------------------------------------------------------------- |
|
59 |
|
60 // --------------------------------------------------------------------------- |
|
61 TBool CTestRFlexTimer::IsDelayOk( |
|
62 const TTimeIntervalMicroSeconds aDelay, |
|
63 const TTimeIntervalMicroSeconds32 aInterval, |
|
64 const TTimeIntervalMicroSeconds32 aWindow ) |
|
65 { |
|
66 TTimeIntervalMicroSeconds interval( aInterval.Int() ); |
|
67 TTimeIntervalMicroSeconds window( aWindow.Int() ); |
|
68 return IsDelayOk( aDelay, interval, window ); |
|
69 } |
|
70 |
|
71 // --------------------------------------------------------------------------- |
|
72 TBool CTestRFlexTimer::IsDelayOk( |
|
73 const TTimeIntervalMicroSeconds aDelay, |
|
74 const TTimeIntervalMicroSeconds32 aInterval, |
|
75 const TTimeIntervalMicroSeconds aWindow ) |
|
76 { |
|
77 TTimeIntervalMicroSeconds interval( aInterval.Int() ); |
|
78 return IsDelayOk( aDelay, interval, aWindow ); |
|
79 } |
|
80 |
|
81 // --------------------------------------------------------------------------- |
|
82 TBool CTestRFlexTimer::IsDelayOk( |
|
83 const TTimeIntervalMicroSeconds aDelay, |
|
84 const TTimeIntervalMicroSeconds aInterval, |
|
85 const TTimeIntervalMicroSeconds32 aWindow ) |
|
86 { |
|
87 TTimeIntervalMicroSeconds window( aWindow.Int() ); |
|
88 return IsDelayOk( aDelay, aInterval, window ); |
|
89 } |
|
90 |
|
91 // --------------------------------------------------------------------------- |
|
92 TBool CTestRFlexTimer::IsDelayOk( |
|
93 const TTimeIntervalMicroSeconds aDelay, |
|
94 const TTimeIntervalMicroSeconds aInterval, |
|
95 const TTimeIntervalMicroSeconds aWindow ) |
|
96 { |
|
97 /** |
|
98 * Timer can be expired 1 sec late or 1 system tick (15625 microseconds) |
|
99 * early. |
|
100 */ |
|
101 const TInt64 KTimerResolution( 1000000 ); |
|
102 const TInt64 KTickResolution( 1000000 / 64 ); |
|
103 |
|
104 RDebug::Print( |
|
105 _L("=== Timer delay: %Ld, interval: %Ld, window: %Ld"), |
|
106 aDelay.Int64(), |
|
107 aInterval.Int64(), |
|
108 aWindow.Int64() ); |
|
109 |
|
110 return !( aDelay.Int64() < aInterval.Int64() - aWindow.Int64() - KTickResolution || |
|
111 aDelay.Int64() > aInterval.Int64() + KTimerResolution ); |
|
112 } |
|
113 |
|
114 // --------------------------------------------------------------------------- |
|
115 // Create, configure, start with AfterTicks and close RFlexTimer |
|
116 // --------------------------------------------------------------------------- |
|
117 // |
|
118 TTimeIntervalMicroSeconds CTestRFlexTimer::ExecuteAfterTicksL( |
|
119 TInt aTicks, |
|
120 TTimeIntervalMicroSeconds aWindowSize ) |
|
121 { |
|
122 // Create, connect and configure the timer handle |
|
123 RFlexTimer timer; |
|
124 User::LeaveIfError( timer.Connect() ); |
|
125 User::LeaveIfError( timer.Configure( aWindowSize ) ); |
|
126 |
|
127 TTime startTime; |
|
128 startTime.UniversalTime(); |
|
129 |
|
130 // Run the timer and wait its expiration |
|
131 TRequestStatus status; |
|
132 timer.AfterTicks( status, aTicks ); |
|
133 User::WaitForRequest( status ); |
|
134 |
|
135 TTime endTime; |
|
136 endTime.UniversalTime(); |
|
137 |
|
138 // Clean up |
|
139 timer.Close(); |
|
140 |
|
141 // Return running time of the timer |
|
142 return endTime.MicroSecondsFrom( startTime ); |
|
143 } |
|
144 |
|
145 // --------------------------------------------------------------------------- |
|
146 // ___ ____ ____ ___ ____ ____ ____ ____ ____ |
|
147 // | |___ [__ | | |__| [__ |___ [__ |
|
148 // | |___ ___] | |___ | | ___] |___ ___] |
|
149 // |
|
150 // --------------------------------------------------------------------------- |
|
151 |
|
152 // --------------------------------------------------------------------------- |
|
153 // TEST CASE: Start a timer using After (32 bit) and wait it to expire. |
|
154 // --------------------------------------------------------------------------- |
|
155 // |
|
156 TInt CTestRFlexTimer::ExpireAfter32L( |
|
157 TTestResult& aResult, |
|
158 CTestFlexTimer* /* aCallback */ ) |
|
159 { |
|
160 __UHEAP_MARK; |
|
161 |
|
162 const TTimeIntervalMicroSeconds32 KInterval( 3000000 ); // Time to wait timer |
|
163 const TTimeIntervalMicroSeconds KWindow( 0 ); // Window for check results |
|
164 |
|
165 // Initialize case |
|
166 aResult.SetResult( KErrGeneral, _L("Test case leaved") ); |
|
167 |
|
168 TTime startTime; |
|
169 startTime.UniversalTime(); |
|
170 TRequestStatus status; |
|
171 |
|
172 // Do the actual test |
|
173 //----------------------------------------------------- |
|
174 |
|
175 RFlexTimer timer; |
|
176 User::LeaveIfError( timer.Connect() ); |
|
177 |
|
178 timer.After( status, KInterval ); |
|
179 |
|
180 // // ___ _____ |
|
181 User::WaitForRequest( status ); // // // //_ // // // |
|
182 //_//_// // // // // |
|
183 |
|
184 timer.Close(); |
|
185 |
|
186 //----------------------------------------------------- |
|
187 |
|
188 // Verify the test |
|
189 TTime endTime; |
|
190 endTime.UniversalTime(); |
|
191 |
|
192 aResult.SetResult( KErrNone, _L("Test case passed") ); |
|
193 if ( !IsDelayOk( endTime.MicroSecondsFrom( startTime ), KInterval, KWindow ) ) |
|
194 { |
|
195 aResult.SetResult( KErrGeneral, _L("Test case failed. Wrong expiration.") ); |
|
196 } |
|
197 |
|
198 __UHEAP_MARKEND; |
|
199 |
|
200 return KErrNone; |
|
201 } |
|
202 |
|
203 // --------------------------------------------------------------------------- |
|
204 // TEST CASE: Start a timer using After (32 bit) and wait it to expire. |
|
205 // --------------------------------------------------------------------------- |
|
206 // |
|
207 TInt CTestRFlexTimer::ExpireAfter64L( |
|
208 TTestResult& aResult, |
|
209 CTestFlexTimer* /* aCallback */ ) |
|
210 { |
|
211 __UHEAP_MARK; |
|
212 |
|
213 const TTimeIntervalMicroSeconds KInterval( 3000000 ); // Time to wait timer |
|
214 const TTimeIntervalMicroSeconds KWindow( 0 ); // Window for check results |
|
215 |
|
216 // Initialize case |
|
217 aResult.SetResult( KErrGeneral, _L("Test case leaved") ); |
|
218 |
|
219 TTime startTime; |
|
220 startTime.UniversalTime(); |
|
221 TRequestStatus status; |
|
222 |
|
223 // Do the actual test |
|
224 //----------------------------------------------------- |
|
225 |
|
226 RFlexTimer timer; |
|
227 User::LeaveIfError( timer.Connect() ); |
|
228 |
|
229 timer.After( status, KInterval ); |
|
230 |
|
231 // // ___ _____ |
|
232 User::WaitForRequest( status ); // // // //_ // // // |
|
233 //_//_// // // // // |
|
234 |
|
235 timer.Close(); |
|
236 |
|
237 //----------------------------------------------------- |
|
238 |
|
239 // Verify the test |
|
240 TTime endTime; |
|
241 endTime.UniversalTime(); |
|
242 |
|
243 aResult.SetResult( KErrNone, _L("Test case passed") ); |
|
244 if ( !IsDelayOk( endTime.MicroSecondsFrom( startTime ), KInterval, KWindow ) ) |
|
245 { |
|
246 aResult.SetResult( KErrGeneral, _L("Test case failed. Wrong expiration.") ); |
|
247 } |
|
248 |
|
249 __UHEAP_MARKEND; |
|
250 |
|
251 return KErrNone; |
|
252 } |
|
253 |
|
254 // --------------------------------------------------------------------------- |
|
255 // TEST CASE: Start a timer using AfterTicks and wait it to expire. |
|
256 // --------------------------------------------------------------------------- |
|
257 // |
|
258 TInt CTestRFlexTimer::ExpireAfterTicksL( |
|
259 TTestResult& aResult, |
|
260 CTestFlexTimer* /* aCallback */ ) |
|
261 { |
|
262 __UHEAP_MARK; |
|
263 |
|
264 const TTimeIntervalMicroSeconds32 KInterval( 3000000 ); // Time to wait timer |
|
265 const TTimeIntervalMicroSeconds KWindow( 0 ); // Window for check results |
|
266 const TTimeIntervalMicroSeconds32 KOneTick( 1000000 / 64 ); // System tick: 1/64 sec |
|
267 |
|
268 // Initialize case |
|
269 aResult.SetResult( KErrGeneral, _L("Test case leaved") ); |
|
270 |
|
271 TTime startTime; |
|
272 startTime.UniversalTime(); |
|
273 TRequestStatus status; |
|
274 |
|
275 // Do the actual test |
|
276 //----------------------------------------------------- |
|
277 |
|
278 RFlexTimer timer; |
|
279 User::LeaveIfError( timer.Connect() ); |
|
280 |
|
281 timer.AfterTicks( status, KInterval.Int() / KOneTick.Int() ); |
|
282 |
|
283 // // ___ _____ |
|
284 User::WaitForRequest( status ); // // // //_ // // // |
|
285 //_//_// // // // // |
|
286 |
|
287 timer.Close(); |
|
288 |
|
289 //----------------------------------------------------- |
|
290 |
|
291 // Verify the test |
|
292 TTime endTime; |
|
293 endTime.UniversalTime(); |
|
294 |
|
295 aResult.SetResult( KErrNone, _L("Test case passed") ); |
|
296 if ( !IsDelayOk( endTime.MicroSecondsFrom( startTime ), KInterval, KWindow ) ) |
|
297 { |
|
298 aResult.SetResult( KErrGeneral, _L("Test case failed. Wrong expiration.") ); |
|
299 } |
|
300 |
|
301 __UHEAP_MARKEND; |
|
302 |
|
303 return KErrNone; |
|
304 } |
|
305 |
|
306 // --------------------------------------------------------------------------- |
|
307 // TEST CASE: Start a timer using At and wait it to expire. |
|
308 // --------------------------------------------------------------------------- |
|
309 // |
|
310 TInt CTestRFlexTimer::ExpireAtL( |
|
311 TTestResult& aResult, |
|
312 CTestFlexTimer* /* aCallback */ ) |
|
313 { |
|
314 __UHEAP_MARK; |
|
315 |
|
316 const TTimeIntervalMicroSeconds KInterval( 3000000 ); // Time to wait timer |
|
317 const TTimeIntervalMicroSeconds KWindow( 0 ); // Window for check results |
|
318 |
|
319 // Initialize case |
|
320 aResult.SetResult( KErrGeneral, _L("Test case leaved") ); |
|
321 |
|
322 TTime startTime; |
|
323 startTime.UniversalTime(); |
|
324 TRequestStatus status; |
|
325 |
|
326 // Do the actual test |
|
327 //----------------------------------------------------- |
|
328 |
|
329 RFlexTimer timer; |
|
330 User::LeaveIfError( timer.Connect() ); |
|
331 |
|
332 TTime now; |
|
333 now.HomeTime(); |
|
334 |
|
335 timer.At( status, now + KInterval ); |
|
336 |
|
337 // // ___ _____ |
|
338 User::WaitForRequest( status ); // // // //_ // // // |
|
339 //_//_// // // // // |
|
340 |
|
341 timer.Close(); |
|
342 |
|
343 //----------------------------------------------------- |
|
344 |
|
345 // Verify the test |
|
346 TTime endTime; |
|
347 endTime.UniversalTime(); |
|
348 |
|
349 aResult.SetResult( KErrNone, _L("Test case passed") ); |
|
350 if ( !IsDelayOk( endTime.MicroSecondsFrom( startTime ), KInterval, KWindow ) ) |
|
351 { |
|
352 aResult.SetResult( KErrGeneral, _L("Test case failed. Wrong expiration.") ); |
|
353 } |
|
354 |
|
355 __UHEAP_MARKEND; |
|
356 |
|
357 return KErrNone; |
|
358 } |
|
359 |
|
360 // --------------------------------------------------------------------------- |
|
361 // TEST CASE: Start a timer using AtUTC and wait it to expire. |
|
362 // --------------------------------------------------------------------------- |
|
363 // |
|
364 TInt CTestRFlexTimer::ExpireAtUtcL( |
|
365 TTestResult& aResult, |
|
366 CTestFlexTimer* /* aCallback */ ) |
|
367 { |
|
368 __UHEAP_MARK; |
|
369 |
|
370 const TTimeIntervalMicroSeconds KInterval( 3000000 ); // Time to wait timer |
|
371 const TTimeIntervalMicroSeconds KWindow( 0 ); // Window for check results |
|
372 |
|
373 // Initialize case |
|
374 aResult.SetResult( KErrGeneral, _L("Test case leaved") ); |
|
375 |
|
376 TTime startTime; |
|
377 startTime.UniversalTime(); |
|
378 TRequestStatus status; |
|
379 |
|
380 // Do the actual test |
|
381 //----------------------------------------------------- |
|
382 |
|
383 RFlexTimer timer; |
|
384 User::LeaveIfError( timer.Connect() ); |
|
385 |
|
386 TTime now; |
|
387 now.UniversalTime(); |
|
388 |
|
389 timer.AtUTC( status, now + KInterval ); |
|
390 |
|
391 // // ___ _____ |
|
392 User::WaitForRequest( status ); // // // //_ // // // |
|
393 //_//_// // // // // |
|
394 |
|
395 timer.Close(); |
|
396 |
|
397 //----------------------------------------------------- |
|
398 |
|
399 // Verify the test |
|
400 TTime endTime; |
|
401 endTime.UniversalTime(); |
|
402 |
|
403 aResult.SetResult( KErrNone, _L("Test case passed") ); |
|
404 if ( !IsDelayOk( endTime.MicroSecondsFrom( startTime ), KInterval, KWindow ) ) |
|
405 { |
|
406 aResult.SetResult( KErrGeneral, _L("Test case failed. Wrong expiration.") ); |
|
407 } |
|
408 |
|
409 __UHEAP_MARKEND; |
|
410 |
|
411 return KErrNone; |
|
412 } |
|
413 |
|
414 // --------------------------------------------------------------------------- |
|
415 // TEST CASE: Start timer with After (32 bit) without connecting first |
|
416 // --------------------------------------------------------------------------- |
|
417 // |
|
418 TInt CTestRFlexTimer::After32WithoutConnect( |
|
419 TTestResult& aResult, |
|
420 CTestFlexTimer* aCallback ) |
|
421 { |
|
422 TRequestStatus status; |
|
423 |
|
424 // Test should panic with |
|
425 // Category: "KERN-EXEC" |
|
426 // Reason: 0 |
|
427 aCallback->TestModuleIf().SetExitReason( |
|
428 CTestModuleIf::EPanic, |
|
429 0 ); |
|
430 |
|
431 // Do the actual test |
|
432 //----------------------------------------------------- |
|
433 |
|
434 RFlexTimer timer; |
|
435 timer.After( status, TTimeIntervalMicroSeconds32( 1000000 ) ); |
|
436 User::WaitForRequest( status ); // PANIC |
|
437 timer.Close(); |
|
438 |
|
439 //----------------------------------------------------- |
|
440 |
|
441 // No panic, change result back to normal |
|
442 aCallback->TestModuleIf().SetExitReason( |
|
443 CTestModuleIf::ENormal, |
|
444 KErrNone ); |
|
445 |
|
446 aResult.SetResult( KErrGeneral, _L("Test case failed. No panic.") ); |
|
447 |
|
448 return KErrNone; |
|
449 } |
|
450 |
|
451 // --------------------------------------------------------------------------- |
|
452 // TEST CASE: Start timer with After (64 bit) without connecting first |
|
453 // --------------------------------------------------------------------------- |
|
454 // |
|
455 TInt CTestRFlexTimer::After64WithoutConnect( |
|
456 TTestResult& aResult, |
|
457 CTestFlexTimer* aCallback ) |
|
458 { |
|
459 TRequestStatus status; |
|
460 |
|
461 // Test should panic with |
|
462 // Category: "KERN-EXEC" |
|
463 // Reason: 0 |
|
464 aCallback->TestModuleIf().SetExitReason( |
|
465 CTestModuleIf::EPanic, |
|
466 0 ); |
|
467 |
|
468 // Do the actual test |
|
469 //----------------------------------------------------- |
|
470 |
|
471 RFlexTimer timer; |
|
472 |
|
473 timer.After( status, TTimeIntervalMicroSeconds( 1000000 ) ); |
|
474 User::WaitForRequest( status ); // PANIC |
|
475 timer.Close(); |
|
476 |
|
477 //----------------------------------------------------- |
|
478 |
|
479 // No panic, change result back to normal |
|
480 aCallback->TestModuleIf().SetExitReason( |
|
481 CTestModuleIf::ENormal, |
|
482 KErrNone ); |
|
483 |
|
484 aResult.SetResult( KErrGeneral, _L("Test case failed. No panic.") ); |
|
485 |
|
486 return KErrNone; |
|
487 } |
|
488 |
|
489 // --------------------------------------------------------------------------- |
|
490 // TEST CASE: Start timer with AfterTicks without connecting first |
|
491 // --------------------------------------------------------------------------- |
|
492 // |
|
493 TInt CTestRFlexTimer::AfterTicksWithoutConnect( |
|
494 TTestResult& aResult, |
|
495 CTestFlexTimer* aCallback ) |
|
496 { |
|
497 TRequestStatus status; |
|
498 |
|
499 // Test should panic with |
|
500 // Category: "KERN-EXEC" |
|
501 // Reason: 0 |
|
502 aCallback->TestModuleIf().SetExitReason( |
|
503 CTestModuleIf::EPanic, |
|
504 0 ); |
|
505 |
|
506 // Do the actual test |
|
507 //----------------------------------------------------- |
|
508 |
|
509 RFlexTimer timer; |
|
510 |
|
511 timer.AfterTicks( status, 1000 ); |
|
512 User::WaitForRequest( status ); // PANIC |
|
513 timer.Close(); |
|
514 |
|
515 //----------------------------------------------------- |
|
516 |
|
517 // No panic, change result back to normal |
|
518 aCallback->TestModuleIf().SetExitReason( |
|
519 CTestModuleIf::ENormal, |
|
520 KErrNone ); |
|
521 |
|
522 aResult.SetResult( KErrGeneral, _L("Test case failed. No panic.") ); |
|
523 |
|
524 return KErrNone; |
|
525 } |
|
526 |
|
527 // --------------------------------------------------------------------------- |
|
528 // TEST CASE: Start timer with At without connecting first |
|
529 // --------------------------------------------------------------------------- |
|
530 // |
|
531 TInt CTestRFlexTimer::AtWithoutConnect( |
|
532 TTestResult& aResult, |
|
533 CTestFlexTimer* aCallback ) |
|
534 { |
|
535 TRequestStatus status; |
|
536 |
|
537 // Test should panic with |
|
538 // Category: "KERN-EXEC" |
|
539 // Reason: 0 |
|
540 aCallback->TestModuleIf().SetExitReason( |
|
541 CTestModuleIf::EPanic, |
|
542 0 ); |
|
543 |
|
544 // Do the actual test |
|
545 //----------------------------------------------------- |
|
546 |
|
547 RFlexTimer timer; |
|
548 |
|
549 TTime expirationTime; |
|
550 expirationTime.HomeTime(); |
|
551 expirationTime += TTimeIntervalMicroSeconds( 1000000 ); |
|
552 |
|
553 timer.At( status, expirationTime ); |
|
554 User::WaitForRequest( status ); // PANIC |
|
555 timer.Close(); |
|
556 |
|
557 //----------------------------------------------------- |
|
558 |
|
559 // No panic, change result back to normal |
|
560 aCallback->TestModuleIf().SetExitReason( |
|
561 CTestModuleIf::ENormal, |
|
562 KErrNone ); |
|
563 |
|
564 aResult.SetResult( KErrGeneral, _L("Test case failed. No panic.") ); |
|
565 |
|
566 return KErrNone; |
|
567 } |
|
568 |
|
569 // --------------------------------------------------------------------------- |
|
570 // TEST CASE: Start timer with At without connecting first |
|
571 // --------------------------------------------------------------------------- |
|
572 // |
|
573 TInt CTestRFlexTimer::AtUtcWithoutConnect( |
|
574 TTestResult& aResult, |
|
575 CTestFlexTimer* aCallback ) |
|
576 { |
|
577 TRequestStatus status; |
|
578 |
|
579 // Test should panic with |
|
580 // Category: "KERN-EXEC" |
|
581 // Reason: 0 |
|
582 aCallback->TestModuleIf().SetExitReason( |
|
583 CTestModuleIf::EPanic, |
|
584 0 ); |
|
585 |
|
586 // Do the actual test |
|
587 //----------------------------------------------------- |
|
588 |
|
589 RFlexTimer timer; |
|
590 |
|
591 TTime expirationTime; |
|
592 expirationTime.UniversalTime(); |
|
593 expirationTime += TTimeIntervalMicroSeconds( 1000000 ); |
|
594 |
|
595 timer.AtUTC( status, expirationTime ); |
|
596 User::WaitForRequest( status ); // PANIC |
|
597 timer.Close(); |
|
598 |
|
599 //----------------------------------------------------- |
|
600 |
|
601 // No panic, change result back to normal |
|
602 aCallback->TestModuleIf().SetExitReason( |
|
603 CTestModuleIf::ENormal, |
|
604 KErrNone ); |
|
605 |
|
606 aResult.SetResult( KErrGeneral, _L("Test case failed. No panic.") ); |
|
607 |
|
608 return KErrNone; |
|
609 } |
|
610 |
|
611 // --------------------------------------------------------------------------- |
|
612 // TEST CASE: Configure (32 bit) timer without connecting first |
|
613 // --------------------------------------------------------------------------- |
|
614 // |
|
615 TInt CTestRFlexTimer::Configure32WithoutConnect( |
|
616 TTestResult& aResult, |
|
617 CTestFlexTimer* aCallback ) |
|
618 { |
|
619 // Test should panic with |
|
620 // Category: "KERN-EXEC" |
|
621 // Reason: 0 |
|
622 aCallback->TestModuleIf().SetExitReason( |
|
623 CTestModuleIf::EPanic, |
|
624 0 ); |
|
625 |
|
626 // Do the actual test |
|
627 //----------------------------------------------------- |
|
628 |
|
629 RFlexTimer timer; |
|
630 |
|
631 timer.Configure( TTimeIntervalMicroSeconds32( 1000000 ) ); // PANIC |
|
632 // Configure is synchronous command. No need to wait. |
|
633 timer.Close(); |
|
634 |
|
635 //----------------------------------------------------- |
|
636 |
|
637 // No panic, change result back to normal |
|
638 aCallback->TestModuleIf().SetExitReason( |
|
639 CTestModuleIf::ENormal, |
|
640 KErrNone ); |
|
641 |
|
642 aResult.SetResult( KErrGeneral, _L("Test case failed. No panic.") ); |
|
643 |
|
644 return KErrNone; |
|
645 } |
|
646 |
|
647 // --------------------------------------------------------------------------- |
|
648 // TEST CASE: Configure (32 bit) timer without connecting first |
|
649 // --------------------------------------------------------------------------- |
|
650 // |
|
651 TInt CTestRFlexTimer::Configure64WithoutConnect( |
|
652 TTestResult& aResult, |
|
653 CTestFlexTimer* aCallback ) |
|
654 { |
|
655 // Test should panic with |
|
656 // Category: "KERN-EXEC" |
|
657 // Reason: 0 |
|
658 aCallback->TestModuleIf().SetExitReason( |
|
659 CTestModuleIf::EPanic, |
|
660 0 ); |
|
661 |
|
662 // Do the actual test |
|
663 //----------------------------------------------------- |
|
664 |
|
665 RFlexTimer timer; |
|
666 |
|
667 timer.Configure( TTimeIntervalMicroSeconds( 1000000 ) ); // PANIC |
|
668 // Configure is synchronous command. No need to wait. |
|
669 timer.Close(); |
|
670 |
|
671 //----------------------------------------------------- |
|
672 |
|
673 // No panic, change result back to normal |
|
674 aCallback->TestModuleIf().SetExitReason( |
|
675 CTestModuleIf::ENormal, |
|
676 KErrNone ); |
|
677 |
|
678 aResult.SetResult( KErrGeneral, _L("Test case failed. No panic.") ); |
|
679 |
|
680 return KErrNone; |
|
681 } |
|
682 |
|
683 // --------------------------------------------------------------------------- |
|
684 // TEST CASE: Cancel timer without connecting first |
|
685 // --------------------------------------------------------------------------- |
|
686 // |
|
687 TInt CTestRFlexTimer::CancelWithoutConnect( |
|
688 TTestResult& aResult, |
|
689 CTestFlexTimer* aCallback ) |
|
690 { |
|
691 |
|
692 // Test should panic with |
|
693 // Category: "KERN-EXEC" |
|
694 // Reason: 0 |
|
695 aCallback->TestModuleIf().SetExitReason( |
|
696 CTestModuleIf::EPanic, |
|
697 0 ); |
|
698 |
|
699 // Do the actual test |
|
700 //----------------------------------------------------- |
|
701 |
|
702 RFlexTimer timer; |
|
703 timer.Cancel(); // PANIC |
|
704 // Cancel is synchronous command. No need to wait. |
|
705 timer.Close(); |
|
706 |
|
707 //----------------------------------------------------- |
|
708 |
|
709 // No panic, change result back to normal |
|
710 aCallback->TestModuleIf().SetExitReason( |
|
711 CTestModuleIf::ENormal, |
|
712 KErrNone ); |
|
713 |
|
714 aResult.SetResult( KErrGeneral, _L("Test case failed. No panic.") ); |
|
715 |
|
716 return KErrNone; |
|
717 } |
|
718 |
|
719 // --------------------------------------------------------------------------- |
|
720 // TEST CASE: Call After twice |
|
721 // --------------------------------------------------------------------------- |
|
722 // |
|
723 TInt CTestRFlexTimer::CallAfterTwiceL( |
|
724 TTestResult& aResult, |
|
725 CTestFlexTimer* aCallback ) |
|
726 { |
|
727 aResult.SetResult( KErrGeneral, _L("Test case leaved") ); |
|
728 |
|
729 // Test should panic with |
|
730 // Category: "RFlexTimer" |
|
731 // Reason: 15 (EFlexTimerServerErrorPendingTimer) |
|
732 aCallback->TestModuleIf().SetExitReason( |
|
733 CTestModuleIf::EPanic, |
|
734 15 ); |
|
735 |
|
736 TRequestStatus status; |
|
737 |
|
738 // Do the actual test |
|
739 //----------------------------------------------------- |
|
740 |
|
741 RFlexTimer timer; |
|
742 User::LeaveIfError( timer.Connect() ); |
|
743 |
|
744 timer.After( status, TTimeIntervalMicroSeconds32( 100000 ) ); |
|
745 timer.After( status, TTimeIntervalMicroSeconds( 100000 ) ); |
|
746 |
|
747 User::WaitForRequest( status ); // PANIC |
|
748 |
|
749 timer.Close(); |
|
750 |
|
751 //----------------------------------------------------- |
|
752 |
|
753 |
|
754 // No panic, change result back to normal |
|
755 aCallback->TestModuleIf().SetExitReason( |
|
756 CTestModuleIf::ENormal, |
|
757 KErrNone ); |
|
758 |
|
759 aResult.SetResult( KErrGeneral, _L("Test case failed. No panic.") ); |
|
760 |
|
761 return KErrNone; |
|
762 } |
|
763 |
|
764 // --------------------------------------------------------------------------- |
|
765 // TEST CASE: Call AfterTicks twice |
|
766 // --------------------------------------------------------------------------- |
|
767 // |
|
768 TInt CTestRFlexTimer::CallAfterTicksTwiceL( |
|
769 TTestResult& aResult, |
|
770 CTestFlexTimer* aCallback ) |
|
771 { |
|
772 aResult.SetResult( KErrGeneral, _L("Test case leaved") ); |
|
773 |
|
774 // Test should panic with |
|
775 // Category: "RFlexTimer" |
|
776 // Reason: 15 (EFlexTimerServerErrorPendingTimer) |
|
777 aCallback->TestModuleIf().SetExitReason( |
|
778 CTestModuleIf::EPanic, |
|
779 15 ); |
|
780 |
|
781 TRequestStatus status; |
|
782 |
|
783 // Do the actual test |
|
784 //----------------------------------------------------- |
|
785 |
|
786 RFlexTimer timer; |
|
787 User::LeaveIfError( timer.Connect() ); |
|
788 |
|
789 timer.AfterTicks( status, 1000 ); |
|
790 timer.AfterTicks( status, 1000 ); |
|
791 |
|
792 User::WaitForRequest( status ); // PANIC |
|
793 |
|
794 timer.Close(); |
|
795 |
|
796 //----------------------------------------------------- |
|
797 |
|
798 // No panic, change result back to normal |
|
799 aCallback->TestModuleIf().SetExitReason( |
|
800 CTestModuleIf::ENormal, |
|
801 KErrNone ); |
|
802 |
|
803 aResult.SetResult( KErrGeneral, _L("Test case failed. No panic.") ); |
|
804 |
|
805 return KErrNone; |
|
806 } |
|
807 |
|
808 // --------------------------------------------------------------------------- |
|
809 // TEST CASE: Call At twice |
|
810 // --------------------------------------------------------------------------- |
|
811 // |
|
812 TInt CTestRFlexTimer::CallAtTwiceL( |
|
813 TTestResult& aResult, |
|
814 CTestFlexTimer* aCallback ) |
|
815 { |
|
816 aResult.SetResult( KErrGeneral, _L("Test case leaved") ); |
|
817 |
|
818 // Test should panic with |
|
819 // Category: "RFlexTimer" |
|
820 // Reason: 15 (EFlexTimerServerErrorPendingTimer) |
|
821 aCallback->TestModuleIf().SetExitReason( |
|
822 CTestModuleIf::EPanic, |
|
823 15 ); |
|
824 |
|
825 TRequestStatus status; |
|
826 |
|
827 // Do the actual test |
|
828 //----------------------------------------------------- |
|
829 |
|
830 RFlexTimer timer; |
|
831 User::LeaveIfError( timer.Connect() ); |
|
832 |
|
833 TTime expirationTime; |
|
834 expirationTime.HomeTime(); |
|
835 expirationTime += TTimeIntervalMicroSeconds( 1000000 ); |
|
836 |
|
837 timer.At( status, expirationTime ); |
|
838 timer.At( status, expirationTime ); |
|
839 |
|
840 User::WaitForRequest( status ); // PANIC |
|
841 |
|
842 timer.Close(); |
|
843 |
|
844 //----------------------------------------------------- |
|
845 |
|
846 |
|
847 // No panic, change result back to normal |
|
848 aCallback->TestModuleIf().SetExitReason( |
|
849 CTestModuleIf::ENormal, |
|
850 KErrNone ); |
|
851 |
|
852 aResult.SetResult( KErrGeneral, _L("Test case failed. No panic.") ); |
|
853 |
|
854 return KErrNone; |
|
855 } |
|
856 |
|
857 // --------------------------------------------------------------------------- |
|
858 // TEST CASE: Call AtUTC twice |
|
859 // --------------------------------------------------------------------------- |
|
860 // |
|
861 TInt CTestRFlexTimer::CallAtUtcTwiceL( |
|
862 TTestResult& aResult, |
|
863 CTestFlexTimer* aCallback ) |
|
864 { |
|
865 aResult.SetResult( KErrGeneral, _L("Test case leaved") ); |
|
866 |
|
867 // Test should panic with |
|
868 // Category: "RFlexTimer" |
|
869 // Reason: 15 (EFlexTimerServerErrorPendingTimer) |
|
870 aCallback->TestModuleIf().SetExitReason( |
|
871 CTestModuleIf::EPanic, |
|
872 15 ); |
|
873 |
|
874 TRequestStatus status; |
|
875 |
|
876 // Do the actual test |
|
877 //----------------------------------------------------- |
|
878 |
|
879 RFlexTimer timer; |
|
880 User::LeaveIfError( timer.Connect() ); |
|
881 |
|
882 TTime expirationTime; |
|
883 expirationTime.UniversalTime(); |
|
884 expirationTime += TTimeIntervalMicroSeconds( 1000000 ); |
|
885 |
|
886 timer.AtUTC( status, expirationTime ); |
|
887 timer.AtUTC( status, expirationTime ); |
|
888 |
|
889 |
|
890 User::WaitForRequest( status ); // PANIC |
|
891 |
|
892 timer.Close(); |
|
893 |
|
894 //----------------------------------------------------- |
|
895 |
|
896 // No panic, change result back to normal |
|
897 aCallback->TestModuleIf().SetExitReason( |
|
898 CTestModuleIf::ENormal, |
|
899 KErrNone ); |
|
900 |
|
901 aResult.SetResult( KErrGeneral, _L("Test case failed. No panic.") ); |
|
902 |
|
903 return KErrNone; |
|
904 } |
|
905 |
|
906 // --------------------------------------------------------------------------- |
|
907 // TEST CASE: Call Connect twice |
|
908 // --------------------------------------------------------------------------- |
|
909 // |
|
910 TInt CTestRFlexTimer::CallConnectTwiceL( |
|
911 TTestResult& aResult, |
|
912 CTestFlexTimer* aCallback ) |
|
913 { |
|
914 aResult.SetResult( KErrGeneral, _L("Test case leaved") ); |
|
915 |
|
916 // Test should panic with |
|
917 // Category: "RFlexTimer" |
|
918 // Reason: 33 (EFlexTimerAlreadyConnected) |
|
919 aCallback->TestModuleIf().SetExitReason( |
|
920 CTestModuleIf::EPanic, |
|
921 33 ); |
|
922 |
|
923 // Do the actual test |
|
924 //----------------------------------------------------- |
|
925 |
|
926 RFlexTimer timer; |
|
927 User::LeaveIfError( timer.Connect() ); |
|
928 User::LeaveIfError( timer.Connect() ); // PANIC |
|
929 |
|
930 timer.Close(); |
|
931 |
|
932 //----------------------------------------------------- |
|
933 |
|
934 // No panic, change result back to normal |
|
935 aCallback->TestModuleIf().SetExitReason( |
|
936 CTestModuleIf::ENormal, |
|
937 KErrNone ); |
|
938 |
|
939 aResult.SetResult( KErrGeneral, _L("Test case failed. No panic.") ); |
|
940 |
|
941 return KErrNone; |
|
942 } |
|
943 |
|
944 // --------------------------------------------------------------------------- |
|
945 // TEST CASE: Reconnect the handle to the server |
|
946 // --------------------------------------------------------------------------- |
|
947 // |
|
948 TInt CTestRFlexTimer::ReconnectL( |
|
949 TTestResult& aResult, |
|
950 CTestFlexTimer* /* aCallback */ ) |
|
951 { |
|
952 aResult.SetResult( KErrGeneral, _L("Test case leaved") ); |
|
953 |
|
954 // Do the actual test |
|
955 //----------------------------------------------------- |
|
956 |
|
957 RFlexTimer timer; |
|
958 User::LeaveIfError( timer.Connect() ); |
|
959 timer.Close(); |
|
960 User::LeaveIfError( timer.Connect() ); |
|
961 timer.Close(); |
|
962 |
|
963 //----------------------------------------------------- |
|
964 |
|
965 aResult.SetResult( KErrNone, _L("Test case passed") ); |
|
966 |
|
967 return KErrNone; |
|
968 } |
|
969 |
|
970 // --------------------------------------------------------------------------- |
|
971 // TEST CASE: Cancel timer without starting it first |
|
972 // --------------------------------------------------------------------------- |
|
973 // |
|
974 TInt CTestRFlexTimer::CancelWithoutStart( |
|
975 TTestResult& aResult, |
|
976 CTestFlexTimer* /* aCallback */ ) |
|
977 { |
|
978 aResult.SetResult( KErrGeneral, _L("Test case leaved") ); |
|
979 |
|
980 // Do the actual test |
|
981 //----------------------------------------------------- |
|
982 |
|
983 RFlexTimer timer; |
|
984 |
|
985 User::LeaveIfError( timer.Connect() ); |
|
986 timer.Cancel(); |
|
987 timer.Close(); |
|
988 |
|
989 //----------------------------------------------------- |
|
990 |
|
991 aResult.SetResult( KErrNone, _L("Test case passed") ); |
|
992 |
|
993 return KErrNone; |
|
994 } |
|
995 |
|
996 // --------------------------------------------------------------------------- |
|
997 // TEST CASE: Start tick timer with negative ticks |
|
998 // --------------------------------------------------------------------------- |
|
999 // |
|
1000 TInt CTestRFlexTimer::NegativeTicksInAfterTicksL( |
|
1001 TTestResult& aResult, |
|
1002 CTestFlexTimer* aCallback ) |
|
1003 { |
|
1004 const TInt KTestValue( -1 ); |
|
1005 |
|
1006 aResult.SetResult( KErrGeneral, _L("Test case leaved") ); |
|
1007 |
|
1008 // Test should panic with |
|
1009 // Category: "RFlexTimer" |
|
1010 // Reason: 2 (EFlexTimerAfterTicksIntervalLessThanZero) |
|
1011 aCallback->TestModuleIf().SetExitReason( |
|
1012 CTestModuleIf::EPanic, |
|
1013 2 ); |
|
1014 |
|
1015 TTimeIntervalMicroSeconds delay = ExecuteAfterTicksL( KTestValue ); |
|
1016 |
|
1017 // No panic, change result back to normal |
|
1018 aCallback->TestModuleIf().SetExitReason( |
|
1019 CTestModuleIf::ENormal, |
|
1020 KErrNone ); |
|
1021 |
|
1022 aResult.SetResult( KErrGeneral, _L("Test case failed. No panic.") ); |
|
1023 |
|
1024 return KErrNone; |
|
1025 } |
|
1026 |
|
1027 // --------------------------------------------------------------------------- |
|
1028 // TEST CASE: Start tick timer with zero ticks |
|
1029 // --------------------------------------------------------------------------- |
|
1030 // |
|
1031 TInt CTestRFlexTimer::ZeroTicksInAfterTicksL( |
|
1032 TTestResult& aResult, |
|
1033 CTestFlexTimer* /* aCallback */ ) |
|
1034 { |
|
1035 const TInt KTestValue( 0 ); |
|
1036 |
|
1037 aResult.SetResult( KErrGeneral, _L("Test case leaved") ); |
|
1038 |
|
1039 TTimeIntervalMicroSeconds delay = ExecuteAfterTicksL( KTestValue ); |
|
1040 |
|
1041 // Analyze the results |
|
1042 aResult.SetResult( KErrNone, _L("Test case passed") ); |
|
1043 if ( !IsDelayOk( delay, |
|
1044 TTimeIntervalMicroSeconds( KTestValue ), |
|
1045 TTimeIntervalMicroSeconds( 0 )) ) |
|
1046 { |
|
1047 aResult.SetResult( |
|
1048 KErrGeneral, |
|
1049 _L("Test case failed. Wrong expiration time.") ); |
|
1050 } |
|
1051 |
|
1052 return KErrNone; |
|
1053 } |
|
1054 |
|
1055 // --------------------------------------------------------------------------- |
|
1056 // TEST CASE: Change system time while tick timer is active |
|
1057 // --------------------------------------------------------------------------- |
|
1058 // |
|
1059 TInt CTestRFlexTimer::ChangeTimeWhileAfterTicksL( |
|
1060 TTestResult& aResult, |
|
1061 CTestFlexTimer* /* aCallback */ ) |
|
1062 { |
|
1063 const TTimeIntervalMicroSeconds32 KTimerInterval( 10000000 ); // Time to wait timer |
|
1064 const TTimeIntervalMicroSeconds KWaitTillChangeTime( 1000000 ); // Time to wait before change system time |
|
1065 const TTimeIntervalMicroSeconds KTimeChange( 3000000 ); // Duration to change system time |
|
1066 |
|
1067 // Interval for check results |
|
1068 const TTimeIntervalMicroSeconds KInterval( KTimerInterval.Int() + KTimeChange.Int64() ); |
|
1069 const TTimeIntervalMicroSeconds KWindow( 0 ); // Window for check results |
|
1070 const TTimeIntervalMicroSeconds32 KOneTick( 1000000 / 64 ); // System tick: 1/64 sec |
|
1071 |
|
1072 // Initialize case |
|
1073 aResult.SetResult( KErrGeneral, _L("Test case leaved") ); |
|
1074 |
|
1075 TTime startTime; |
|
1076 startTime.UniversalTime(); |
|
1077 TRequestStatus status, helperStatus; |
|
1078 |
|
1079 // Do the actual test |
|
1080 //----------------------------------------------------- |
|
1081 |
|
1082 RFlexTimer timer; |
|
1083 User::LeaveIfError( timer.Connect() ); |
|
1084 |
|
1085 timer.AfterTicks( status, KTimerInterval.Int() / KOneTick.Int() ); |
|
1086 |
|
1087 //----------------------------------------------------- |
|
1088 // ... meanwhile change system time |
|
1089 |
|
1090 RFlexTimer helper; |
|
1091 |
|
1092 User::LeaveIfError( helper.Connect() ); |
|
1093 helper.After( helperStatus, KWaitTillChangeTime ); |
|
1094 |
|
1095 // // ___ _____ |
|
1096 User::WaitForRequest( helperStatus ); // // // //_ // // // |
|
1097 //_//_// // // // // |
|
1098 |
|
1099 TTime newNow; |
|
1100 newNow.UniversalTime(); |
|
1101 newNow += KTimeChange; |
|
1102 |
|
1103 User::SetUTCTime( newNow ); |
|
1104 |
|
1105 helper.Close(); |
|
1106 |
|
1107 // The test continues... |
|
1108 //----------------------------------------------------- |
|
1109 |
|
1110 // // ___ _____ |
|
1111 User::WaitForRequest( status ); // // // //_ // // // |
|
1112 //_//_// // // // // |
|
1113 |
|
1114 timer.Close(); |
|
1115 |
|
1116 //----------------------------------------------------- |
|
1117 |
|
1118 // Verify the test |
|
1119 TTime endTime; |
|
1120 endTime.UniversalTime(); |
|
1121 |
|
1122 aResult.SetResult( KErrNone, _L("Test case passed") ); |
|
1123 if ( !IsDelayOk( endTime.MicroSecondsFrom( startTime ), KInterval, KWindow ) ) |
|
1124 { |
|
1125 //RDebug::Print( _L("Timer delay: %lld"), |
|
1126 // endTime.MicroSecondsFrom( startTime ).Int64() ); |
|
1127 aResult.SetResult( KErrGeneral, _L("Test case failed. Wrong expiration.") ); |
|
1128 } |
|
1129 |
|
1130 __UHEAP_MARKEND; |
|
1131 |
|
1132 return KErrNone; |
|
1133 } |
|
1134 |
|
1135 // --------------------------------------------------------------------------- |
|
1136 // TEST CASE: Timer window works correctly |
|
1137 // --------------------------------------------------------------------------- |
|
1138 // |
|
1139 TInt CTestRFlexTimer::TestAfterTicksWindowL( |
|
1140 TTestResult& aResult, |
|
1141 CTestFlexTimer* /* aCallback */ ) |
|
1142 { |
|
1143 |
|
1144 // T1: expiration after 4-8 sec |
|
1145 const TTimeIntervalMicroSeconds32 KTimerOneInterval( 8000000 ); |
|
1146 const TTimeIntervalMicroSeconds32 KTimerOneWindow( 4000000 ); |
|
1147 |
|
1148 // T2: expiration after 9-10 sec |
|
1149 // T2's interval must not overlap with T1's -- otherwise T1 will be |
|
1150 // delayed |
|
1151 const TTimeIntervalMicroSeconds32 KTimerTwoInterval( 10000000 ); |
|
1152 const TTimeIntervalMicroSeconds32 KTimerTwoWindow( 1000000 ); |
|
1153 |
|
1154 // T3: expiration after 5 secs |
|
1155 const TTimeIntervalMicroSeconds KAfterTimerInterval( 5000000 ); |
|
1156 const TTimeIntervalMicroSeconds KAfterTimerWindow( 0 ); |
|
1157 |
|
1158 // System tick: 1/64 sec |
|
1159 const TTimeIntervalMicroSeconds32 KOneTick( 1000000 / 64 ); |
|
1160 const TTimeIntervalMicroSeconds KNoWindow( 0 ); |
|
1161 |
|
1162 |
|
1163 |
|
1164 // Initialize case |
|
1165 aResult.SetResult( KErrGeneral, _L("Test case leaved") ); |
|
1166 |
|
1167 TTime startTime; |
|
1168 startTime.UniversalTime(); |
|
1169 TRequestStatus oneStatus, twoStatus, afterStatus; |
|
1170 |
|
1171 // Do the actual test |
|
1172 //----------------------------------------------------- |
|
1173 |
|
1174 RFlexTimer timerOne; |
|
1175 User::LeaveIfError( timerOne.Connect() ); |
|
1176 timerOne.Configure( KTimerOneWindow ); |
|
1177 timerOne.AfterTicks( oneStatus, KTimerOneInterval.Int() / KOneTick.Int() ); |
|
1178 |
|
1179 RFlexTimer timerTwo; |
|
1180 User::LeaveIfError( timerTwo.Connect() ); |
|
1181 timerTwo.Configure( KTimerTwoWindow ); |
|
1182 timerTwo.AfterTicks( twoStatus, KTimerTwoInterval.Int() / KOneTick.Int() ); |
|
1183 |
|
1184 RFlexTimer afterTimer; |
|
1185 User::LeaveIfError( afterTimer.Connect() ); |
|
1186 afterTimer.Configure( KAfterTimerWindow ); |
|
1187 afterTimer.After( afterStatus, KAfterTimerInterval ); |
|
1188 |
|
1189 // // ___ _____ |
|
1190 User::WaitForRequest( oneStatus ); // // // //_ // // // |
|
1191 //_//_// // // // // |
|
1192 |
|
1193 TTime oneEndTime; |
|
1194 oneEndTime.UniversalTime(); |
|
1195 // // ___ _____ |
|
1196 User::WaitForRequest( twoStatus ); // // // //_ // // // |
|
1197 //_//_// // // // // |
|
1198 |
|
1199 TTime twoEndTime; |
|
1200 twoEndTime.UniversalTime(); |
|
1201 |
|
1202 timerOne.Close(); |
|
1203 timerTwo.Close(); |
|
1204 afterTimer.Close(); |
|
1205 |
|
1206 //----------------------------------------------------- |
|
1207 |
|
1208 // Handle afterStatus too - to get rid of unhandled asynchronous message |
|
1209 // error from STIF. |
|
1210 User::WaitForRequest( afterStatus ); |
|
1211 |
|
1212 aResult.SetResult( KErrNone, _L("Test case passed") ); |
|
1213 |
|
1214 // T1 should be expired at the same time than T3 - check with T3's values |
|
1215 if ( !IsDelayOk( oneEndTime.MicroSecondsFrom( startTime ), KAfterTimerInterval, KNoWindow ) ) |
|
1216 { |
|
1217 aResult.SetResult( KErrGeneral, _L("Test case failed. Timer one wrong expiration.") ); |
|
1218 } |
|
1219 // T2 should be expired at it's max window |
|
1220 else if ( !IsDelayOk( twoEndTime.MicroSecondsFrom( startTime ), KTimerTwoInterval, KNoWindow ) ) |
|
1221 { |
|
1222 aResult.SetResult( KErrGeneral, _L("Test case failed. Timer two wrong expiration.") ); |
|
1223 } |
|
1224 |
|
1225 __UHEAP_MARKEND; |
|
1226 |
|
1227 return KErrNone; |
|
1228 } |
|