contentmgmt/referencedrmagent/tcaf/source/CafutilsStep.cpp
changeset 108 ca9a0fc2f082
parent 85 1efb81185f1c
equal deleted inserted replaced
102:deec7e509f66 108:ca9a0fc2f082
     1 /*
     1 /*
     2 * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of the License "Eclipse Public License v1.0"
     5 * under the terms of the License "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    59 	CDir *fileList = NULL;
    59 	CDir *fileList = NULL;
    60 	User::LeaveIfError(manager->GetDir(KTcafDir(),KNullUid, ESortByName, fileList));
    60 	User::LeaveIfError(manager->GetDir(KTcafDir(),KNullUid, ESortByName, fileList));
    61 	
    61 	
    62 	CDirStreamable *newFileList = CDirStreamable::NewL(*fileList);
    62 	CDirStreamable *newFileList = CDirStreamable::NewL(*fileList);
    63 	delete fileList;
    63 	delete fileList;
       
    64 
       
    65 	CleanupStack::PushL(newFileList);
    64 	
    66 	
    65 	// Create a buffer
    67 	// Create a buffer
    66 	CBufFlat* buf = CBufFlat::NewL(50);
    68 	CBufFlat* buf = CBufFlat::NewL(50);
    67 	CleanupStack::PushL(buf);
    69 	CleanupStack::PushL(buf);
    68 	
    70 	
    94 			}
    96 			}
    95 		}
    97 		}
    96 	
    98 	
    97 	CleanupStack::PopAndDestroy(buf);
    99 	CleanupStack::PopAndDestroy(buf);
    98 	
   100 	
    99 	delete newFileList;
   101 	CleanupStack::PopAndDestroy(newFileList); 
       
   102 
   100 	delete streamDir;
   103 	delete streamDir;
   101 	CleanupStack::PopAndDestroy(manager);
   104 	CleanupStack::PopAndDestroy(manager);
   102 	
   105 	
   103 	__UHEAP_MARKEND;
   106 	__UHEAP_MARKEND;
   104 
   107 
   122 	INFO_PRINTF1(_L("CRAttributeSet streaming test"));
   125 	INFO_PRINTF1(_L("CRAttributeSet streaming test"));
   123 	
   126 	
   124 	__UHEAP_MARK;
   127 	__UHEAP_MARK;
   125 	
   128 	
   126 
   129 
   127 	RAttributeSet aSet;
   130 	RAttributeSet tempSet;
   128 	CleanupClosePushL(aSet);
   131 	CleanupClosePushL(tempSet);
   129 	aSet.AddL(EIsProtected);
   132 	tempSet.AddL(EIsProtected);
   130 	aSet.AddL(EIsForwardable);
   133 	tempSet.AddL(EIsForwardable);
   131 	aSet.AddL(EIsForwardable);
   134 	tempSet.AddL(EIsForwardable);
   132 	
   135 	
   133 	aSet.SetValue(EIsProtected, (TInt) ETrue, KErrNone);
   136 	tempSet.SetValue(EIsProtected, (TInt) ETrue, KErrNone);
   134 	aSet.SetValue(EIsForwardable, (TInt) EFalse, KErrNone);
   137 	tempSet.SetValue(EIsForwardable, (TInt) EFalse, KErrNone);
   135 		
   138 		
   136 	// Create a buffer
   139 	// Create a buffer
   137 	CBufFlat* buf = CBufFlat::NewL(50);
   140 	CBufFlat* buf = CBufFlat::NewL(50);
   138 	CleanupStack::PushL(buf);
   141 	CleanupStack::PushL(buf);
   139 	
   142 	
   140 	// create write stream
   143 	// create write stream
   141 	RBufWriteStream writeStream(*buf);
   144 	RBufWriteStream writeStream(*buf);
   142 	CleanupClosePushL(writeStream);
   145 	CleanupClosePushL(writeStream);
   143 
   146 
   144 	// write the directory to the stream
   147 	// write the directory to the stream
   145 	aSet.ExternalizeL(writeStream);
   148 	tempSet.ExternalizeL(writeStream);
   146 	CleanupStack::PopAndDestroy(&writeStream);
   149 	CleanupStack::PopAndDestroy(&writeStream);
   147 
   150 
   148 	// create read stream
   151 	// create read stream
   149 	RBufReadStream readStream(*buf);
   152 	RBufReadStream readStream(*buf);
   150 	CleanupClosePushL(readStream);
   153 	CleanupClosePushL(readStream);
   153 	RAttributeSet bSet;
   156 	RAttributeSet bSet;
   154 	CleanupClosePushL(bSet);
   157 	CleanupClosePushL(bSet);
   155 	bSet.InternalizeL(readStream);
   158 	bSet.InternalizeL(readStream);
   156 		
   159 		
   157 	TInt valueA, valueB;
   160 	TInt valueA, valueB;
   158 	if(aSet.Count() != bSet.Count())
   161 	if(tempSet.Count() != bSet.Count())
   159 		{
   162 		{
   160 		SetTestStepResult(EFail);
   163 		SetTestStepResult(EFail);
   161 		}
   164 		}
   162 	
   165 	
   163 	for(TInt i = 0; i < aSet.Count(); i++)
   166 	for(TInt i = 0; i < tempSet.Count(); i++)
   164 		{
   167 		{
   165 		valueA = -1;
   168 		valueA = -1;
   166 		valueB = -1;
   169 		valueB = -1;
   167 		if(aSet.GetValue(aSet[i],valueA) != bSet.GetValue(aSet[i],valueB))
   170 		if(tempSet.GetValue(tempSet[i],valueA) != bSet.GetValue(tempSet[i],valueB))
   168 			{
   171 			{
   169 			SetTestStepResult(EFail);
   172 			SetTestStepResult(EFail);
   170 			}
   173 			}
   171 			
   174 			
   172 		if(valueA != valueB)
   175 		if(valueA != valueB)
   176 		}
   179 		}
   177 	
   180 	
   178 	CleanupStack::PopAndDestroy(&bSet);
   181 	CleanupStack::PopAndDestroy(&bSet);
   179 	CleanupStack::PopAndDestroy(&readStream);
   182 	CleanupStack::PopAndDestroy(&readStream);
   180 	CleanupStack::PopAndDestroy(buf);
   183 	CleanupStack::PopAndDestroy(buf);
   181 	CleanupStack::PopAndDestroy(&aSet);
   184 	CleanupStack::PopAndDestroy(&tempSet);
   182 	
   185 	
   183 	__UHEAP_MARKEND;
   186 	__UHEAP_MARKEND;
   184 
   187 
   185 	return TestStepResult();
   188 	return TestStepResult();
   186 	}
   189 	}
   204 	
   207 	
   205 	_LIT(KMimeType,"mime/type");
   208 	_LIT(KMimeType,"mime/type");
   206 
   209 
   207 	__UHEAP_MARK;
   210 	__UHEAP_MARK;
   208 	
   211 	
   209 	RStringAttributeSet aSet;
   212 	RStringAttributeSet tempSet;
   210 	CleanupClosePushL(aSet);
   213 	CleanupClosePushL(tempSet);
   211 	aSet.AddL(EMimeType);
   214 	tempSet.AddL(EMimeType);
   212 	aSet.AddL(EDescription);
   215 	tempSet.AddL(EDescription);
   213 	
   216 	
   214 	// Set some values, normally be done by the agent
   217 	// Set some values, normally be done by the agent
   215 	aSet.SetValue(EMimeType, KMimeType(), KErrNone);	
   218 	tempSet.SetValue(EMimeType, KMimeType(), KErrNone);	
   216 	aSet.SetValue(EDescription, KNullDesC(), KErrNotSupported);	
   219 	tempSet.SetValue(EDescription, KNullDesC(), KErrNotSupported);	
   217 	
   220 	
   218 	// Create a buffer
   221 	// Create a buffer
   219 	CBufFlat* buf = CBufFlat::NewL(50);
   222 	CBufFlat* buf = CBufFlat::NewL(50);
   220 	CleanupStack::PushL(buf);
   223 	CleanupStack::PushL(buf);
   221 	
   224 	
   222 	// create write stream
   225 	// create write stream
   223 	RBufWriteStream writeStream(*buf);
   226 	RBufWriteStream writeStream(*buf);
   224 	CleanupClosePushL(writeStream);
   227 	CleanupClosePushL(writeStream);
   225 
   228 
   226 	// write the directory to the stream
   229 	// write the directory to the stream
   227 	aSet.ExternalizeL(writeStream);
   230 	tempSet.ExternalizeL(writeStream);
   228 	CleanupStack::PopAndDestroy(&writeStream);
   231 	CleanupStack::PopAndDestroy(&writeStream);
   229 
   232 
   230 	// create read stream
   233 	// create read stream
   231 	RBufReadStream readStream(*buf);
   234 	RBufReadStream readStream(*buf);
   232 	CleanupClosePushL(readStream);
   235 	CleanupClosePushL(readStream);
   236 	CleanupClosePushL(bSet);
   239 	CleanupClosePushL(bSet);
   237 	bSet.InternalizeL(readStream);
   240 	bSet.InternalizeL(readStream);
   238 		
   241 		
   239 	TBuf <1024> valueA;
   242 	TBuf <1024> valueA;
   240 	TBuf <1024> valueB;
   243 	TBuf <1024> valueB;
   241 	if(aSet.Count() != bSet.Count())
   244 	if(tempSet.Count() != bSet.Count())
   242 		{
   245 		{
   243 		SetTestStepResult(EFail);
   246 		SetTestStepResult(EFail);
   244 		}
   247 		}
   245 	
   248 	
   246 	for(TInt i = 0; i < aSet.Count(); i++)
   249 	for(TInt i = 0; i < tempSet.Count(); i++)
   247 		{
   250 		{
   248 		valueA.SetLength(0);
   251 		valueA.SetLength(0);
   249 		valueB.SetLength(0);
   252 		valueB.SetLength(0);
   250 		if(aSet.GetValue(aSet[i],valueA) != bSet.GetValue(aSet[i],valueB))
   253 		if(tempSet.GetValue(tempSet[i],valueA) != bSet.GetValue(tempSet[i],valueB))
   251 			{
   254 			{
   252 			SetTestStepResult(EFail);
   255 			SetTestStepResult(EFail);
   253 			}
   256 			}
   254 			
   257 			
   255 		if(valueA != valueB)
   258 		if(valueA != valueB)
   259 		}
   262 		}
   260 	
   263 	
   261 	CleanupStack::PopAndDestroy(&bSet);
   264 	CleanupStack::PopAndDestroy(&bSet);
   262 	CleanupStack::PopAndDestroy(&readStream);
   265 	CleanupStack::PopAndDestroy(&readStream);
   263 	CleanupStack::PopAndDestroy(buf);
   266 	CleanupStack::PopAndDestroy(buf);
   264 	CleanupStack::PopAndDestroy(&aSet);
   267 	CleanupStack::PopAndDestroy(&tempSet);
   265 	
   268 	
   266 	__UHEAP_MARKEND;
   269 	__UHEAP_MARKEND;
   267 
   270 
   268 	return TestStepResult();
   271 	return TestStepResult();
   269 	}
   272 	}
   291 	
   294 	
   292 
   295 
   293 	__UHEAP_MARK;
   296 	__UHEAP_MARK;
   294 	
   297 	
   295 	CSupplierOutputFile *outputFile = CSupplierOutputFile::NewL(KDummyName(), EContent, KDummyType());
   298 	CSupplierOutputFile *outputFile = CSupplierOutputFile::NewL(KDummyName(), EContent, KDummyType());
       
   299 
       
   300 	CleanupStack::PushL(outputFile);
   296 	
   301 	
   297 	// Create a buffer
   302 	// Create a buffer
   298 	CBufFlat* buf = CBufFlat::NewL(50);
   303 	CBufFlat* buf = CBufFlat::NewL(50);
   299 	CleanupStack::PushL(buf);
   304 	CleanupStack::PushL(buf);
   300 	
   305 	
   311 	CleanupClosePushL(readStream);
   316 	CleanupClosePushL(readStream);
   312 
   317 
   313 	// construct a new CSupplierOutputFile from the stream
   318 	// construct a new CSupplierOutputFile from the stream
   314 	CSupplierOutputFile *outputFile2= CSupplierOutputFile::NewL(readStream);
   319 	CSupplierOutputFile *outputFile2= CSupplierOutputFile::NewL(readStream);
   315 	CleanupStack::PopAndDestroy(&readStream);
   320 	CleanupStack::PopAndDestroy(&readStream);
       
   321 
       
   322 	CleanupStack::PushL(outputFile2);
   316 	
   323 	
   317 	if(outputFile->FileName() != outputFile2->FileName())
   324 	if(outputFile->FileName() != outputFile2->FileName())
   318 			{
   325 			{
   319 			SetTestStepResult(EFail);
   326 			SetTestStepResult(EFail);
   320 			}
   327 			}
   325 	if(outputFile->MimeTypeL() != outputFile2->MimeTypeL())
   332 	if(outputFile->MimeTypeL() != outputFile2->MimeTypeL())
   326 			{
   333 			{
   327 			SetTestStepResult(EFail);
   334 			SetTestStepResult(EFail);
   328 			}
   335 			}
   329 	
   336 	
   330 	CleanupStack::PopAndDestroy(buf);
   337 	CleanupStack::PopAndDestroy(3); // Relinquishes buf, outputFile and outputFile2.	
   331 	
       
   332 	delete outputFile;
       
   333 	delete outputFile2;
       
   334 	
   338 	
   335 	__UHEAP_MARKEND;
   339 	__UHEAP_MARKEND;
   336 
   340 
   337 	return TestStepResult();
   341 	return TestStepResult();
   338 	}
   342 	}
   452 	INFO_PRINTF1(_L("CEmbeddedObject test"));
   456 	INFO_PRINTF1(_L("CEmbeddedObject test"));
   453 	
   457 	
   454 
   458 
   455 	__UHEAP_MARK;
   459 	__UHEAP_MARK;
   456 	
   460 	
   457 	CEmbeddedObject *aObject = CEmbeddedObject::NewL(KTestUniqueId(), KTestName(), KTestMimeType(), EContentObject);
   461     CEmbeddedObject *tempObject = CEmbeddedObject::NewL(KTestUniqueId(), KTestName(), KTestMimeType(), EContentObject);
       
   462     CleanupStack::PushL(tempObject);
   458 	
   463 	
   459 	// Create a buffer
   464 	// Create a buffer
   460 	CBufFlat* buf = CBufFlat::NewL(50);
   465 	CBufFlat* buf = CBufFlat::NewL(50);
   461 	CleanupStack::PushL(buf);
   466 	CleanupStack::PushL(buf);
   462 	
   467 	
   463 	// create write stream
   468 	// create write stream
   464 	RBufWriteStream writeStream(*buf);
   469 	RBufWriteStream writeStream(*buf);
   465 	CleanupClosePushL(writeStream);
   470 	CleanupClosePushL(writeStream);
   466 
   471 
   467 	// write the directory to the stream
   472 	// write the directory to the stream
   468 	aObject->ExternalizeL(writeStream);
   473     tempObject ->ExternalizeL(writeStream);
   469 	CleanupStack::PopAndDestroy(&writeStream);
   474 	CleanupStack::PopAndDestroy(&writeStream);
   470 
   475 
   471 	// create read stream
   476 	// create read stream
   472 	RBufReadStream readStream(*buf);
   477 	RBufReadStream readStream(*buf);
   473 	CleanupClosePushL(readStream);
   478 	CleanupClosePushL(readStream);
   475 	// construct a new CSupplierOutputFile from the stream
   480 	// construct a new CSupplierOutputFile from the stream
   476 	CEmbeddedObject *bObject= CEmbeddedObject::NewL(readStream);
   481 	CEmbeddedObject *bObject= CEmbeddedObject::NewL(readStream);
   477 	CleanupStack::PopAndDestroy(&readStream);
   482 	CleanupStack::PopAndDestroy(&readStream);
   478 	
   483 	
   479 	
   484 	
   480 	if(aObject->UniqueId() != bObject->UniqueId())
   485     if(tempObject ->UniqueId() != bObject->UniqueId())
   481 			{
   486 			{
   482 			SetTestStepResult(EFail);
   487 			SetTestStepResult(EFail);
   483 			}
   488 			}
   484 			
   489 			
   485 	if(aObject->Name() != bObject->Name())
   490     if(tempObject ->Name() != bObject->Name())
   486 			{
   491 			{
   487 			SetTestStepResult(EFail);
   492 			SetTestStepResult(EFail);
   488 			}			
   493 			}			
   489 	if(aObject->Type() != bObject->Type())
   494     if(tempObject ->Type() != bObject->Type())
   490 			{
   495 			{
   491 			SetTestStepResult(EFail);
   496 			SetTestStepResult(EFail);
   492 			}			
   497 			}			
   493 	if(aObject->MimeType() != bObject->MimeType())
   498     if(tempObject ->MimeType() != bObject->MimeType())
   494 			{
   499 			{
   495 			SetTestStepResult(EFail);
   500 			SetTestStepResult(EFail);
   496 			}			
   501 			}			
   497 	
   502 	
   498 	CleanupStack::PopAndDestroy(buf);
   503 	CleanupStack::PopAndDestroy(buf);
   499 	delete aObject;
   504 
       
   505     CleanupStack::PopAndDestroy(tempObject );
   500 	delete bObject;
   506 	delete bObject;
   501 	
   507 	
   502 	__UHEAP_MARKEND;
   508 	__UHEAP_MARKEND;
   503 
   509 
   504 	return TestStepResult();
   510 	return TestStepResult();
   615 		delete heapPath;
   621 		delete heapPath;
   616 		heapPath=NULL;
   622 		heapPath=NULL;
   617 		}
   623 		}
   618 
   624 
   619 
   625 
   620 	CVirtualPath *aPath= CVirtualPath::NewL(KTestUri(), KTestUniqueId());
   626 	CVirtualPath *tempPath= CVirtualPath::NewL(KTestUri(), KTestUniqueId());
   621 	
   627 	
       
   628 	CleanupStack::PushL(tempPath);
   622 	// Create a buffer
   629 	// Create a buffer
   623 	CBufFlat* buf = CBufFlat::NewL(50);
   630 	CBufFlat* buf = CBufFlat::NewL(50);
   624 	CleanupStack::PushL(buf);
   631 	CleanupStack::PushL(buf);
   625 	
   632 	
   626 	// create write stream
   633 	// create write stream
   627 	RBufWriteStream writeStream(*buf);
   634 	RBufWriteStream writeStream(*buf);
   628 	CleanupClosePushL(writeStream);
   635 	CleanupClosePushL(writeStream);
   629 
   636 
   630 	// write the directory to the stream
   637 	// write the directory to the stream
   631 	aPath->ExternalizeL(writeStream);
   638 	tempPath->ExternalizeL(writeStream);
   632 	CleanupStack::PopAndDestroy(&writeStream);
   639 	CleanupStack::PopAndDestroy(&writeStream);
   633 
   640 
   634 	// create read stream
   641 	// create read stream
   635 	RBufReadStream readStream(*buf);
   642 	RBufReadStream readStream(*buf);
   636 	CleanupClosePushL(readStream);
   643 	CleanupClosePushL(readStream);
   637 
   644 
   638 	// construct a new CSupplierOutputFile from the stream
   645 	// construct a new CSupplierOutputFile from the stream
   639 	CVirtualPath *bPath= CVirtualPath::NewL(readStream);
   646 	CVirtualPath *bPath= CVirtualPath::NewL(readStream);
   640 	CleanupStack::PopAndDestroy(&readStream);
   647 	CleanupStack::PopAndDestroy(&readStream);
   641 	
   648 	
   642 	
   649 	CleanupStack::PushL(bPath);  
   643 	if(aPath->UniqueId() != bPath->UniqueId())
   650 	
       
   651 	if(tempPath->UniqueId() != bPath->UniqueId())
   644 			{
   652 			{
   645 			SetTestStepResult(EFail);
   653 			SetTestStepResult(EFail);
   646 			}
   654 			}
   647 			
   655 			
   648 	if(aPath->URI() != bPath->URI())
   656 	if(tempPath->URI() != bPath->URI())
   649 			{
   657 			{
   650 			SetTestStepResult(EFail);
   658 			SetTestStepResult(EFail);
   651 			}			
   659 			}			
   652 
   660 
   653 	// Test that if a uniqueID of length greater than ContentAccess::KMaxCafUniqueId
   661 	// Test that if a uniqueID of length greater than ContentAccess::KMaxCafUniqueId
   654 	// is given then it will not treat it as a valid uniqueID
   662 	// 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);
   663 	HBufC* longUID = HBufC::NewLC(tempPath->UniqueId().Length() * 100+tempPath->URI().Length()+1);
   656 	longUID->Des().Append(aPath->URI());
   664 	longUID->Des().Append(tempPath->URI());
   657 	longUID->Des().Append(KCafVirtualPathSeparator);
   665 	longUID->Des().Append(KCafVirtualPathSeparator);
   658 	// create a very long concatenated URI and UniqueID
   666 	// create a very long concatenated URI and UniqueID
   659 	for ( i = 0; i < 100; ++i )
   667 	for ( i = 0; i < 100; ++i )
   660 		{
   668 		{
   661 		longUID->Des().Append(aPath->UniqueId());
   669 		longUID->Des().Append(tempPath->UniqueId());
   662 		}
   670 		}
   663 	// create a TVirtualPathPtr with the concatenated URI and UniqueID
   671 	// create a TVirtualPathPtr with the concatenated URI and UniqueID
   664 	TVirtualPathPtr longPath(longUID->Des());
   672 	TVirtualPathPtr longPath(longUID->Des());
   665 	// check if the expected URI and UniqueID are stored
   673 	// check if the expected URI and UniqueID are stored
   666 	if(longPath.URI()!=longUID->Des())
   674 	if(longPath.URI()!=longUID->Des())
   670 	if(longPath.UniqueId()!=KDefaultUniqueID)
   678 	if(longPath.UniqueId()!=KDefaultUniqueID)
   671 		{
   679 		{
   672 		SetTestStepResult(EFail);
   680 		SetTestStepResult(EFail);
   673 		}
   681 		}
   674 		
   682 		
   675 	CleanupStack::PopAndDestroy(longUID);
   683 	CleanupStack::PopAndDestroy(4);	// Relinquishes longUID, bPath, buf, tempPath.
   676 	CleanupStack::PopAndDestroy(buf);
       
   677 	delete aPath;
       
   678 	delete bPath;
       
   679 	
   684 	
   680 	
   685 	
   681 	__UHEAP_MARKEND;
   686 	__UHEAP_MARKEND;
   682 
   687 
   683 	return TestStepResult();
   688 	return TestStepResult();
   705 	INFO_PRINTF1(_L("CRightsInfo test"));
   710 	INFO_PRINTF1(_L("CRightsInfo test"));
   706 	
   711 	
   707 
   712 
   708 	__UHEAP_MARK;
   713 	__UHEAP_MARK;
   709 	
   714 	
   710 	CRightsInfo *aRights= CRightsInfo::NewL(KTestDescription(), KTestUniqueId(), ERightsTypeConsumable, ERightsStatusNone);
   715 	CRightsInfo *tempRights= CRightsInfo::NewL(KTestDescription(), KTestUniqueId(), ERightsTypeConsumable, ERightsStatusNone);
   711 	
   716 
       
   717 	CleanupStack::PushL(tempRights);	
   712 	
   718 	
   713 	// Create a buffer
   719 	// Create a buffer
   714 	CBufFlat* buf = CBufFlat::NewL(50);
   720 	CBufFlat* buf = CBufFlat::NewL(50);
   715 	CleanupStack::PushL(buf);
   721 	CleanupStack::PushL(buf);
   716 	
   722 	
   717 	// create write stream
   723 	// create write stream
   718 	RBufWriteStream writeStream(*buf);
   724 	RBufWriteStream writeStream(*buf);
   719 	CleanupClosePushL(writeStream);
   725 	CleanupClosePushL(writeStream);
   720 
   726 
   721 	// write the directory to the stream
   727 	// write the directory to the stream
   722 	aRights->ExternalizeL(writeStream);
   728 	tempRights->ExternalizeL(writeStream);
   723 	CleanupStack::PopAndDestroy(&writeStream);
   729 	CleanupStack::PopAndDestroy(&writeStream);
   724 
   730 
   725 	// create read stream
   731 	// create read stream
   726 	RBufReadStream readStream(*buf);
   732 	RBufReadStream readStream(*buf);
   727 	CleanupClosePushL(readStream);
   733 	CleanupClosePushL(readStream);
   729 	// construct a new CSupplierOutputFile from the stream
   735 	// construct a new CSupplierOutputFile from the stream
   730 	CRightsInfo *bRights= CRightsInfo::NewL(readStream);
   736 	CRightsInfo *bRights= CRightsInfo::NewL(readStream);
   731 	CleanupStack::PopAndDestroy(&readStream);
   737 	CleanupStack::PopAndDestroy(&readStream);
   732 	
   738 	
   733 	
   739 	
   734 	if(aRights->UniqueId() != bRights->UniqueId())
   740 	if(tempRights->UniqueId() != bRights->UniqueId())
   735 			{
   741 			{
   736 			SetTestStepResult(EFail);
   742 			SetTestStepResult(EFail);
   737 			}
   743 			}
   738 			
   744 			
   739 	if(aRights->Description() != bRights->Description())
   745 	if(tempRights->Description() != bRights->Description())
   740 			{
   746 			{
   741 			SetTestStepResult(EFail);
   747 			SetTestStepResult(EFail);
   742 			}			
   748 			}			
   743 
   749 
   744 	if(aRights->RightsType() != bRights->RightsType())
   750 	if(tempRights->RightsType() != bRights->RightsType())
   745 			{
   751 			{
   746 			SetTestStepResult(EFail);
   752 			SetTestStepResult(EFail);
   747 			}			
   753 			}			
   748 
   754 
   749 	if(aRights->RightsStatus() != bRights->RightsStatus())
   755 	if(tempRights->RightsStatus() != bRights->RightsStatus())
   750 			{
   756 			{
   751 			SetTestStepResult(EFail);
   757 			SetTestStepResult(EFail);
   752 			}			
   758 			}			
   753 	
   759 	
   754 	CleanupStack::PopAndDestroy(buf);
   760 	CleanupStack::PopAndDestroy(buf);
   755 	delete aRights;
   761 
       
   762 	CleanupStack::PopAndDestroy(tempRights); 
       
   763 
   756 	delete bRights;
   764 	delete bRights;
   757 	
   765 	
   758 	__UHEAP_MARKEND;
   766 	__UHEAP_MARKEND;
   759 
   767 
   760 	return TestStepResult();
   768 	return TestStepResult();
   783 	INFO_PRINTF1(_L("StreamablePtrArray test"));
   791 	INFO_PRINTF1(_L("StreamablePtrArray test"));
   784 	
   792 	
   785 	__UHEAP_MARK;
   793 	__UHEAP_MARK;
   786 	
   794 	
   787 	RStreamablePtrArray <CEmbeddedObject> array;
   795 	RStreamablePtrArray <CEmbeddedObject> array;
   788 	
   796 
   789 	CEmbeddedObject *aObject = CEmbeddedObject::NewL(KTestUniqueId(), KTestName(), KTestMimeType(), EContentObject);
   797 	CleanupClosePushL(array); // This itself is a resource. So need to be pushed in advance.
   790 	CEmbeddedObject *bObject = CEmbeddedObject::NewL(KTestUniqueId(), KTestName(), KTestMimeType(), EContentObject);
   798 	
   791 	CEmbeddedObject *cObject = CEmbeddedObject::NewL(KTestUniqueId(), KTestName(), KTestMimeType(), EContentObject);
   799 	CEmbeddedObject *e1Object = CEmbeddedObject::NewL(KTestUniqueId(), KTestName(), KTestMimeType(), EContentObject);
   792 	
   800 	CleanupStack::PushL(e1Object);
   793 	array.AppendL(aObject);
   801 	array.AppendL(e1Object);
   794 	array.AppendL(bObject);
   802 	CleanupStack::Pop(e1Object); // Immediately pop off, since the ownership has been transferred to "array".
   795 	array.AppendL(cObject);
   803 
   796 	
   804 	CEmbeddedObject *e2Object = CEmbeddedObject::NewL(KTestUniqueId(), KTestName(), KTestMimeType(), EContentObject);
       
   805 	CleanupStack::PushL(e2Object);
       
   806 	array.AppendL(e2Object);
       
   807 	CleanupStack::Pop(e2Object); // Immediately pop off, since the ownership has been transferred to "array".
       
   808 
       
   809 	CEmbeddedObject *e3Object = CEmbeddedObject::NewL(KTestUniqueId(), KTestName(), KTestMimeType(), EContentObject);
       
   810 	CleanupStack::PushL(e3Object);
       
   811 	array.AppendL(e3Object);
       
   812 	CleanupStack::Pop(e3Object); // Immediately pop off, since the ownership has been transferred to "array".
   797 
   813 
   798 	// Create a buffer
   814 	// Create a buffer
   799 	CBufFlat* buf = CBufFlat::NewL(50);
   815 	CBufFlat* buf = CBufFlat::NewL(50);
   800 	CleanupStack::PushL(buf);
   816 	CleanupStack::PushL(buf);
   801 	
   817 	
   805 
   821 
   806 	// write the directory to the stream
   822 	// write the directory to the stream
   807 	array.ExternalizeL(writeStream);
   823 	array.ExternalizeL(writeStream);
   808 	CleanupStack::PopAndDestroy(&writeStream);
   824 	CleanupStack::PopAndDestroy(&writeStream);
   809 
   825 
       
   826 	// Construct a new CSupplierOutputFile from the read stream
       
   827 	// being constructed in the next step.
       
   828 	RStreamablePtrArray <CEmbeddedObject> bArray;
       
   829 	CleanupClosePushL(bArray);
       
   830 
   810 	// create read stream
   831 	// create read stream
   811 	RBufReadStream readStream(*buf);
   832 	RBufReadStream readStream(*buf);
   812 	CleanupClosePushL(readStream);
   833 	CleanupClosePushL(readStream);
   813 
       
   814 	// construct a new CSupplierOutputFile from the stream
       
   815 	RStreamablePtrArray <CEmbeddedObject> bArray;
       
   816 	bArray.InternalizeL(readStream);
   834 	bArray.InternalizeL(readStream);
   817 	CleanupStack::PopAndDestroy(&readStream);
   835 	CleanupStack::PopAndDestroy(&readStream);
   818 	
   836 	
   819 	if(array.Count() != bArray.Count())
   837 	if(array.Count() != bArray.Count())
   820 			{
   838 			{
   831 		if(array[i]->Name() != bArray[i]->Name())
   849 		if(array[i]->Name() != bArray[i]->Name())
   832 			{
   850 			{
   833 			SetTestStepResult(EFail);
   851 			SetTestStepResult(EFail);
   834 			}			
   852 			}			
   835 		}
   853 		}
   836 	
   854 
       
   855 	CleanupStack::PopAndDestroy(&bArray);
   837 	CleanupStack::PopAndDestroy(buf);
   856 	CleanupStack::PopAndDestroy(buf);
   838 	array.Close();
   857 	CleanupStack::PopAndDestroy(&array); // Relinquishes array consisting of 
   839 	bArray.Close();
   858 										// e1Object, e2Object and e3Object.
   840 	
       
   841 	__UHEAP_MARKEND;
   859 	__UHEAP_MARKEND;
   842 
   860 
   843 	return TestStepResult();
   861 	return TestStepResult();
   844 	}
   862 	}
       
   863 
   845 
   864 
   846 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
   865 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
   847 
   866 
   848 CCafHelperStep::~CCafHelperStep()
   867 CCafHelperStep::~CCafHelperStep()
   849     {     
   868     {