os/security/contentmgmt/referencedrmagent/tcaf/source/RecognizerStep.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/security/contentmgmt/referencedrmagent/tcaf/source/RecognizerStep.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,555 @@
     1.4 +/*
     1.5 +* Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of the License "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description: 
    1.18 +* cafstep.cpp
    1.19 +*
    1.20 +*/
    1.21 +
    1.22 +
    1.23 +#include <test/testexecutelog.h>
    1.24 +#include <apgcli.h>
    1.25 +#include <apmstd.h>
    1.26 +#include "cafserver.h"
    1.27 +#include "resolver.h"
    1.28 +#include "RecognizerStep.h"
    1.29 +#include "CafApaRecognizer.h"
    1.30 +
    1.31 +using namespace ContentAccess;
    1.32 +
    1.33 +const TInt KCafTestMaxDataTypeLength = 255;
    1.34 +const TInt KCAFTestApparcBufferSize = 100;
    1.35 +
    1.36 +/* 
    1.37 + * This step starts the CAF Apparc recognizer and checks to see that it recognizes the
    1.38 + * correct files
    1.39 + *
    1.40 + */
    1.41 +
    1.42 +CCAFRecognizeStep::~CCAFRecognizeStep()
    1.43 +	{
    1.44 +	}
    1.45 +
    1.46 +CCAFRecognizeStep::CCAFRecognizeStep(CCAFServer& aParent)
    1.47 +: iParent(aParent)
    1.48 +	{
    1.49 +	SetTestStepName(KCAFRecognizeStep);
    1.50 +	}
    1.51 +
    1.52 +/* Tests whether a file opened under the caf framework reports the same size as
    1.53 + * RFile.  Only works for files that are owned by the f32agent which doesn't
    1.54 + * change the content at all.
    1.55 + */
    1.56 +TVerdict CCAFRecognizeStep::doTestStepL()
    1.57 +	{
    1.58 +#ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
    1.59 +    TBool wmdrmFlag = EFalse;     
    1.60 +    GetBoolFromConfig(ConfigSection(),_L("wmdrmEnabled"), wmdrmFlag);     
    1.61 +         
    1.62 +    if(wmdrmFlag)
    1.63 +        {     
    1.64 +        TVerdict verdict = doWmdrmTestStepL();     
    1.65 +        return verdict;     
    1.66 +        }     
    1.67 +#endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT    
    1.68 +
    1.69 +	TBuf8 <KCAFTestApparcBufferSize> buf;
    1.70 +
    1.71 +	CAgentResolver *resolver;
    1.72 +	
    1.73 +	// If we leave before our DoRecognize is complete, something must have gone seriously wrong
    1.74 +	SetTestStepResult(EFail);
    1.75 +
    1.76 +	TBuf8 <KCafTestMaxDataTypeLength> ContainerMimeType;
    1.77 +	TBuf8 <KCafTestMaxDataTypeLength> ContentMimeType;
    1.78 +	TBool result;
    1.79 +	
    1.80 +	TPtrC fileName;
    1.81 +	TBool expectedresult;
    1.82 +	TPtrC expectedContainerMime, expectedContentMime;
    1.83 +
    1.84 +	// Retrieve filename to analyse and expected results from INI file
    1.85 +	GetStringFromConfig(ConfigSection(),_L("FileName"),fileName);
    1.86 +	GetStringFromConfig(ConfigSection(),_L("Container"),expectedContainerMime);
    1.87 +	GetStringFromConfig(ConfigSection(),_L("Content"),expectedContentMime);
    1.88 +	GetBoolFromConfig(ConfigSection(),_L("Recognized"),expectedresult);
    1.89 +	
    1.90 +	if(expectedresult)
    1.91 +		{
    1.92 +		INFO_PRINTF4(_L("DoRecognize Test DRM file: %S, Container Mime Type: %S, Content Mime Type: %S"),&fileName, &expectedContainerMime, &expectedContentMime);
    1.93 +		}
    1.94 +	else
    1.95 +		{
    1.96 +		INFO_PRINTF2(_L("DoRecognize Test non DRM file: %S"), &fileName);	
    1.97 +		}
    1.98 +
    1.99 +	__UHEAP_MARK;
   1.100 +
   1.101 +	// Read the first KCAFTestApparcBufferSize bytes into the buffer in the same way apparc would do
   1.102 +	ReadBufferL(fileName, buf);
   1.103 +	
   1.104 +	// Pass the filename and buffer to CAF DoRecognize function
   1.105 +	resolver = CAgentResolver::NewLC(ETrue);
   1.106 +    	
   1.107 +	result = resolver->DoRecognizeL(fileName, buf, ContainerMimeType, ContentMimeType);
   1.108 +
   1.109 +	CheckResultL(result, ContainerMimeType, ContentMimeType, expectedresult, expectedContainerMime, expectedContentMime);
   1.110 +
   1.111 +	CleanupStack::PopAndDestroy(resolver); 
   1.112 +
   1.113 +	__UHEAP_MARKEND;
   1.114 +	return TestStepResult();
   1.115 +	}
   1.116 +
   1.117 +void CCAFRecognizeStep::CheckResultL(TBool aResult, TDes8& aContainerMimeType, TDes8& aContentMimeType, TBool aExpectedResult, TDesC16& aExpectedContainerMime, TDesC16& aExpectedContentMime)
   1.118 +	{
   1.119 +	// start off by assuming recognition was ok, then check
   1.120 +	SetTestStepResult(EPass);
   1.121 +	
   1.122 +	if(aResult != aExpectedResult)
   1.123 +		{
   1.124 +		if(aResult)
   1.125 +			{
   1.126 +			INFO_PRINTF1(_L("File was incorrectly recognized as DRM"));	
   1.127 +			}
   1.128 +		else
   1.129 +			{
   1.130 +			INFO_PRINTF1(_L("File was incorrectly recognized as not DRM"));	
   1.131 +			}
   1.132 +		SetTestStepResult(EFail);
   1.133 +		return;
   1.134 +		}
   1.135 +
   1.136 +	if(!aResult) // not a drm file so we don't care about the mime types
   1.137 +		return;
   1.138 +	
   1.139 +	TInt compare;
   1.140 +
   1.141 +	// Convert TDes16 mime types read from the INI file to TPtr8's
   1.142 +	HBufC8 *container = ConvertDes16toHBufC8LC(aExpectedContainerMime);
   1.143 +	TPtr8 containerptr(container->Des());
   1.144 +
   1.145 +	HBufC8 *content = ConvertDes16toHBufC8LC(aExpectedContentMime);
   1.146 +	TPtr8 contentptr(content->Des());
   1.147 +
   1.148 +	// Compare expected Mime Types vs mime type
   1.149 +	compare = aContainerMimeType.Compare(containerptr);
   1.150 +	if(compare != 0)
   1.151 +		{
   1.152 +		INFO_PRINTF1(_L("Incorrect Container Mime Type recognized"));	
   1.153 +		SetTestStepResult(EFail);
   1.154 +		}
   1.155 +	compare = aContentMimeType.Compare(contentptr);
   1.156 +	if(compare != 0)
   1.157 +		{
   1.158 +		INFO_PRINTF1(_L("Incorrect Content Mime Type recognized"));	
   1.159 +		SetTestStepResult(EFail);
   1.160 +		}
   1.161 +	CleanupStack::PopAndDestroy(2, container);	
   1.162 +	}
   1.163 +
   1.164 +
   1.165 +/*
   1.166 + * This step starts the CAF Apparc recognizer speed test
   1.167 + * Does 1000 recognitions, log file will measure the time
   1.168 + *
   1.169 + */
   1.170 +
   1.171 +CCAFRecognizerSpeedStep::~CCAFRecognizerSpeedStep()
   1.172 +	{
   1.173 +	}
   1.174 +
   1.175 +CCAFRecognizerSpeedStep::CCAFRecognizerSpeedStep(CCAFServer& aParent) : iParent(aParent)
   1.176 +	{
   1.177 +	SetTestStepName(KCAFRecognizerSpeedStep);
   1.178 +	}
   1.179 +
   1.180 +
   1.181 +TVerdict CCAFRecognizerSpeedStep::doTestStepL()
   1.182 +	{
   1.183 +	TBuf8 <KCAFTestApparcBufferSize> buf;
   1.184 +
   1.185 +	CAgentResolver *resolver;
   1.186 +	
   1.187 +	// If we leave before our DoRecognize is complete, something must have gone seriously wrong
   1.188 +	SetTestStepResult(EFail);
   1.189 +
   1.190 +	TBuf8 <KCafTestMaxDataTypeLength> ContainerMimeType;
   1.191 +	TBuf8 <KCafTestMaxDataTypeLength> ContentMimeType;
   1.192 +	
   1.193 +	TPtrC fileName;
   1.194 +	TBool expectedresult;
   1.195 +	TPtrC expectedContainerMime, expectedContentMime;
   1.196 +
   1.197 +	// Retrieve filename to analyse and expected results from INI file
   1.198 +	GetStringFromConfig(ConfigSection(),_L("FileName"),fileName);
   1.199 +	GetStringFromConfig(ConfigSection(),_L("Container"),expectedContainerMime);
   1.200 +	GetStringFromConfig(ConfigSection(),_L("Content"),expectedContentMime);
   1.201 +	GetBoolFromConfig(ConfigSection(),_L("Recognized"),expectedresult);
   1.202 +	
   1.203 +	if(expectedresult)
   1.204 +		{
   1.205 +		INFO_PRINTF4(_L("DoRecognize Speed Test DRM file: %S, Container Mime Type: %S, Content Mime Type: %S"),&fileName, &expectedContainerMime, &expectedContentMime);
   1.206 +		}
   1.207 +	else
   1.208 +		{
   1.209 +		INFO_PRINTF2(_L("DoRecognize Speed Test non DRM file: %S"), &fileName);	
   1.210 +		}
   1.211 +
   1.212 +	__UHEAP_MARK;
   1.213 +
   1.214 +	// Read the first KCAFTestApparcBufferSize bytes into the buffer in the same way apparc would do
   1.215 +	ReadBufferL(fileName, buf);
   1.216 +	
   1.217 +	// Pass the filename and buffer to CAF DoRecognize function
   1.218 +	resolver = CAgentResolver::NewLC(ETrue);
   1.219 +
   1.220 +	INFO_PRINTF1(_L("Entering measured mile"));	
   1.221 +	
   1.222 +	for(TInt Count=0; Count < 1000; Count++)
   1.223 +		resolver->DoRecognizeL(fileName, buf, ContainerMimeType, ContentMimeType);
   1.224 +	
   1.225 +	INFO_PRINTF1(_L("passing mile marker   (1000 recognitions)"));	
   1.226 +
   1.227 +    CleanupStack::PopAndDestroy(resolver); 
   1.228 +
   1.229 +	__UHEAP_MARKEND;
   1.230 +	SetTestStepResult(EPass);
   1.231 +	return TestStepResult();
   1.232 +	}
   1.233 +
   1.234 +
   1.235 +/* 
   1.236 + * This step starts the CAF Apparc recognizer and checks to see that it recognizes the
   1.237 + * correct files
   1.238 + *
   1.239 + */
   1.240 +
   1.241 +CCAFBufferSizeStep::~CCAFBufferSizeStep()
   1.242 +	{
   1.243 +	}
   1.244 +
   1.245 +CCAFBufferSizeStep::CCAFBufferSizeStep(CCAFServer& aParent) : iParent(aParent)
   1.246 +	{
   1.247 +	SetTestStepName(KCAFBufferSizeStep);
   1.248 +	}
   1.249 +
   1.250 +
   1.251 +/* Apparc uses a buffer to pass data from the start of the file into the apparc recognizer
   1.252 +* to help it determine what mime type the file is.
   1.253 +* In CAF this recognition task is actually handed over to the agents. Each one attempts to
   1.254 +* recognize the file until one is successful or until all agents have rejected the file.
   1.255 +* Each agent may have it's own preferred size for this buffer. This is configured in each
   1.256 +* agent's RSS file, under the default_data tag.
   1.257 +* CAgentResolver::PreferredBufferSize() will return the highest value returned by any agent.
   1.258 +*/
   1.259 +TVerdict CCAFBufferSizeStep::doTestStepL()
   1.260 +	{
   1.261 +	CAgentResolver *resolver;
   1.262 +	TInt expectedBufferSize;
   1.263 +	TInt bufferSize=0;
   1.264 +
   1.265 +	SetTestStepResult(EFail);
   1.266 +
   1.267 +	
   1.268 +	// Find the expected max buffer size from the INI file
   1.269 +	GetIntFromConfig(ConfigSection(),_L("size"),expectedBufferSize);
   1.270 +
   1.271 +	INFO_PRINTF2(_L("Expected buffer size: %d"), expectedBufferSize);
   1.272 +
   1.273 +	__UHEAP_MARK;
   1.274 +
   1.275 +	
   1.276 +	resolver = CAgentResolver::NewLC(ETrue);
   1.277 +
   1.278 +	bufferSize = resolver->PreferredBufferSize();
   1.279 +
   1.280 +	INFO_PRINTF2(_L("Caf Preferred buffer size: %d"), bufferSize);
   1.281 +
   1.282 +	if(bufferSize == expectedBufferSize)
   1.283 +		{	
   1.284 +		SetTestStepResult(EPass);
   1.285 +		}	
   1.286 +    		
   1.287 +	CleanupStack::PopAndDestroy(resolver); 
   1.288 +
   1.289 +	__UHEAP_MARKEND;
   1.290 +	return TestStepResult();
   1.291 +	}
   1.292 +
   1.293 +
   1.294 +
   1.295 +CCAFApparcStep::~CCAFApparcStep()
   1.296 +	{
   1.297 +	}
   1.298 +
   1.299 +CCAFApparcStep::CCAFApparcStep(CCAFServer& aParent) : iParent(aParent)
   1.300 +	{
   1.301 +	SetTestStepName(KCAFApparcStep);
   1.302 +	}
   1.303 +
   1.304 +
   1.305 +/*
   1.306 + * This step loads the apparc recognizer and gives it a test run by 
   1.307 + * pretending to be apparc
   1.308 + * 
   1.309 + */
   1.310 +TVerdict CCAFApparcStep::doTestStepL()
   1.311 +	{
   1.312 +	TDataType dataType;
   1.313 +	TDataType dataType2;
   1.314 +	TDataType dataType3;
   1.315 +	TDataType dataTypeNull(_L8(""));	
   1.316 +	TPtrC8 mimeType(KNullDesC8);
   1.317 +	HBufC16 *displayMime;
   1.318 +	HBufC16 *displayMime2;
   1.319 +	TPtrC fileName;
   1.320 +	TPtrC uri;
   1.321 +	TPtrC expectedMimeType;
   1.322 +	TPtrC nullFileName(KNullDesC); 
   1.323 +	TUid uid = KNullUid;
   1.324 +	
   1.325 +	SetTestStepResult(EInconclusive);
   1.326 +
   1.327 +	__UHEAP_MARK;
   1.328 +
   1.329 +	// Retrieve filename to analyse and expected results from INI file
   1.330 +	GetStringFromConfig(ConfigSection(),_L("URI"),uri);
   1.331 +	GetStringFromConfig(ConfigSection(),_L("FileName"),fileName);
   1.332 +	GetStringFromConfig(ConfigSection(),_L("CafMimeType"),expectedMimeType);
   1.333 +
   1.334 +	// Use the Application Architecture Server to find the Mime type 
   1.335 +	RApaLsSession apparcSession;
   1.336 +	User::LeaveIfError(apparcSession.Connect());
   1.337 +	CleanupClosePushL(apparcSession);
   1.338 +	User::LeaveIfError(apparcSession.AppForDocument(fileName, uid, dataType));
   1.339 +
   1.340 +	RFile fileHandle;
   1.341 +	fileHandle.Open(iParent.Fs(), uri, EFileRead);
   1.342 +	User::LeaveIfError(apparcSession.AppForDocument(fileHandle, uid, dataType2));
   1.343 +
   1.344 +	// Pass in a null file name to make sure it doesn't panic 
   1.345 +	User::LeaveIfError(apparcSession.AppForDocument(nullFileName, uid, dataType3));
   1.346 +
   1.347 +	CleanupStack::PopAndDestroy(&apparcSession);	// close
   1.348 +
   1.349 +
   1.350 +	// check mime type of the file (fileName)
   1.351 +	mimeType.Set(dataType.Des8());
   1.352 +	displayMime = ConvertDes8toHBufC16LC(mimeType);
   1.353 +	TPtr16 displayPtr(displayMime->Des());
   1.354 +	if(displayPtr.Compare(expectedMimeType) != 0)
   1.355 +		{
   1.356 +		INFO_PRINTF2(_L("CAgentResolver returned a mime type of: %S"),&displayPtr);
   1.357 +		INFO_PRINTF1(_L("Please make sure the configuration file RecCafMimeTypes.txt exists for RECCAF.DLL."));
   1.358 +		SetTestStepResult(EFail);
   1.359 +		}
   1.360 +	else
   1.361 +		INFO_PRINTF3(_L("File - CAgentResolver returned a mime type of: %S, matching the expected mime type of: %S"),&displayPtr, &expectedMimeType);
   1.362 +	
   1.363 +		
   1.364 +	// check mime type of the file (fileHandle)
   1.365 +	mimeType.Set(dataType2.Des8());
   1.366 +	displayMime2 = ConvertDes8toHBufC16LC(mimeType);
   1.367 +	TPtr16 displayPtr2(displayMime2->Des());
   1.368 +	if(displayPtr2.Compare(expectedMimeType) != 0)
   1.369 +		{
   1.370 +		INFO_PRINTF2(_L("CAgentResolver returned a mime type of: %S"),&displayPtr2);
   1.371 +		INFO_PRINTF1(_L("Please make sure the configuration file RecCafMimeTypes.txt exists for RECCAF.DLL."));
   1.372 +		SetTestStepResult(EFail);
   1.373 +		}	
   1.374 +	else
   1.375 +		INFO_PRINTF3(_L("FileHandle - CAgentResolver returned a mime type of: %S, matching the expected mime type of: %S"),&displayPtr2, &expectedMimeType);
   1.376 +	
   1.377 +	// Check the returned datatype is null, when a null filename is passed in  
   1.378 +	if (dataType3 == dataTypeNull)
   1.379 +		INFO_PRINTF1(_L("A null datatype is returned, when a null file name is passed in"));
   1.380 +	else 
   1.381 +		SetTestStepResult(EFail);
   1.382 +	
   1.383 +	CleanupStack::PopAndDestroy(displayMime2);		
   1.384 +	CleanupStack::PopAndDestroy(displayMime);
   1.385 +	
   1.386 +	__UHEAP_MARKEND;
   1.387 +	
   1.388 +	if (TestStepResult() != EFail)
   1.389 +		{
   1.390 +		SetTestStepResult(EPass);
   1.391 +		}
   1.392 +	
   1.393 +	return TestStepResult();
   1.394 +	}
   1.395 +
   1.396 +/* 
   1.397 + * This test verifies that upper case Mime types can be recognized.
   1.398 + *
   1.399 + * See DEF077443: Propagated:CAF should not be performing case sensitive comparisons on MIME types
   1.400 + *
   1.401 + */
   1.402 +CCAF_DEF077443_Step::~CCAF_DEF077443_Step()
   1.403 +	{
   1.404 +	}
   1.405 +
   1.406 +CCAF_DEF077443_Step::CCAF_DEF077443_Step(CCAFServer& aParent) : iParent(aParent)
   1.407 +	{
   1.408 +	SetTestStepName(KCAF_DEF077443_Step);
   1.409 +	}
   1.410 +
   1.411 +TVerdict CCAF_DEF077443_Step::doTestStepL()
   1.412 +	{
   1.413 +	TDataType dataType;
   1.414 +	TDataType dataType2;
   1.415 +	TPtrC8 mimeType(KNullDesC8);
   1.416 +	HBufC16 *displayMime;
   1.417 +	HBufC16 *displayMime2;
   1.418 +	TPtrC upperCaseFileName;
   1.419 +	TPtrC emptyFileName;
   1.420 +	TPtrC expectedContentMimeType;
   1.421 +	TPtrC expectedFileMimeType;
   1.422 +	TUid uid = KNullUid;
   1.423 +	
   1.424 +	SetTestStepResult(EInconclusive);
   1.425 +
   1.426 +	__UHEAP_MARK;
   1.427 +
   1.428 +	// Retrieve filename to analyse and expected results from INI file.
   1.429 +	// The CAF resolver forces mime types retrieved from agents to lower case.
   1.430 +	// When recognising the file mime type and content mine type for a file the
   1.431 +	// resolver passes the request to each agent. Its possible that the agent will
   1.432 +	// not use lower case for the file mime type and content mime type. To be 
   1.433 +	// consistent the resolver should set the returned data to lower case as well.
   1.434 +	
   1.435 +	// The test agent takes content mime type from the uppercasetest.drm file.
   1.436 +	// For this case the content mime type is upper case (e.g. TEXT/PLAIN).
   1.437 +	GetStringFromConfig(ConfigSection(),_L("FileName1"), upperCaseFileName);
   1.438 +	GetStringFromConfig(ConfigSection(),_L("CafContentMimeType"), expectedContentMimeType);
   1.439 +
   1.440 +	// For a drm file with no recognised content the test agent sets the file mime type
   1.441 +	// as APPLICATION/TESTAGENT.DRM.
   1.442 +	// For this case the file emptytest.drm is used.
   1.443 +	GetStringFromConfig(ConfigSection(),_L("FileName2"), emptyFileName);
   1.444 +	GetStringFromConfig(ConfigSection(),_L("CafFileMimeType"), expectedFileMimeType);
   1.445 +	
   1.446 +	// create empty DRM file
   1.447 +	RFs fs;
   1.448 +	RFile file;
   1.449 +
   1.450 +	// remove first if exists
   1.451 +	Delete(emptyFileName);
   1.452 +
   1.453 +	fs.Connect();
   1.454 +	TInt result = file.Create(fs, emptyFileName, EFileWrite);
   1.455 +	file.Close();
   1.456 +	fs.Close(); 
   1.457 +
   1.458 +	// Use the Application Architecture Server to find the Content Mime type 
   1.459 +	RApaLsSession apparcSession;
   1.460 +	User::LeaveIfError(apparcSession.Connect());
   1.461 +	CleanupClosePushL(apparcSession);
   1.462 +	User::LeaveIfError(apparcSession.AppForDocument(upperCaseFileName, uid, dataType));
   1.463 +
   1.464 +	// Use the Application Architecture Server to find the File Mime type 
   1.465 +	User::LeaveIfError(apparcSession.AppForDocument(emptyFileName, uid, dataType2));
   1.466 +
   1.467 +	CleanupStack::PopAndDestroy(&apparcSession);	// close
   1.468 +
   1.469 +	// remove empty file
   1.470 +	Delete(emptyFileName);
   1.471 +
   1.472 +	// check content mime type
   1.473 +	mimeType.Set(dataType.Des8());
   1.474 +	displayMime = ConvertDes8toHBufC16LC(mimeType);
   1.475 +	TPtr16 displayPtr(displayMime->Des());
   1.476 +	if(displayPtr.Compare(expectedContentMimeType) != 0)
   1.477 +		{
   1.478 +		INFO_PRINTF2(_L("CAgentResolver returned a content mime type of: %S"),&displayPtr);
   1.479 +		INFO_PRINTF1(_L("Please make sure the configuration file RecCafMimeTypes.txt exists for RECCAF.DLL."));
   1.480 +		SetTestStepResult(EFail);
   1.481 +		}
   1.482 +	else
   1.483 +		INFO_PRINTF3(_L("Content - CAgentResolver returned a mime type of: %S, matching the expected mime type of: %S"),&displayPtr, &expectedContentMimeType);
   1.484 +	
   1.485 +	// check file mime type
   1.486 +	mimeType.Set(dataType2.Des8());
   1.487 +	displayMime2 = ConvertDes8toHBufC16LC(mimeType);
   1.488 +	TPtr16 displayPtr2(displayMime2->Des());
   1.489 +	if(displayPtr2.Compare(expectedFileMimeType) != 0)
   1.490 +		{
   1.491 +		INFO_PRINTF2(_L("CAgentResolver returned a file mime type of: %S"),&displayPtr2);
   1.492 +		INFO_PRINTF1(_L("Please make sure the configuration file RecCafMimeTypes.txt exists for RECCAF.DLL."));
   1.493 +		SetTestStepResult(EFail);
   1.494 +		}	
   1.495 +	else
   1.496 +		INFO_PRINTF3(_L("File - CAgentResolver returned a mime type of: %S, matching the expected mime type of: %S"),&displayPtr2, &expectedFileMimeType);
   1.497 +
   1.498 +	CleanupStack::PopAndDestroy(displayMime2);
   1.499 +	CleanupStack::PopAndDestroy(displayMime);
   1.500 +	
   1.501 +	__UHEAP_MARKEND;
   1.502 +	
   1.503 +	if (TestStepResult() != EFail)
   1.504 +		{
   1.505 +		SetTestStepResult(EPass);
   1.506 +		}
   1.507 +	
   1.508 +	return TestStepResult();
   1.509 +	}
   1.510 +	
   1.511 +#ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
   1.512 +  
   1.513 +// Tests DoRecognizeL API for WMDRM content .
   1.514 +      
   1.515 +TVerdict CCAFRecognizeStep::doWmdrmTestStepL()     
   1.516 +    {     
   1.517 +    SetTestStepResult(EFail);     
   1.518 +         
   1.519 +    TPtrC expectedFileMimeType;     
   1.520 +    GetStringFromConfig(ConfigSection(),_L("filemime"), expectedFileMimeType);     
   1.521 +         
   1.522 +    TPtrC expectedContentMimeType;     
   1.523 +    GetStringFromConfig(ConfigSection(),_L("contentmime"), expectedContentMimeType);     
   1.524 +         
   1.525 +    TBool expectedResult;     
   1.526 +    GetBoolFromConfig(ConfigSection(),_L("recognized"), expectedResult);     
   1.527 +         
   1.528 +    __UHEAP_MARK;     
   1.529 +    TPtrC header;     
   1.530 +    HBufC8* headerData = NULL;     
   1.531 +         
   1.532 +    if(GetStringFromConfig(ConfigSection(),_L("header"), header))     
   1.533 +        {     
   1.534 +        headerData = ConvertDes16toHBufC8LC(header);     
   1.535 +        }     
   1.536 +    else     
   1.537 +        {     
   1.538 +        headerData = CreateWmdrmHeaderLC();      
   1.539 +        }     
   1.540 +      
   1.541 +    // Pass the WMDRM header data to CAF DoRecognize function     
   1.542 +    CAgentResolver* resolver = CAgentResolver::NewLC(ETrue);     
   1.543 +             
   1.544 +    TBuf8 <KCafTestMaxDataTypeLength> fileMimeType;     
   1.545 +    TBuf8 <KCafTestMaxDataTypeLength> contentMimeType;     
   1.546 +             
   1.547 +    TBool result = resolver->DoRecognizeL(*headerData, fileMimeType, contentMimeType);     
   1.548 +         
   1.549 +    CheckResultL(result, fileMimeType, contentMimeType, expectedResult, expectedFileMimeType, expectedContentMimeType);     
   1.550 +      
   1.551 +    CleanupStack::PopAndDestroy(2, headerData);      
   1.552 +      
   1.553 +    __UHEAP_MARKEND;     
   1.554 +    return TestStepResult();     
   1.555 +    }     
   1.556 +      
   1.557 +#endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT 
   1.558 +