os/security/contentmgmt/referencedrmagent/tcaf/source/Consumerstep.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 /*
     2 * Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     5 * under the terms of the License "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description: 
    15 *
    16 */
    17 
    18 
    19 
    20 
    21 #if (!defined __CONSUMER_STEP_H__)
    22 #define __CONSUMER_STEP_H__
    23 #include <test/testexecutestepbase.h>
    24 
    25 #include "cafstep.h"
    26 
    27 // Constants used to name test cases 
    28 _LIT(KCAFSizeStep,"CAFSizeStep");
    29 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
    30 _LIT(KCAFSizeStep64,"CAFSizeStep64");
    31 _LIT(KCAFSeekReadStep64,"CAFSeekReadStep64");
    32 #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
    33 _LIT(KCAFSeekReadStep,"CAFSeekReadStep");
    34 _LIT(KCAFAttributesStep,"CAFAttributesStep");
    35 _LIT(KCAFStringAttributesStep,"CAFStringAttributesStep");
    36 _LIT(KCAFMultiThreadCDataStep,"CAFMultiThreadCDataStep");
    37 _LIT(KCAFMimeTypeCDataStep,"CAFMimeTypeCDataStep");
    38 _LIT(KCAFShareModeStep,"CAFShareModeStep");
    39 _LIT(KCAFHandleSizeStep,"CAFHandleSizeStep");
    40 _LIT(KCAFHandleSeekReadStep,"CAFHandleSeekReadStep");
    41 _LIT(KCAFHandleMultiThreadCDataStep,"CAFHandleMultiThreadCDataStep");
    42 _LIT(KCAFDataAttributeStep,"CAFDataAttributeStep");
    43 _LIT(KCAFDataAttributeSetStep,"CAFDataAttributeSetStep");
    44 _LIT(KCAFDataStringAttributeStep,"CAFDataStringAttributeStep");
    45 _LIT(KCAFDataStringAttributeSetStep,"CAFDataStringAttributeSetStep");
    46 _LIT(KCAFExecuteIntentStep,"CAFExecuteIntentStep");
    47 _LIT(KCAFDRMFileOpenPerformanceStep, "CAFDRMFileOpenPerformanceStep");
    48 
    49 //#ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
    50 _LIT(KWmdrmCAFContentStep,"WmdrmCAFContentStep");     
    51 _LIT(KWmdrmCAFDataStep,"WmdrmCAFDataStep");     
    52 _LIT(KWmdrmCAFReadStep, "WmdrmCAFReadStep");     
    53 //#endif //SYMBIAN_SDP-WMDRM 
    54 
    55 /* 
    56 * Used to open one file with RFile and the DRM packaged version of the same file with 
    57 * CContent::Open() and compare the reported sizes
    58 * It can be used with two identical, non DRM file to check the operation of F32Agent
    59 * The ini file used with this test expects only one parameter
    60 *
    61 * URI1 - The name of the file used for this test
    62 * 
    63 */
    64 class CCAFSizeStep : public CCAFStep
    65 	{
    66 public:
    67 	CCAFSizeStep(CCAFServer& aParent);
    68 	~CCAFSizeStep();
    69 	virtual TVerdict doTestStepL();
    70 private:
    71 	CCAFServer& iParent;
    72 	};
    73 
    74 
    75 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
    76 /* 
    77 * 64bit version of CCAFSizeStep 
    78 * If the agent to be tested implemented 64bit functions, this test step will test 64bit functions
    79 * under the same scenario as its 32bit counterpart. If 64bit functions are not implemented, this test step
    80 * can also ensure that fallback to 32bit functions works properly  
    81 */
    82 class CCAFSizeStep64 : public CCAFStep
    83 	{
    84 public:
    85 	CCAFSizeStep64(CCAFServer& aParent);
    86 	~CCAFSizeStep64();
    87 	virtual TVerdict doTestStepL();
    88 private:
    89 	CCAFServer& iParent;
    90 	};
    91 #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
    92 
    93 /* 
    94 * Used to test file Seek and Read operations on DRM protected content.
    95 * Opens one file with RFile and the DRM packaged version of the same file with 
    96 * CContent::Open() and does a series of Seek and Read operations.
    97 * Verifies that the CAF and the agent corresponding to the DRM content implement 
    98 * all polymorphic versions of Read() and Seek() correctly
    99 * It can also be used with two identical, non DRM file to check the operation of F32Agent
   100 * The ini file used with this test expects only one parameter
   101 *
   102 * URI1 - The name of the file used for this test
   103 * 
   104 */
   105 class CCAFSeekReadStep : public CCAFStep
   106 	{
   107 public:
   108 	CCAFSeekReadStep(CCAFServer& aParent);
   109 	~CCAFSeekReadStep();
   110 	virtual TVerdict doTestStepL();
   111 private:
   112 	void StandardCheckReturnValue(TInt aReturnValue);
   113 private:
   114 	CCAFServer& iParent;
   115 	};
   116 
   117 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   118 /* 
   119 * 64bit version of CAFSeekReadStep
   120 * If the agent to be tested implemented 64bit functions, this test step will test 64bit functions
   121 * under the same scenario as its 32bit counterpart. If 64bit functions are not implemented, this test step
   122 * can also ensure that fallback to 32bit functions works properly 
   123 * 
   124 */
   125 class CCAFSeekReadStep64 : public CCAFStep
   126 	{
   127 public:
   128 	CCAFSeekReadStep64(CCAFServer& aParent);
   129 	~CCAFSeekReadStep64();
   130 	virtual TVerdict doTestStepL();
   131 private:
   132 	void StandardCheckReturnValue(TInt aReturnValue);
   133 private:
   134 	CCAFServer& iParent;
   135 	};
   136 #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   137 
   138 /* 
   139 * Used to test CContent::Attributes()
   140 * The INI file specifies the file to retrieve the attributes from.
   141 * @internalComponent
   142 */
   143 class CCAFAttributesStep : public CCAFStep
   144 	{
   145 public:
   146 	CCAFAttributesStep(CCAFServer& aParent);
   147 	~CCAFAttributesStep();
   148 	virtual TVerdict doTestStepL();
   149 private:
   150 	CCAFServer& iParent;
   151 	};
   152 
   153 
   154 /* 
   155 * Used to test Content::StringAttributes()
   156 * The INI file specifies the file to retrieve the attributes from.
   157 * @internalComponent
   158 */
   159 class CCAFStringAttributesStep : public CCAFStep
   160 	{
   161 public:
   162 	CCAFStringAttributesStep(CCAFServer& aParent);
   163 	~CCAFStringAttributesStep();
   164 	virtual TVerdict doTestStepL();
   165 private:
   166 	CCAFServer& iParent;
   167 	};
   168 
   169 
   170 
   171 /* 
   172 * Used to test multi-threaded read from CContent
   173 * @internalComponent
   174 */
   175 class CCAFMultiThreadCDataStep : public CCAFStep
   176 	{
   177 public:
   178 	CCAFMultiThreadCDataStep(CCAFServer& aParent);
   179 	~CCAFMultiThreadCDataStep();
   180 	virtual TVerdict doTestStepL();
   181 	static TInt ReaderThreadEntry(TAny *aPtr);
   182 private:
   183 	CCAFServer& iParent;
   184 	};
   185 
   186 
   187 /* 
   188 * Used to test finding the mime type from CData
   189 * @internalComponent
   190 */
   191 class CCAFMimeTypeCDataStep: public CCAFStep
   192 	{
   193 public:
   194 	CCAFMimeTypeCDataStep(CCAFServer& aParent);
   195 	~CCAFMimeTypeCDataStep();
   196 	virtual TVerdict doTestStepL();
   197 	static TInt ReaderThreadEntry(TAny *aPtr);
   198 private:
   199 	CCAFServer& iParent;
   200 	};
   201 
   202 /* 
   203 * Used to test content sharing modes
   204 * @internalComponent
   205 */
   206 class CCAFShareModeStep: public CCAFStep
   207 	{
   208 public:
   209 	CCAFShareModeStep(CCAFServer& aParent);
   210 	~CCAFShareModeStep();
   211 	virtual TVerdict doTestStepL();
   212 	TVerdict doShareModeStepL();
   213 private:
   214 	CCAFServer& iParent;
   215 	};
   216 
   217 
   218 /* 
   219 * Used to open one file with RFile and the DRM packaged version of the same file with 
   220 * CContent::Open() by passing RFile handle and compare the reported sizes
   221 * It can be used with two identical, non DRM file to check the operation of F32Agent
   222 * The ini file used with this test expects only one parameter
   223 *
   224 * URI1 - The name of the file used for this test
   225 * 
   226 */
   227 class CCAFHandleSizeStep : public CCAFStep
   228 	{
   229 public:
   230 	CCAFHandleSizeStep(CCAFServer& aParent);
   231 	~CCAFHandleSizeStep();
   232 	virtual TVerdict doTestStepL();
   233 private:
   234 	CCAFServer& iParent;
   235 	};	
   236 
   237 /* 
   238 * Used to test file Seek and Read operations on DRM protected content.
   239 * Opens one file with RFile and the DRM packaged version of the same file with 
   240 * CContent::Open() by passing RFile handle and does a series of Seek and Read operations.
   241 * Verifies that the CAF and the agent corresponding to the DRM content implement 
   242 * all polymorphic versions of Read() and Seek() correctly
   243 * It can also be used with two identical, non DRM file to check the operation of F32Agent
   244 * The ini file used with this test expects only one parameter
   245 *
   246 * URI1 - The name of the file used for this test
   247 */
   248 class CCAFHandleSeekReadStep : public CCAFStep
   249 	{
   250 public:
   251 	CCAFHandleSeekReadStep(CCAFServer& aParent);
   252 	~CCAFHandleSeekReadStep();
   253 	virtual TVerdict doTestStepL();
   254 private:
   255 	CCAFServer& iParent;
   256 	};
   257 
   258 /* 
   259 * Used to test multi-threaded read from CContent
   260 * @internalComponent
   261 */
   262 class CCAFHandleMultiThreadCDataStep : public CCAFStep
   263 	{
   264 public:
   265 	CCAFHandleMultiThreadCDataStep(CCAFServer& aParent);
   266 	~CCAFHandleMultiThreadCDataStep();
   267 	virtual TVerdict doTestStepL();
   268 	static TInt ReaderThreadEntry(TAny *aPtr);
   269 private:
   270 	CCAFServer& iParent;
   271 	};
   272 	
   273 /* 
   274 * Used to test CManager::GetAttribute()
   275 * The INI file specifies the file to delete and the expected return code.
   276 * For instance this can be used to try and delete a file that does not exist or a file
   277 * that is read-only or has rights that don't allow it to be deleted
   278 * INI file paramerters
   279 *
   280 *
   281 * @internalComponent Exposure internally
   282 */
   283 class CCAFDataAttributeStep : public CCAFStep
   284 	{
   285 public:
   286 	CCAFDataAttributeStep(CCAFServer& aParent);
   287 	~CCAFDataAttributeStep();
   288 	virtual TVerdict doTestStepL();
   289 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
   290     TVerdict doWmdrmTestStepL();     
   291 #endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT 
   292 private:
   293 	CCAFServer& iParent;
   294 	};
   295 
   296 /* 
   297 * Used to test CManager::GetAttributeSet()
   298 * The INI file specifies the file to delete and the expected return code.
   299 * For instance this can be used to try and delete a file that does not exist or a file
   300 * that is read-only or has rights that don't allow it to be deleted
   301 * INI file paramerters
   302 *
   303 *
   304 * @internalComponent Exposure internally
   305 */
   306 class CCAFDataAttributeSetStep : public CCAFStep
   307 	{
   308 public:
   309 	CCAFDataAttributeSetStep(CCAFServer& aParent);
   310 	~CCAFDataAttributeSetStep();
   311 	virtual TVerdict doTestStepL();
   312 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT     
   313     TVerdict doWmdrmTestStepL();     
   314 #endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT 
   315 private:
   316 	CCAFServer& iParent;
   317 	};
   318 
   319 /* 
   320 * Used to test CContent::GetAttribute()
   321 * The INI file specifies the file to delete and the expected return code.
   322 * For instance this can be used to try and delete a file that does not exist or a file
   323 * that is read-only or has rights that don't allow it to be deleted
   324 * INI file paramerters
   325 *
   326 *
   327 * @internalComponent Exposure internally
   328 */
   329 class CCAFDataStringAttributeStep : public CCAFStep
   330 	{
   331 public:
   332 	CCAFDataStringAttributeStep(CCAFServer& aParent);
   333 	~CCAFDataStringAttributeStep();
   334 	virtual TVerdict doTestStepL();
   335 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT     
   336     TVerdict doWmdrmTestStepL();     
   337 #endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT 
   338 private:
   339 	CCAFServer& iParent;
   340 	};
   341 
   342 /* 
   343 * Used to test CData::GetStringAttributeSet()
   344 * The INI file specifies the file to delete and the expected return code.
   345 * For instance this can be used to try and delete a file that does not exist or a file
   346 * that is read-only or has rights that don't allow it to be deleted
   347 * INI file paramerters
   348 *
   349 *
   350 * @internalComponent Exposure internally
   351 */
   352 class CCAFDataStringAttributeSetStep : public CCAFStep
   353 	{
   354 public:
   355 	CCAFDataStringAttributeSetStep(CCAFServer& aParent);
   356 	~CCAFDataStringAttributeSetStep();
   357 	virtual TVerdict doTestStepL();
   358 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT     
   359     TVerdict doWmdrmTestStepL();     
   360 #endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT 
   361 private:
   362 	CCAFServer& iParent;
   363 	};
   364 
   365 class CCAFExecuteIntentStep : public CCAFStep
   366 	{
   367 public:
   368 	CCAFExecuteIntentStep(CCAFServer& aParent);
   369 	~CCAFExecuteIntentStep();
   370 	virtual TVerdict doTestStepL();
   371 private:
   372 	CCAFServer& iParent;
   373 	};
   374 	
   375 /*
   376 * Used to test DRM File Open perfomance.
   377 * The INI file specifies the file to be opened , the iteration count and the maximum time limit for 
   378 * file open operation(in millisecs).
   379 * If the obtained time doesn't fall within the provided limit (in the INI parameters) , the test case fails.
   380 *
   381 * @internalComponent Exposure internally
   382 */
   383 
   384 class CCAFDRMFileOpenPerformanceTest : public CCAFStep
   385 	{
   386 	public:
   387 	CCAFDRMFileOpenPerformanceTest(CCAFServer& aParent);
   388 	~CCAFDRMFileOpenPerformanceTest();
   389 	virtual TVerdict doTestStepL();
   390 	
   391 	private:
   392 	// Read content from file using CAF
   393 	void OpenAndReadFileContentL(const TDesC& aFileName);
   394 	
   395 	private:
   396 
   397 	CCAFServer& iParent;
   398 	TUint32 iIterationSum;
   399 	};
   400 
   401 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT     
   402 /* Used to test behaviour of CContent object creation and attribute APIs for WMDRM content.  +-   
   403 * @internalComponent Exposure internally     
   404 */     
   405 class CWmdrmCAFContentStep : public CCAFStep     
   406     {     
   407 public:     
   408     CWmdrmCAFContentStep();     
   409     ~CWmdrmCAFContentStep();     
   410     virtual TVerdict doTestStepL();     
   411     };     
   412       
   413       
   414 /* Used to test the behaviour of CData object creation and attribute APIs for WMDRM content.     
   415 * @internalComponent Exposure internally     
   416 */     
   417 class CWmdrmCAFDataStep : public CCAFStep     
   418     {     
   419 public:     
   420     CWmdrmCAFDataStep();     
   421     ~CWmdrmCAFDataStep();     
   422     virtual TVerdict doTestStepL();     
   423     };     
   424       
   425          
   426 /* Used to test synchronous and asynchronous behaviour of ReadL() APIs of CData class for WMDRM content.     
   427 * @internalComponent Exposure internally     
   428 */     
   429 class CWmdrmCAFReadStep : public CCAFStep     
   430     {     
   431 public:     
   432     CWmdrmCAFReadStep();     
   433     ~CWmdrmCAFReadStep();     
   434     virtual TVerdict doTestStepL();     
   435       
   436 private:     
   437     TInt TestSynchronousReadL(const TDesC8& aHeaderData, TBool aIntent, TDesC& aInputPacket, TDesC& aExpectedOuput);     
   438     TInt TestAsynchronousReadL(const TDesC8& aHeaderData, TBool aIntent, TDesC& aInputPacket, TDesC& aExpectedOuput);     
   439     };       
   440       
   441 #endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT 
   442 
   443 #endif