Update contrib.
1 // Copyright (c) 2007-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
22 #include "dvbhhaitest.h"
23 #include "dvbhhaitestutil.h"
24 #include <mobiletv/hai/dvbh/dvbhtypes.h>
28 * DVB-H HAI Unit Tests on stub implementations
31 RDvbhHaiTest* RDvbhHaiTest::NewL(TBool aRequireReceiverInfo, const TDesC& aTestName)
33 RDvbhHaiTest* self = new (ELeave) RDvbhHaiTest(aRequireReceiverInfo, aTestName);
37 RDvbhHaiTest::RDvbhHaiTest(TBool aRequireReceiverInfo, const TDesC& aTestName)
38 : RTestStep(), iDvbhTestDriverVersion(1, 2, 3), iDvbhTestTime(TDateTime(2007, EJuly, 30, 16, 35, 22, 18)),
39 iDvbhTestPerformanceData(), iDvbhTestScanConfiguration(), iDvbhTestPlatform(), iDvbhTestHardwareInfo(),
40 iDvbhTestNetwork(), iDvbhTestNetworkTime(), iDvbhTestScanResult(), iRequireReceiverInfo(aRequireReceiverInfo),
41 iRxInfo(NULL), iTestUtils(NULL), iReceiverType(EDvbhReceiverBluetooth)
43 iTestStepName.Copy(aTestName);
47 void RDvbhHaiTest::SetupParameterData()
49 // The members initialised here should be treated as constants
51 iDvbhTestPerformanceData.iFilterCount = 1;
52 iDvbhTestPerformanceData.iMaxFilters = 2;
53 iDvbhTestPerformanceData.iDataCount = 3;
54 iDvbhTestPerformanceData.iWriteCount = 4;
55 iDvbhTestPerformanceData.iWriteCommandCount = 5;
56 iDvbhTestPerformanceData.iReadCount = 6;
57 iDvbhTestPerformanceData.iReadCommandCount = 7;
59 iDvbhTestScanConfiguration.iScanStartFrequency = 100;
60 iDvbhTestScanConfiguration.iScanEndFrequency = 200;
61 iDvbhTestScanConfiguration.iSignalBandwidth = 10;
62 iDvbhTestScanConfiguration.iScanOptions = EDvbhScanOptionFullScan;
64 iDvbhTestPlatform.iPlatform.iId = KInitialPlatformId;
65 iDvbhTestPlatform.iPlatform.iName = KInitialPlatformName;
66 iDvbhTestPlatform.iEsgRoot = KDvbhTestIpV6Addr;
68 iDvbhTestHardwareInfo = KDvbhTestHardwareInfo;
70 iDvbhTestNetworkTime.iNetworkTime = iDvbhTestTime;
71 iDvbhTestNetworkTime.iTerminalTimeStamp = KDvbhTestTerminalTimeStamp;
72 iDvbhTestNetworkTime.iPlatformId = KInitialPlatformId;
75 void RDvbhHaiTest::InfoPrintf3(const TDesC16& aString, TInt aInt1, TInt aInt2)
77 INFO_PRINTF3(aString, aInt1, aInt2);
80 void RDvbhHaiTest::InfoPrintf4(const TDesC16& aString, TInt aInt1, TInt aInt2, TInt aInt3)
82 INFO_PRINTF4(aString, aInt1, aInt2, aInt3);
85 TVerdict RDvbhHaiTest::DoTestStepPreambleL()
87 TRAPD(result, iTestUtils = CDvbhTestUtil::NewL(*this));
88 if (result != KErrNone)
90 INFO_PRINTF2(_L("Error %d creating CDvbhTestUtil"), result);
94 if (iRequireReceiverInfo)
96 TRAP(result, iRxInfo = CDvbhReceiverInfo::NewL())
97 if (result != KErrNone)
99 INFO_PRINTF2(_L("Error %d creating CDvbhReceiverInfo"), result);
100 return EInconclusive;
104 if (iTestStepName.Compare(_L("MM-TV-DVBH-U-101")) == 0)
106 result = iTestUtils->DefineAllDvbhProperties();
108 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-103")) == 0)
110 result = iTestUtils->DefineDvbhStateProperty(EDvbhStateInactive);
112 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-104")) == 0)
114 // Receiver state must be EDvbhStateReceiving before we can do this test.
115 result = iTestUtils->DefineDvbhStateProperty(EDvbhStateReceiving);
116 if (result == KErrNone)
118 result = iTestUtils->DefineDvbhIntegerProperty(EDvbhPropertyKeySignalQuality, KInitialSignalQuality);
121 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-105")) == 0)
123 // Receiver state must be EDvbhStateReady or EDvbhStateReceiving before we can do this test.
124 result = iTestUtils->DefineDvbhStateProperty(EDvbhStateReady);
125 if (result == KErrNone)
127 TPckg<TDvbhPlatformProperty> initialPlatformPckg(iDvbhTestPlatform);
128 result = iTestUtils->DefineDvbhProperty(EDvbhPropertyKeyPlatform, CDvbhTestUtil::GetType(EDvbhPropertyKeyPlatform), initialPlatformPckg);
131 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-106")) == 0)
133 // Receiver state must be EDvbhStateReady or EDvbhStateReceiving before we can do this test.
134 result = iTestUtils->DefineDvbhStateProperty(EDvbhStateReady);
135 if (result == KErrNone)
137 TPckg<TDvbhNetworkTime> initialTimePckg(iDvbhTestNetworkTime);
138 result = iTestUtils->DefineDvbhProperty(EDvbhPropertyKeyNetworkTime, CDvbhTestUtil::GetType(EDvbhPropertyKeyNetworkTime), initialTimePckg);
141 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-107")) == 0)
143 // Receiver state must be EDvbhStateReady or EDvbhStateReceiving before we can do this test.
144 result = iTestUtils->DefineDvbhStateProperty(EDvbhStateReady);
145 if (result == KErrNone)
147 TPckg<TDvbhPerformanceData> initialDataPckg(iDvbhTestPerformanceData);
148 result = iTestUtils->DefineDvbhProperty(EDvbhPropertyKeyPerformanceData, CDvbhTestUtil::GetType(EDvbhPropertyKeyPerformanceData), initialDataPckg);
151 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-108")) == 0)
153 // Receiver state must be EDvbhStateReady or EDvbhStateReceiving before we can do this test.
154 result = iTestUtils->DefineDvbhStateProperty(EDvbhStateReady);
155 if (result == KErrNone)
157 result = iTestUtils->DefineDvbhIntegerProperty(EDvbhPropertyKeyFrequency, KInitialFrequency);
160 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-109")) == 0)
162 // Receiver state must be EDvbhStateReady or EDvbhStateReceiving before we can do this test.
163 result = iTestUtils->DefineDvbhStateProperty(EDvbhStateReady);
164 if (result == KErrNone)
166 result = iTestUtils->DefineDvbhIntegerProperty(EDvbhPropertyKeyCellId, KInitialCellId);
169 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-110")) == 0)
171 // Receiver state must be EDvbhStateReady or EDvbhStateReceiving before we can do this test.
172 result = iTestUtils->DefineDvbhStateProperty(EDvbhStateReady);
173 if (result == KErrNone)
175 result = iTestUtils->DefineDvbhIntegerProperty(EDvbhPropertyKeyNetworkId, KInitialNetworkId);
178 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-309")) == 0)
180 // Receiver state must be EDvbhStateReceiving before we can do this test.
181 result = iTestUtils->DefineDvbhStateProperty(EDvbhStateReceiving);
184 return (result == KErrNone ? EPass : EInconclusive);
187 TVerdict RDvbhHaiTest::DoTestStepPostambleL()
192 TInt result = KErrNone;
193 if (iTestStepName.Compare(_L("MM-TV-DVBH-U-101")) == 0)
195 result = iTestUtils->DeleteAllDvbhProperties();
197 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-103")) == 0)
199 result = iTestUtils->DeleteDvbhProperty(EDvbhPropertyKeyState);
201 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-104")) == 0)
203 result = iTestUtils->DeleteDvbhProperty(EDvbhPropertyKeyState);
204 TInt result2 = iTestUtils->DeleteDvbhProperty(EDvbhPropertyKeySignalQuality);
205 result = result2 != KErrNone ? result2 : result;
207 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-105")) == 0)
209 result = iTestUtils->DeleteDvbhProperty(EDvbhPropertyKeyState);
210 TInt result2 = iTestUtils->DeleteDvbhProperty(EDvbhPropertyKeyPlatform);
211 result = result2 != KErrNone ? result2 : result;
213 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-106")) == 0)
215 result = iTestUtils->DeleteDvbhProperty(EDvbhPropertyKeyState);
216 TInt result2 = iTestUtils->DeleteDvbhProperty(EDvbhPropertyKeyNetworkTime);
217 result = result2 != KErrNone ? result2 : result;
219 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-107")) == 0)
221 result = iTestUtils->DeleteDvbhProperty(EDvbhPropertyKeyState);
222 TInt result2 = iTestUtils->DeleteDvbhProperty(EDvbhPropertyKeyPerformanceData);
223 result = result2 != KErrNone ? result2 : result;
225 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-108")) == 0)
227 result = iTestUtils->DeleteDvbhProperty(EDvbhPropertyKeyState);
228 TInt result2 = iTestUtils->DeleteDvbhProperty(EDvbhPropertyKeyFrequency);
229 result = result2 != KErrNone ? result2 : result;
231 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-109")) == 0)
233 result = iTestUtils->DeleteDvbhProperty(EDvbhPropertyKeyState );
234 TInt result2 = iTestUtils->DeleteDvbhProperty(EDvbhPropertyKeyCellId);
235 result = result2 != KErrNone ? result2 : result;
237 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-110")) == 0)
239 result = iTestUtils->DeleteDvbhProperty(EDvbhPropertyKeyState );
240 TInt result2 = iTestUtils->DeleteDvbhProperty(EDvbhPropertyKeyNetworkId);
241 result = result2 != KErrNone ? result2 : result;
243 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-309")) == 0)
245 result = iTestUtils->DeleteDvbhProperty(EDvbhPropertyKeyState );
250 return (result == KErrNone ? EPass : EInconclusive);
253 TVerdict RDvbhHaiTest::DoTestStepL()
255 if(iTestStepName.Compare(_L("MM-TV-DVBH-U-001")) == 0)
257 return DoCreateReceiverOnStackTestStep();
259 else if(iTestStepName.Compare(_L("MM-TV-DVBH-U-002")) == 0)
261 return DoCreateReceiverOnHeapTestStep();
263 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-003")) == 0)
265 return DoGetDriverVersionBeforeOpenTestStep();
267 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-004")) == 0)
269 return DoReceiverOpenTestStep();
271 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-005")) == 0)
273 return DoMultipleReceiverOpenTestStep();
275 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-006")) == 0)
277 return DoGetDriverVersionAfterOpenTestStep();
279 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-007")) == 0)
281 return DoPowerOnAfterOpenTestStep();
283 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-008")) == 0)
285 return DoSetScanConfigurationAfterOpenTestStep();
287 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-009")) == 0)
289 return DoGetScanConfigurationAfterOpenTestStep();
291 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-010")) == 0)
293 return DoGetDvbhVersionAfterOpenTestStep();
295 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-011")) == 0)
297 return DoGetHardwareInfoAfterOpenTestStep();
299 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-012")) == 0)
301 return DoScanAfterOpenTestStep();
303 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-013")) == 0)
305 return DoSetPlatformAfterOpenTestStep();
307 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-014")) == 0)
309 return DoCreateFilterAfterOpenTestStep();
311 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-015")) == 0)
313 return DoCancelFilterAfterOpenTestStep();
315 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-016")) == 0)
317 return DoReceiveIpDataAfterOpenTestStep();
319 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-017")) == 0)
321 return DoUpdateNetworkTimeAfterOpenTestStep();
323 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-018")) == 0)
325 return DoCustomAsyncAfterOpenTestStep();
327 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-019")) == 0)
329 return DoCancelCustomAsyncAfterOpenTestStep();
331 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-020")) == 0)
333 return DoCustomAfterOpenTestStep();
335 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-022")) == 0)
337 return DoPowerOffAfterOpenTestStep();
339 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-023")) == 0)
341 return DoSetDisabledAfterOpenTestStep();
343 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-024")) == 0)
345 return DoCancelScanAfterOpenTestStep();
347 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-025")) == 0)
349 return DoCancelSetPlatformAfterOpenTestStep();
351 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-026")) == 0)
353 return DoCancelReceiveIpDataAfterOpenTestStep();
355 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-027")) == 0)
357 return DoCancelUpdateNetworkTimeAfterOpenTestStep();
359 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-101")) == 0)
361 return DoCreateReceiverInfoTestStep();
363 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-102")) == 0)
365 return DoCreateReceiverInfoTestStep();
367 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-103")) == 0)
369 return DoGetStateTestStep();
371 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-104")) == 0)
373 return DoGetSignalQualityTestStep();
375 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-105")) == 0)
377 return DoGetPlatformTestStep();
379 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-106")) == 0)
381 return DoGetNetworkTimeTestStep();
383 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-107")) == 0)
385 return DoGetPerformanceDataTestStep();
387 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-108")) == 0)
389 return DoGetFrequencyTestStep();
391 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-109")) == 0)
393 return DoGetCellIdTestStep();
395 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-110")) == 0)
397 return DoGetNetworkIdTestStep();
399 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-202")) == 0)
401 return DoPowerOnBeforeOpenTestStep();
403 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-203")) == 0)
405 return DoSetScanConfigurationBeforeOpenTestStep();
407 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-204")) == 0)
409 return DoGetScanConfigurationBeforeOpenTestStep();
411 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-205")) == 0)
413 return DoGetDvbhVersionBeforeOpenTestStep();
415 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-206")) == 0)
417 return DoGetHardwareInfoBeforeOpenTestStep();
419 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-207")) == 0)
421 return DoScanBeforeOpenTestStep();
423 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-208")) == 0)
425 return DoSetPlatformBeforeOpenTestStep();
427 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-209")) == 0)
429 return DoCreateFilterBeforeOpenTestStep();
431 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-210")) == 0)
433 return DoCancelFilterBeforeOpenTestStep();
435 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-211")) == 0)
437 return DoReceiveIpDataBeforeOpenTestStep();
439 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-212")) == 0)
441 return DoUpdateNetworkTimeBeforeOpenTestStep();
443 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-213")) == 0)
445 return DoCustomAsyncBeforeOpenTestStep();
447 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-214")) == 0)
449 return DoCancelCustomAsyncBeforeOpenTestStep();
451 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-215")) == 0)
453 return DoCustomBeforeOpenTestStep();
455 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-216")) == 0)
457 return DoCloseBeforeOpenTestStep();
459 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-217")) == 0)
461 return DoPowerOffBeforeOpenTestStep();
463 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-218")) == 0)
465 return DoSetDisabledBeforeOpenTestStep();
467 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-219")) == 0)
469 return DoCancelScanBeforeOpenTestStep();
471 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-220")) == 0)
473 return DoCancelSetPlatformBeforeOpenTestStep();
475 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-221")) == 0)
477 return DoCancelReceiveIpDataBeforeOpenTestStep();
479 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-222")) == 0)
481 return DoCancelUpdateNetworkTimeBeforeOpenTestStep();
483 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-301")) == 0)
485 return DoGetStateNoPropertiesTestStep();
487 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-302")) == 0)
489 return DoGetSignalQualityNoPropertiesTestStep();
491 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-303")) == 0)
493 return DoGetPlatformNoPropertiesTestStep();
495 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-304")) == 0)
497 return DoGetNetworkTimeNoPropertiesTestStep();
499 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-305")) == 0)
501 return DoGetPerformanceDataNoPropertiesTestStep();
503 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-306")) == 0)
505 return DoGetFrequencyNoPropertiesTestStep();
507 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-307")) == 0)
509 return DoGetCellIdNoPropertiesTestStep();
511 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-308")) == 0)
513 return DoGetNetworkIdNoPropertiesTestStep();
515 else if (iTestStepName.Compare(_L("MM-TV-DVBH-U-309")) == 0)
517 return DoGetTestsNoProperties();
520 return EInconclusive;
523 TVerdict RDvbhHaiTest::DoCreateReceiverOnStackTestStep()
527 //Create RDvbhReceiver on stack
528 RDvbhReceiver receiver;
530 //RDvbhReceiver out-of-scope, verify no heap leaks
535 TVerdict RDvbhHaiTest::DoCreateReceiverOnHeapTestStep()
538 TVerdict verdict = EPass;
540 RDvbhReceiver* receiver = new RDvbhReceiver;
541 if (receiver == NULL)
543 verdict = EInconclusive;
556 TVerdict RDvbhHaiTest::DoGetDriverVersion(RDvbhReceiver& aReceiver)
558 TVerdict verdict = EPass;
559 TVersion version = iDvbhTestDriverVersion;
561 TInt result = aReceiver.GetDriverVersion(version);
562 if (result != KErrNotSupported)
564 INFO_PRINTF2(_L("RDvbhReceiver::GetDriverVersion returned %d"), result);
567 else if (!CDvbhTestUtil::CompareVersions(version, iDvbhTestDriverVersion))
569 INFO_PRINTF1(_L("RDvbhReceiver::GetDriverVersion modified its arguments."));
575 TVerdict RDvbhHaiTest::DoGetDriverVersionBeforeOpenTestStep()
578 TVerdict verdict = EPass;
580 RDvbhReceiver receiver;
581 verdict = DoGetDriverVersion(receiver);
582 } //end of receiver's scope
588 * @param aMultiples the number of times to call open on a single RDvbhReceiver instance. Must be greater than 0.
590 * Creates a RDvbhReceiver instance, calls Open aMultiples of times on it, then Closes it.
592 TVerdict RDvbhHaiTest::DoReceiverOpenAndClose(TUint aMultiples)
594 TVerdict verdict = EPass;
595 RDvbhReceiver receiver;
599 verdict = EInconclusive;
603 for (TUint i=0;i < aMultiples;++i)
605 TVerdict openVerdict = OpenReceiver(receiver);
606 verdict = (openVerdict == EPass) ? verdict : openVerdict;
614 * Helper used to open a receiver before testing other methods.
615 * @return EInconclusive if the Open call did not behave as expected so it shouldn't be used to test the Open() method itself.
617 TVerdict RDvbhHaiTest::OpenReceiver(RDvbhReceiver& aReceiver)
619 TVerdict verdict = EPass;
620 TInt result = aReceiver.Open(iReceiverType);
621 if (result != KErrNotSupported)
623 INFO_PRINTF2(_L("RDvbhReceiver::Open returned %d"), result);
624 verdict = EInconclusive;
629 TVerdict RDvbhHaiTest::DoReceiverOpenTestStep()
632 TVerdict verdict = DoReceiverOpenAndClose();
638 TVerdict RDvbhHaiTest::DoMultipleReceiverOpenTestStep()
641 TVerdict verdict = DoReceiverOpenAndClose(3);
646 TVerdict RDvbhHaiTest::DoGetDriverVersionAfterOpenTestStep()
649 TVerdict verdict = EPass;
651 RDvbhReceiver receiver;
652 if ((verdict = OpenReceiver(receiver)) == EPass)
654 verdict = DoGetDriverVersion(receiver);
657 } //end of receiver's scope
663 TVerdict RDvbhHaiTest::DoPowerOnAfterOpenTestStep()
666 TVerdict verdict = EPass;
668 RDvbhReceiver receiver;
669 if ((verdict = OpenReceiver(receiver)) == EPass)
671 TRequestStatus status;
672 TInt result = receiver.PowerOn(status);
673 if (result != KErrNotSupported)
675 INFO_PRINTF2(_L("RDvbhReceiver::PowerOn returned %d"), result);
680 } //end of receiver's scope
685 TVerdict RDvbhHaiTest::DoSetScanConfigurationAfterOpenTestStep()
688 TVerdict verdict = EPass;
690 RDvbhReceiver receiver;
691 if ((verdict = OpenReceiver(receiver)) == EPass)
693 TInt result = receiver.SetScanConfiguration(iDvbhTestScanConfiguration);
694 if (result != KErrNotSupported)
696 INFO_PRINTF2(_L("RDvbhReceiver::SetScanConfiguration returned %d"), result);
701 } //end of receiver's scope
706 TVerdict RDvbhHaiTest::DoGetScanConfigurationAfterOpenTestStep()
709 TVerdict verdict = EPass;
711 RDvbhReceiver receiver;
712 if ((verdict = OpenReceiver(receiver)) == EPass)
714 TDvbhScanConfiguration scanConfig;
715 scanConfig.iScanStartFrequency = iDvbhTestScanConfiguration.iScanStartFrequency;
716 scanConfig.iScanEndFrequency = iDvbhTestScanConfiguration.iScanEndFrequency;
717 scanConfig.iSignalBandwidth = iDvbhTestScanConfiguration.iSignalBandwidth;
718 scanConfig.iScanOptions = iDvbhTestScanConfiguration.iScanOptions;
720 TInt result = receiver.GetScanConfiguration(scanConfig);
721 if (result != KErrNotSupported)
723 INFO_PRINTF2(_L("RDvbhReceiver::GetScanConfiguration returned %d"), result);
728 if (!CDvbhTestUtil::CompareScanConfigurations(scanConfig, iDvbhTestScanConfiguration))
730 INFO_PRINTF1(_L("RDvbhReceiver::GetScanConfiguration modified its arguments."));
736 } //end of receiver's scope
741 TVerdict RDvbhHaiTest::DoGetDvbhVersionAfterOpenTestStep()
744 TVerdict verdict = EPass;
746 RDvbhReceiver receiver;
747 if ((verdict = OpenReceiver(receiver)) == EPass)
749 TVersion version = iDvbhTestDriverVersion;
750 TInt result = receiver.GetDvbhVersion(version);
751 if (result != KErrNotSupported)
753 INFO_PRINTF2(_L("RDvbhReceiver::GetDvbhVersion returned %d"), result);
758 if (!CDvbhTestUtil::CompareVersions(version, iDvbhTestDriverVersion))
760 INFO_PRINTF1(_L("RDvbhReceiver::GetDvbhVersion modified its arguments."));
766 } //end of receiver's scope
771 TVerdict RDvbhHaiTest::DoGetHardwareInfoAfterOpenTestStep()
774 TVerdict verdict = EPass;
776 RDvbhReceiver receiver;
777 if ((verdict = OpenReceiver(receiver)) == EPass)
779 TDvbhHardwareInfo info = iDvbhTestHardwareInfo;
780 TInt result = receiver.GetHardwareInfo(info);
781 if (result != KErrNotSupported)
783 INFO_PRINTF2(_L("RDvbhReceiver::GetHardwareInfo returned %d"), result);
788 if (info.Compare(iDvbhTestHardwareInfo) != 0) // Compare returns 0 if they are the same
790 INFO_PRINTF1(_L("RDvbhReceiver::GetHardwareInfo modified its arguments."));
796 } //end of receiver's scope
801 TVerdict RDvbhHaiTest::DoScanAfterOpenTestStep()
804 TVerdict verdict = EPass;
806 RDvbhReceiver receiver;
807 if ((verdict = OpenReceiver(receiver)) == EPass)
809 TRequestStatus status;
810 TInt result = receiver.Scan(*this, status);
811 if (result != KErrNotSupported)
813 INFO_PRINTF2(_L("RDvbhReceiver::Scan returned %d"), result);
818 } //end of receiver's scope
823 TVerdict RDvbhHaiTest::DoSetPlatformAfterOpenTestStep()
826 TVerdict verdict = EPass;
828 RDvbhReceiver receiver;
829 if ((verdict = OpenReceiver(receiver)) == EPass)
831 TRequestStatus status;
832 TInt result = receiver.SetPlatform(iDvbhTestNetwork, iDvbhTestPlatform.iPlatform, status);
833 if (result != KErrNotSupported)
835 INFO_PRINTF2(_L("RDvbhReceiver::SetPlatform returned %d"), result);
840 } //end of receiver's scope
845 TVerdict RDvbhHaiTest::DoCreateFilterAfterOpenTestStep()
848 TVerdict verdict = EPass;
850 RDvbhReceiver receiver;
851 if ((verdict = OpenReceiver(receiver)) == EPass)
853 TInt filterId = KDvbhTestFilterId;
854 TRequestStatus status;
855 TInt result = receiver.CreateFilter(KDvbhTestIpV6Addr, filterId, status);
856 if (result != KErrNotSupported)
858 INFO_PRINTF2(_L("RDvbhReceiver::CreateFilter returned %d"), result);
863 if (filterId != KDvbhTestFilterId)
865 INFO_PRINTF1(_L("RDvbhReceiver::CreateFilter modified its arguments."));
871 } //end of receiver's scope
876 TVerdict RDvbhHaiTest::DoCancelFilterAfterOpenTestStep()
879 TVerdict verdict = EPass;
881 RDvbhReceiver receiver;
882 if ((verdict = OpenReceiver(receiver)) == EPass)
884 TInt filterId = KDvbhTestFilterId;
885 TInt result = receiver.CancelFilter(filterId);
886 if (result != KErrNotSupported)
888 INFO_PRINTF2(_L("RDvbhReceiver::CancelFilter returned %d"), result);
893 } //end of receiver's scope
898 TVerdict RDvbhHaiTest::DoReceiveIpDataAfterOpenTestStep()
901 TVerdict verdict = EPass;
903 RDvbhReceiver receiver;
904 if ((verdict = OpenReceiver(receiver)) == EPass)
906 TInt result = receiver.ReceiveIPData(*this);
907 if (result != KErrNotSupported)
909 INFO_PRINTF2(_L("RDvbhReceiver::ReceiveIPData returned %d"), result);
914 } //end of receiver's scope
919 TVerdict RDvbhHaiTest::DoUpdateNetworkTimeAfterOpenTestStep()
922 TVerdict verdict = EPass;
924 RDvbhReceiver receiver;
925 if ((verdict = OpenReceiver(receiver)) == EPass)
927 TRequestStatus status;
928 TInt result = receiver.UpdateNetworkTime(status);
929 if (result != KErrNotSupported)
931 INFO_PRINTF2(_L("RDvbhReceiver::UpdateNetworkTime returned %d"), result);
936 } //end of receiver's scope
941 TVerdict RDvbhHaiTest::DoCustomAsyncAfterOpenTestStep()
944 TVerdict verdict = EPass;
946 RDvbhReceiver receiver;
948 if ((verdict = OpenReceiver(receiver)) == EPass)
951 output = KDvbhTestCustomCommandOutput;
952 TRequestStatus status;
953 TInt result = receiver.CustomCommand(KDvbhTestCustomCommand, KDvbhTestCustomCommandInput, output, status);
954 if (result != KErrNotSupported)
956 INFO_PRINTF2(_L("RDvbhReceiver::CustomCommand returned %d"), result);
961 if (output.Compare(KDvbhTestCustomCommandOutput) != 0) // Compare returns 0 if they are the same
963 INFO_PRINTF1(_L("RDvbhReceiver::CustomCommand modified its arguments."));
969 } //end of receiver's scope
974 TVerdict RDvbhHaiTest::DoCancelCustomAsyncAfterOpenTestStep()
977 TVerdict verdict = EPass;
979 RDvbhReceiver receiver;
980 if ((verdict = OpenReceiver(receiver)) == EPass)
982 TRequestStatus status;
983 receiver.CancelCustomCommand(status);
986 } //end of receiver's scope
991 TVerdict RDvbhHaiTest::DoCustomAfterOpenTestStep()
994 TVerdict verdict = EPass;
996 RDvbhReceiver receiver;
997 if ((verdict = OpenReceiver(receiver)) == EPass)
999 TInt result = receiver.CustomCommand(KDvbhTestCustomCommand, KDvbhTestCustomCommandInput);
1000 if (result != KErrNotSupported)
1002 INFO_PRINTF2(_L("RDvbhReceiver::CustomCommand returned %d"), result);
1007 } //end of receiver's scope
1012 TVerdict RDvbhHaiTest::DoPowerOffAfterOpenTestStep()
1015 TVerdict verdict = EPass;
1017 RDvbhReceiver receiver;
1018 if ((verdict = OpenReceiver(receiver)) == EPass)
1020 TRequestStatus status;
1021 receiver.PowerOff(status);
1022 //User::WaitForRequest(status);
1025 } //end of receiver's scope
1030 TVerdict RDvbhHaiTest::DoSetDisabledAfterOpenTestStep()
1033 TVerdict verdict = EPass;
1035 RDvbhReceiver receiver;
1036 if ((verdict = OpenReceiver(receiver)) == EPass)
1038 TRequestStatus status;
1039 receiver.SetDisabled(ETrue, status);
1040 //User::WaitForRequest(status);
1043 } //end of receiver's scope
1048 TVerdict RDvbhHaiTest::DoCancelScanAfterOpenTestStep()
1051 TVerdict verdict = EPass;
1053 RDvbhReceiver receiver;
1054 if ((verdict = OpenReceiver(receiver)) == EPass)
1056 receiver.CancelScan();
1059 } //end of receiver's scope
1064 TVerdict RDvbhHaiTest::DoCancelSetPlatformAfterOpenTestStep()
1067 TVerdict verdict = EPass;
1069 RDvbhReceiver receiver;
1070 if ((verdict = OpenReceiver(receiver)) == EPass)
1072 receiver.CancelSetPlatform();
1075 } //end of receiver's scope
1080 TVerdict RDvbhHaiTest::DoCancelReceiveIpDataAfterOpenTestStep()
1083 TVerdict verdict = EPass;
1085 RDvbhReceiver receiver;
1086 if ((verdict = OpenReceiver(receiver)) == EPass)
1088 receiver.CancelReceiveIPData();
1091 } //end of receiver's scope
1096 TVerdict RDvbhHaiTest::DoCancelUpdateNetworkTimeAfterOpenTestStep()
1099 TVerdict verdict = EPass;
1101 RDvbhReceiver receiver;
1102 if ((verdict = OpenReceiver(receiver)) == EPass)
1104 receiver.CancelUpdateNetworkTime();
1107 } //end of receiver's scope
1114 // CDvbhReceiverInfo Positive Tests
1119 TVerdict RDvbhHaiTest::DoCreateReceiverInfoTestStep()
1121 TVerdict verdict = EPass;
1125 TRAPD(result, iRxInfo = CDvbhReceiverInfo::NewL())
1126 if (result != KErrNone)
1128 INFO_PRINTF2(_L("Error %d creating CDvbhReceiverInfo"), result);
1138 TVerdict RDvbhHaiTest::DoGetStateTestStep()
1140 TVerdict verdict = EPass;
1142 //First set the state to a known value (expectedState) so that we know
1143 //what we are trying to Get.
1144 const TInt expectedState = EDvbhStateInactive;
1145 if (iTestUtils->SetStateProperty(expectedState) != KErrNone)
1147 verdict = EInconclusive;
1151 TDvbhState state = EDvbhStateNoHardware;
1152 TInt result = iRxInfo->GetState(state);
1153 if (result != KErrNone)
1155 INFO_PRINTF2(_L("Error %d getting state"), result);
1160 if (state != expectedState)
1162 INFO_PRINTF2(_L("Got unexpected state %d"), state);
1172 TVerdict RDvbhHaiTest::DoGetSignalQualityTestStep()
1174 TVerdict verdict = EPass;
1176 //First set the signal quality to a known value (expectedQuality) so that we know
1177 //what we are trying to Get.
1178 const TInt expectedQuality = EDvbhSignalQualityFair;
1179 TInt result = iTestUtils->SetIntegerProperty(EDvbhPropertyKeySignalQuality, expectedQuality);
1180 if (result != KErrNone)
1182 INFO_PRINTF3(_L("Error %d setting signal quality property to %d"), result, expectedQuality);
1183 verdict = EInconclusive;
1187 TDvbhSignalQuality quality = EDvbhSignalQualityNoSignal;
1188 result = iRxInfo->GetSignalQuality(quality);
1189 if (result != KErrNone)
1191 INFO_PRINTF2(_L("Error %d getting signal quality"), result);
1196 if (quality != expectedQuality)
1198 INFO_PRINTF2(_L("Got unexpected quality %d"), quality);
1208 TVerdict RDvbhHaiTest::DoGetPlatformTestStep()
1210 TVerdict verdict = EPass;
1212 //First set the platform property to a known value (iDvbhTestPlatform) so that we know
1213 //what we are trying to Get.
1214 TPckg<TDvbhPlatformProperty> platformPckg(iDvbhTestPlatform);
1215 TInt result = iTestUtils->SetByteArrayProperty(EDvbhPropertyKeyPlatform, platformPckg);
1216 if (result != KErrNone)
1218 INFO_PRINTF2(_L("Error %d setting platform property."), result);
1219 verdict = EInconclusive;
1223 TDvbhPlatform platform;
1225 result = iRxInfo->GetPlatform(platform, esgRoot);
1226 if (result != KErrNone)
1228 INFO_PRINTF2(_L("Error %d getting platform."), result);
1233 if (!CDvbhTestUtil::ComparePlatforms(platform, iDvbhTestPlatform.iPlatform))
1235 INFO_PRINTF1(_L("Got unexpected platform."));
1238 if (!esgRoot.IsEqual(iDvbhTestPlatform.iEsgRoot))
1240 INFO_PRINTF1(_L("Got unexpected esgRoot."));
1249 //Helper for test 106
1250 TVerdict RDvbhHaiTest::DoGetNetworkTime(TBool aExpectedValidity)
1252 TVerdict verdict = EPass;
1254 //Expected result is based on whether or not the platformId in the network time we
1256 TInt expectedResult = KErrNone;
1257 if (iDvbhTestNetworkTime.iPlatformId == KDvbhInvalidPlatform)
1259 expectedResult = KErrNotReady;
1262 //Set the time to a known value (iDvbhTestNetworkTime) so that we know
1263 //what we are trying to Get.
1264 TPckg<TDvbhNetworkTime> timePckg(iDvbhTestNetworkTime);
1265 TInt result = iTestUtils->SetByteArrayProperty(EDvbhPropertyKeyNetworkTime, timePckg);
1266 if (result != KErrNone)
1268 INFO_PRINTF2(_L("Error %d setting network time property."), result);
1269 verdict = EInconclusive;
1273 TTime initialTime(TInt64(0));
1274 TTime time = initialTime;
1275 TBool valid = EFalse;
1276 result = iRxInfo->GetNetworkTime(time, valid);
1277 if (result != expectedResult)
1279 INFO_PRINTF2(_L("Unexptected result %d getting network time."), result);
1284 if (result == KErrNone)
1286 //Check if what we got was as expected
1287 if (time != iDvbhTestNetworkTime.iNetworkTime || (valid != aExpectedValidity))
1289 INFO_PRINTF1(_L("Got unexpected network time or validity."));
1295 //Check that the arguments weren't updated
1296 if (time != initialTime || (valid != EFalse))
1298 INFO_PRINTF1(_L("GetNetworkTime modified its args on failure."));
1308 TVerdict RDvbhHaiTest::DoGetNetworkTimeTestStep()
1310 TVerdict verdict = EPass;
1313 //The 1st two tests are positive tests, so we do not want to get KErrNotReady
1314 //so we leave iDvbhTestNetworkTime.iPlatformId != KDvbhInvalidPlatform
1315 //(which is how it is set by default).
1317 //Test one: Set state to Receiving or Ready so that we expect a valid network time
1318 TDvbhState state = EDvbhStateReady;
1319 TInt result = iTestUtils->SetStateProperty(state);
1320 if (result != KErrNone)
1322 verdict = EInconclusive;
1326 verdict = DoGetNetworkTime((state == EDvbhStateReady) || (state == EDvbhStateReceiving));
1329 if (verdict != EPass)
1335 //Test two: Set state to something other than Ready or Receiving so we expect
1336 //and invalid network time
1337 state = EDvbhStateScanning;
1338 result = iTestUtils->SetStateProperty(state);
1339 if (result != KErrNone)
1341 verdict = EInconclusive;
1345 verdict = DoGetNetworkTime((state == EDvbhStateReady) || (state == EDvbhStateReceiving));
1348 if (verdict != EPass)
1354 //Test three: Set iDvbhTestNetworkTime.iPlatformId = KDvbhInvalidPlatform
1355 //which indicates the receiver is not ready to give network time, regardless
1356 //of the state it is in. Will result in KErrNotReady being returned from
1357 //CDvbhReceiverInfo::GetNetworkTime()
1358 iDvbhTestNetworkTime.iPlatformId = KDvbhInvalidPlatform;
1359 verdict = DoGetNetworkTime((state == EDvbhStateReady) || (state == EDvbhStateReceiving));
1366 TVerdict RDvbhHaiTest::DoGetPerformanceDataTestStep()
1368 TVerdict verdict = EPass;
1370 //First set the data to a known value (expectedData) so that we know
1371 //what we are trying to Get.
1372 TPckg<TDvbhPerformanceData> dataPckg(iDvbhTestPerformanceData);
1373 TInt result = iTestUtils->SetByteArrayProperty(EDvbhPropertyKeyPerformanceData, dataPckg);
1374 if (result != KErrNone)
1376 INFO_PRINTF2(_L("Error %d setting performance data property."), result);
1377 verdict = EInconclusive;
1381 TDvbhPerformanceData data; //Is initialised to 0s by constructor.
1382 result = iRxInfo->GetPerformanceData(data);
1383 if (result != KErrNone)
1385 INFO_PRINTF2(_L("Error %d getting performance data."), result);
1390 if (!CDvbhTestUtil::ComparePerformanceDatas(data, iDvbhTestPerformanceData))
1392 INFO_PRINTF1(_L("Got unexpected performance data."));
1402 TVerdict RDvbhHaiTest::DoGetFrequencyTestStep()
1404 TVerdict verdict = EPass;
1406 //First set the data to a known value (expectedFrequency) so that we know
1407 //what we are trying to Get.
1408 const TDvbhFrequency expectedFrequency = 150000;
1409 TInt result = iTestUtils->SetIntegerProperty(EDvbhPropertyKeyFrequency, expectedFrequency);
1410 if (result != KErrNone)
1412 INFO_PRINTF2(_L("Error %d setting frequency property."), result);
1413 verdict = EInconclusive;
1417 TDvbhFrequency frequency = 0;
1418 result = iRxInfo->GetFrequency(frequency);
1419 if (result != KErrNone)
1421 INFO_PRINTF2(_L("Error %d getting frequency."), result);
1426 if (frequency != expectedFrequency)
1428 INFO_PRINTF2(_L("Got unexpected frequency %d."), frequency);
1438 TVerdict RDvbhHaiTest::DoGetCellIdTestStep()
1440 TVerdict verdict = EPass;
1442 //First set the data to a known value (expectedId) so that we know
1443 //what we are trying to Get.
1444 const TDvbhCellId expectedId = 1001;
1445 TInt result = iTestUtils->SetIntegerProperty(EDvbhPropertyKeyCellId , expectedId);
1446 if (result != KErrNone)
1448 INFO_PRINTF2(_L("Error %d setting cellId property."), result);
1449 verdict = EInconclusive;
1454 result = iRxInfo->GetCellId(id);
1455 if (result != KErrNone)
1457 INFO_PRINTF2(_L("Error %d getting cellId."), result);
1462 if (id != expectedId)
1464 INFO_PRINTF2(_L("Got unexpected cellId %d."), id);
1474 TVerdict RDvbhHaiTest::DoGetNetworkIdTestStep()
1476 TVerdict verdict = EPass;
1478 //First set the data to a known value (expectedId) so that we know
1479 //what we are trying to Get.
1480 const TDvbhNetworkId expectedId = 9876;
1481 TInt result = iTestUtils->SetIntegerProperty(EDvbhPropertyKeyNetworkId , expectedId);
1482 if (result != KErrNone)
1484 INFO_PRINTF2(_L("Error %d setting networkId property."), result);
1485 verdict = EInconclusive;
1489 TDvbhNetworkId id = 0;
1490 result = iRxInfo->GetNetworkId(id);
1491 if (result != KErrNone)
1493 INFO_PRINTF2(_L("Error %d getting networkId."), result);
1498 if (id != expectedId)
1500 INFO_PRINTF2(_L("Got unexpected networkId %d."), id);
1511 // RDvbhReceiver negative tests
1516 TVerdict RDvbhHaiTest::DoPowerOnBeforeOpenTestStep()
1519 TVerdict verdict = EPass;
1521 RDvbhReceiver receiver;
1522 TRequestStatus status;
1523 TInt result = receiver.PowerOn(status);
1524 if (result != KErrNotReady)
1526 INFO_PRINTF2(_L("RDvbhReceiver::PowerOn returned %d"), result);
1529 } //end of receiver's scope
1535 TVerdict RDvbhHaiTest::DoSetScanConfigurationBeforeOpenTestStep()
1538 TVerdict verdict = EPass;
1540 RDvbhReceiver receiver;
1541 TInt result = receiver.SetScanConfiguration(iDvbhTestScanConfiguration);
1542 if (result != KErrNotReady)
1544 INFO_PRINTF2(_L("RDvbhReceiver::SetScanConfiguration returned %d"), result);
1547 } //end of receiver's scope
1553 TVerdict RDvbhHaiTest::DoGetScanConfigurationBeforeOpenTestStep()
1556 TVerdict verdict = EPass;
1558 RDvbhReceiver receiver;
1559 TDvbhScanConfiguration config;
1560 config.iScanStartFrequency = iDvbhTestScanConfiguration.iScanStartFrequency;
1561 config.iScanEndFrequency = iDvbhTestScanConfiguration.iScanEndFrequency;
1562 config.iSignalBandwidth = iDvbhTestScanConfiguration.iSignalBandwidth;
1563 config.iScanOptions = iDvbhTestScanConfiguration.iScanOptions;
1565 TInt result = receiver.GetScanConfiguration(config);
1566 if (result != KErrNotReady)
1568 INFO_PRINTF2(_L("RDvbhReceiver::GetScanConfiguration returned %d"), result);
1573 if (!iTestUtils->CompareScanConfigurations(iDvbhTestScanConfiguration, config))
1575 INFO_PRINTF1(_L("RDvbhReceiver::GetScanConfiguration modified its arg on failure."));
1579 } //end of receiver's scope
1585 TVerdict RDvbhHaiTest::DoGetDvbhVersionBeforeOpenTestStep()
1588 TVerdict verdict = EPass;
1590 RDvbhReceiver receiver;
1591 TVersion version = iDvbhTestDriverVersion;
1593 TInt result = receiver.GetDvbhVersion(version);
1594 if (result != KErrNotReady)
1596 INFO_PRINTF2(_L("RDvbhReceiver::GetDvbhVersion returned %d"), result);
1601 if (!iTestUtils->CompareVersions(version, iDvbhTestDriverVersion))
1603 INFO_PRINTF1(_L("RDvbhReceiver::GetDvbhVersion modified its arg on failure."));
1608 } //end of receiver's scope
1614 TVerdict RDvbhHaiTest::DoGetHardwareInfoBeforeOpenTestStep()
1617 TVerdict verdict = EPass;
1619 RDvbhReceiver receiver;
1620 TDvbhHardwareInfo info = iDvbhTestHardwareInfo;
1622 TInt result = receiver.GetHardwareInfo(info);
1623 if (result != KErrNotReady)
1625 INFO_PRINTF2(_L("RDvbhReceiver::GetHardwareInfo returned %d"), result);
1630 if (info.Compare(iDvbhTestHardwareInfo) != 0) // Compare returns 0 if they are the same
1632 INFO_PRINTF1(_L("RDvbhReceiver::GetHardwareInfo modified its arg on failure."));
1636 } //end of receiver's scope
1642 TVerdict RDvbhHaiTest::DoScanBeforeOpenTestStep()
1645 TVerdict verdict = EPass;
1647 RDvbhReceiver receiver;
1648 TRequestStatus status;
1649 TInt result = receiver.Scan(*this, status);
1650 if (result != KErrNotReady)
1652 INFO_PRINTF2(_L("RDvbhReceiver::Scan returned %d"), result);
1655 } //end of receiver's scope
1661 TVerdict RDvbhHaiTest::DoSetPlatformBeforeOpenTestStep()
1664 TVerdict verdict = EPass;
1666 RDvbhReceiver receiver;
1667 TRequestStatus status;
1668 TInt result = receiver.SetPlatform(iDvbhTestNetwork, iDvbhTestPlatform.iPlatform, status);
1669 if (result != KErrNotReady)
1671 INFO_PRINTF2(_L("RDvbhReceiver::SetPlatform returned %d"), result);
1674 } //end of receiver's scope
1680 TVerdict RDvbhHaiTest::DoCreateFilterBeforeOpenTestStep()
1683 TVerdict verdict = EPass;
1685 RDvbhReceiver receiver;
1686 TInt filterId = 100;
1687 TInt origFilterId = filterId;
1688 TRequestStatus status;
1689 TInt result = receiver.CreateFilter(KDvbhTestIpV6Addr, filterId, status);
1690 if (result != KErrNotReady)
1692 INFO_PRINTF2(_L("RDvbhReceiver::CreateFilter returned %d"), result);
1697 if (filterId != origFilterId)
1699 INFO_PRINTF1(_L("RDvbhReceiver::CreateFilter modified its arg on failure."));
1703 } //end of receiver's scope
1709 TVerdict RDvbhHaiTest::DoCancelFilterBeforeOpenTestStep()
1712 TVerdict verdict = EPass;
1714 RDvbhReceiver receiver;
1716 TInt result = receiver.CancelFilter(filterId);
1717 if (result != KErrNotReady)
1719 INFO_PRINTF2(_L("RDvbhReceiver::CancelFilter returned %d"), result);
1722 } //end of receiver's scope
1728 TVerdict RDvbhHaiTest::DoReceiveIpDataBeforeOpenTestStep()
1731 TVerdict verdict = EPass;
1733 RDvbhReceiver receiver;
1734 TInt result = receiver.ReceiveIPData(*this);
1735 if (result != KErrNotReady)
1737 INFO_PRINTF2(_L("RDvbhReceiver::ReceiveIPData returned %d"), result);
1740 } //end of receiver's scope
1746 TVerdict RDvbhHaiTest::DoUpdateNetworkTimeBeforeOpenTestStep()
1749 TVerdict verdict = EPass;
1751 RDvbhReceiver receiver;
1752 TRequestStatus status;
1753 TInt result = receiver.UpdateNetworkTime(status);
1754 if (result != KErrNotReady)
1756 INFO_PRINTF2(_L("RDvbhReceiver::UpdateNetworkTime returned %d"), result);
1759 } //end of receiver's scope
1765 TVerdict RDvbhHaiTest::DoCustomAsyncBeforeOpenTestStep()
1768 TVerdict verdict = EPass;
1770 RDvbhReceiver receiver;
1771 TBuf8<32> output = _L8("Output");
1772 TBuf8<32> origOutput = output;
1773 TRequestStatus status;
1774 TInt result = receiver.CustomCommand(KDvbhTestCustomCommand, KDvbhTestCustomCommandInput, output, status);
1775 if (result != KErrNotReady)
1777 INFO_PRINTF2(_L("RDvbhReceiver::CustomCommand returned %d"), result);
1782 if (output.Compare(origOutput) != 0) //Compare returns 0 if they are the same
1784 INFO_PRINTF1(_L("RDvbhReceiver::CustomCommand modified its arg on failure."));
1788 } //end of receiver's scope
1794 TVerdict RDvbhHaiTest::DoCancelCustomAsyncBeforeOpenTestStep()
1797 TVerdict verdict = EPass;
1799 RDvbhReceiver receiver;
1800 TRequestStatus status;
1801 receiver.CancelCustomCommand(status);
1802 } //end of receiver's scope
1808 TVerdict RDvbhHaiTest::DoCustomBeforeOpenTestStep()
1811 TVerdict verdict = EPass;
1813 RDvbhReceiver receiver;
1814 TInt result = receiver.CustomCommand(KDvbhTestCustomCommand, KDvbhTestCustomCommandInput);
1815 if (result != KErrNotReady)
1817 INFO_PRINTF2(_L("RDvbhReceiver::CustomCommand returned %d"), result);
1820 } //end of receiver's scope
1826 TVerdict RDvbhHaiTest::DoCloseBeforeOpenTestStep()
1829 TVerdict verdict = EPass;
1831 RDvbhReceiver receiver;
1833 } //end of receiver's scope
1839 TVerdict RDvbhHaiTest::DoPowerOffBeforeOpenTestStep()
1842 TVerdict verdict = EPass;
1844 RDvbhReceiver receiver;
1845 TRequestStatus status;
1846 receiver.PowerOff(status);
1847 } //end of receiver's scope
1853 TVerdict RDvbhHaiTest::DoSetDisabledBeforeOpenTestStep()
1856 TVerdict verdict = EPass;
1858 RDvbhReceiver receiver;
1859 TRequestStatus status;
1860 receiver.SetDisabled(ETrue, status);
1861 } //end of receiver's scope
1867 TVerdict RDvbhHaiTest::DoCancelScanBeforeOpenTestStep()
1870 TVerdict verdict = EPass;
1872 RDvbhReceiver receiver;
1873 receiver.CancelScan();
1874 } //end of receiver's scope
1880 TVerdict RDvbhHaiTest::DoCancelSetPlatformBeforeOpenTestStep()
1883 TVerdict verdict = EPass;
1885 RDvbhReceiver receiver;
1886 receiver.CancelSetPlatform();
1887 } //end of receiver's scope
1893 TVerdict RDvbhHaiTest::DoCancelReceiveIpDataBeforeOpenTestStep()
1896 TVerdict verdict = EPass;
1898 RDvbhReceiver receiver;
1899 receiver.CancelReceiveIPData();
1900 } //end of receiver's scope
1906 TVerdict RDvbhHaiTest::DoCancelUpdateNetworkTimeBeforeOpenTestStep()
1909 TVerdict verdict = EPass;
1911 RDvbhReceiver receiver;
1912 receiver.CancelUpdateNetworkTime();
1913 } //end of receiver's scope
1921 TVerdict RDvbhHaiTest::DoGetStateNoPropertiesTestStep()
1923 TVerdict verdict = EPass;
1925 TDvbhState state = EDvbhStateReady;
1926 TInt result = iRxInfo->GetState(state);
1927 if (result != KErrNotFound)
1929 INFO_PRINTF2(_L("Got error %d getting state but expected KErrNotFound"), result);
1934 if (state != EDvbhStateReady)
1936 INFO_PRINTF1(_L("RDvbhReceiverInfo::GetState modified its arg on failure."));
1945 TVerdict RDvbhHaiTest::DoGetSignalQualityNoPropertiesTestStep()
1947 TVerdict verdict = EPass;
1949 TDvbhSignalQuality quality = EDvbhSignalQualityVeryGood;
1950 TInt result = iRxInfo->GetSignalQuality(quality);
1951 if (result != KErrNotFound)
1953 INFO_PRINTF2(_L("Got error %d getting signal quality but expected KErrNotFound"), result);
1958 if (quality != EDvbhSignalQualityVeryGood)
1960 INFO_PRINTF1(_L("RDvbhReceiverInfo::GetSignalQuality modified its arg on failure."));
1969 TVerdict RDvbhHaiTest::DoGetPlatformNoPropertiesTestStep()
1971 TVerdict verdict = EPass;
1973 TDvbhPlatform platform;
1974 platform.iId = iDvbhTestPlatform.iPlatform.iId;
1975 platform.iName = iDvbhTestPlatform.iPlatform.iName;
1977 TIp6Addr esgRoot = iDvbhTestPlatform.iEsgRoot;
1979 TInt result = iRxInfo->GetPlatform(platform, esgRoot);
1980 if (result != KErrNotFound)
1982 INFO_PRINTF2(_L("Got error %d getting platform but expected KErrNotFound"), result);
1987 if (!CDvbhTestUtil::ComparePlatforms(platform, iDvbhTestPlatform.iPlatform) ||
1988 !esgRoot.IsEqual(iDvbhTestPlatform.iEsgRoot) )
1990 INFO_PRINTF1(_L("RDvbhReceiverInfo::GetPlatform modified its arg on failure."));
1999 TVerdict RDvbhHaiTest::DoGetNetworkTimeNoPropertiesTestStep()
2001 TVerdict verdict = EPass;
2003 TTime time = iDvbhTestTime;
2004 TBool valid = ETrue;
2006 TInt result = iRxInfo->GetNetworkTime(time, valid);
2007 if (result != KErrNotFound)
2009 INFO_PRINTF2(_L("Got error %d getting network time but expected KErrNotFound"), result);
2014 if (time != iDvbhTestTime || !valid )
2016 INFO_PRINTF1(_L("RDvbhReceiverInfo::GetNetworkTime modified its arg on failure."));
2025 TVerdict RDvbhHaiTest::DoGetPerformanceDataNoPropertiesTestStep()
2027 TVerdict verdict = EPass;
2029 TDvbhPerformanceData data;
2030 data.iFilterCount = iDvbhTestPerformanceData.iFilterCount;
2031 data.iMaxFilters = iDvbhTestPerformanceData. iMaxFilters;
2032 data.iDataCount = iDvbhTestPerformanceData.iDataCount;
2033 data.iWriteCount = iDvbhTestPerformanceData.iWriteCount;
2034 data.iWriteCommandCount = iDvbhTestPerformanceData.iWriteCommandCount;
2035 data.iReadCount = iDvbhTestPerformanceData.iReadCount;
2036 data.iReadCommandCount = iDvbhTestPerformanceData.iReadCommandCount;
2038 TInt result = iRxInfo->GetPerformanceData(data);
2039 if (result != KErrNotFound)
2041 INFO_PRINTF2(_L("Got error %d getting performance data but expected KErrNotFound"), result);
2046 if (!CDvbhTestUtil::ComparePerformanceDatas(data, iDvbhTestPerformanceData))
2048 INFO_PRINTF1(_L("RDvbhReceiverInfo::GetPerformaceData modified its arg on failure."));
2057 TVerdict RDvbhHaiTest::DoGetFrequencyNoPropertiesTestStep()
2059 TVerdict verdict = EPass;
2061 TDvbhFrequency frequency = KInitialFrequency;
2063 TInt result = iRxInfo->GetFrequency(frequency);
2064 if (result != KErrNotFound)
2066 INFO_PRINTF2(_L("Got error %d getting frequency but expected KErrNotFound"), result);
2071 if (frequency != KInitialFrequency)
2073 INFO_PRINTF1(_L("RDvbhReceiverInfo::GetFrequency modified its arg on failure."));
2082 TVerdict RDvbhHaiTest::DoGetCellIdNoPropertiesTestStep()
2084 TVerdict verdict = EPass;
2086 TDvbhCellId cellId = KInitialCellId;
2088 TInt result = iRxInfo->GetCellId(cellId);
2089 if (result != KErrNotFound)
2091 INFO_PRINTF2(_L("Got error %d getting cellId but expected KErrNotFound"), result);
2096 if (cellId != KInitialCellId)
2098 INFO_PRINTF1(_L("RDvbhReceiverInfo::GetCellId modified its arg on failure."));
2107 TVerdict RDvbhHaiTest::DoGetNetworkIdNoPropertiesTestStep()
2109 TVerdict verdict = EPass;
2111 TDvbhNetworkId networkId = KInitialNetworkId;
2113 TInt result = iRxInfo->GetNetworkId(networkId);
2114 if (result != KErrNotFound)
2116 INFO_PRINTF2(_L("Got error %d getting networkId but expected KErrNotFound"), result);
2121 if (networkId != KInitialNetworkId)
2123 INFO_PRINTF1(_L("RDvbhReceiverInfo::GetNetworkId modified its arg on failure."));
2134 * Test added to improve conditional code coverage. It tries to get all the properties
2135 * that depend on state when the state property is defined, but no other properties are
2138 TVerdict RDvbhHaiTest::DoGetTestsNoProperties()
2140 TVerdict verdict = EPass;
2142 //Preamble will have defined the state property and set it to EDvbhStateReceiving. So
2143 //we just have to try to get each (non-defined) property that depends on state.
2146 verdict = DoGetCellIdNoPropertiesTestStep();
2147 if (verdict != EPass)
2153 verdict = DoGetFrequencyNoPropertiesTestStep();
2154 if (verdict != EPass)
2160 verdict = DoGetNetworkIdNoPropertiesTestStep();
2161 if (verdict != EPass)
2167 verdict = DoGetPlatformNoPropertiesTestStep();
2168 if (verdict != EPass)
2174 verdict = DoGetSignalQualityNoPropertiesTestStep();
2175 if (verdict != EPass)
2184 void RDvbhHaiTest::DvbhScanProgress( const TDvbhScanResult& /*aResult*/ )
2186 //Should never be called
2191 void RDvbhHaiTest::DvbhPacketReceived( const TDesC8& /*aPacket*/ )
2193 //Should never be called