|
1 // Copyright (c) 2005-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 "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include "TEAlarmTestAlarmPlayConfig.h" |
|
17 #include <asclisession.h> |
|
18 #include "consoleantestclient.h" |
|
19 |
|
20 CTEAlarmTestAlarmPlayConfigStep::~CTEAlarmTestAlarmPlayConfigStep() |
|
21 { |
|
22 iSoundIntervals->Reset(); |
|
23 delete iSoundIntervals; |
|
24 } |
|
25 |
|
26 CTEAlarmTestAlarmPlayConfigStep::CTEAlarmTestAlarmPlayConfigStep() |
|
27 { |
|
28 SetTestStepName(KTEAlarmTestAlarmPlayConfigStep); |
|
29 } |
|
30 |
|
31 |
|
32 TVerdict CTEAlarmTestAlarmPlayConfigStep::doTestStepL() |
|
33 { |
|
34 TESTL(GetAndCheckAlarmPlayIntervalsL()); |
|
35 |
|
36 __UHEAP_MARK; |
|
37 // Get Alarm(s) from Config |
|
38 CArrayFixFlat<TASShdAlarm>* alarmArray = new(ELeave) CArrayFixFlat<TASShdAlarm>(1); |
|
39 CleanupStack::PushL(alarmArray); |
|
40 |
|
41 TESTL(GetAlarmsFromConfigL(ConfigSection(), *alarmArray)); |
|
42 |
|
43 TInt alarmCount = alarmArray->Count(); |
|
44 |
|
45 for(TInt i = 0; i < alarmCount; i++) |
|
46 { |
|
47 // Add the Alarm |
|
48 TESTL((iSession.AlarmAdd(alarmArray->At(i))==KErrNone)); |
|
49 INFO_PRINTF5(_L("Alarm[%d] Added: Id=%d, State=%d, Status=%d"), i, alarmArray->At(i).Id(), alarmArray->At(i).State(), alarmArray->At(i).Status()); |
|
50 } |
|
51 |
|
52 if( alarmArray->Count() > 0 ) |
|
53 { |
|
54 TESTL(StartIntervalVerifierL(alarmArray->At(0).Id())); |
|
55 } |
|
56 else |
|
57 { |
|
58 INFO_PRINTF1(_L("AlarmPlayConfig: No Alarms specified; skipping Alarm Play Interval Tests")); |
|
59 } |
|
60 CleanupStack::PopAndDestroy(alarmArray); |
|
61 __UHEAP_MARKEND; |
|
62 return TestStepResult(); |
|
63 } |
|
64 |
|
65 |
|
66 TBool CTEAlarmTestAlarmPlayConfigStep::GetAndCheckAlarmPlayIntervalsL() |
|
67 { |
|
68 // Get Alarm Play Interval from Config, and Verify that it matches what the client has. |
|
69 iSoundIntervals = new(ELeave) CArrayFixFlat<TASCliSoundPlayDefinition>(5); |
|
70 |
|
71 // Get Interval info from Config |
|
72 TESTL(GetIntervalsFromConfigL(ConfigSection(),*iSoundIntervals)); |
|
73 |
|
74 // Verify that Interval info matches GetAlarmPlayIntervalsL(). |
|
75 CArrayFixFlat<TASCliSoundPlayDefinition>* intervalArrayFromClient = new(ELeave) CArrayFixFlat<TASCliSoundPlayDefinition>(5); |
|
76 CleanupStack::PushL(intervalArrayFromClient); |
|
77 iSession.GetAlarmPlayIntervalsL(*intervalArrayFromClient); |
|
78 INFO_PRINTF2(_L("AlarmPlayConfig: NumIntervals from Client=%d"), intervalArrayFromClient->Count()); |
|
79 |
|
80 TESTL(CompareAlarmPlayIntervals(*iSoundIntervals, *intervalArrayFromClient)); |
|
81 |
|
82 CleanupStack::PopAndDestroy(intervalArrayFromClient); |
|
83 return ETrue; |
|
84 } |
|
85 |
|
86 |
|
87 TBool CTEAlarmTestAlarmPlayConfigStep::StartIntervalVerifierL(TAlarmId aAlarmId) |
|
88 { |
|
89 TESTL(GetIntervalRepeatFromConfig(ConfigSection(), iRepeatSetting)); |
|
90 TESTL(GetTimerContingencyFromConfig(ConfigSection(), iTimerContingency)); |
|
91 |
|
92 // Instantiate the various objects we need: |
|
93 CActiveScheduler* scheduler = new(ELeave) CActiveScheduler(); |
|
94 CleanupStack::PushL(scheduler); |
|
95 CActiveScheduler::Install(scheduler); |
|
96 |
|
97 CActiveAlertListener* alarmListener = new(ELeave) CActiveAlertListener(*this, iCAASClient); |
|
98 CleanupStack::PushL(alarmListener); |
|
99 CActiveAlertListener* soundStartListener = new(ELeave) CActiveAlertListener(*this, iCAASClient); |
|
100 CleanupStack::PushL(soundStartListener); |
|
101 CActiveAlertListener* soundStopListener = new(ELeave) CActiveAlertListener(*this, iCAASClient); |
|
102 CleanupStack::PushL(soundStopListener); |
|
103 CInactivityTimer* inactivityTimer = CInactivityTimer::NewLC(*this); |
|
104 |
|
105 INFO_PRINTF3(_L("IntervalVerifier::Verify %d Intervals, with AlarmId %d"), (iSoundIntervals->Count()), (aAlarmId)); |
|
106 |
|
107 TInt timeout; |
|
108 if ( iRepeatSetting == EAlarmSoundRepeatSettingStop && |
|
109 GetIntFromConfig(ConfigSection(), _L("Timeout"), timeout) ) |
|
110 { |
|
111 INFO_PRINTF2(_L("IntervalVerifier::InactivyTimer set for %d seconds."), (timeout)); |
|
112 inactivityTimer->After(timeout* 1000000); |
|
113 } |
|
114 |
|
115 if (iCAASClient.SetExtendedMode() != KErrNone) |
|
116 { |
|
117 INFO_PRINTF1(_L("IntervalVerifier::iCAASClient.SetExtendedMode() failed")); |
|
118 return EFalse; |
|
119 } |
|
120 |
|
121 // Setup the control variables |
|
122 iExpectedAlarmId = aAlarmId; |
|
123 iExpectedEventType = MAlarmEventHandler::EAlarmExpired; |
|
124 iExpectedInterval = 0; |
|
125 |
|
126 // Start the Active Listeners. |
|
127 INFO_PRINTF1(_L("IntervalVerifier::Start Listeners")); |
|
128 alarmListener->Start(MAlarmEventHandler::EAlarmExpired); |
|
129 soundStartListener->Start(MAlarmEventHandler::ESoundStarted); |
|
130 soundStopListener->Start(MAlarmEventHandler::ESoundStopped); |
|
131 |
|
132 // Start the Active Scheduler. The HandleAlarmEvent is responsible for stopping it. |
|
133 INFO_PRINTF1(_L("IntervalVerifier::Start Scheduler")); |
|
134 CActiveScheduler::Start(); |
|
135 |
|
136 INFO_PRINTF1(_L("IntervalVerifier::Scheduler Completed")); |
|
137 |
|
138 // Cleanup after yourself. |
|
139 CleanupStack::PopAndDestroy(inactivityTimer); |
|
140 CleanupStack::PopAndDestroy(soundStopListener); |
|
141 CleanupStack::PopAndDestroy(soundStartListener); |
|
142 CleanupStack::PopAndDestroy(alarmListener); |
|
143 |
|
144 CActiveScheduler::Install(NULL); |
|
145 CleanupStack::PopAndDestroy(scheduler); |
|
146 |
|
147 if (TestStepResult()==EPass) |
|
148 { |
|
149 return ETrue; |
|
150 } |
|
151 else |
|
152 { |
|
153 INFO_PRINTF1(_L("IntervalVerifier::TestStepResult() != EPass")); |
|
154 return EFalse; |
|
155 } |
|
156 } |
|
157 |
|
158 void CTEAlarmTestAlarmPlayConfigStep::HandleAlertEvent(MAlarmEventHandler::TAlertEvent aEventType, TAlarmId aAlarmId) |
|
159 { |
|
160 INFO_PRINTF4(_L("IntervalVerifier::AlertEvent Type=%d, AlarmId=%d, Interval=%d"), aEventType, aAlarmId, iExpectedInterval); |
|
161 |
|
162 if (aAlarmId != iExpectedAlarmId) |
|
163 { |
|
164 return; |
|
165 } |
|
166 |
|
167 if (aEventType != iExpectedEventType) |
|
168 { |
|
169 INFO_PRINTF3(_L("IntervalVerifier::AlertEvent Type Mismatch (%d != %d)"), aEventType, iExpectedEventType); |
|
170 SetTestStepResult(EFail); |
|
171 StopIntervalVerifier(); |
|
172 } |
|
173 else if (TimeDiff(aAlarmId, aEventType) > iTimerContingency) // seconds |
|
174 { |
|
175 INFO_PRINTF2(_L("IntervalVerifier::EventTime exceeds contingency (%d seconds) "), iTimerContingency.Int()); |
|
176 SetTestStepResult(EFail); |
|
177 StopIntervalVerifier(); |
|
178 } |
|
179 else |
|
180 { |
|
181 switch(aEventType) |
|
182 { |
|
183 case(MAlarmEventHandler::EAlarmExpired): |
|
184 iExpectedEventType = ESoundStarted; |
|
185 break; |
|
186 case(MAlarmEventHandler::ESoundStarted): |
|
187 iExpectedEventType = ESoundStopped; |
|
188 break; |
|
189 case(MAlarmEventHandler::ESoundStopped): |
|
190 iExpectedEventType = ESoundStarted; |
|
191 // To complete the test, we want to make sure that we get an |
|
192 // "extra" interval. |
|
193 if (++iExpectedInterval > iSoundIntervals->Count()) |
|
194 { |
|
195 StopIntervalVerifier(); |
|
196 } |
|
197 break; |
|
198 } |
|
199 } |
|
200 } |
|
201 |
|
202 TTimeIntervalSeconds CTEAlarmTestAlarmPlayConfigStep::TimeDiff(TAlarmId aAlarmId, MAlarmEventHandler::TAlertEvent aEventType) |
|
203 { |
|
204 // Get the current time: |
|
205 TTime timeNow; |
|
206 timeNow.UniversalTime(); |
|
207 |
|
208 // Determine original expiry time for alarm |
|
209 TASShdAlarm alarm; |
|
210 if (iSession.GetAlarmDetails(aAlarmId, alarm) != KErrNone) |
|
211 // We didn't find the currently expired alarm. This should never happen. |
|
212 { |
|
213 INFO_PRINTF2(_L("IntervalVerifier::TimeDiff failed to find alarm with Id=%d"), aAlarmId); |
|
214 return iTimerContingency.Int() + 1; // Forces the test to fail. |
|
215 } |
|
216 |
|
217 TTime expectedTime; |
|
218 expectedTime = alarm.OriginalExpiryTime(); |
|
219 TInt err = GetExpectedEventTime(expectedTime, aEventType); |
|
220 if(err != KErrNone) |
|
221 { |
|
222 INFO_PRINTF2(_L("IntervalVerifier::TimeDiff->GetExpectedEventTime() returned %d"), err); |
|
223 return iTimerContingency.Int() + 1; // Forces the test to fail. |
|
224 } |
|
225 |
|
226 TDateTime expTimeDT = expectedTime.DateTime(); |
|
227 TDateTime timeNowDT = timeNow.DateTime(); |
|
228 // Displayed date => DD/MM/YYYY HH:MM:SS |
|
229 INFO_PRINTF7(_L("IntervalVerifier::TimeDiff - Expected Time=%02d:%02d:%02d, Event Time=%02d:%02d:%02d"), |
|
230 expTimeDT.Hour(), expTimeDT.Minute(), expTimeDT.Second(), |
|
231 timeNowDT.Hour(), timeNowDT.Minute(), timeNowDT.Second()); |
|
232 |
|
233 TTimeIntervalSeconds diff; |
|
234 (timeNow > expectedTime)? |
|
235 timeNow.SecondsFrom(expectedTime, diff): |
|
236 expectedTime.SecondsFrom(timeNow, diff); |
|
237 return diff; |
|
238 } |
|
239 |
|
240 TInt CTEAlarmTestAlarmPlayConfigStep::GetExpectedEventTime(TTime& aExpectedTime, MAlarmEventHandler::TAlertEvent aEventType) |
|
241 { |
|
242 if ( iSoundIntervals->Count() == 0 ) |
|
243 { |
|
244 // We only expect one event: EAlarmExpired, so don't change aExpectedTime: |
|
245 return KErrNone; |
|
246 } |
|
247 |
|
248 if ( iExpectedInterval < iSoundIntervals->Count() ) |
|
249 { |
|
250 // Get original expiry time |
|
251 if (aEventType != EAlarmExpired) |
|
252 { |
|
253 aExpectedTime += TTimeIntervalMinutes(iSoundIntervals->At(iExpectedInterval).Offset().Int()); |
|
254 if (aEventType != ESoundStarted) |
|
255 { |
|
256 // Only event left is ESoundStopped. |
|
257 aExpectedTime += TTimeIntervalSeconds(iSoundIntervals->At(iExpectedInterval).Duration().Int()); |
|
258 } |
|
259 } |
|
260 } |
|
261 else |
|
262 { |
|
263 // we've exceeded the intervals; our test depends on the repeat setting |
|
264 switch (iRepeatSetting) |
|
265 { |
|
266 case(EAlarmSoundRepeatSettingLoop): |
|
267 { |
|
268 TASCliSoundPlayDefinition lastInterval = iSoundIntervals->At(iSoundIntervals->Count()-1); |
|
269 |
|
270 // How many times have we been around? |
|
271 TInt loopCount = (iExpectedInterval) / (iSoundIntervals->Count()); |
|
272 // Restart time is offset by (last Offset + last Duration) * loopCount. |
|
273 aExpectedTime += TTimeIntervalMinutes(lastInterval.Offset().Int() * loopCount); |
|
274 aExpectedTime += TTimeIntervalSeconds(lastInterval.Duration().Int() * loopCount); |
|
275 |
|
276 TInt adjustedInterval = (iExpectedInterval) % (iSoundIntervals->Count()); |
|
277 // We can safely assume that the aEventType is *not* EAlarmExpired |
|
278 aExpectedTime += TTimeIntervalMinutes(iSoundIntervals->At(adjustedInterval).Offset().Int()); |
|
279 if (aEventType == ESoundStopped) |
|
280 { |
|
281 aExpectedTime += TTimeIntervalSeconds(iSoundIntervals->At(adjustedInterval).Duration().Int()); |
|
282 } |
|
283 } |
|
284 break; |
|
285 case(EAlarmSoundRepeatSettingRepeatLast): |
|
286 { |
|
287 TASCliSoundPlayDefinition secondToLastInterval = iSoundIntervals->At(iSoundIntervals->Count()-2); |
|
288 TASCliSoundPlayDefinition lastInterval = iSoundIntervals->At(iSoundIntervals->Count()-1); |
|
289 |
|
290 TTimeIntervalMinutes lastOffsetDuration = lastInterval.Offset().Int() - secondToLastInterval.Offset().Int(); |
|
291 |
|
292 |
|
293 // Determine the time that the last interval's sound stopped: |
|
294 TInt repeatCount = 1 + iExpectedInterval - (iSoundIntervals->Count()); |
|
295 |
|
296 aExpectedTime += TTimeIntervalMinutes(lastOffsetDuration.Int() * repeatCount ); |
|
297 |
|
298 // We can safely assume that the aEventType is *not* EAlarmExpired |
|
299 aExpectedTime += TTimeIntervalMinutes(lastInterval.Offset().Int()); |
|
300 if (aEventType == ESoundStopped) |
|
301 { |
|
302 aExpectedTime += TTimeIntervalSeconds(lastInterval.Duration().Int()); |
|
303 } |
|
304 } |
|
305 break; |
|
306 case(EAlarmSoundRepeatSettingStop): |
|
307 INFO_PRINTF3(_L("IntervalVerifier::Interval Index(%d) >= Interval Count(%d). RepeatSetting=Stop"), |
|
308 iExpectedInterval, iSoundIntervals->Count()); |
|
309 return KErrGeneral; |
|
310 default: |
|
311 INFO_PRINTF3(_L("IntervalVerifier::Unexpected RepeatSetting(%d) with Interval Index(%d)"), |
|
312 iRepeatSetting, iExpectedInterval); |
|
313 return KErrCorrupt; |
|
314 } |
|
315 } |
|
316 return KErrNone; |
|
317 } |
|
318 |
|
319 void CTEAlarmTestAlarmPlayConfigStep::InactivityTimerExpired() |
|
320 { |
|
321 INFO_PRINTF1(_L("IntervalVerifier::InactivityTimerExpired.")); |
|
322 TEST(iRepeatSetting == EAlarmSoundRepeatSettingStop); |
|
323 TEST(iExpectedInterval <= iSoundIntervals->Count() ); |
|
324 StopIntervalVerifier(); |
|
325 } |
|
326 |
|
327 void CTEAlarmTestAlarmPlayConfigStep::StopIntervalVerifier() |
|
328 { |
|
329 INFO_PRINTF1(_L("IntervalVerifier::Stop Scheduler")); |
|
330 CActiveScheduler::Stop(); |
|
331 } |
|
332 |
|
333 /* |
|
334 * Initializes the Active Object and adds itself to the Scheduler. |
|
335 */ |
|
336 CActiveAlertListener::CActiveAlertListener(MAlarmEventHandler& aHandler, RANTestClient& aClient) : CActive(EPriorityStandard), iHandler(aHandler), iClient(aClient) |
|
337 { |
|
338 CActiveScheduler::Add(this); |
|
339 } |
|
340 |
|
341 /* |
|
342 * Cleanups after the Active Object. |
|
343 */ |
|
344 CActiveAlertListener::~CActiveAlertListener() |
|
345 { |
|
346 Deque(); |
|
347 } |
|
348 |
|
349 /* |
|
350 * Starts the Active Objects by regitering for a asynchronous notification |
|
351 * Called by the test step. |
|
352 */ |
|
353 TBool CActiveAlertListener::Start(MAlarmEventHandler::TAlertEvent aEventTypeToWaitFor) |
|
354 { |
|
355 if (IsActive()) |
|
356 { |
|
357 return EFalse; |
|
358 } |
|
359 |
|
360 switch(aEventTypeToWaitFor) |
|
361 { |
|
362 case(MAlarmEventHandler::EAlarmExpired): |
|
363 case(MAlarmEventHandler::ESoundStarted): |
|
364 case(MAlarmEventHandler::ESoundStopped): |
|
365 iEventType = aEventTypeToWaitFor; |
|
366 break; |
|
367 default: |
|
368 return EFalse; |
|
369 } |
|
370 RegisterForNextEvent(); |
|
371 return ETrue; |
|
372 } |
|
373 |
|
374 void CActiveAlertListener::DoCancel() |
|
375 { |
|
376 iClient.CancelNotifications(); |
|
377 } |
|
378 |
|
379 /* |
|
380 * We've receive an event, be sure to pass it along to the test step for proper handling... |
|
381 */ |
|
382 void CActiveAlertListener::RunL() |
|
383 { |
|
384 if (iStatus == KErrNone) |
|
385 { |
|
386 if (iEventType == MAlarmEventHandler::EAlarmExpired) |
|
387 { |
|
388 iAlarmId = iExpiredAlarm.Id(); |
|
389 } |
|
390 RegisterForNextEvent(); |
|
391 } |
|
392 iHandler.HandleAlertEvent(iEventType, iAlarmId); |
|
393 } |
|
394 |
|
395 /* |
|
396 * Register For the next event. |
|
397 */ |
|
398 void CActiveAlertListener::RegisterForNextEvent() |
|
399 { |
|
400 switch(iEventType) |
|
401 { |
|
402 case(MAlarmEventHandler::EAlarmExpired): |
|
403 iClient.NotifyOnAlarm(iExpiredAlarm, iStatus); |
|
404 break; |
|
405 case(MAlarmEventHandler::ESoundStarted): |
|
406 iClient.NotifyOnSoundStart(iAlarmId, iFileName, iStatus); |
|
407 break; |
|
408 case(MAlarmEventHandler::ESoundStopped): |
|
409 iClient.NotifyOnSoundStop(iAlarmId, iStatus); |
|
410 break; |
|
411 default: |
|
412 // We should have never gotten to here: |
|
413 User::Invariant(); |
|
414 } |
|
415 SetActive(); |
|
416 } |
|
417 |
|
418 /* |
|
419 * This object is used for verifying the RepeatSetting=Stop behavior. |
|
420 */ |
|
421 CInactivityTimer* CInactivityTimer::NewLC(MAlarmEventHandler& aHandler) |
|
422 { |
|
423 CInactivityTimer* timer = new(ELeave) CInactivityTimer(aHandler); |
|
424 CleanupStack::PushL(timer); |
|
425 timer->ConstructL(); |
|
426 return timer; |
|
427 } |
|
428 |
|
429 /* |
|
430 * Let's the test step know that the timer expired. |
|
431 */ |
|
432 void CInactivityTimer::RunL() |
|
433 { |
|
434 iHandler.InactivityTimerExpired(); |
|
435 } |
|
436 |
|
437 /* |
|
438 * Initializes the object |
|
439 */ |
|
440 CInactivityTimer::CInactivityTimer(MAlarmEventHandler& aHandler) : CTimer(EPriorityStandard), iHandler(aHandler) |
|
441 { |
|
442 CActiveScheduler::Add(this); |
|
443 } |
|
444 |
|
445 CTEAlarmTestAPCSetIntervalsStep::~CTEAlarmTestAPCSetIntervalsStep() |
|
446 { |
|
447 } |
|
448 |
|
449 CTEAlarmTestAPCSetIntervalsStep::CTEAlarmTestAPCSetIntervalsStep() |
|
450 { |
|
451 SetTestStepName(KTEAlarmTestAPCSetIntervalsStep); |
|
452 } |
|
453 |
|
454 TVerdict CTEAlarmTestAPCSetIntervalsStep::doTestStepL() |
|
455 { |
|
456 // Check result from preamble and setup test step result. |
|
457 if(TestStepResult() != EPass) |
|
458 { |
|
459 return TestStepResult(); |
|
460 } |
|
461 |
|
462 __UHEAP_MARK; |
|
463 // Get Alarm Play Interval from Config, and Verify that it matches what the client has. |
|
464 CArrayFixFlat<TASCliSoundPlayDefinition>* intervalsFromConfig = new(ELeave) CArrayFixFlat<TASCliSoundPlayDefinition>(5); |
|
465 CleanupStack::PushL(intervalsFromConfig); |
|
466 |
|
467 // Get Interval info from Config |
|
468 TESTL(GetIntervalsFromConfigL(ConfigSection(),*intervalsFromConfig)); |
|
469 |
|
470 INFO_PRINTF2(_L("Loaded Intervals From Config - Count=%d"), intervalsFromConfig->Count()); |
|
471 |
|
472 // Verify that Interval info matches GetAlarmPlayIntervalsL(). |
|
473 CArrayFixFlat<TASCliSoundPlayDefinition>* origIntervalsFromClient = new(ELeave) CArrayFixFlat<TASCliSoundPlayDefinition>(5); |
|
474 CleanupStack::PushL(origIntervalsFromClient); |
|
475 |
|
476 iSession.GetAlarmPlayIntervalsL(*origIntervalsFromClient); |
|
477 INFO_PRINTF2(_L("Loaded Intervals From Client - Count=%d"), origIntervalsFromClient->Count()); |
|
478 |
|
479 INFO_PRINTF1(_L("Make sure there are differences between the current and new intervals:")); |
|
480 TESTL(!CompareAlarmPlayIntervals(*intervalsFromConfig, *origIntervalsFromClient)); |
|
481 |
|
482 INFO_PRINTF2(_L("Setting AlarmPlayIntervals, Count = %d"), intervalsFromConfig->Count()); |
|
483 |
|
484 if( 0 == intervalsFromConfig->Count() ) |
|
485 { |
|
486 TRAPD(err, iSession.SetAlarmPlayIntervalsL(*intervalsFromConfig)); |
|
487 TESTL(err == KErrArgument || err == KErrGeneral); |
|
488 } |
|
489 else if ( 0 == origIntervalsFromClient->Count() ) |
|
490 { |
|
491 TRAPD(err, iSession.SetAlarmPlayIntervalsL(*intervalsFromConfig)); |
|
492 TESTL(err == KErrNotSupported ); |
|
493 } |
|
494 else |
|
495 { |
|
496 iSession.SetAlarmPlayIntervalsL(*intervalsFromConfig); |
|
497 } |
|
498 |
|
499 CArrayFixFlat<TASCliSoundPlayDefinition>* updatedIntervalsFromClient = new(ELeave) CArrayFixFlat<TASCliSoundPlayDefinition>(5); |
|
500 CleanupStack::PushL(updatedIntervalsFromClient); |
|
501 |
|
502 iSession.GetAlarmPlayIntervalsL(*updatedIntervalsFromClient); |
|
503 INFO_PRINTF2(_L("Loaded Intervals From Client - Count=%d"), updatedIntervalsFromClient->Count()); |
|
504 |
|
505 if (origIntervalsFromClient->Count() == 0) |
|
506 { |
|
507 INFO_PRINTF1(_L("SoundIntervals are disabled in Client - Setting should have failed")); |
|
508 TESTL(CompareAlarmPlayIntervals(*origIntervalsFromClient, *updatedIntervalsFromClient)); |
|
509 } |
|
510 else if (intervalsFromConfig->Count() == 0) |
|
511 { |
|
512 INFO_PRINTF1(_L("SoundIntervals are enabled in Client - Disabling should have failed")); |
|
513 TESTL(CompareAlarmPlayIntervals(*origIntervalsFromClient, *updatedIntervalsFromClient)); |
|
514 } |
|
515 else |
|
516 { |
|
517 TESTL(CompareAlarmPlayIntervals(*intervalsFromConfig, *updatedIntervalsFromClient)); |
|
518 } |
|
519 |
|
520 CleanupStack::PopAndDestroy(updatedIntervalsFromClient); |
|
521 CleanupStack::PopAndDestroy(origIntervalsFromClient); |
|
522 CleanupStack::PopAndDestroy(intervalsFromConfig); |
|
523 __UHEAP_MARKEND; |
|
524 return TestStepResult(); |
|
525 } |
|
526 |