tsrc/fusionmpxplayer_test/inc/FusionMpxPlayer_ApiTest.h
branchRCL_3
changeset 10 112a725ff2c2
parent 9 5294c000a26d
child 11 8970fbd719ec
equal deleted inserted replaced
9:5294c000a26d 10:112a725ff2c2
     1 /*
       
     2 * Copyright (c) 2008 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 // wait until command is complete( no more expected messages )
       
    20 
       
    21 #ifndef MPXFUSIONPLAYER_APITEST_H
       
    22 #define MPXFUSIONPLAYER_APITEST_H
       
    23 
       
    24 //  INCLUDES
       
    25 #include "VCXTestLog.h"
       
    26 #include <StifLogger.h>
       
    27 #include <TestScripterInternal.h>
       
    28 #include <StifTestModule.h>
       
    29 #include <TestclassAssert.h>
       
    30 
       
    31 #include <f32file.h>
       
    32 
       
    33 #include "MIptvTestTimerObserver.h"
       
    34 #include "VCXTestPSObserver.h"
       
    35 
       
    36 // CONSTANTS
       
    37 const TInt KTimeoutTimerId = 0;
       
    38 const TUint KFusionTestCommandTimeout = 60*1000000;
       
    39 
       
    40 // MACROS
       
    41 //#define ?macro ?macro_def
       
    42 #define TEST_CLASS_VERSION_MAJOR 0
       
    43 #define TEST_CLASS_VERSION_MINOR 0
       
    44 #define TEST_CLASS_VERSION_BUILD 0
       
    45 
       
    46 // Logging path
       
    47 _LIT( KFusionMpxPlayer_ApiTestLogPath, "\\logs\\testframework\\FusionMpxPlayer_ApiTest\\" );
       
    48 // Log file
       
    49 _LIT( KFusionMpxPlayer_ApiTestLogFile, "FusionMpxPlayer_ApiTest.txt" );
       
    50 _LIT( KFusionMpxPlayer_ApiTestLogFileWithTitle, "FusionMpxPlayer_ApiTest_[%S].txt" );
       
    51 
       
    52 // FUNCTION PROTOTYPES
       
    53 //?type ?function_name(?arg_list);
       
    54 
       
    55 // FORWARD DECLARATIONS
       
    56 //class ?FORWARD_CLASSNAME;
       
    57 class CFusionMpxPlayer_ApiTest;
       
    58 class CIptvTestTimer;
       
    59 class CIptvTestActiveWait;
       
    60 class CVCXTestCommon;
       
    61 class CVCXTestPSSubscriber;
       
    62 
       
    63 // DATA TYPES
       
    64 //enum ?declaration
       
    65 //typedef ?declaration
       
    66 //extern ?data_type;
       
    67 enum  TFusionPlayerTestSeekType
       
    68 {
       
    69     EFusionPlayerTestSeekForward,
       
    70     EFusionPlayerTestSeekBackward,
       
    71     EFusionPlayerTestSeekStop,
       
    72 } ;
       
    73 // CLASS DECLARATION
       
    74 
       
    75 
       
    76 /**
       
    77 *  CFusionMpxPlayer_ApiTest test class for STIF Test Framework TestScripter.
       
    78 *  ?other_description_lines
       
    79 *
       
    80 *  @lib ?library
       
    81 *  @since ?Series60_version
       
    82 */
       
    83 NONSHARABLE_CLASS(CFusionMpxPlayer_ApiTest) : public CScriptBase,
       
    84                                               public MVCXTestPSObserver,
       
    85                                               public MIptvTestTimerObserver
       
    86     {
       
    87     public:  // Constructors and destructor
       
    88 
       
    89         /**
       
    90         * Two-phased constructor.
       
    91         */
       
    92         static CFusionMpxPlayer_ApiTest* NewL( CTestModuleIf& aTestModuleIf );
       
    93 
       
    94         /**
       
    95         * Destructor.
       
    96         */
       
    97         virtual ~CFusionMpxPlayer_ApiTest();
       
    98 
       
    99     public: // New functions
       
   100 
       
   101     public: // Functions from base classes
       
   102 
       
   103         /**
       
   104         * From CScriptBase Runs a script line.
       
   105         * @since ?Series60_version
       
   106         * @param aItem Script line containing method name and parameters
       
   107         * @return Symbian OS error code
       
   108         */
       
   109         virtual TInt RunMethodL( CStifItemParser& aItem );
       
   110 
       
   111         /**
       
   112         * From MIptvTestTimerObserver Handles timer completion
       
   113         * @since
       
   114         * @param aTimerId
       
   115         * @param aError
       
   116         */
       
   117         void TimerComplete(TInt aTimerId, TInt aError);
       
   118 
       
   119         /**
       
   120          * From MVCXConnUtilTestPSObserver, called when P&S key changes.
       
   121          */
       
   122         void ValueChangedL( const TUid& aUid, const TUint32& aKey, const TInt&  aValue );
       
   123 
       
   124         /**
       
   125          * From MVCXConnUtilTestPSObserver, called when P&S key changes.
       
   126          */
       
   127         void ValueChangedL( const TUid& aUid, const TUint32& aKey, const TDesC& aValue );
       
   128 
       
   129     private:
       
   130 
       
   131         /**
       
   132         * C++ default constructor.
       
   133         */
       
   134         CFusionMpxPlayer_ApiTest( CTestModuleIf& aTestModuleIf );
       
   135 
       
   136         /**
       
   137         * By default Symbian 2nd phase constructor is private.
       
   138         */
       
   139         void ConstructL();
       
   140 
       
   141         /**
       
   142         * Frees all resources allocated from test methods.
       
   143         * @since ?Series60_version
       
   144         */
       
   145         void Delete();
       
   146 
       
   147         /**
       
   148         * Test methods are listed below.
       
   149         */
       
   150 
       
   151         /**
       
   152          * Set 0 to stop wait for command completion message from tester exe. 
       
   153          */
       
   154         virtual TInt SetCommandCompletionWaitL( CStifItemParser& aItem );
       
   155         
       
   156         /**
       
   157          * Call this before CreateL. Will try to shutdown all possible tester exes.
       
   158          */
       
   159         virtual TInt PrepareCaseL( CStifItemParser& aItem );
       
   160 
       
   161         /**
       
   162          * Called at module deletion. Shutdowns tester exe.
       
   163          */
       
   164         virtual TInt ShutdownTesterL( CStifItemParser& aItem );
       
   165 
       
   166         /**
       
   167          * Creates the test module.
       
   168          */
       
   169         virtual TInt CreateL( CStifItemParser& aItem );
       
   170 
       
   171         /**
       
   172          * Starts playing a random local file using MMPXPlaybackUtility::InitL and activates
       
   173          * player view.
       
   174          * @param filename
       
   175          */
       
   176         virtual TInt OpenRandomFileL( CStifItemParser& aItem );        
       
   177         
       
   178         /**
       
   179          * Starts playing a local file using MMPXPlaybackUtility::InitL and activates
       
   180          * player view.
       
   181          * @param filename
       
   182          */
       
   183         virtual TInt OpenLocalFileL( CStifItemParser& aItem );
       
   184 
       
   185         /**
       
   186          * Starts playing stream.
       
   187          * @param URL
       
   188          * @param IAP
       
   189          */
       
   190         virtual TInt OpenUrlL( CStifItemParser& aItem );
       
   191         
       
   192         /**
       
   193          * These map to commands defined in mpxplaybackcommanddefs.h
       
   194          */
       
   195 
       
   196         virtual TInt PlayL( CStifItemParser& aItem );
       
   197         virtual TInt PlayWithFadeInL( CStifItemParser& aItem );
       
   198         virtual TInt PauseL( CStifItemParser& aItem );
       
   199         virtual TInt StopL( CStifItemParser& aItem );
       
   200         virtual TInt PlayPauseL( CStifItemParser& aItem );
       
   201 
       
   202         virtual TInt NextL( CStifItemParser& aItem );
       
   203         virtual TInt PreviousL( CStifItemParser& aItem );
       
   204         virtual TInt ReplayL( CStifItemParser& aItem );
       
   205         virtual TInt StartSeekForwardL( CStifItemParser& aItem );
       
   206         virtual TInt StartSeekBackwardL( CStifItemParser& aItem );
       
   207         virtual TInt StopSeekingL( CStifItemParser& aItem );
       
   208         virtual TInt DecreaseVolumeL( CStifItemParser& aItem );
       
   209         virtual TInt IncreaseVolumeL( CStifItemParser& aItem );
       
   210         virtual TInt MuteVolumeL( CStifItemParser& aItem );
       
   211         virtual TInt UnMuteVolumeL( CStifItemParser& aItem );
       
   212         virtual TInt SetVolumeL( CStifItemParser& aItem );
       
   213 
       
   214         virtual TInt CloseL( CStifItemParser& aItem );
       
   215         virtual TInt ApplyEffectL( CStifItemParser& aItem );
       
   216         virtual TInt DisableEffectL( CStifItemParser& aItem );
       
   217         virtual TInt PreservePositionL( CStifItemParser& aItem );
       
   218         virtual TInt PreserveStateL( CStifItemParser& aItem );
       
   219         virtual TInt CloseItemL( CStifItemParser& aItem );
       
   220         virtual TInt CancelInitL( CStifItemParser& aItem );
       
   221         virtual TInt ResetPreserveStateL( CStifItemParser& aItem );
       
   222         virtual TInt UnloadNonActivePluginL( CStifItemParser& aItem );
       
   223         virtual TInt ClearKeyBufferL( CStifItemParser& aItem );
       
   224 
       
   225         /**
       
   226          * These map to commands defined in mpxvideoplaybackdefs.h
       
   227          */
       
   228 
       
   229         virtual TInt VideoSeekForwardL( CStifItemParser& aItem );
       
   230         virtual TInt VideoSeekBackwardL( CStifItemParser& aItem );
       
   231         virtual TInt VideoEndSeekL( CStifItemParser& aItem );
       
   232         virtual TInt VideoNaturalAspectRatioL( CStifItemParser& aItem );
       
   233         virtual TInt VideoZoomAspectRatioL( CStifItemParser& aItem );
       
   234         virtual TInt VideoStretchAspectRatioL( CStifItemParser& aItem );
       
   235         virtual TInt VideoDefaultAspectRatioL( CStifItemParser& aItem );
       
   236         virtual TInt VideoHandleForegroundL( CStifItemParser& aItem );
       
   237         virtual TInt VideoHandleBackgroundL( CStifItemParser& aItem );
       
   238 
       
   239         /**
       
   240          * Method used to log version of test class
       
   241          */
       
   242         void SendTestClassVersion();
       
   243 
       
   244         //ADD NEW METHOD DEC HERE
       
   245         //[TestMethods] - Do not remove
       
   246 
       
   247     private:
       
   248         void TesterExeAliveL();
       
   249 
       
   250         void SendExeCmdL( TInt aCmd );
       
   251         void SendExeCmdL( TInt aCmd, TInt aIntParam1 );
       
   252         void SendExeCmdL( TInt aCmd, TInt aIntParam1, TInt aIntParam2 );
       
   253         void SendExeCmdL( TInt aCmd, const TDesC& aDescParam1 );
       
   254         void SendExeCmdL( TInt aCmd, const TDesC& aDescParam1, TInt aIntParam1 );
       
   255         void WaitForCommandL();
       
   256         
       
   257     private:    // Data
       
   258         CVCXTestCommon* iTestCommon;
       
   259 
       
   260         TBool iShutdownCalled;
       
   261 
       
   262         CVCXTestPSSubscriber* iTesterGetAckResponseSubscriber;
       
   263         CVCXTestPSSubscriber* iTesterGetMessageListResponseSubscriber;
       
   264 
       
   265         // Testexe
       
   266         RProcess iProcess;
       
   267 
       
   268         // Timeout timer
       
   269         CIptvTestTimer* iTimeoutTimer;
       
   270 
       
   271         CIptvTestActiveWait* iWait;
       
   272 
       
   273         TInt64 iRandomSeed;
       
   274         
       
   275         RFs iFs;
       
   276         
       
   277         TBool iCommandComplete;
       
   278         
       
   279         TInt iError;
       
   280         
       
   281         TBool iCommandWait;
       
   282         
       
   283         TInt iPSKeyBase;
       
   284     };
       
   285 
       
   286 #endif      // MPXFUSIONPLAYER_APITEST_H
       
   287 
       
   288 // End of File