mpx/tsrc/public/basic/collectionhelpertest/inc/collectionhelpertest.h
changeset 64 92dbd2a406d9
equal deleted inserted replaced
61:3b098142db83 64:92dbd2a406d9
       
     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 "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:  Scripted Tests for MPXCollectionHelper
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef COLLECTIONHELPERTEST_H
       
    19 #define COLLECTIONHELPERTEST_H
       
    20 
       
    21 
       
    22 #include <mpxcollectionutility.h>
       
    23 #include <mpxcollectionpath.h>
       
    24 #include <mpxcollectionplaylist.h>
       
    25 #include <mpxcollectionmessage.h>
       
    26 #include <mpxcollectionframeworkdefs.h>
       
    27 #include "mpxcollectionhelper.h"
       
    28 #include "mpxcollectionhelperfactory.h"
       
    29 #include "mpxcollectionhelperobserver.h"
       
    30 #include "mpxcollectionuihelper.h"
       
    31 #include "mpxcollectionuihelperobserver.h"
       
    32 #include "basetest.h"
       
    33 
       
    34 
       
    35 
       
    36 // Logging path
       
    37 #ifdef __WINSCW__
       
    38 _LIT( KCollectionHelperTestLogPath, "\\logs\\testframework\\CollectionHelperTest\\" ); 
       
    39 #else
       
    40 _LIT( KCollectionHelperTestLogPath, "e:\\logs\\testframework\\CollectionHelperTest\\" );
       
    41 #endif
       
    42 
       
    43 // Log file
       
    44 _LIT( KCollectionHelperTestLogFile, "CollectionHelperTest.txt" ); 
       
    45 
       
    46 
       
    47 /**
       
    48 *  CCollectionHelperTest test class for STIF Test Framework TestScripter.
       
    49 *
       
    50 */
       
    51 NONSHARABLE_CLASS(CCollectionHelperTest) : public CBaseTest,
       
    52 								public MMPXCollectionHelperObserver,
       
    53 								public MMPXCHelperObserver,
       
    54 								public MMPXCHelperEmbeddedOpenObserver,
       
    55                                 public MMPXCollectionObserver,
       
    56            						public MMPXCollectionRemoveObserver,
       
    57            						public MMPXCollectionFindObserver
       
    58 												
       
    59     {
       
    60 	public:  // Constructors and destructor
       
    61 
       
    62         /**
       
    63         * Two-phased constructor.
       
    64         */
       
    65         static CCollectionHelperTest* NewL( CTestModuleIf& aTestModuleIf );
       
    66 
       
    67         /**
       
    68         * Destructor.
       
    69         */
       
    70         virtual ~CCollectionHelperTest();       
       
    71 
       
    72     public: // New functions
       
    73 
       
    74 		/**
       
    75     	* Callback function to signal that adding a file is complete
       
    76     	* @param aErr, error of the operation
       
    77 	    */
       
    78     	virtual void HandleAddFileCompleteL( TInt aErr ); 
       
    79 
       
    80 		/**
       
    81 		* Generic Observer class for the ui helper
       
    82 		* A single callback function, but usable for all collection helper callbacks
       
    83 		*/   
       
    84 		virtual void HandleOperationCompleteL( TCHelperOperation aOperation,
       
    85         	                                   TInt aErr,
       
    86             	                               void* aArgument );
       
    87                                            
       
    88     	/**
       
    89     	* Callback to the observer for embedded OpenL() result
       
    90     	* @param aErr, error for the operation, KErrNone if successful
       
    91     	* @param aCategory, category of the file opened
       
    92     	*/
       
    93     	virtual void HandleEmbeddedOpenL( TInt aErr, 
       
    94                                           TMPXGeneralCategory aCategory );
       
    95 
       
    96         /**
       
    97         *  From MMPXCollectionObserver
       
    98         *  Handle extended media properties
       
    99         *  @param aMedia media 
       
   100         *  @param aError error code    
       
   101         */
       
   102         void HandleCollectionMediaL(
       
   103                         const CMPXMedia& aMedia, 
       
   104                         TInt aError);
       
   105             
       
   106         /**
       
   107         *  From MMPXCollectionObserver
       
   108         *  Handle collection message
       
   109         *  @param aMessage collection message
       
   110         */
       
   111         void HandleCollectionMessageL(const CMPXMessage& aMsg);
       
   112 
       
   113         /**
       
   114         *  From MMPXCollectionObserver
       
   115         *  Handles the collection entries being opened. Typically called
       
   116         *  when client has Open()'d a folder
       
   117         *
       
   118         *  @param aEntries collection entries opened
       
   119         *  @param aIndex focused entry
       
   120         *  @param aComplete ETrue no more entries. EFalse more entries
       
   121         *                   expected
       
   122         *  @param aError error code   
       
   123         */
       
   124         void HandleOpenL(const CMPXMedia& aEntries,
       
   125                                  TInt aIndex,TBool aComplete,TInt aError);
       
   126         
       
   127         /**
       
   128         *  From MMPXCollectionObserver
       
   129         *  Handles the item being opened. Typically called
       
   130         *  when client has Open()'d an item. Client typically responds by
       
   131         *  'playing' the item via the playlist
       
   132         *
       
   133         *  @param aPlaylist collection playlist, owner ship is transfered    
       
   134         *  @param aError error code   
       
   135         */                         
       
   136         void HandleOpenL(const CMPXCollectionPlaylist& aPlaylist,TInt aError);
       
   137         
       
   138                 		    
       
   139         void HandleCommandComplete(CMPXCommand* aCommandResult, TInt aError);
       
   140                                                      
       
   141     public: // Functions from base classes
       
   142 
       
   143         /**
       
   144         * From CScriptBase Runs a script line.
       
   145         * @since ?Series60_version
       
   146         * @param aItem Script line containing method name and parameters
       
   147         * @return Symbian OS error code
       
   148         */
       
   149         virtual TInt RunMethodL( CStifItemParser& aItem );
       
   150 	    
       
   151     private:
       
   152 
       
   153         /**
       
   154         * C++ default constructor.
       
   155         */
       
   156         CCollectionHelperTest( CTestModuleIf& aTestModuleIf );
       
   157 
       
   158         /**
       
   159         * By default Symbian 2nd phase constructor is private.
       
   160         */
       
   161         void ConstructL();
       
   162 
       
   163         // Prohibit copy constructor if not deriving from CBase.
       
   164         // ?classname( const ?classname& );
       
   165         // Prohibit assigment operator if not deriving from CBase.
       
   166         // ?classname& operator=( const ?classname& );
       
   167 
       
   168         /**
       
   169         * Frees all resources allocated from test methods.
       
   170         * @since ?Series60_version
       
   171         */
       
   172         void Delete();
       
   173 	    
       
   174         /**
       
   175         * Test methods are listed below. 
       
   176         */
       
   177 
       
   178         TInt OpenCollectionUtilityL(CStifItemParser& /*aItem*/);
       
   179 		TInt NewUiHelperL(CStifItemParser& /*aItem*/);
       
   180         TInt NewHelperL(CStifItemParser& /*aItem*/);
       
   181         TInt NewCachedHelperL(CStifItemParser& /*aItem*/);
       
   182 		TInt CloseUiHelperL(CStifItemParser& /*aItem*/);
       
   183 		TInt CloseHelperL(CStifItemParser& /*aItem*/);
       
   184 		TInt CloseCachedHelperL(CStifItemParser& /*aItem*/);      
       
   185         TInt AddFileL(CStifItemParser& /*aItem*/);
       
   186         TInt AddMediaL(CStifItemParser& /*aItem*/);
       
   187         TInt RemoveFileL(CStifItemParser& /*aItem*/);
       
   188         TInt RemoveAllL(CStifItemParser& /*aItem*/);
       
   189         TInt CleanupDeletedMediasL(CStifItemParser& /*aItem*/);
       
   190         TInt SetMediaL(CStifItemParser& /*aItem*/);
       
   191         TInt RenameUriL(CStifItemParser& /*aItem*/);
       
   192         TInt GetFileL(CStifItemParser& /*aItem*/);
       
   193         TInt GetFile2L(CStifItemParser& /*aItem*/);
       
   194         TInt FindAllL(CStifItemParser& /*aItem*/);
       
   195 
       
   196     	/**
       
   197     	*  From MMPXCollectionRemoveObserver
       
   198     	*  Handles removing a collection path
       
   199     	*  calls back with the list of file paths that were deleted
       
   200     	*  This callback is only applicable for local file storage plugins.
       
   201     	*
       
   202     	*  @param aUriArray, list of files that were deleted
       
   203     	*/
       
   204     	void HandleRemoveL(MDesCArray& aUriArray, TInt aError);
       
   205 
       
   206 		//***********************************************************************
       
   207 
       
   208 	    /**
       
   209 	    *  From MMPXCollectionFindObserver
       
   210     	*  Handle callback for "find" operation
       
   211     	*  @param aEntries, CMPXMedia to be returned
       
   212     	*  @param aComplete ETrue no more entries. EFalse more entries
       
   213     	*                   expected
       
   214     	*  @param aError error code   
       
   215     	*/
       
   216     	void HandleFindAllL(const CMPXMedia& aResults, TBool aComplete,
       
   217                             TInt aError);
       
   218     	        
       
   219         void CreateTestMediaL( CMPXMedia*& aNewProperty );
       
   220         
       
   221     private:    // Data
       
   222     
       
   223     	MMPXCollectionUtility*  	iCollectionUtility;
       
   224 
       
   225     	//NewUiHelperL()
       
   226         MMPXCollectionUiHelper* 	iUIHelper;  
       
   227              
       
   228         //NewHelperL()
       
   229 		MMPXCollectionHelper* 		iHelper;
       
   230 		
       
   231 		//NewCachedHelperL()
       
   232 		MMPXCollectionHelper* 		iCachedHelper;		
       
   233     };
       
   234 
       
   235 #endif      // COLLECTIONHELPERTEST_H
       
   236 
       
   237 // End of File