serviceproviders/sapi_mediamanagement/tsrc/testing/tmediaprovidertesting/inc/tmediaobserver.h
changeset 22 fc9cf246af83
child 33 50974a8b132e
equal deleted inserted replaced
19:989d2f495d90 22:fc9cf246af83
       
     1 /*
       
     2 * Copyright (c) 2002 - 2007 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:  ?Description
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef _TMEDIAPROVIDERTESTING_H__
       
    19 #define _TMEDIAPROVIDERTESTING_H__
       
    20 
       
    21 #include <LiwCommon.h>
       
    22 #include <LiwBufferExtension.h>
       
    23 #include <LiwServiceHandler.h>
       
    24 #include <e32base.h>
       
    25 extern TInt count;
       
    26 class CMediaObserver : public CBase , public MLiwNotifyCallback
       
    27 {
       
    28 	public :
       
    29 		enum TFileType
       
    30 			{
       
    31 			EOtherFile,
       
    32 			EMusicFile,
       
    33 			EStreamingURLFile
       
    34 			};
       
    35 	public:
       
    36 	
       
    37 	static CMediaObserver* NewL();
       
    38 
       
    39  		/**
       
    40   	* Destructor.
       
    41   	*/
       
    42   	virtual ~CMediaObserver();	
       
    43   	
       
    44 	private :
       
    45 	    void ConstructL();
       
    46 	    
       
    47 	    CMediaObserver();
       
    48   	
       
    49 	public: // New functions
       
    50 		/**
       
    51 		* A static method which compares two result maps. This mehtod compares image,sound and video maps.         
       
    52 		* @return ETrue OR EFalse.
       
    53 		*/
       
    54 		TBool CMediaObserver::CompareMaps(CLiwMap* aExpectedMap, 
       
    55 		                                          const CLiwMap* aResultMap);    
       
    56 		/**
       
    57 		* A static method which compares two strings from the maps.
       
    58 		* @param  aKey key value to be compared.
       
    59 		* @param  aExpectedMap the expected result map.
       
    60 		* @param  aResultMap the fetched result map.       
       
    61 		* @return ETrue OR EFalse.
       
    62 		*/ 
       
    63 		TBool CMediaObserver::CompareStringResult(const TDesC8& aKey,
       
    64 			                                              CLiwMap* aExpectedMap,
       
    65 			                                              const CLiwMap* aResultMap);
       
    66 		
       
    67 		/**
       
    68 		* A static method which compares two TTime values from the maps.
       
    69 		* @param  aKey key value to be compared.
       
    70 		* @param  aExpectedMap the expected result map.
       
    71 		* @param  aResultMap the fetched result map.       
       
    72 		* @return ETrue OR EFalse.
       
    73 		*/
       
    74 		TBool CMediaObserver::CompareTTimeResult(const TDesC8& aKey,
       
    75 							                             CLiwMap* aExpectedMap,
       
    76 							                             const CLiwMap* aResultMap);
       
    77 		
       
    78 		/**
       
    79 		* A static method which compares two TTime values from the maps.
       
    80 		* @param  aKey key value to be compared.
       
    81 		* @param  aExpectedMap the expected result map.
       
    82 		* @param  aResultMap the fetched result map.       
       
    83 		* @return ETrue OR EFalse.
       
    84 		*/
       
    85 		TBool CMediaObserver::CompareTIntResult(const TDesC8& aKey,
       
    86 		                                                CLiwMap* aExpectedMap,
       
    87 		                                                const CLiwMap* aResultMap);
       
    88 
       
    89 
       
    90 
       
    91 public:
       
    92 	/**
       
    93 		* From the  MLiwNotifyCallback interface it is called by the media management service.      
       
    94 		* @param aCmdId Script line containing method name and parameters.
       
    95 		* @return Symbian OS error code.
       
    96 		*/
       
    97 		TInt HandleNotifyL(TInt aCmdId,
       
    98         		           TInt aEventId,
       
    99         		           CLiwGenericParamList& aEventParamList,
       
   100         		           const CLiwGenericParamList& aInParamList);
       
   101 public:
       
   102     
       
   103     /**
       
   104     * This method checks whether the obtained result and the expected results match.     
       
   105     * @param aResultlist a list of maps as iterator to be compared with expected output.
       
   106     * @return Symbian OS error code.
       
   107     */
       
   108     TBool IsExpectedResult(CLiwIterable* aResultlist);        
       
   109     
       
   110     
       
   111 	      /**
       
   112 	        * This method parses the input from cfg file and prepare the input list.             
       
   113 	        * @param  aItem input list contaning input params from cfg file. 
       
   114 	        * @return Symbian OS error code.
       
   115 	        */
       
   116 	        void ParseStiffInput(CStifItemParser& aItem);        
       
   117 	        /**
       
   118 	        * This method parses the input from cfg file and prepare the Expected out put list.             
       
   119 	        * @param  aItem input list contaning input params from cfg file.
       
   120 	        * @return Symbian OS error code.
       
   121 	        */
       
   122 	        void SetExpectedOutputMap(CStifItemParser& aItem);   
       
   123 
       
   124 		
       
   125 		
       
   126 	public:
       
   127 			//An array to hold the expected result maps. 
       
   128 		RPointerArray <CLiwMap> iExpectedOutPutArray;
       
   129         //input parameter list
       
   130         CLiwGenericParamList* iInList;
       
   131 
       
   132         //input parameter list
       
   133          CLiwGenericParamList* iOutList;
       
   134 
       
   135 		
       
   136 		//the expected output error code
       
   137 		TInt iExpErrorCode;        
       
   138 		//result of the test case.
       
   139 		TInt iResult;
       
   140 		//file type 
       
   141 		TFileType iFiletype;	
       
   142 		   //Filename
       
   143 		        HBufC* iFilename;
       
   144 		RFs iFs;
       
   145 		RFile iFile;
       
   146 		
       
   147 	
       
   148 };
       
   149 
       
   150 
       
   151 
       
   152 
       
   153 
       
   154 
       
   155 
       
   156 
       
   157 
       
   158 
       
   159 
       
   160 
       
   161 
       
   162 
       
   163 
       
   164 #endif // _TMEDIAPROVIDERTESTING_H__