contentmgmt/cafstreamingsupport/test/tscaf/inc/tscafstep.h
branchRCL_3
changeset 43 2f10d260163b
child 61 641f389e9157
equal deleted inserted replaced
42:eb9b28acd381 43:2f10d260163b
       
     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 the License "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".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Defines the basic test step for the Streaming CAF test harness
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file 
       
    20  @internalComponent
       
    21  @test
       
    22 */
       
    23 
       
    24 #ifndef TSCAFSTEP_H_
       
    25 #define TSCAFSTEP_H_
       
    26 
       
    27 #include <test/testexecutestepbase.h>
       
    28 #include <caf/streaming/keystreamdecoder.h>
       
    29 #include "testagentkeystreamdecoder.h"
       
    30 #include "testsingleprocesskeystreamdecoder.h"
       
    31 #include "testkeystreamsink.h"
       
    32 #include "srarightsobject.h"
       
    33 #include "tscafserver.h"
       
    34 #include "tscafdefs.h"
       
    35 #include <f32file.h>
       
    36 #include <s32file.h>
       
    37 
       
    38 using namespace StreamAccess;
       
    39 class CSdpMediaField;
       
    40 class CSdpDocument;
       
    41 
       
    42 class TSdpAttribute
       
    43 /**
       
    44  * Data storage class containing the information about a single SDP Attribute
       
    45  */
       
    46 	{
       
    47 public:
       
    48 	TSdpAttribute();
       
    49 	
       
    50 	TPtrC	iAttributeType;
       
    51 	TPtrC	iAttributeName;
       
    52 	TPtrC	iAttributeValue;
       
    53 	};
       
    54 
       
    55 
       
    56 class CTestDecoderConfiguration : public CBase
       
    57 /**
       
    58  * Container class storing the parameters and attributes retreived from the configuration file
       
    59  * that are required to construct a key stream decoder object 
       
    60  */
       
    61 	{
       
    62 public:
       
    63 	static CTestDecoderConfiguration* NewLC();
       
    64 	~CTestDecoderConfiguration();
       
    65 	
       
    66 	TBool	iSingleProcessAgent;
       
    67 	TPtrC	iPrivateFolderPath;
       
    68 	TPtrC	iMedia;					
       
    69 	TPtrC	iProtocol;
       
    70 	TInt	iPort;
       
    71 	TPtrC	iFormat;
       
    72 	TPtrC   iConnAddr; ///< SDP connection field's IP address
       
    73 	
       
    74 	// Array of sdp meta data attributes
       
    75 	RArray<TSdpAttribute> iAttributeArray;
       
    76 	
       
    77 protected:
       
    78 	CTestDecoderConfiguration();
       
    79 	};
       
    80 
       
    81 
       
    82 class TExpectedKeyStreamDecoderAttributes
       
    83 	{
       
    84 /**
       
    85  * Data storage class containing expected values for the attributes associated to a particular
       
    86  * Key Stream Decoder
       
    87  */
       
    88 public:
       
    89 	TExpectedKeyStreamDecoderAttributes();
       
    90 	
       
    91 	TBool IsProgramProtected;
       
    92 	TBool IsServiceProtected;
       
    93 	TBool CanExport;
       
    94 	TBool MustProtectIfRecording;
       
    95 	TBool CanPlay;
       
    96 	
       
    97 	TPtrC ContentId;
       
    98 	TPtrC RightsIssuerUri;
       
    99 	};	
       
   100 
       
   101 
       
   102 class CScafStep : public CTestStep
       
   103 /**
       
   104  	Base class used to provide handy functions available to test step classes.
       
   105  */
       
   106 	{
       
   107 public:
       
   108 	virtual ~CScafStep();
       
   109 	
       
   110 	TVerdict doTestStepPreambleL();
       
   111 	TVerdict doTestStepL();
       
   112 	TVerdict doTestStepPostambleL();
       
   113 	void CleanAgentsPrivateFolderL(const TDesC& aPrivatePath);
       
   114 #ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY
       
   115 	CSdpDocument* CreateSdpDocumentLC();
       
   116 	CSdpMediaField* CreateSdpLC(TInt aSdpNum);
       
   117 	void AddMediaFieldL(CSdpDocument& aSdpDoc, const CSdpMediaField* aSdpKeyStream);
       
   118 #endif
       
   119 	CKeyStreamSink* CreateKeyStreamSinkLC(const TDesC& aFilePath, const TDesC& aPrivPath);
       
   120 	void CopyFile2AgentsPrivateFolderL(RFs& aFs, const TDesC& aFileName, const TDesC& aPrivPath);
       
   121 	HBufC* GetFullPathLC(const TDesC& aPath, const TDesC& aFileName);
       
   122 	CSraRightsObject* GetRightsObjectLC(const TDesC& aName, const TDesC& aPrivPath);
       
   123 	void ReadTestConfigurationL();
       
   124 	TBool CheckKeyStreamDecoderAttributesL(const CKeyStreamDecoder& aDecoder, 
       
   125 											const TExpectedKeyStreamDecoderAttributes& aExpectedData);
       
   126 	
       
   127 protected:
       
   128 	CScafStep(CScafServer& aParent);
       
   129 	TPtr8 Convert16To8LC(TDesC& aDes);
       
   130 	TVerdict doOOMTestL();
       
   131 	virtual TVerdict doTestL();
       
   132 	TBool CompareBooleanAttributeL(const CKeyStreamDecoder& aDecoder,
       
   133 									const TAttribute& aAttributeEnum,
       
   134 									const TDesC& aAttributeDescription,
       
   135 									const TBool aExpectedValue);
       
   136 	TBool CompareStringAttributeL(const CKeyStreamDecoder& aDecoder,
       
   137 									const TStringAttribute& aAttributeEnum,
       
   138 									const TDesC& aAttributeDescription,
       
   139 									const TDesC& aExpectedValue);
       
   140 	
       
   141 private:
       
   142 #ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY
       
   143 	void AddAttributes2SdpL(CSdpMediaField& aSdp, TInt aSdpNum);
       
   144 #endif
       
   145 	void PrintErrorAndLeaveL(TDesC& aKey);
       
   146 	static void DeleteSdpDocAndCloseCodecPool(TAny* aSdpDoc);
       
   147 	
       
   148 protected:
       
   149 	CScafServer& iParent;
       
   150 	TInt iThreadId;
       
   151 	TBool iOOMTest;
       
   152 	RPointerArray<CTestDecoderConfiguration> iDecoderConfigurationArray;
       
   153 	RArray<TExpectedKeyStreamDecoderAttributes> iExpectedKeyStreamDecoderData;
       
   154 	
       
   155 private:
       
   156 	CActiveScheduler *iActiveScheduler;
       
   157 	};
       
   158 #endif /*TSCAFSTEP_H_*/