First public contribution.
2 * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of the License "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
19 #include <test/testexecutelog.h>
22 #include <caf/rightsinfo.h>
23 #include <caf/manager.h>
24 #include <caf/supplieroutputfile.h>
25 #include "cafserver.h"
26 #include "CafUtilsStep.h"
28 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
29 #include "refcafhelper.h"
30 #include <caf/cafhelper.h>
31 #endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
33 using namespace ContentAccess;
36 CCafCDirStreamStep::~CCafCDirStreamStep()
40 CCafCDirStreamStep::CCafCDirStreamStep(CCAFServer& aParent) : iParent(aParent)
42 SetTestStepName(KCAFCDirStreamStep);
46 TVerdict CCafCDirStreamStep::doTestStepL()
48 SetTestStepResult(EPass);
50 _LIT(KTcafDir, "C:\\tcaf\\");
52 INFO_PRINTF1(_L("CDirStreamable test"));
57 CManager *manager = CManager::NewLC();
59 CDir *fileList = NULL;
60 User::LeaveIfError(manager->GetDir(KTcafDir(),KNullUid, ESortByName, fileList));
62 CDirStreamable *newFileList = CDirStreamable::NewL(*fileList);
66 CBufFlat* buf = CBufFlat::NewL(50);
67 CleanupStack::PushL(buf);
69 // create write stream
70 RBufWriteStream writeStream(*buf);
71 CleanupClosePushL(writeStream);
73 // write the directory to the stream
74 newFileList->ExternalizeL(writeStream);
75 CleanupStack::PopAndDestroy(&writeStream);
78 RBufReadStream readStream(*buf);
79 CleanupClosePushL(readStream);
81 // construct a new CDirStreamable from the stream
82 CDirStreamable *streamDir = CDirStreamable::NewL(readStream);
83 CleanupStack::PopAndDestroy(&readStream);
85 for(TInt i = 0; i < newFileList->Count(); i++)
87 if((*newFileList)[i].iName != (*streamDir)[i].iName)
89 SetTestStepResult(EFail);
91 if((*newFileList)[i].iType != (*streamDir)[i].iType)
93 SetTestStepResult(EFail);
97 CleanupStack::PopAndDestroy(buf);
101 CleanupStack::PopAndDestroy(manager);
105 return TestStepResult();
108 CCafRAttributeSetStreamStep::~CCafRAttributeSetStreamStep()
112 CCafRAttributeSetStreamStep::CCafRAttributeSetStreamStep(CCAFServer& aParent) : iParent(aParent)
114 SetTestStepName(KCAFRAttributeSetStreamStep);
118 TVerdict CCafRAttributeSetStreamStep::doTestStepL()
120 SetTestStepResult(EPass);
122 INFO_PRINTF1(_L("CRAttributeSet streaming test"));
128 CleanupClosePushL(aSet);
129 aSet.AddL(EIsProtected);
130 aSet.AddL(EIsForwardable);
131 aSet.AddL(EIsForwardable);
133 aSet.SetValue(EIsProtected, (TInt) ETrue, KErrNone);
134 aSet.SetValue(EIsForwardable, (TInt) EFalse, KErrNone);
137 CBufFlat* buf = CBufFlat::NewL(50);
138 CleanupStack::PushL(buf);
140 // create write stream
141 RBufWriteStream writeStream(*buf);
142 CleanupClosePushL(writeStream);
144 // write the directory to the stream
145 aSet.ExternalizeL(writeStream);
146 CleanupStack::PopAndDestroy(&writeStream);
148 // create read stream
149 RBufReadStream readStream(*buf);
150 CleanupClosePushL(readStream);
152 // construct a new CDirStreamable from the stream
154 CleanupClosePushL(bSet);
155 bSet.InternalizeL(readStream);
158 if(aSet.Count() != bSet.Count())
160 SetTestStepResult(EFail);
163 for(TInt i = 0; i < aSet.Count(); i++)
167 if(aSet.GetValue(aSet[i],valueA) != bSet.GetValue(aSet[i],valueB))
169 SetTestStepResult(EFail);
174 SetTestStepResult(EFail);
178 CleanupStack::PopAndDestroy(&bSet);
179 CleanupStack::PopAndDestroy(&readStream);
180 CleanupStack::PopAndDestroy(buf);
181 CleanupStack::PopAndDestroy(&aSet);
185 return TestStepResult();
189 CCafRStringAttributeSetStreamStep::~CCafRStringAttributeSetStreamStep()
193 CCafRStringAttributeSetStreamStep::CCafRStringAttributeSetStreamStep(CCAFServer& aParent) : iParent(aParent)
195 SetTestStepName(KCAFRStringAttributeSetStreamStep);
199 TVerdict CCafRStringAttributeSetStreamStep::doTestStepL()
201 SetTestStepResult(EPass);
203 INFO_PRINTF1(_L("CRStringAttributeSet streaming test"));
205 _LIT(KMimeType,"mime/type");
209 RStringAttributeSet aSet;
210 CleanupClosePushL(aSet);
211 aSet.AddL(EMimeType);
212 aSet.AddL(EDescription);
214 // Set some values, normally be done by the agent
215 aSet.SetValue(EMimeType, KMimeType(), KErrNone);
216 aSet.SetValue(EDescription, KNullDesC(), KErrNotSupported);
219 CBufFlat* buf = CBufFlat::NewL(50);
220 CleanupStack::PushL(buf);
222 // create write stream
223 RBufWriteStream writeStream(*buf);
224 CleanupClosePushL(writeStream);
226 // write the directory to the stream
227 aSet.ExternalizeL(writeStream);
228 CleanupStack::PopAndDestroy(&writeStream);
230 // create read stream
231 RBufReadStream readStream(*buf);
232 CleanupClosePushL(readStream);
234 // construct a new CDirStreamable from the stream
235 RStringAttributeSet bSet;
236 CleanupClosePushL(bSet);
237 bSet.InternalizeL(readStream);
241 if(aSet.Count() != bSet.Count())
243 SetTestStepResult(EFail);
246 for(TInt i = 0; i < aSet.Count(); i++)
250 if(aSet.GetValue(aSet[i],valueA) != bSet.GetValue(aSet[i],valueB))
252 SetTestStepResult(EFail);
257 SetTestStepResult(EFail);
261 CleanupStack::PopAndDestroy(&bSet);
262 CleanupStack::PopAndDestroy(&readStream);
263 CleanupStack::PopAndDestroy(buf);
264 CleanupStack::PopAndDestroy(&aSet);
268 return TestStepResult();
273 CCafSupplierOutputFileStreamStep::~CCafSupplierOutputFileStreamStep()
277 CCafSupplierOutputFileStreamStep::CCafSupplierOutputFileStreamStep(CCAFServer& aParent) : iParent(aParent)
279 SetTestStepName(KCAFSupplierOutputFileStreamStep);
283 TVerdict CCafSupplierOutputFileStreamStep::doTestStepL()
285 SetTestStepResult(EPass);
287 _LIT(KDummyName, "C:\\tcaf\\supplieroutputfile.txt");
288 _LIT8(KDummyType, "something//caf");
290 INFO_PRINTF1(_L("CSupplierOutputFile test"));
295 CSupplierOutputFile *outputFile = CSupplierOutputFile::NewL(KDummyName(), EContent, KDummyType());
298 CBufFlat* buf = CBufFlat::NewL(50);
299 CleanupStack::PushL(buf);
301 // create write stream
302 RBufWriteStream writeStream(*buf);
303 CleanupClosePushL(writeStream);
305 // write the directory to the stream
306 outputFile->ExternalizeL(writeStream);
307 CleanupStack::PopAndDestroy(&writeStream);
309 // create read stream
310 RBufReadStream readStream(*buf);
311 CleanupClosePushL(readStream);
313 // construct a new CSupplierOutputFile from the stream
314 CSupplierOutputFile *outputFile2= CSupplierOutputFile::NewL(readStream);
315 CleanupStack::PopAndDestroy(&readStream);
317 if(outputFile->FileName() != outputFile2->FileName())
319 SetTestStepResult(EFail);
321 if(outputFile->OutputType() != outputFile2->OutputType())
323 SetTestStepResult(EFail);
325 if(outputFile->MimeTypeL() != outputFile2->MimeTypeL())
327 SetTestStepResult(EFail);
330 CleanupStack::PopAndDestroy(buf);
337 return TestStepResult();
340 CCafMetaDataArrayStep::~CCafMetaDataArrayStep()
344 CCafMetaDataArrayStep::CCafMetaDataArrayStep(CCAFServer& aParent) : iParent(aParent)
346 SetTestStepName(KCAFMetaDataArrayStep);
350 TVerdict CCafMetaDataArrayStep::doTestStepL()
352 SetTestStepResult(EPass);
355 _LIT(KValue1, "Sat");
357 _LIT8(KTest2, "Mellow");
358 _LIT8(KValue2, "Yellow");
360 _LIT8(KTest3, "Tree");
361 _LIT8(KValue3, "House");
364 INFO_PRINTF1(_L("CMetaDataArray test"));
369 CMetaDataArray *array = CMetaDataArray::NewLC();
370 array->AddL(KTest1(), KValue1());
371 array->AddL(KTest2(), KValue2());
372 array->AddL(KTest3(), KValue3());
375 CBufFlat* buf = CBufFlat::NewL(50);
376 CleanupStack::PushL(buf);
378 // create write stream
379 RBufWriteStream writeStream(*buf);
380 CleanupClosePushL(writeStream);
382 // write the directory to the stream
383 array->ExternalizeL(writeStream);
384 CleanupStack::PopAndDestroy(&writeStream);
386 // create read stream
387 RBufReadStream readStream(*buf);
388 CleanupClosePushL(readStream);
390 // construct a new CSupplierOutputFile from the stream
391 CMetaDataArray *array2= CMetaDataArray::NewL(readStream);
392 CleanupStack::PopAndDestroy(&readStream);
395 if(array->Count() != array2->Count() || (*array)[0].Field() != KTest1() || (*array)[1].Data8() != KValue2())
397 SetTestStepResult(EFail);
399 for(TInt i = 0; i < array->Count(); i++)
401 const CMetaData &a = (*array)[i];
402 const CMetaData &b = (*array2)[i];
403 if(a.Field() != b.Field())
405 SetTestStepResult(EFail);
407 if(a.Field8() != b.Field8())
409 SetTestStepResult(EFail);
411 if(a.Data() != b.Data())
413 SetTestStepResult(EFail);
415 if(a.Data8() != b.Data8())
417 SetTestStepResult(EFail);
423 CleanupStack::PopAndDestroy(buf);
424 CleanupStack::PopAndDestroy(array);
428 return TestStepResult();
432 CCafEmbeddedObjectStep::~CCafEmbeddedObjectStep()
436 CCafEmbeddedObjectStep::CCafEmbeddedObjectStep(CCAFServer& aParent) : iParent(aParent)
438 SetTestStepName(KCAFEmbeddedObjectStep);
442 TVerdict CCafEmbeddedObjectStep::doTestStepL()
444 SetTestStepResult(EPass);
446 _LIT(KTestUniqueId, "The UniqueId");
447 _LIT(KTestName, "The Name");
449 _LIT8(KTestMimeType, "The mime type");
452 INFO_PRINTF1(_L("CEmbeddedObject test"));
457 CEmbeddedObject *aObject = CEmbeddedObject::NewL(KTestUniqueId(), KTestName(), KTestMimeType(), EContentObject);
460 CBufFlat* buf = CBufFlat::NewL(50);
461 CleanupStack::PushL(buf);
463 // create write stream
464 RBufWriteStream writeStream(*buf);
465 CleanupClosePushL(writeStream);
467 // write the directory to the stream
468 aObject->ExternalizeL(writeStream);
469 CleanupStack::PopAndDestroy(&writeStream);
471 // create read stream
472 RBufReadStream readStream(*buf);
473 CleanupClosePushL(readStream);
475 // construct a new CSupplierOutputFile from the stream
476 CEmbeddedObject *bObject= CEmbeddedObject::NewL(readStream);
477 CleanupStack::PopAndDestroy(&readStream);
480 if(aObject->UniqueId() != bObject->UniqueId())
482 SetTestStepResult(EFail);
485 if(aObject->Name() != bObject->Name())
487 SetTestStepResult(EFail);
489 if(aObject->Type() != bObject->Type())
491 SetTestStepResult(EFail);
493 if(aObject->MimeType() != bObject->MimeType())
495 SetTestStepResult(EFail);
498 CleanupStack::PopAndDestroy(buf);
504 return TestStepResult();
507 CCafVirtualPathStep::~CCafVirtualPathStep()
511 CCafVirtualPathStep::CCafVirtualPathStep(CCAFServer& aParent) : iParent(aParent)
513 SetTestStepName(KCAFVirtualPathStep);
517 TVerdict CCafVirtualPathStep::doTestStepL()
519 SetTestStepResult(EPass);
520 INFO_PRINTF1(_L("CVirtualPath test"));
521 _LIT(KTestUniqueId, "The UniqueId");
522 _LIT(KTestUri, "A URI");
523 _LIT(KSection,"virtualpath");
524 _LIT(KDefaultUniqueID,"DEFAULT");
528 TPtrC expecteduniqueid;
532 /* test the creation of TVirtualPathPtr and CVirtualPath objects and check if they contain
533 * the expected URI and UniqueID values.
538 TBuf<13> sectionName(KSection);
539 sectionName.AppendNum(i);
540 GetStringFromConfig(sectionName,_L("uri"),uri);
541 GetStringFromConfig(sectionName,_L("uniqueID"),uniqueID);
542 GetStringFromConfig(sectionName,_L("combined"),combined);
543 GetStringFromConfig(sectionName,_L("expecteduri"),expecteduri);
544 GetStringFromConfig(sectionName,_L("expecteduniqueid"),expecteduniqueid);
545 // Test the TVirtualPathPtr API
546 TVirtualPathPtr vPath(uri,uniqueID);
547 if(vPath.URI()!=expecteduri)
549 INFO_PRINTF4(_L("TVirtualPathPtr(uri,uniqueID) failed Uri for %S\nExpected %S\nGot %S"),&combined,&expecteduri,&vPath.URI());
550 SetTestStepResult(EFail);
552 if(vPath.UniqueId()!=expecteduniqueid)
554 INFO_PRINTF4(_L("TVirtualPathPtr(uri,uniqueID) failed uniqueID for %S\nExpected %S\nGot %S"),&combined,&expecteduniqueid,&vPath.UniqueId());
555 SetTestStepResult(EFail);
557 vPath=TVirtualPathPtr(combined);
558 if(vPath.URI()!=expecteduri)
560 INFO_PRINTF4(_L("TVirtualPathPtr(uri,uniqueID) failed Uri() for %S\nExpected %S\nGot %S"),&combined,&expecteduri,&vPath.URI());
561 SetTestStepResult(EFail);
563 if(vPath.UniqueId()!=expecteduniqueid)
565 INFO_PRINTF4(_L("TVirtualPathPtr(aCombinedUriUniqueId) failed UniqueID() for %S\nExpected %S\nGot %S"),&combined,&expecteduniqueid,&vPath.UniqueId());
566 SetTestStepResult(EFail);
569 if(vPath.URI()!=expecteduri)
571 INFO_PRINTF4(_L("TVirtualPathPtr operator = failed Uri for %S\nExpected %S\nGot %S"),&combined,&expecteduri,&vPath.URI());
572 SetTestStepResult(EFail);
574 if(vPath.UniqueId()!=expecteduniqueid)
576 INFO_PRINTF4(_L("TVirtualPathPtr operator = UniqueId for %S\nExpected %S\nGot %S"),&combined,&expecteduniqueid,&vPath.UniqueId());
577 SetTestStepResult(EFail);
579 // Test the CVirtualPath API
580 CVirtualPath* heapPath = CVirtualPath::NewL(uri,uniqueID);
581 if(heapPath->URI()!=expecteduri)
583 INFO_PRINTF4(_L("TCVirtualPath::NewL(uri,uniqueID) failed Uri for %S\nExpected %S\nGot %S"),&combined,&expecteduri,&heapPath->URI());
584 SetTestStepResult(EFail);
586 if(heapPath->UniqueId()!=expecteduniqueid)
588 INFO_PRINTF4(_L("CVirtualPath::NewL(uri,uniqueID) failed UniqueID for %S\nExpected %S\nGot %S"),&combined,&expecteduniqueid,&heapPath->UniqueId());;
589 SetTestStepResult(EFail);
591 if(heapPath->GetCombinedUriUniqueId()!=combined)
593 INFO_PRINTF4(_L("CVirtualPath::NewL(uri,uniqueID) failed GetCombinedUriUniqueId() for %S\nExpected %S\nGot %S"),&combined,&combined,&heapPath->GetCombinedUriUniqueId());
594 SetTestStepResult(EFail);
599 heapPath = CVirtualPath::NewL(combined);
600 if(heapPath->URI()!=expecteduri)
602 INFO_PRINTF4(_L("CVirtualPath::NewL(combined) failed Uri for %S\nExpected %S\nGot %S"),&combined,&expecteduri,&heapPath->URI());
603 SetTestStepResult(EFail);
605 if(heapPath->UniqueId()!=expecteduniqueid)
607 INFO_PRINTF4(_L("CVirtualPath::NewL(combined) failed UniqueID for %S\nExpected %S\nGot %S"),&combined,&expecteduniqueid,&heapPath->UniqueId());
608 SetTestStepResult(EFail);
610 if(heapPath->GetCombinedUriUniqueId()!=combined)
612 INFO_PRINTF4(_L("CVirtualPath::NewL(combined) failed GetCombinedUriUniqueId() for %S\nExpected %S\nGot %S"),&combined,&combined,&heapPath->GetCombinedUriUniqueId());
613 SetTestStepResult(EFail);
620 CVirtualPath *aPath= CVirtualPath::NewL(KTestUri(), KTestUniqueId());
623 CBufFlat* buf = CBufFlat::NewL(50);
624 CleanupStack::PushL(buf);
626 // create write stream
627 RBufWriteStream writeStream(*buf);
628 CleanupClosePushL(writeStream);
630 // write the directory to the stream
631 aPath->ExternalizeL(writeStream);
632 CleanupStack::PopAndDestroy(&writeStream);
634 // create read stream
635 RBufReadStream readStream(*buf);
636 CleanupClosePushL(readStream);
638 // construct a new CSupplierOutputFile from the stream
639 CVirtualPath *bPath= CVirtualPath::NewL(readStream);
640 CleanupStack::PopAndDestroy(&readStream);
643 if(aPath->UniqueId() != bPath->UniqueId())
645 SetTestStepResult(EFail);
648 if(aPath->URI() != bPath->URI())
650 SetTestStepResult(EFail);
653 // Test that if a uniqueID of length greater than ContentAccess::KMaxCafUniqueId
654 // is given then it will not treat it as a valid uniqueID
655 HBufC* longUID = HBufC::NewLC(aPath->UniqueId().Length() * 100+aPath->URI().Length()+1);
656 longUID->Des().Append(aPath->URI());
657 longUID->Des().Append(KCafVirtualPathSeparator);
658 // create a very long concatenated URI and UniqueID
659 for ( i = 0; i < 100; ++i )
661 longUID->Des().Append(aPath->UniqueId());
663 // create a TVirtualPathPtr with the concatenated URI and UniqueID
664 TVirtualPathPtr longPath(longUID->Des());
665 // check if the expected URI and UniqueID are stored
666 if(longPath.URI()!=longUID->Des())
668 SetTestStepResult(EFail);
670 if(longPath.UniqueId()!=KDefaultUniqueID)
672 SetTestStepResult(EFail);
675 CleanupStack::PopAndDestroy(longUID);
676 CleanupStack::PopAndDestroy(buf);
683 return TestStepResult();
688 CCafRightsInfoStep::~CCafRightsInfoStep()
692 CCafRightsInfoStep::CCafRightsInfoStep(CCAFServer& aParent) : iParent(aParent)
694 SetTestStepName(KCAFRightsInfoStep);
698 TVerdict CCafRightsInfoStep::doTestStepL()
700 SetTestStepResult(EPass);
702 _LIT(KTestUniqueId, "The UniqueId");
703 _LIT(KTestDescription, "A Description");
705 INFO_PRINTF1(_L("CRightsInfo test"));
710 CRightsInfo *aRights= CRightsInfo::NewL(KTestDescription(), KTestUniqueId(), ERightsTypeConsumable, ERightsStatusNone);
714 CBufFlat* buf = CBufFlat::NewL(50);
715 CleanupStack::PushL(buf);
717 // create write stream
718 RBufWriteStream writeStream(*buf);
719 CleanupClosePushL(writeStream);
721 // write the directory to the stream
722 aRights->ExternalizeL(writeStream);
723 CleanupStack::PopAndDestroy(&writeStream);
725 // create read stream
726 RBufReadStream readStream(*buf);
727 CleanupClosePushL(readStream);
729 // construct a new CSupplierOutputFile from the stream
730 CRightsInfo *bRights= CRightsInfo::NewL(readStream);
731 CleanupStack::PopAndDestroy(&readStream);
734 if(aRights->UniqueId() != bRights->UniqueId())
736 SetTestStepResult(EFail);
739 if(aRights->Description() != bRights->Description())
741 SetTestStepResult(EFail);
744 if(aRights->RightsType() != bRights->RightsType())
746 SetTestStepResult(EFail);
749 if(aRights->RightsStatus() != bRights->RightsStatus())
751 SetTestStepResult(EFail);
754 CleanupStack::PopAndDestroy(buf);
760 return TestStepResult();
765 CCafStreamablePtrArrayStep::~CCafStreamablePtrArrayStep()
769 CCafStreamablePtrArrayStep::CCafStreamablePtrArrayStep(CCAFServer& aParent) : iParent(aParent)
771 SetTestStepName(KCAFStreamablePtrArrayStep);
775 TVerdict CCafStreamablePtrArrayStep::doTestStepL()
777 SetTestStepResult(EPass);
779 _LIT(KTestUniqueId, "The UniqueId");
780 _LIT(KTestName, "The Name");
781 _LIT8(KTestMimeType, "The mime type");
783 INFO_PRINTF1(_L("StreamablePtrArray test"));
787 RStreamablePtrArray <CEmbeddedObject> array;
789 CEmbeddedObject *aObject = CEmbeddedObject::NewL(KTestUniqueId(), KTestName(), KTestMimeType(), EContentObject);
790 CEmbeddedObject *bObject = CEmbeddedObject::NewL(KTestUniqueId(), KTestName(), KTestMimeType(), EContentObject);
791 CEmbeddedObject *cObject = CEmbeddedObject::NewL(KTestUniqueId(), KTestName(), KTestMimeType(), EContentObject);
793 array.AppendL(aObject);
794 array.AppendL(bObject);
795 array.AppendL(cObject);
799 CBufFlat* buf = CBufFlat::NewL(50);
800 CleanupStack::PushL(buf);
802 // create write stream
803 RBufWriteStream writeStream(*buf);
804 CleanupClosePushL(writeStream);
806 // write the directory to the stream
807 array.ExternalizeL(writeStream);
808 CleanupStack::PopAndDestroy(&writeStream);
810 // create read stream
811 RBufReadStream readStream(*buf);
812 CleanupClosePushL(readStream);
814 // construct a new CSupplierOutputFile from the stream
815 RStreamablePtrArray <CEmbeddedObject> bArray;
816 bArray.InternalizeL(readStream);
817 CleanupStack::PopAndDestroy(&readStream);
819 if(array.Count() != bArray.Count())
821 SetTestStepResult(EFail);
824 for(TInt i=0; i < array.Count(); i++)
826 if(array[i]->UniqueId() != bArray[i]->UniqueId())
828 SetTestStepResult(EFail);
831 if(array[i]->Name() != bArray[i]->Name())
833 SetTestStepResult(EFail);
837 CleanupStack::PopAndDestroy(buf);
843 return TestStepResult();
846 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
848 CCafHelperStep::~CCafHelperStep()
852 CCafHelperStep::CCafHelperStep()
854 SetTestStepName(KCAFHelperStep);
858 TVerdict CCafHelperStep::doTestStepL()
860 SetTestStepResult(EFail);
866 GetIntFromConfig(ConfigSection(),_L("error"),error);
869 GetIntFromConfig(ConfigSection(),_L("expected"),expectedValue);
873 if (!GetStringFromConfig(ConfigSection(), _L("uri"), uri))
875 INFO_PRINTF1(_L("CCafHelper test : HeaderData case."));
876 result = TestHeaderDataCaseL(error);
881 TBool isFileName = EFalse;
882 GetBoolFromConfig(ConfigSection(),_L("flag"),isFileName);
885 if(isFileName == EFalse)
887 INFO_PRINTF1(_L("CCafHelper test : FileHandle case."));
888 result = TestFileHandleCaseL(error, uri);
894 INFO_PRINTF1(_L("CCafHelper test : FileName case."));
896 CCAFHelper* helperObj = CCAFHelper::NewL();
897 CleanupStack::PushL(helperObj);
899 result = (*helperObj)().HandleCAFErrorL(error, uri);
900 CleanupStack::PopAndDestroy(helperObj);
904 if(result == expectedValue)
906 SetTestStepResult(EPass);
911 return TestStepResult();
914 TInt CCafHelperStep::TestFileHandleCaseL(TInt aError, const TDesC& aFileName)
919 User::LeaveIfError(fs.Connect());
920 CleanupClosePushL(fs);
921 User::LeaveIfError(fileHandle.Open(fs, aFileName, EFileRead));
922 CleanupClosePushL(fileHandle);
924 CCAFHelper* helperObj = CCAFHelper::NewL();
925 CleanupStack::PushL(helperObj);
926 TInt result = (*helperObj)().HandleCAFErrorL(aError, fileHandle);
927 CleanupStack::PopAndDestroy(3, &fs);
933 TInt CCafHelperStep::TestHeaderDataCaseL(TInt aError)
935 _LIT8(KFileHeaderData,"W\0R\0M\0H\0E\0A\0D\0E\0R\0");
938 CCAFHelper* helperObj = CCAFHelper::NewL();
939 CleanupStack::PushL(helperObj);
941 TInt result = (*helperObj)().HandleCAFErrorL(aError, KFileHeaderData);
942 CleanupStack::PopAndDestroy(helperObj);
948 #endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT