os/security/contentmgmt/cafstreamingsupport/test/tscaf/inc/tscafstep.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/security/contentmgmt/cafstreamingsupport/test/tscaf/inc/tscafstep.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,154 @@
     1.4 +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// Defines the basic test step for the Streaming CAF test harness
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +/**
    1.22 + @file 
    1.23 + @internalComponent
    1.24 + @test
    1.25 +*/
    1.26 +
    1.27 +#ifndef TSCAFSTEP_H_
    1.28 +#define TSCAFSTEP_H_
    1.29 +
    1.30 +#include <test/testexecutestepbase.h>
    1.31 +#include <caf/streaming/keystreamdecoder.h>
    1.32 +#include "testagentkeystreamdecoder.h"
    1.33 +#include "testsingleprocesskeystreamdecoder.h"
    1.34 +#include "testkeystreamsink.h"
    1.35 +#include "srarightsobject.h"
    1.36 +#include "tscafserver.h"
    1.37 +#include "tscafdefs.h"
    1.38 +#include <f32file.h>
    1.39 +#include <s32file.h>
    1.40 +
    1.41 +using namespace StreamAccess;
    1.42 +class CSdpMediaField;
    1.43 +class CSdpDocument;
    1.44 +
    1.45 +class TSdpAttribute
    1.46 +/**
    1.47 + * Data storage class containing the information about a single SDP Attribute
    1.48 + */
    1.49 +	{
    1.50 +public:
    1.51 +	TSdpAttribute();
    1.52 +	
    1.53 +	TPtrC	iAttributeType;
    1.54 +	TPtrC	iAttributeName;
    1.55 +	TPtrC	iAttributeValue;
    1.56 +	};
    1.57 +
    1.58 +
    1.59 +class CTestDecoderConfiguration : public CBase
    1.60 +/**
    1.61 + * Container class storing the parameters and attributes retreived from the configuration file
    1.62 + * that are required to construct a key stream decoder object 
    1.63 + */
    1.64 +	{
    1.65 +public:
    1.66 +	static CTestDecoderConfiguration* NewLC();
    1.67 +	~CTestDecoderConfiguration();
    1.68 +	
    1.69 +	TBool	iSingleProcessAgent;
    1.70 +	TPtrC	iPrivateFolderPath;
    1.71 +	TPtrC	iMedia;					
    1.72 +	TPtrC	iProtocol;
    1.73 +	TInt	iPort;
    1.74 +	TPtrC	iFormat;
    1.75 +	TPtrC   iConnAddr; ///< SDP connection field's IP address
    1.76 +	
    1.77 +	// Array of sdp meta data attributes
    1.78 +	RArray<TSdpAttribute> iAttributeArray;
    1.79 +	
    1.80 +protected:
    1.81 +	CTestDecoderConfiguration();
    1.82 +	};
    1.83 +
    1.84 +
    1.85 +class TExpectedKeyStreamDecoderAttributes
    1.86 +	{
    1.87 +/**
    1.88 + * Data storage class containing expected values for the attributes associated to a particular
    1.89 + * Key Stream Decoder
    1.90 + */
    1.91 +public:
    1.92 +	TExpectedKeyStreamDecoderAttributes();
    1.93 +	
    1.94 +	TBool IsProgramProtected;
    1.95 +	TBool IsServiceProtected;
    1.96 +	TBool CanExport;
    1.97 +	TBool MustProtectIfRecording;
    1.98 +	TBool CanPlay;
    1.99 +	
   1.100 +	TPtrC ContentId;
   1.101 +	TPtrC RightsIssuerUri;
   1.102 +	};	
   1.103 +
   1.104 +
   1.105 +class CScafStep : public CTestStep
   1.106 +/**
   1.107 + 	Base class used to provide handy functions available to test step classes.
   1.108 + */
   1.109 +	{
   1.110 +public:
   1.111 +	virtual ~CScafStep();
   1.112 +	
   1.113 +	TVerdict doTestStepPreambleL();
   1.114 +	TVerdict doTestStepL();
   1.115 +	TVerdict doTestStepPostambleL();
   1.116 +	void CleanAgentsPrivateFolderL(const TDesC& aPrivatePath);
   1.117 +	CSdpDocument* CreateSdpDocumentLC();
   1.118 +	CSdpMediaField* CreateSdpLC(TInt aSdpNum);
   1.119 +	void AddMediaFieldL(CSdpDocument& aSdpDoc, const CSdpMediaField* aSdpKeyStream);
   1.120 +	CKeyStreamSink* CreateKeyStreamSinkLC(const TDesC& aFilePath, const TDesC& aPrivPath);
   1.121 +	void CopyFile2AgentsPrivateFolderL(RFs& aFs, const TDesC& aFileName, const TDesC& aPrivPath);
   1.122 +	HBufC* GetFullPathLC(const TDesC& aPath, const TDesC& aFileName);
   1.123 +	CSraRightsObject* GetRightsObjectLC(const TDesC& aName, const TDesC& aPrivPath);
   1.124 +	void ReadTestConfigurationL();
   1.125 +	TBool CheckKeyStreamDecoderAttributesL(const CKeyStreamDecoder& aDecoder, 
   1.126 +											const TExpectedKeyStreamDecoderAttributes& aExpectedData);
   1.127 +	
   1.128 +protected:
   1.129 +	CScafStep(CScafServer& aParent);
   1.130 +	TPtr8 Convert16To8LC(TDesC& aDes);
   1.131 +	TVerdict doOOMTestL();
   1.132 +	virtual TVerdict doTestL();
   1.133 +	TBool CompareBooleanAttributeL(const CKeyStreamDecoder& aDecoder,
   1.134 +									const TAttribute& aAttributeEnum,
   1.135 +									const TDesC& aAttributeDescription,
   1.136 +									const TBool aExpectedValue);
   1.137 +	TBool CompareStringAttributeL(const CKeyStreamDecoder& aDecoder,
   1.138 +									const TStringAttribute& aAttributeEnum,
   1.139 +									const TDesC& aAttributeDescription,
   1.140 +									const TDesC& aExpectedValue);
   1.141 +	
   1.142 +private:
   1.143 +	void AddAttributes2SdpL(CSdpMediaField& aSdp, TInt aSdpNum);
   1.144 +	void PrintErrorAndLeaveL(TDesC& aKey);
   1.145 +	static void DeleteSdpDocAndCloseCodecPool(TAny* aSdpDoc);
   1.146 +	
   1.147 +protected:
   1.148 +	CScafServer& iParent;
   1.149 +	TInt iThreadId;
   1.150 +	TBool iOOMTest;
   1.151 +	RPointerArray<CTestDecoderConfiguration> iDecoderConfigurationArray;
   1.152 +	RArray<TExpectedKeyStreamDecoderAttributes> iExpectedKeyStreamDecoderData;
   1.153 +	
   1.154 +private:
   1.155 +	CActiveScheduler *iActiveScheduler;
   1.156 +	};
   1.157 +#endif /*TSCAFSTEP_H_*/