os/security/contentmgmt/cafstreamingsupport/test/tscaf/inc/tscafstep.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     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 	CSdpDocument* CreateSdpDocumentLC();
   115 	CSdpMediaField* CreateSdpLC(TInt aSdpNum);
   116 	void AddMediaFieldL(CSdpDocument& aSdpDoc, const CSdpMediaField* aSdpKeyStream);
   117 	CKeyStreamSink* CreateKeyStreamSinkLC(const TDesC& aFilePath, const TDesC& aPrivPath);
   118 	void CopyFile2AgentsPrivateFolderL(RFs& aFs, const TDesC& aFileName, const TDesC& aPrivPath);
   119 	HBufC* GetFullPathLC(const TDesC& aPath, const TDesC& aFileName);
   120 	CSraRightsObject* GetRightsObjectLC(const TDesC& aName, const TDesC& aPrivPath);
   121 	void ReadTestConfigurationL();
   122 	TBool CheckKeyStreamDecoderAttributesL(const CKeyStreamDecoder& aDecoder, 
   123 											const TExpectedKeyStreamDecoderAttributes& aExpectedData);
   124 	
   125 protected:
   126 	CScafStep(CScafServer& aParent);
   127 	TPtr8 Convert16To8LC(TDesC& aDes);
   128 	TVerdict doOOMTestL();
   129 	virtual TVerdict doTestL();
   130 	TBool CompareBooleanAttributeL(const CKeyStreamDecoder& aDecoder,
   131 									const TAttribute& aAttributeEnum,
   132 									const TDesC& aAttributeDescription,
   133 									const TBool aExpectedValue);
   134 	TBool CompareStringAttributeL(const CKeyStreamDecoder& aDecoder,
   135 									const TStringAttribute& aAttributeEnum,
   136 									const TDesC& aAttributeDescription,
   137 									const TDesC& aExpectedValue);
   138 	
   139 private:
   140 	void AddAttributes2SdpL(CSdpMediaField& aSdp, TInt aSdpNum);
   141 	void PrintErrorAndLeaveL(TDesC& aKey);
   142 	static void DeleteSdpDocAndCloseCodecPool(TAny* aSdpDoc);
   143 	
   144 protected:
   145 	CScafServer& iParent;
   146 	TInt iThreadId;
   147 	TBool iOOMTest;
   148 	RPointerArray<CTestDecoderConfiguration> iDecoderConfigurationArray;
   149 	RArray<TExpectedKeyStreamDecoderAttributes> iExpectedKeyStreamDecoderData;
   150 	
   151 private:
   152 	CActiveScheduler *iActiveScheduler;
   153 	};
   154 #endif /*TSCAFSTEP_H_*/