mmappfw_plat/mpx_playback_utility_api/tsrc/mpxplaybackutilitytest/src/mpxplaybackutilitytestBlocks.cpp
branchRCL_3
changeset 59 666f9a5a90a9
parent 56 63223d4fd956
child 67 16db3449d7ba
equal deleted inserted replaced
56:63223d4fd956 59:666f9a5a90a9
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 
    19 
    20 // [INCLUDE FILES] - do not remove
    20 // [INCLUDE FILES] - do not remove
       
    21 #include <sysutil.h>
       
    22 #include <s32file.h>
       
    23 #include <bautils.h> 
       
    24 
    21 #include <e32svr.h>
    25 #include <e32svr.h>
    22 #include <StifParser.h>
    26 #include <StifParser.h>
    23 #include <Stiftestinterface.h>
    27 #include <Stiftestinterface.h>
    24 #include <mpxvideoplaybackdefs.h>
    28 #include <mpxvideoplaybackdefs.h>
    25 #include <mpxplaybackcommanddefs.h>
    29 #include <mpxplaybackcommanddefs.h>
    30 #include <mpxmediageneraldefs.h>
    34 #include <mpxmediageneraldefs.h>
    31 #include <mpxlog.h>
    35 #include <mpxlog.h>
    32 #include <mpxcollectionplaylist.h>
    36 #include <mpxcollectionplaylist.h>
    33 #include "mpxplaybackutilitytest.h"
    37 #include "mpxplaybackutilitytest.h"
    34 #include "mpxplaybackutilitytestdefs.h"
    38 #include "mpxplaybackutilitytestdefs.h"
       
    39 #include "testcommonpluginuids.h"
       
    40 
       
    41 const TUid KPbTestVideoPlugin = {KPlaybackTestVideoPluginImpId};
    35 
    42 
    36 // ============================ MEMBER FUNCTIONS ===============================
    43 // ============================ MEMBER FUNCTIONS ===============================
    37 // ---------------------------------------------------------------------------
    44 // ---------------------------------------------------------------------------
    38 // From MMPXPlaybackObserver
    45 // From MMPXPlaybackObserver
    39 // Handle playback message.
    46 // Handle playback message.
    40 // ---------------------------------------------------------------------------
    47 // ---------------------------------------------------------------------------
    41 //
    48 //
    42 void Cmpxplaybackutilitytest::HandlePlaybackMessage( CMPXMessage* aMessage, TInt aError )
    49 void Cmpxplaybackutilitytest::HandlePlaybackMessage( CMPXMessage* aMessage, TInt aError )
    43     {
    50 {
    44     iLog->Log(_L("Cmpxharvestertest::HandlePlaybackMessage: Error %d"), aError);
    51     MPX_FUNC_EX("Cmpxplaybackutilitytest::HandlePlaybackMessage( CMPXMessage* aMessage, TInt aError )");
       
    52     iLog->Log(_L("Cmpxplaybackutilitytest::HandlePlaybackMessage: Error %d"), aError);
    45     if ( !aError )
    53     if ( !aError )
    46         {
    54     {
    47         TMPXMessageId id( *(aMessage->Value<TMPXMessageId>(KMPXMessageGeneralId)) );
    55         TMPXMessageId id( *(aMessage->Value<TMPXMessageId>(KMPXMessageGeneralId)) );
    48         TInt event( *aMessage->Value<TInt>( KMPXMessageGeneralEvent ) );
    56         TInt event( *aMessage->Value<TInt>( KMPXMessageGeneralEvent ) );
    49         TInt type( *aMessage->Value<TInt>( KMPXMessageGeneralType ) );
    57         TInt type( *aMessage->Value<TInt>( KMPXMessageGeneralType ) );
    50         TInt data( *aMessage->Value<TInt>( KMPXMessageGeneralData ) );
    58         TInt data( *aMessage->Value<TInt>( KMPXMessageGeneralData ) );
    51 
    59 
    52         if ( KMPXMessageGeneral == id )
    60         if ( KMPXMessageGeneral == id )
    53             {
    61         {
    54             iLog->Log(_L("Cmpxplaybackutilitytest::HandlePlaybackMessage() General event = %d type = %d  value = %d"),
    62             iLog->Log(_L("Cmpxplaybackutilitytest::HandlePlaybackMessage() General event = %d type = %d  value = %d"),
    55                          event, type, data );
    63                          event, type, data );
    56             RemoveExpectedEventL( KGeneralPlaybackMsgOffset + event, type, data );
    64             RemoveExpectedEventL( KGeneralPlaybackMsgOffset + event, type, data );
    57             }
    65         }
    58         else if ( KMPXMediaIdVideoPlayback == id )
    66         else if ( KMPXMediaIdVideoPlayback == id )
    59             {
    67         {
    60             iLog->Log(_L("Cmpxplaybackutilitytest::HandlePlaybackMessage() Video event = %d type = %d  value = %d"),
    68             iLog->Log(_L("Cmpxplaybackutilitytest::HandlePlaybackMessage() Video event = %d type = %d  value = %d"),
    61                          event, type, data );
    69                          event, type, data );
    62             RemoveExpectedEventL( KVideoPlaybackMsgOffset + event, type, data );
    70             RemoveExpectedEventL( KVideoPlaybackMsgOffset + event, type, data );
    63             }
    71         }
    64         else if ( KMPXMessageStif )
    72         else if ( KMPXMessageStif )
    65             {
    73         {
    66             iLog->Log(_L("Cmpxplaybackutilitytest::HandlePlaybackMessage() STIF event = %d type = %d  value = %d"),
    74             iLog->Log(_L("Cmpxplaybackutilitytest::HandlePlaybackMessage() STIF event = %d type = %d  value = %d"),
    67                          event, type, data );
    75                          event, type, data );
    68             RemoveExpectedEventL( KStifPlaybackMsgOffset + event, type, data );
    76             RemoveExpectedEventL( KStifPlaybackMsgOffset + event, type, data );
    69             }
    77         }
    70         }
    78     }
    71     else
    79     else
    72         {
    80     {
    73         if ( !iCallbackError )
    81         if ( !iCallbackError )
    74             {
    82         {
    75             iCallbackError = aError;
    83             iCallbackError = aError;
    76             }
    84         }
    77         }
    85     }
    78     }
    86 }
    79 
    87 
    80 // ---------------------------------------------------------------------------
    88 // ---------------------------------------------------------------------------
    81 //  Handle playback property.
    89 //  Handle playback property.
    82 // ---------------------------------------------------------------------------
    90 // ---------------------------------------------------------------------------
    83 //
    91 //
    84 void Cmpxplaybackutilitytest::HandlePropertyL( TMPXPlaybackProperty aProperty, TInt aValue, TInt aError )
    92 void Cmpxplaybackutilitytest::HandlePropertyL( TMPXPlaybackProperty aProperty, TInt aValue, TInt aError )
    85     {
    93 {
    86     iLog->Log(_L("Cmpxharvestertest::HandlePropertyL: Property %d, Value %d, Error %d"), 
    94     MPX_FUNC_EX("Cmpxplaybackutilitytest::HandlePropertyL( TMPXPlaybackProperty aProperty, TInt aValue, TInt aError )");
       
    95     iLog->Log(_L("Cmpxplaybackutilitytest::HandlePropertyL: Property %d, Value %d, Error %d"), 
    87             aProperty, aValue, aError);   
    96             aProperty, aValue, aError);   
    88     }
    97 }
    89 
    98 
    90 // ---------------------------------------------------------------------------
    99 // ---------------------------------------------------------------------------
    91 //  Method is called continously until aComplete=ETrue, signifying that 
   100 //  Method is called continously until aComplete=ETrue, signifying that 
    92 //  it is done and there will be no more callbacks.
   101 //  it is done and there will be no more callbacks.
    93 //  Only new items are passed each time.
   102 //  Only new items are passed each time.
    95 //
   104 //
    96 void Cmpxplaybackutilitytest::HandleSubPlayerNamesL( TUid aPlayer, 
   105 void Cmpxplaybackutilitytest::HandleSubPlayerNamesL( TUid aPlayer, 
    97                                                      const MDesCArray* aSubPlayers,
   106                                                      const MDesCArray* aSubPlayers,
    98                                                      TBool aComplete,
   107                                                      TBool aComplete,
    99                                                      TInt aError )
   108                                                      TInt aError )
   100     {
   109 {
   101     iLog->Log(_L("Cmpxharvestertest::HandleSubPlayerNamesL: Complete %d, Error %d"), aComplete, aError);   
   110     MPX_FUNC_EX("Cmpxplaybackutilitytest::HandleSubPlayerNamesL( TUid aPlayer, const MDesCArray* aSubPlayers, TBool aComplete, TInt aError)");
   102     }
   111     iLog->Log(_L("Cmpxplaybackutilitytest::HandleSubPlayerNamesL: Complete %d, Error %d"), aComplete, aError);   
       
   112 }
   103 
   113 
   104 // ---------------------------------------------------------------------------
   114 // ---------------------------------------------------------------------------
   105 //  Call back of media request.
   115 //  Call back of media request.
   106 // ---------------------------------------------------------------------------
   116 // ---------------------------------------------------------------------------
   107 //
   117 //
   108 void Cmpxplaybackutilitytest::HandleMediaL( const CMPXMedia& aProperties, TInt aError )
   118 void Cmpxplaybackutilitytest::HandleMediaL( const CMPXMedia& aProperties, TInt aError )
   109     {
   119 {
   110     iLog->Log(_L("Cmpxharvestertest::HandleMediaL: Error %d"), aError);   
   120     MPX_FUNC_EX("Cmpxplaybackutilitytest::HandleMediaL( const CMPXMedia& aProperties, TInt aError )");
   111     }
   121     iLog->Log(_L("Cmpxplaybackutilitytest::HandleMediaL: Error %d"), aError);   
       
   122 }
   112 
   123 
   113 // ---------------------------------------------------------------------------
   124 // ---------------------------------------------------------------------------
   114 //  Handle completion of a asynchronous command.
   125 //  Handle completion of a asynchronous command.
   115 //  Note: All clients should implement this callback.
   126 //  Note: All clients should implement this callback.
   116 // ---------------------------------------------------------------------------
   127 // ---------------------------------------------------------------------------
   117 //
   128 //
   118 void Cmpxplaybackutilitytest::HandlePlaybackCommandComplete( CMPXCommand* aCommandResult, TInt aError )
   129 void Cmpxplaybackutilitytest::HandlePlaybackCommandComplete( CMPXCommand* aCommandResult, TInt aError )
   119     {
   130 {
   120     iLog->Log(_L("Cmpxharvestertest::HandlePlaybackCommandComplete: Error %d"), aError);   
   131     MPX_FUNC_EX("Cmpxplaybackutilitytest::HandlePlaybackCommandComplete( CMPXCommand* aCommandResult, TInt aError )");
   121     }
   132     iLog->Log(_L("Cmpxplaybackutilitytest::HandlePlaybackCommandComplete: Error %d"), aError);   
       
   133 }
   122 
   134 
   123 // -----------------------------------------------------------------------------
   135 // -----------------------------------------------------------------------------
   124 // Cmpxplaybackutilitytest::Delete
   136 // Cmpxplaybackutilitytest::Delete
   125 // Delete here all resources allocated and opened from test methods. 
   137 // Delete here all resources allocated and opened from test methods. 
   126 // Called from destructor. 
   138 // Called from destructor. 
   127 // -----------------------------------------------------------------------------
   139 // -----------------------------------------------------------------------------
   128 //
   140 //
   129 void Cmpxplaybackutilitytest::Delete()
   141 void Cmpxplaybackutilitytest::Delete()
   130     {
   142 {
   131     iMPXPlaybackUtility->Close();
   143     TInt delerr = KErrNone;
       
   144     
       
   145     iMPXPlaybackUtility->Close();    
   132 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   146 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   133     iFile64.Close();
   147     iFile64.Close();
   134 #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   148 #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   135     iFile.Close();
   149     iFile.Close();
       
   150     
       
   151     if ( BaflUtils::FileExists( iFs, iFileName ) )
       
   152     {
       
   153         User::After( 1000000 * 10 );
       
   154         delerr = BaflUtils::DeleteFile(iFs,iFileName);
       
   155         iLog->Log(_L("deleting tempfile delerr=%d"),delerr);       
       
   156     }    
   136     iFs.Close();
   157     iFs.Close();
   137     iExpectedEventArray->ResetAndDestroy();
   158     iExpectedEventArray->ResetAndDestroy();
   138     }
   159       
       
   160 }
       
   161 
   139 
   162 
   140 // -----------------------------------------------------------------------------
   163 // -----------------------------------------------------------------------------
   141 // Cmpxplaybackutilitytest::CreateL
   164 // Cmpxplaybackutilitytest::CreateL
   142 // Create here all resources needed for test methods. 
   165 // Create here all resources needed for test methods. 
   143 // Called from ConstructL(). 
   166 // Called from ConstructL(). 
   144 // -----------------------------------------------------------------------------
   167 // -----------------------------------------------------------------------------
   145 //
   168 //
   146 void Cmpxplaybackutilitytest::CreateL()
   169 void Cmpxplaybackutilitytest::CreateL()
   147     {
   170 {
   148     iFs.Connect();
   171     iFs.Connect();
   149     iFs.ShareProtected();
   172     iFs.ShareProtected();
   150 
   173 
   151     iExpectedEventArray = new (ELeave) CArrayPtrFlat<TMpxPlaybackTestEvent>( 1 );
   174     iExpectedEventArray = new (ELeave) CArrayPtrFlat<TMpxPlaybackTestEvent>( 1 );
   152     iCallbackError = KErrNone;
   175     iCallbackError = KErrNone;
   153     iMPXPlaybackUtility = NULL;
   176     iMPXPlaybackUtility = NULL;
   154     }
   177 }
   155 
   178 
   156 // -----------------------------------------------------------------------------
   179 // -----------------------------------------------------------------------------
   157 // Cmpxplaybackutilitytest::AddExpectedEventL
   180 // Cmpxplaybackutilitytest::AddExpectedEventL
   158 // -----------------------------------------------------------------------------
   181 // -----------------------------------------------------------------------------
   159 //
   182 //
   160 void Cmpxplaybackutilitytest::AddExpectedEventL( TInt aEvent, TInt aType, TInt aData )
   183 void Cmpxplaybackutilitytest::AddExpectedEventL( TInt aEvent, TInt aType, TInt aData )
   161     {
   184 {
       
   185     MPX_FUNC_EX("Cmpxplaybackutilitytest::AddExpectedEventL( TInt aEvent, TInt aType, TInt aData )");
   162     iLog->Log(_L("Cmpxplaybackutilitytest::AddExpectedEventL() event = %d type = %d  value = %d"),
   186     iLog->Log(_L("Cmpxplaybackutilitytest::AddExpectedEventL() event = %d type = %d  value = %d"),
   163                  aEvent, aType, aData );
   187                  aEvent, aType, aData );
   164     
   188     
   165     TMpxPlaybackTestEvent* event = new (ELeave) TMpxPlaybackTestEvent;
   189     TMpxPlaybackTestEvent* event = new (ELeave) TMpxPlaybackTestEvent;
   166     event->iEvent = aEvent;
   190     event->iEvent = aEvent;
   167     event->iType = aType;
   191     event->iType = aType;
   168     event->iData = aData;
   192     event->iData = aData;
   169     iExpectedEventArray->AppendL( event );
   193     iExpectedEventArray->AppendL( event );
   170     }
   194 }
   171 
   195 
   172 // -----------------------------------------------------------------------------
   196 // -----------------------------------------------------------------------------
   173 // Cmpxplaybackutilitytest::RemoveExpectedEventL
   197 // Cmpxplaybackutilitytest::RemoveExpectedEventL
   174 // -----------------------------------------------------------------------------
   198 // -----------------------------------------------------------------------------
   175 //
   199 //
   176 void Cmpxplaybackutilitytest::RemoveExpectedEventL( TInt aEvent, TInt aType, TInt aData )
   200 void Cmpxplaybackutilitytest::RemoveExpectedEventL( TInt aEvent, TInt aType, TInt aData )
   177     {
   201 {
       
   202     MPX_FUNC_EX("Cmpxplaybackutilitytest::RemoveExpectedEventL( TInt aEvent, TInt aType, TInt aData )");
   178     iLog->Log(_L("Cmpxplaybackutilitytest::RemoveExpectedEventL() event = %d type = %d  value = %d"),
   203     iLog->Log(_L("Cmpxplaybackutilitytest::RemoveExpectedEventL() event = %d type = %d  value = %d"),
   179                  aEvent, aType, aData );
   204                  aEvent, aType, aData );
   180     
   205     
   181     if ( (iExpectedEventArray->Count() > 0) &&
   206     if ( (iExpectedEventArray->Count() > 0) &&
   182          ((*iExpectedEventArray)[0]->iEvent == aEvent) )
   207          ((*iExpectedEventArray)[0]->iEvent == aEvent) && ((*iExpectedEventArray)[0]->iType == aType))
   183         {
   208     {
   184         iLog->Log(_L("Cmpxplaybackutilitytest::RemoveExpectedEventL() event = %d removed."), aEvent);
   209         iLog->Log(_L("Cmpxplaybackutilitytest::RemoveExpectedEventL() event = %d removed."), aEvent);
   185         iExpectedEventArray->Delete( 0 );
   210         iExpectedEventArray->Delete( 0 );
   186         }
   211     }
   187     }
   212 }
   188 
   213 
   189 // -----------------------------------------------------------------------------
   214 // -----------------------------------------------------------------------------
   190 // Cmpxplaybackutilitytest::RunMethodL
   215 // Cmpxplaybackutilitytest::RunMethodL
   191 // Run specified method. Contains also table of test mothods and their names.
   216 // Run specified method. Contains also table of test mothods and their names.
   192 // -----------------------------------------------------------------------------
   217 // -----------------------------------------------------------------------------
   193 //
   218 //
   194 TInt Cmpxplaybackutilitytest::RunMethodL( CStifItemParser& aItem ) 
   219 TInt Cmpxplaybackutilitytest::RunMethodL( CStifItemParser& aItem ) 
   195     {
   220 {
   196     static TStifFunctionInfo const KFunctions[] =
   221     static TStifFunctionInfo const KFunctions[] =
   197         {  
   222     {  
   198         // Copy this line for every implemented function.
   223         // Copy this line for every implemented function.
   199         // First string is the function name used in TestScripter script file.
   224         // First string is the function name used in TestScripter script file.
   200         // Second is the actual implementation member function. 
   225         // Second is the actual implementation member function. 
   201 
   226 
   202         //ADD NEW ENTRY HERE
   227         //ADD NEW ENTRY HERE
   214         ENTRY( "MMPXPlaybackUtilityInitStreaming64L", Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreaming64L ),
   239         ENTRY( "MMPXPlaybackUtilityInitStreaming64L", Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreaming64L ),
   215         ENTRY( "MMPXPlaybackUtilityFile64L", Cmpxplaybackutilitytest::MMPXPlaybackUtilityFile64L ),
   240         ENTRY( "MMPXPlaybackUtilityFile64L", Cmpxplaybackutilitytest::MMPXPlaybackUtilityFile64L ),
   216         ENTRY( "MMPXPlaybackUtilityAddObserverL", Cmpxplaybackutilitytest::MMPXPlaybackUtilityAddObserverL ),
   241         ENTRY( "MMPXPlaybackUtilityAddObserverL", Cmpxplaybackutilitytest::MMPXPlaybackUtilityAddObserverL ),
   217         ENTRY( "MMPXPlaybackUtilityRemoveObserverL", Cmpxplaybackutilitytest::MMPXPlaybackUtilityRemoveObserverL ),
   242         ENTRY( "MMPXPlaybackUtilityRemoveObserverL", Cmpxplaybackutilitytest::MMPXPlaybackUtilityRemoveObserverL ),
   218         ENTRY( "MMPXPlaybackUtilityPlayerManagerSelectPlayerL", Cmpxplaybackutilitytest::MMPXPlaybackUtilityPlayerManagerSelectPlayerL ),
   243         ENTRY( "MMPXPlaybackUtilityPlayerManagerSelectPlayerL", Cmpxplaybackutilitytest::MMPXPlaybackUtilityPlayerManagerSelectPlayerL ),
       
   244         
       
   245         ENTRY( "MMPXPlaybackUtilityCommandPlayL", Cmpxplaybackutilitytest::MMPXPlaybackUtilityCommandPlayL ),
       
   246         ENTRY( "MMPXPlaybackUtilityCommandStopL", Cmpxplaybackutilitytest::MMPXPlaybackUtilityCommandStopL ),
       
   247         ENTRY( "MMPXPlaybackUtilityCommandPauseL", Cmpxplaybackutilitytest::MMPXPlaybackUtilityCommandPauseL ),
       
   248         ENTRY( "MMPXPlaybackUtilityCommandPlayPauseL", Cmpxplaybackutilitytest::MMPXPlaybackUtilityCommandPlayPauseL ),
       
   249         ENTRY( "MMPXPlaybackUtilityCommandPlayCompleteL", Cmpxplaybackutilitytest::MMPXPlaybackUtilityCommandPlayCompleteL ),
       
   250         ENTRY( "MMPXPlaybackUtilityCommandSeekForwardL", Cmpxplaybackutilitytest::MMPXPlaybackUtilityCommandSeekForwardL ),
       
   251         ENTRY( "MMPXPlaybackUtilityCommandSeekBackwardL", Cmpxplaybackutilitytest::MMPXPlaybackUtilityCommandSeekBackwardL ),
       
   252         ENTRY( "MMPXPlaybackUtilityCommandCloseL", Cmpxplaybackutilitytest::MMPXPlaybackUtilityCommandCloseL ),
       
   253         ENTRY( "MMPXPlaybackUtilitySetL", Cmpxplaybackutilitytest::MMPXPlaybackUtilitySetL),
       
   254         
   219         ENTRY( "EndTest", Cmpxplaybackutilitytest::EndTest ),
   255         ENTRY( "EndTest", Cmpxplaybackutilitytest::EndTest ),
   220         };
   256     };
   221 
   257 
   222     const TInt count = sizeof( KFunctions ) / 
   258     const TInt count = sizeof( KFunctions ) / 
   223                         sizeof( TStifFunctionInfo );
   259                         sizeof( TStifFunctionInfo );
   224    
   260    
   225     return RunInternalL( KFunctions, count, aItem );
   261     return RunInternalL( KFunctions, count, aItem );
   226     }
   262 }
   227 
   263 
   228 // -----------------------------------------------------------------------------
   264 // -----------------------------------------------------------------------------
   229 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityNewL
   265 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityNewL
   230 // NewL test method function.
   266 // NewL test method function.
   231 // (other items were commented in a header).
   267 // (other items were commented in a header).
   232 // -----------------------------------------------------------------------------
   268 // -----------------------------------------------------------------------------
   233 //
   269 //
   234 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityNewL( CStifItemParser& aItem )
   270 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityNewL( CStifItemParser& aItem )
   235 	{
   271 {
   236 	iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityNewL"));
   272     MPX_FUNC_EX("Cmpxplaybackutilitytest::MMPXPlaybackUtilityNewL( CStifItemParser& aItem )");
       
   273     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityNewL"));
   237 	TInt err = KErrNone;
   274 	TInt err = KErrNone;
   238     TInt mode;
   275     TInt mode;
   239    
   276    
   240     if ( aItem.GetNextInt(mode) != KErrNone )
   277     if ( aItem.GetNextInt(mode) != KErrNone )
   241         {
   278     {
   242         iLog->Log(_L("MMPXPlaybackUtilityNewL - Missing playback mode."));
   279         iLog->Log(_L("MMPXPlaybackUtilityNewL - Missing playback mode."));
   243         err = KErrArgument;
   280         err = KErrArgument;
   244         return err;
   281         return err;
   245         }
   282     }
   246 
   283 
   247     iLog->Log(_L("Cmpxharvestertest::MMPXPlaybackUtilityNewL: mode %d"), mode);
   284     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityNewL: mode %d"), mode);
   248 	TRAP( err,iMPXPlaybackUtility = MMPXPlaybackUtility::NewL(TUid::Uid(mode), this ));
   285 	TRAP( err,iMPXPlaybackUtility = MMPXPlaybackUtility::NewL(TUid::Uid(mode), this ));
   249     
   286     
   250 	if (err!= KErrNone)
   287 	if (err!= KErrNone)
   251 		{
   288     {
   252 		iLog->Log(_L("Cmpxharvestertest::MMPXPlaybackUtilityNewL: error %d"), err);
   289 		iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityNewL: error %d"), err);
   253 		}
   290     }
   254 	
   291 	
   255 	return err;
   292 	return err;
   256 	}
   293 }
   257 
   294 
   258 // -----------------------------------------------------------------------------
   295 // -----------------------------------------------------------------------------
   259 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityNewWithCatL
   296 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityNewWithCatL
   260 // NewL test method function.
   297 // NewL test method function.
   261 // (other items were commented in a header).
   298 // (other items were commented in a header).
   262 // -----------------------------------------------------------------------------
   299 // -----------------------------------------------------------------------------
   263 //
   300 //
   264 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityNewWithCatL( CStifItemParser& aItem )
   301 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityNewWithCatL( CStifItemParser& aItem )
   265     {
   302 {
       
   303     MPX_FUNC_EX("Cmpxplaybackutilitytest::MMPXPlaybackUtilityNewWithCatL( CStifItemParser& aItem )");
   266     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityNewWithCatL"));
   304     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityNewWithCatL"));
   267     TInt err = KErrNone;
   305     TInt err = KErrNone;
   268     TInt mode;
   306     TInt mode;
   269     TInt category;
   307     TInt category;
   270     if ( aItem.GetNextInt(category) != KErrNone )
   308     if ( aItem.GetNextInt(category) != KErrNone )
   271         {
   309     {
   272         iLog->Log(_L("MMPXPlaybackUtilityNewWithCatL - Missing category."));
   310         iLog->Log(_L("MMPXPlaybackUtilityNewWithCatL - Missing category."));
   273         err = KErrArgument;
   311         err = KErrArgument;
   274         return err;
   312         return err;
   275         }
   313     }
   276 
   314 
   277     if ( aItem.GetNextInt(mode) != KErrNone )
   315     if ( aItem.GetNextInt(mode) != KErrNone )
   278         {
   316     {
   279         iLog->Log(_L("MMPXPlaybackUtilityNewWithCatL - Missing playback mode."));
   317         iLog->Log(_L("MMPXPlaybackUtilityNewWithCatL - Missing playback mode."));
   280         err = KErrArgument;
   318         err = KErrArgument;
   281         return err;
   319         return err;
   282         }
   320     }
   283 
   321 
   284     iLog->Log(_L("Cmpxharvestertest::MMPXPlaybackUtilityNewWithCatL: category %d"), category);
   322     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityNewWithCatL: category %d"), category);
   285     iLog->Log(_L("Cmpxharvestertest::MMPXPlaybackUtilityNewWithCatL: mode %d"), mode);
   323     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityNewWithCatL: mode %d"), mode);
   286     TRAP( err,iMPXPlaybackUtility = MMPXPlaybackUtility::NewL((TMPXCategory)category, TUid::Uid(mode), this ));
   324     TRAP( err,iMPXPlaybackUtility = MMPXPlaybackUtility::NewL((TMPXCategory)category, TUid::Uid(mode), this ));
   287     
   325     
   288     if (err!= KErrNone)
   326     if (err!= KErrNone)
   289         {
   327     {
   290         iLog->Log(_L("Cmpxharvestertest::MMPXPlaybackUtilityNewWithCatL: error %d"), err);
   328         iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityNewWithCatL: error %d"), err);
   291         }
   329     }
   292     return err;
   330     return err;
   293     }
   331 }
   294 
   332 
   295 // -----------------------------------------------------------------------------
   333 // -----------------------------------------------------------------------------
   296 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityUtilityL
   334 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityUtilityL
   297 // UtilityL test method function.
   335 // UtilityL test method function.
   298 // (other items were commented in a header).
   336 // (other items were commented in a header).
   299 // -----------------------------------------------------------------------------
   337 // -----------------------------------------------------------------------------
   300 //
   338 //
   301 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityUtilityL( CStifItemParser& aItem )
   339 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityUtilityL( CStifItemParser& aItem )
   302 	{
   340 {
       
   341     MPX_FUNC_EX("Cmpxplaybackutilitytest::MMPXPlaybackUtilityUtilityL( CStifItemParser& aItem )");
   303     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityUtilityL"));
   342     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityUtilityL"));
   304 	TInt err = KErrNone;
   343 	TInt err = KErrNone;
   305 	TInt mode = 0;
   344 	TInt mode = 0;
   306 	
   345 	
   307 	aItem.GetNextInt(mode);
   346 	aItem.GetNextInt(mode);
   308     iLog->Log(_L("Cmpxharvestertest::MMPXPlaybackUtilityUtilityL: mode %d"), mode);
   347     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityUtilityL: mode %d"), mode);
   309 	if ( mode )
   348 	if ( mode )
   310 	    {
   349     {
   311 	    TRAP(err,iMPXPlaybackUtility = MMPXPlaybackUtility::UtilityL(TUid::Uid(mode)));
   350 	    TRAP(err,iMPXPlaybackUtility = MMPXPlaybackUtility::UtilityL(TUid::Uid(mode)));
   312 	    }
   351     }
   313 	else
   352 	else
   314 	    {
   353     {
   315         TRAP(err,iMPXPlaybackUtility = MMPXPlaybackUtility::UtilityL());
   354         TRAP(err,iMPXPlaybackUtility = MMPXPlaybackUtility::UtilityL());
   316 	    }
   355     }
   317     
   356     
   318 	iLog->Log(_L("Cmpxharvestertest::MMPXPlaybackUtilityUtilityL: error %d"), err);
   357 	iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityUtilityL: error %d"), err);
   319 	
   358 	
   320 	return err;
   359 	return err;
   321 	}
   360 }
   322 
   361 
   323 // -----------------------------------------------------------------------------
   362 // -----------------------------------------------------------------------------
   324 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityUtilityWithCatL
   363 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityUtilityWithCatL
   325 // UtilityL test method function.
   364 // UtilityL test method function.
   326 // (other items were commented in a header).
   365 // (other items were commented in a header).
   327 // -----------------------------------------------------------------------------
   366 // -----------------------------------------------------------------------------
   328 //
   367 //
   329 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityUtilityWithCatL( CStifItemParser& aItem )
   368 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityUtilityWithCatL( CStifItemParser& aItem )
   330     {
   369 {
       
   370     MPX_FUNC_EX("Cmpxplaybackutilitytest::MMPXPlaybackUtilityUtilityWithCatL( CStifItemParser& aItem )");
   331     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityUtilityWithCatL"));
   371     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityUtilityWithCatL"));
   332     TInt err = KErrNone;
   372     TInt err = KErrNone;
   333     TInt category;
   373     TInt category;
   334     TInt mode = 0;
   374     TInt mode = 0;
   335     
   375     
   336     if ( aItem.GetNextInt(category) != KErrNone )
   376     if ( aItem.GetNextInt(category) != KErrNone )
   337         {
   377     {
   338         iLog->Log(_L("MMPXPlaybackUtilityNewWithCatL - Missing category."));
   378         iLog->Log(_L("MMPXPlaybackUtilityNewWithCatL - Missing category."));
   339         err = KErrArgument;
   379         err = KErrArgument;
   340         return err;
   380         return err;
   341         }
   381     }
   342 
   382 
   343     aItem.GetNextInt(mode);
   383     aItem.GetNextInt(mode);
   344     iLog->Log(_L("Cmpxharvestertest::MMPXPlaybackUtilityUtilityWithCatL: category %d"), category);
   384     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityUtilityWithCatL: category %d"), category);
   345     iLog->Log(_L("Cmpxharvestertest::MMPXPlaybackUtilityUtilityWithCatL: mode %d"), mode);
   385     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityUtilityWithCatL: mode %d"), mode);
   346     if ( mode )
   386     if ( mode )
   347         {
   387     {
   348         TRAP(err,iMPXPlaybackUtility = MMPXPlaybackUtility::UtilityL((TMPXCategory)category, TUid::Uid(mode)));
   388         TRAP(err,iMPXPlaybackUtility = MMPXPlaybackUtility::UtilityL((TMPXCategory)category, TUid::Uid(mode)));
   349         }
   389     }
   350     else
   390     else
   351         {
   391     {
   352         TRAP(err,iMPXPlaybackUtility = MMPXPlaybackUtility::UtilityL((TMPXCategory)category));
   392         TRAP(err,iMPXPlaybackUtility = MMPXPlaybackUtility::UtilityL((TMPXCategory)category));
   353         }
   393     }
   354     
   394     
   355     iLog->Log(_L("Cmpxharvestertest::MMPXPlaybackUtilityUtilityWithCatL: error %d"), err);
   395     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityUtilityWithCatL: error %d"), err);
   356     
   396     
   357     return err;
   397     return err;
   358     }
   398 }
   359 
   399 
   360 // -----------------------------------------------------------------------------
   400 // -----------------------------------------------------------------------------
   361 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithPlaylistL
   401 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithPlaylistL
   362 // InitL(CMPXCollectionPlaylist) test method function.
   402 // InitL(CMPXCollectionPlaylist) test method function.
   363 // (other items were commented in a header).
   403 // (other items were commented in a header).
   364 // -----------------------------------------------------------------------------
   404 // -----------------------------------------------------------------------------
   365 //
   405 //
   366 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithPlaylistL( CStifItemParser& /*aItem*/ )
   406 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithPlaylistL( CStifItemParser& /*aItem*/ )
   367     {
   407 {
       
   408     MPX_FUNC_EX("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithPlaylistL( CStifItemParser& )");
   368     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithPlaylistL"));
   409     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithPlaylistL"));
   369     TInt err = KErrNone;
   410     TInt err = KErrNone;
   370     CMPXCollectionPlaylist* playlist = CMPXCollectionPlaylist::NewL();
   411     CMPXCollectionPlaylist* playlist = CMPXCollectionPlaylist::NewL();
   371     CleanupStack::PushL(playlist);
   412     CleanupStack::PushL(playlist);
   372     TRAP(err,iMPXPlaybackUtility->InitL(*playlist));
   413     TRAP(err,iMPXPlaybackUtility->InitL(*playlist));
   373     CleanupStack::PopAndDestroy(playlist);
   414     CleanupStack::PopAndDestroy(playlist);
   374     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithPlaylistL - error=%d"),err);
   415     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithPlaylistL - error=%d"),err);
   375     return err;
   416     return err;
   376     }
   417 }
   377 
   418 
   378 // -----------------------------------------------------------------------------
   419 // -----------------------------------------------------------------------------
   379 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithUriL
   420 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithUriL
   380 // InitL(Uri) test method function.
   421 // InitL(Uri) test method function.
   381 // (other items were commented in a header).
   422 // (other items were commented in a header).
   382 // -----------------------------------------------------------------------------
   423 // -----------------------------------------------------------------------------
   383 //
   424 //
   384 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithUriL( CStifItemParser& aItem )
   425 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithUriL( CStifItemParser& aItem )
   385     {
   426 {
       
   427     MPX_FUNC_EX("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithUriL( CStifItemParser& aItem )");
   386     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithUriL"));
   428     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithUriL"));
   387     TInt err = KErrNone;
   429     TInt err = KErrNone; 
   388     TPtrC string;
   430     TPtrC string;
   389    
   431     
       
   432     MMPXPlayerManager& manager = iMPXPlaybackUtility->PlayerManager();
       
   433     MMPXPlayer* player = manager.CurrentPlayer();        
       
   434     
   390     if( aItem.GetNextString( string ) == KErrNone )
   435     if( aItem.GetNextString( string ) == KErrNone )
   391         {
   436     {
   392         TBuf<120> uri;
   437         //TBuf<120> uri;
       
   438         TFileName uri;
   393         uri.Append(KmpxplaybackutilityTestFilePath);
   439         uri.Append(KmpxplaybackutilityTestFilePath);
   394         uri.Append(string);
   440         uri.Append(string);
   395         iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithUriL - uri = %S."), &uri);
   441         iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithUriL - uri = %S."), &uri);
       
   442         iFileName = uri;
       
   443 
       
   444         if ( ! BaflUtils::FileExists( iFs, iFileName ) )
       
   445         {             
       
   446             err = iFile.Create( iFs, uri, EFileShareAny );
       
   447             iLog->Log(_L("creating tempfile error=%d"),err);
       
   448             iFile.Close();
       
   449         }
       
   450                                      
   396         TRAP(err,iMPXPlaybackUtility->InitL(uri));
   451         TRAP(err,iMPXPlaybackUtility->InitL(uri));
   397         
   452         
   398         if ( !err )
   453         if ( !err )
   399             {
   454         {
   400             TInt event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EPlayerChanged;
   455             TInt event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EPlayerChanged;
   401             AddExpectedEventL(event, 0, 0);
   456             AddExpectedEventL(event, 0, 0);
       
   457             
   402             event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EInitializeComplete;
   458             event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EInitializeComplete;
   403             AddExpectedEventL(event, 0, 0);
   459             AddExpectedEventL(event, 0, 0);
       
   460 
       
   461             event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EStateChanged;
       
   462             AddExpectedEventL(event, EPbStateInitialised, 0);
       
   463             
       
   464             if ( player->UidL() == KPbTestVideoPlugin )
       
   465             {
       
   466                 event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EStateChanged;
       
   467                 AddExpectedEventL(event, EPbStateBuffering, 0);
   404             }
   468             }
   405         iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithUriL - error=%d"),err);
   469         }
   406         }
   470         iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithUriL - error=%d"),err);                  
       
   471     }
   407     else
   472     else
   408         {
   473     {
   409         iLog->Log(_L("MMPXPlaybackUtilityInitWithUriL - Missing file name."));
   474         iLog->Log(_L("MMPXPlaybackUtilityInitWithUriL - Missing file name."));
   410         err = KErrArgument;
   475         err = KErrArgument;
   411         }
   476     }
   412     return err;
   477     
   413     }
   478     return err;
       
   479 }
   414 
   480 
   415 // -----------------------------------------------------------------------------
   481 // -----------------------------------------------------------------------------
   416 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithRFileL
   482 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithRFileL
   417 // Init64L test method function.
   483 // Init64L test method function.
   418 // (other items were commented in a header).
   484 // (other items were commented in a header).
   419 // -----------------------------------------------------------------------------
   485 // -----------------------------------------------------------------------------
   420 //
   486 //
   421 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithRFileL( CStifItemParser& aItem )
   487 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithRFileL( CStifItemParser& aItem )
   422     {
   488 {
       
   489     MPX_FUNC_EX("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithRFileL( CStifItemParser& aItem )");
   423     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithRFileL"));
   490     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithRFileL"));
   424     TInt err = KErrNone;
   491     TInt err = KErrNone;
   425     TPtrC string;
   492     TPtrC string;
       
   493     
       
   494     MMPXPlayerManager& manager = iMPXPlaybackUtility->PlayerManager();
       
   495     MMPXPlayer* player = manager.CurrentPlayer();
   426    
   496    
   427     if( aItem.GetNextString( string ) == KErrNone )
   497     if( aItem.GetNextString( string ) == KErrNone )
   428         {
   498     {
   429         TBuf<120> KFrom;
   499         TBuf<120> KFrom;
   430         KFrom.Append(KmpxplaybackutilityTestFilePath);
   500         KFrom.Append(KmpxplaybackutilityTestFilePath);
   431         KFrom.Append(string);
   501         KFrom.Append(string);
       
   502         iFileName = KFrom;
       
   503         
   432         if ( iFile.SubSessionHandle() )
   504         if ( iFile.SubSessionHandle() )
   433             {
   505         {
   434             iFile.Close();
   506             iFile.Close();
   435             }
   507         }
       
   508         
       
   509         if ( ! BaflUtils::FileExists( iFs, iFileName ) )
       
   510         {             
       
   511             err = iFile.Create( iFs, KFrom, EFileShareAny );
       
   512             iLog->Log(_L("creating tempfile error=%d"),err);
       
   513             iFile.Close();
       
   514         }
       
   515         
   436         err = iFile.Open(iFs, KFrom, EFileRead | EFileShareReadersOrWriters);
   516         err = iFile.Open(iFs, KFrom, EFileRead | EFileShareReadersOrWriters);
       
   517         
   437         if ( err == KErrNone )
   518         if ( err == KErrNone )
   438             {
   519         {
   439             iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithRFileL - Open passed."));
   520             iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithRFileL - Open passed."));
   440             TRAP(err,iMPXPlaybackUtility->InitL(iFile));
   521             TRAP(err,iMPXPlaybackUtility->InitL(iFile));
   441             
   522             
   442             if ( !err )
   523             if ( !err )
   443                 {
   524             {
   444                 TInt event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EPlayerChanged;
   525                 TInt event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EPlayerChanged;
   445                 AddExpectedEventL(event, 0, 0);
   526                 AddExpectedEventL(event, 0, 0);
       
   527                 
   446                 event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EInitializeComplete;
   528                 event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EInitializeComplete;
   447                 AddExpectedEventL(event, 0, 0);
   529                 AddExpectedEventL(event, 0, 0);
       
   530                 
       
   531                 event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EStateChanged;
       
   532                 AddExpectedEventL(event, EPbStateInitialised, 0);
       
   533                 
       
   534                 if ( player->UidL() == KPbTestVideoPlugin )
       
   535                 {
       
   536                     event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EStateChanged;
       
   537                     AddExpectedEventL(event, EPbStateBuffering, 0);
   448                 }
   538                 }
   449             }
   539             }
       
   540         }
   450         iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithRFileL - error=%d"),err);
   541         iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithRFileL - error=%d"),err);
   451         }
   542     }
   452     else
   543     else
   453         {
   544     {
   454         iLog->Log(_L("MMPXPlaybackUtilityInitWithRFileL - Missing file name."));
   545         iLog->Log(_L("MMPXPlaybackUtilityInitWithRFileL - Missing file name."));
   455         err = KErrArgument;
   546         err = KErrArgument;
   456         }
   547     }
   457     return err;
   548     return err;
   458     }
   549 }
   459 
   550 
   460 // -----------------------------------------------------------------------------
   551 // -----------------------------------------------------------------------------
   461 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreamingWithUriL
   552 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreamingWithUriL
   462 // InitStreamingL(Uri) test method function.
   553 // InitStreamingL(Uri) test method function.
   463 // (other items were commented in a header).
   554 // (other items were commented in a header).
   464 // -----------------------------------------------------------------------------
   555 // -----------------------------------------------------------------------------
   465 //
   556 //
   466 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreamingWithUriL( CStifItemParser& aItem )
   557 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreamingWithUriL( CStifItemParser& aItem )
   467     {
   558 {
       
   559     MPX_FUNC_EX("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreamingWithUriL( CStifItemParser& aItem )");
   468     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreamingWithUriL"));
   560     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreamingWithUriL"));
   469     TInt err = KErrNone;
   561     TInt err = KErrNone;
   470     TPtrC string;
   562     TPtrC string;
   471     TInt accessPoint = 1;
   563     TInt accessPoint = 1;
   472    
   564    
       
   565     MMPXPlayerManager& manager = iMPXPlaybackUtility->PlayerManager();
       
   566     MMPXPlayer* player = manager.CurrentPlayer();
       
   567     
   473     if( aItem.GetNextString( string ) == KErrNone )
   568     if( aItem.GetNextString( string ) == KErrNone )
   474         {
   569     {
   475         TBuf<120> uri;
   570         TBuf<120> uri;
   476         uri.Append(KmpxplaybackutilityTestFilePath);
   571         uri.Append(KmpxplaybackutilityTestFilePath);
   477         uri.Append(string);
   572         uri.Append(string);
   478         iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreamingWithUriL - uri = %S."), &uri);
   573         iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreamingWithUriL - uri = %S."), &uri);
       
   574         iFileName = uri;
       
   575 
       
   576         if ( ! BaflUtils::FileExists( iFs, iFileName ) )
       
   577         {             
       
   578             err = iFile.Create( iFs, uri, EFileShareAny );
       
   579             iLog->Log(_L("creating tempfile error=%d"),err);
       
   580             iFile.Close();
       
   581         }
       
   582         
   479         TRAP(err,iMPXPlaybackUtility->InitStreamingL(uri, NULL, accessPoint));
   583         TRAP(err,iMPXPlaybackUtility->InitStreamingL(uri, NULL, accessPoint));
   480         
   584         
   481         if ( !err )
   585         if ( !err )
   482             {
   586         {
   483             TInt event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EPlayerChanged;
   587             TInt event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EPlayerChanged;
   484             AddExpectedEventL(event, 0, 0);
   588             AddExpectedEventL(event, 0, 0);
       
   589             
   485             event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EInitializeComplete;
   590             event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EInitializeComplete;
   486             AddExpectedEventL(event, 0, 0);
   591             AddExpectedEventL(event, 0, 0);
       
   592             
       
   593             event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EStateChanged;
       
   594             AddExpectedEventL(event, EPbStateInitialised, 0);
       
   595             
       
   596             if ( player->UidL() == KPbTestVideoPlugin )
       
   597             {
       
   598                 event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EStateChanged;
       
   599                 AddExpectedEventL(event, EPbStateBuffering, 0);
   487             }
   600             }
       
   601                         
       
   602         }
   488         iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreamingWithUriL - error=%d"),err);
   603         iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreamingWithUriL - error=%d"),err);
   489         }
   604     }
   490     else
   605     else
   491         {
   606     {
   492         iLog->Log(_L("MMPXPlaybackUtilityInitStreamingWithUriL - Missing file name."));
   607         iLog->Log(_L("MMPXPlaybackUtilityInitStreamingWithUriL - Missing file name."));
   493         err = KErrArgument;
   608         err = KErrArgument;
   494         }
   609     }
   495     return err;
   610     return err;
   496     }
   611 }
   497 
   612 
   498 // -----------------------------------------------------------------------------
   613 // -----------------------------------------------------------------------------
   499 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreamingWithRFileL
   614 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreamingWithRFileL
   500 // InitStreamingL(RFile) test method function.
   615 // InitStreamingL(RFile) test method function.
   501 // (other items were commented in a header).
   616 // (other items were commented in a header).
   502 // -----------------------------------------------------------------------------
   617 // -----------------------------------------------------------------------------
   503 //
   618 //
   504 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreamingWithRFileL( CStifItemParser& aItem )
   619 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreamingWithRFileL( CStifItemParser& aItem )
   505     {
   620 {
       
   621     MPX_FUNC_EX("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreamingWithRFileL( CStifItemParser& aItem )");
   506     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreamingWithRFileL"));
   622     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreamingWithRFileL"));
   507     TInt err = KErrNone;
   623     TInt err = KErrNone;
   508     TPtrC string;
   624     TPtrC string;
   509     TInt accessPoint = 1;
   625     TInt accessPoint = 1;
   510     
   626     
       
   627     MMPXPlayerManager& manager = iMPXPlaybackUtility->PlayerManager();
       
   628     MMPXPlayer* player = manager.CurrentPlayer();
       
   629     
   511     if( aItem.GetNextString( string ) == KErrNone )
   630     if( aItem.GetNextString( string ) == KErrNone )
   512         {
   631     {
   513         TBuf<120> KFrom;
   632         TBuf<120> KFrom;
   514         KFrom.Append(KmpxplaybackutilityTestFilePath);
   633         KFrom.Append(KmpxplaybackutilityTestFilePath);
   515         KFrom.Append(string);
   634         KFrom.Append(string);
       
   635         iFileName = KFrom;
       
   636         
   516         if ( iFile.SubSessionHandle() )
   637         if ( iFile.SubSessionHandle() )
   517             {
   638         {
   518             iFile.Close();
   639             iFile.Close();
   519             }
   640         }
       
   641         
       
   642         if ( ! BaflUtils::FileExists( iFs, iFileName ) )
       
   643         {             
       
   644             err = iFile.Create( iFs, KFrom, EFileShareAny );
       
   645             iLog->Log(_L("creating tempfile error=%d"),err);
       
   646             iFile.Close();
       
   647         }
       
   648         
   520         err = iFile.Open(iFs, KFrom, EFileRead | EFileShareReadersOrWriters);
   649         err = iFile.Open(iFs, KFrom, EFileRead | EFileShareReadersOrWriters);
   521         if ( err == KErrNone )
   650         if ( err == KErrNone )
   522             {
   651         {
   523             iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreamingWithRFileL - Open passed."));
   652             iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreamingWithRFileL - Open passed."));
   524             TRAP(err,iMPXPlaybackUtility->InitStreamingL(iFile, accessPoint));
   653             TRAP(err,iMPXPlaybackUtility->InitStreamingL(iFile, accessPoint));
   525 
   654 
   526             if ( !err )
   655             if ( !err )
   527                 {
   656             {
   528                 TInt event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EPlayerChanged;
   657                 TInt event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EPlayerChanged;
   529                 AddExpectedEventL(event, 0, 0);
   658                 AddExpectedEventL(event, 0, 0);
       
   659                 
   530                 event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EInitializeComplete;
   660                 event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EInitializeComplete;
   531                 AddExpectedEventL(event, 0, 0);
   661                 AddExpectedEventL(event, 0, 0);
       
   662 
       
   663                 event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EStateChanged;
       
   664                 AddExpectedEventL(event, EPbStateInitialised, 0);
       
   665             
       
   666                 if ( player->UidL() == KPbTestVideoPlugin )
       
   667                 {
       
   668                     event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EStateChanged;
       
   669                     AddExpectedEventL(event, EPbStateBuffering, 0);
   532                 }
   670                 }
       
   671                                 
   533             }
   672             }
       
   673         }
   534         iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreamingWithRFileL - error=%d"),err);
   674         iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreamingWithRFileL - error=%d"),err);
   535         }
   675     }
   536     else
   676     else
   537         {
   677     {
   538         iLog->Log(_L("MMPXPlaybackUtilityInitStreamingWithRFileL - Missing file name."));
   678         iLog->Log(_L("MMPXPlaybackUtilityInitStreamingWithRFileL - Missing file name."));
   539         err = KErrArgument;
   679         err = KErrArgument;
   540         }
   680     }
   541     return err;
   681     return err;
   542     }
   682 }
   543 
   683 
   544 // -----------------------------------------------------------------------------
   684 // -----------------------------------------------------------------------------
   545 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityInit64L
   685 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityInit64L
   546 // Init64L test method function.
   686 // Init64L test method function.
   547 // (other items were commented in a header).
   687 // (other items were commented in a header).
   548 // -----------------------------------------------------------------------------
   688 // -----------------------------------------------------------------------------
   549 //
   689 //
   550 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityInit64L( CStifItemParser& aItem )
   690 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityInit64L( CStifItemParser& aItem )
   551     {
   691 {
       
   692     MPX_FUNC_EX("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInit64L( CStifItemParser& aItem )");
   552     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInit64L"));
   693     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInit64L"));
   553     TInt err = KErrNone;
   694     TInt err = KErrNone;
   554 #ifndef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   695 #ifndef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   555     err = KErrNotSupported;
   696     err = KErrNotSupported;
   556     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInit64L testing Init64L() error=%d"),err);
   697     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInit64L testing Init64L() error=%d"),err);
   557 #else // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   698 #else // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   558     TPtrC string;
   699     TPtrC string;
   559    
   700    
       
   701     MMPXPlayerManager& manager = iMPXPlaybackUtility->PlayerManager();
       
   702     MMPXPlayer* player = manager.CurrentPlayer();
       
   703     
   560     if( aItem.GetNextString( string ) == KErrNone )
   704     if( aItem.GetNextString( string ) == KErrNone )
   561         {
   705     {
   562         TBuf<120> KFrom;
   706         TBuf<120> KFrom;
   563         KFrom.Append(KmpxplaybackutilityTestFilePath);
   707         KFrom.Append(KmpxplaybackutilityTestFilePath);
   564         KFrom.Append(string);
   708         KFrom.Append(string);
       
   709         iFileName = KFrom;
       
   710         
   565         if ( iFile64.SubSessionHandle() )
   711         if ( iFile64.SubSessionHandle() )
   566             {
   712         {
   567             iFile64.Close();
   713             iFile64.Close();
   568             }
   714         }
       
   715         
       
   716         if ( ! BaflUtils::FileExists( iFs, iFileName ) )
       
   717         {             
       
   718             err = iFile64.Create( iFs, KFrom, EFileShareAny );
       
   719             iLog->Log(_L("creating tempfile error=%d"),err);
       
   720             iFile64.Close();
       
   721         }
       
   722         
   569         err = iFile64.Open(iFs, KFrom, EFileRead | EFileShareReadersOrWriters);
   723         err = iFile64.Open(iFs, KFrom, EFileRead | EFileShareReadersOrWriters);
       
   724         
   570         if ( err == KErrNone )
   725         if ( err == KErrNone )
   571             {
   726         {
   572             iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInit64L - Open passed."));
   727             iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInit64L - Open passed."));
   573             TRAP(err,iMPXPlaybackUtility->Init64L(iFile64));
   728             TRAP(err,iMPXPlaybackUtility->Init64L(iFile64));
   574             
   729             
   575             if ( !err )
   730             if ( !err )
   576                 {
   731             {
   577                 TInt event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EPlayerChanged;
   732                 TInt event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EPlayerChanged;
   578                 AddExpectedEventL(event, 0, 0);
   733                 AddExpectedEventL(event, 0, 0);
       
   734                 
   579                 event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EInitializeComplete;
   735                 event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EInitializeComplete;
   580                 AddExpectedEventL(event, 0, 0);
   736                 AddExpectedEventL(event, 0, 0);
       
   737 
       
   738                 event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EStateChanged;
       
   739                 AddExpectedEventL(event, EPbStateInitialised, 0);
       
   740 
       
   741                 if ( player->UidL() == KPbTestVideoPlugin )
       
   742                 {
       
   743                     event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EStateChanged;
       
   744                     AddExpectedEventL(event, EPbStateBuffering, 0);
   581                 }
   745                 }
       
   746                                 
   582             }
   747             }
       
   748         }
   583         iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInit64L - error=%d"),err);
   749         iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInit64L - error=%d"),err);
   584         }
   750     }
   585     else
   751     else
   586         {
   752     {
   587         iLog->Log(_L("MMPXPlaybackUtilityInit64L - Missing file name."));
   753         iLog->Log(_L("MMPXPlaybackUtilityInit64L - Missing file name."));
   588         err = KErrArgument;
   754         err = KErrArgument;
   589         }
   755     }
   590 #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   756 #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   591     return err;
   757     return err;
   592     }
   758 }
   593 
   759 
   594 // -----------------------------------------------------------------------------
   760 // -----------------------------------------------------------------------------
   595 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreaming64L
   761 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreaming64L
   596 // InitStreaming64L test method function.
   762 // InitStreaming64L test method function.
   597 // (other items were commented in a header).
   763 // (other items were commented in a header).
   598 // -----------------------------------------------------------------------------
   764 // -----------------------------------------------------------------------------
   599 //
   765 //
   600 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreaming64L( CStifItemParser& aItem )
   766 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreaming64L( CStifItemParser& aItem )
   601     {
   767 {
       
   768     MPX_FUNC_EX("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreaming64L( CStifItemParser& aItem )");
   602     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreaming64L"));
   769     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreaming64L"));
   603     TInt err = KErrNone;
   770     TInt err = KErrNone;
   604 #ifndef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   771 #ifndef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   605     err = KErrNotSupported;
   772     err = KErrNotSupported;
   606     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreaming64L - error=%d"),err);
   773     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreaming64L - error=%d"),err);
   607 #else // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   774 #else // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   608     TPtrC string;
   775     TPtrC string;
   609     TInt accessPoint = 1;
   776     TInt accessPoint = 1;
   610     
   777     
       
   778     MMPXPlayerManager& manager = iMPXPlaybackUtility->PlayerManager();
       
   779     MMPXPlayer* player = manager.CurrentPlayer();
       
   780     
   611     if( aItem.GetNextString( string ) == KErrNone )
   781     if( aItem.GetNextString( string ) == KErrNone )
   612         {
   782     {
   613         TBuf<120> KFrom;
   783         TBuf<120> KFrom;
   614         KFrom.Append(KmpxplaybackutilityTestFilePath);
   784         KFrom.Append(KmpxplaybackutilityTestFilePath);
   615         KFrom.Append(string);
   785         KFrom.Append(string);
       
   786         iFileName = KFrom;
       
   787         
   616         if ( iFile64.SubSessionHandle() )
   788         if ( iFile64.SubSessionHandle() )
   617             {
   789         {
   618             iFile64.Close();
   790             iFile64.Close();
   619             }
   791         }
       
   792         
       
   793         if ( ! BaflUtils::FileExists( iFs, iFileName ) )
       
   794         {             
       
   795             err = iFile64.Create( iFs, KFrom, EFileShareAny );
       
   796             iLog->Log(_L("creating tempfile error=%d"),err);
       
   797             iFile64.Close();
       
   798         }
       
   799         
   620         err = iFile64.Open(iFs, KFrom, EFileRead | EFileShareReadersOrWriters);
   800         err = iFile64.Open(iFs, KFrom, EFileRead | EFileShareReadersOrWriters);
       
   801         
   621         if ( err == KErrNone )
   802         if ( err == KErrNone )
   622             {
   803         {
   623             iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreaming64L - Open passed."));
   804             iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreaming64L - Open passed."));
   624             TRAP(err,iMPXPlaybackUtility->InitStreaming64L(iFile64, accessPoint));
   805             TRAP(err,iMPXPlaybackUtility->InitStreaming64L(iFile64, accessPoint));
   625 
   806 
   626             if ( !err )
   807             if ( !err )
   627                 {
   808             {
   628                 TInt event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EPlayerChanged;
   809                 TInt event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EPlayerChanged;
   629                 AddExpectedEventL(event, 0, 0);
   810                 AddExpectedEventL(event, 0, 0);
       
   811                 
   630                 event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EInitializeComplete;
   812                 event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EInitializeComplete;
   631                 AddExpectedEventL(event, 0, 0);
   813                 AddExpectedEventL(event, 0, 0);
       
   814                 
       
   815                 event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EStateChanged;
       
   816                 AddExpectedEventL(event, EPbStateInitialised, 0);
       
   817                 
       
   818                 if ( player->UidL() == KPbTestVideoPlugin )
       
   819                 {
       
   820                     event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EStateChanged;
       
   821                     AddExpectedEventL(event, EPbStateBuffering, 0);                                
   632                 }
   822                 }
   633             }
   823             }
       
   824         }
   634         iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreaming64L - error=%d"),err);
   825         iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreaming64L - error=%d"),err);
   635         }
   826     }
   636     else
   827     else
   637         {
   828     {
   638         iLog->Log(_L("MMPXPlaybackUtilityInitStreaming64L - Missing file name."));
   829         iLog->Log(_L("MMPXPlaybackUtilityInitStreaming64L - Missing file name."));
   639         err = KErrArgument;
   830         err = KErrArgument;
   640         }
   831     }
   641 #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   832 #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   642     return err;
   833     return err;
   643     }
   834 }
   644 
   835 
   645 // -----------------------------------------------------------------------------
   836 // -----------------------------------------------------------------------------
   646 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityFile64L
   837 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityFile64L
   647 // File64L test method function.
   838 // File64L test method function.
   648 // (other items were commented in a header).
   839 // (other items were commented in a header).
   649 // -----------------------------------------------------------------------------
   840 // -----------------------------------------------------------------------------
   650 //
   841 //
   651 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityFile64L( CStifItemParser& /*aItem*/ )
   842 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityFile64L( CStifItemParser& /*aItem*/ )
   652     {
   843 {
       
   844     MPX_FUNC_EX("Cmpxplaybackutilitytest::MMPXPlaybackUtilityFile64L( CStifItemParser& )");
   653     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityFile64L"));
   845     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityFile64L"));
   654     TInt err = KErrNone;
   846     TInt err = KErrNone;
   655 #ifndef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   847 #ifndef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   656     err = KErrNotSupported;
   848     err = KErrNotSupported;
   657     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityFile64L - error=%d"),err);
   849     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityFile64L - error=%d"),err);
   658 #else // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   850 #else // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   659     RFile64* file64Ptr=NULL;
   851     RFile64* file64Ptr=NULL;
   660     TRAP(err, file64Ptr=iMPXPlaybackUtility->Source()->File64L());
   852     TRAP(err, file64Ptr=iMPXPlaybackUtility->Source()->File64L());
   661     if ( !file64Ptr->SubSessionHandle() )
   853     if ( !file64Ptr->SubSessionHandle() )
   662         {
   854     {
   663         iLog->Log(_L("MMPXPlaybackUtilityFile64L - file64 = NULL."));
   855         iLog->Log(_L("MMPXPlaybackUtilityFile64L - file64 = NULL."));
   664         }
   856     }
   665     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityFile64L - error=%d"),err);
   857     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityFile64L - error=%d"),err);
   666 #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   858 #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   667     return err;
   859     return err;
   668     }
   860 }
   669 
   861 
   670 // -----------------------------------------------------------------------------
   862 // -----------------------------------------------------------------------------
   671 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityAddObserverL
   863 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityAddObserverL
   672 // AddObserverL test method function.
   864 // AddObserverL test method function.
   673 // (other items were commented in a header).
   865 // (other items were commented in a header).
   674 // -----------------------------------------------------------------------------
   866 // -----------------------------------------------------------------------------
   675 //
   867 //
   676 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityAddObserverL( CStifItemParser& /*aItem*/ )
   868 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityAddObserverL( CStifItemParser& /*aItem*/ )
   677     {
   869 {
       
   870     MPX_FUNC_EX("Cmpxplaybackutilitytest::MMPXPlaybackUtilityAddObserverL( CStifItemParser&)");
   678     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityAddObserverL"));
   871     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityAddObserverL"));
   679     TInt err = KErrNone;
   872     TInt err = KErrNone;
   680     TRAP(err, iMPXPlaybackUtility->AddObserverL(*this));
   873     TRAP(err, iMPXPlaybackUtility->AddObserverL(*this));
   681     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityAddObserverL - error=%d"),err);
   874     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityAddObserverL - error=%d"),err);
   682     return err;
   875     return err;
   683     }
   876 }
   684 
   877 
   685 // -----------------------------------------------------------------------------
   878 // -----------------------------------------------------------------------------
   686 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityRemoveObserverL
   879 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityRemoveObserverL
   687 // RemoveObserverL test method function.
   880 // RemoveObserverL test method function.
   688 // (other items were commented in a header).
   881 // (other items were commented in a header).
   689 // -----------------------------------------------------------------------------
   882 // -----------------------------------------------------------------------------
   690 //
   883 //
   691 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityRemoveObserverL( CStifItemParser& /*aItem*/ )
   884 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityRemoveObserverL( CStifItemParser& /*aItem*/ )
   692     {
   885 {
       
   886     MPX_FUNC_EX("Cmpxplaybackutilitytest::MMPXPlaybackUtilityRemoveObserverL( CStifItemParser&)");
   693     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityRemoveObserverL"));
   887     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityRemoveObserverL"));
   694     TInt err = KErrNone;
   888     TInt err = KErrNone;
   695     TRAP(err, iMPXPlaybackUtility->RemoveObserverL(*this));
   889     TRAP(err, iMPXPlaybackUtility->RemoveObserverL(*this));
   696     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityRemoveObserverL - error=%d"),err);
   890     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityRemoveObserverL - error=%d"),err);
   697     return err;
   891     return err;
   698     }
   892 }
   699 
   893 
   700 // -----------------------------------------------------------------------------
   894 // -----------------------------------------------------------------------------
   701 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityPlayerManagerSelectPlayerL
   895 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityPlayerManagerSelectPlayerL
   702 // RemoveObserverL test method function.
   896 // RemoveObserverL test method function.
   703 // (other items were commented in a header).
   897 // (other items were commented in a header).
   704 // -----------------------------------------------------------------------------
   898 // -----------------------------------------------------------------------------
   705 //
   899 //
   706 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityPlayerManagerSelectPlayerL(CStifItemParser& aItem)
   900 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityPlayerManagerSelectPlayerL( CStifItemParser& aItem )
   707     {
   901 {
       
   902     MPX_FUNC_EX("Cmpxplaybackutilitytest::MMPXPlaybackUtilityPlayerManagerSelectPlayerL(CStifItemParser& aItem)");
   708     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityPlayerManagerSelectPlayerL"));
   903     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityPlayerManagerSelectPlayerL"));
   709     TInt uidInt;
   904     TInt uidInt;
   710     TInt err = KErrNone;
   905     TInt err = KErrNone;
   711     
   906     
   712     // read in UID
   907     // read in UID
   713     if ( aItem.GetNextInt(uidInt) != KErrNone )
   908     if ( aItem.GetNextInt(uidInt) != KErrNone )
   714         {
   909     {
   715         iLog->Log(_L("MMPXPlaybackUtilityPlayerManagerSelectPlayerL - Missing UID."));
   910         iLog->Log(_L("MMPXPlaybackUtilityPlayerManagerSelectPlayerL - Missing UID."));
   716         err = KErrArgument;
   911         err = KErrArgument;
   717         return err;
   912         return err;
   718         }
   913     }
   719 
   914 
   720     iLog->Log(_L("MMPXPlaybackUtilityPlayerManagerSelectPlayerL - UID = 0x%x."), uidInt);
   915     iLog->Log(_L("MMPXPlaybackUtilityPlayerManagerSelectPlayerL - UID = 0x%x."), uidInt);
   721     if ( iMPXPlaybackUtility )
   916     if ( iMPXPlaybackUtility )
   722         {
   917     {
   723         MMPXPlayerManager& manager = iMPXPlaybackUtility->PlayerManager();
   918         MMPXPlayerManager& manager = iMPXPlaybackUtility->PlayerManager();
   724         TRAP( err, manager.SelectPlayerL( TUid::Uid(uidInt) ) );
   919         
       
   920         if (uidInt == 0x10282551)
       
   921         {
       
   922             iLog->Log(_L("MMPXPlaybackUtilityPlayerManagerSelectPlayerL video uid"));    
       
   923             MPX_DEBUG2(("MMPXPlaybackUtilityPlayerManagerSelectPlayerL - uidInt = %d."), uidInt);
       
   924             TRAP( err, manager.SelectPlayerL( KPbTestVideoPlugin ) );
       
   925         }
       
   926         else 
       
   927         {
       
   928             iLog->Log(_L("MMPXPlaybackUtilityPlayerManagerSelectPlayerL NOT video uid"));    
       
   929             MPX_DEBUG1(("MMPXPlaybackUtilityPlayerManagerSelectPlayerL NOT video uid"));
       
   930             TRAP( err, manager.SelectPlayerL( TUid::Uid(uidInt) ) );
       
   931         }
   725         iLog->Log(_L("MMPXPlaybackUtilityPlayerManagerSelectPlayerL - SelectPlayer err = %d."), err);
   932         iLog->Log(_L("MMPXPlaybackUtilityPlayerManagerSelectPlayerL - SelectPlayer err = %d."), err);
   726         }
   933     }
   727     else
   934     else
   728         {
   935     {
   729         iLog->Log(_L("MMPXPlaybackUtilityPlayerManagerSelectPlayerL - MPX Playback Utility not created."));
   936         iLog->Log(_L("MMPXPlaybackUtilityPlayerManagerSelectPlayerL - MPX Playback Utility not created."));
   730         err = KErrGeneral;
   937         err = KErrGeneral;
   731         }
   938     }
   732     return err;
   939     return err;
   733     }
   940 }
       
   941 
       
   942 
       
   943 // -----------------------------------------------------------------------------
       
   944 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityCommandPlayL
       
   945 // -----------------------------------------------------------------------------
       
   946 //
       
   947 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityCommandPlayL( CStifItemParser& /*aItem*/ )
       
   948 {
       
   949     MPX_FUNC_EX("Cmpxplaybackutilitytest::MMPXPlaybackUtilityCommandPlayL(CStifItemParser&)");
       
   950     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityCommandPlayL")); 
       
   951     
       
   952     //create command
       
   953     CMPXCommand* cmd = CMPXCommand::NewL();
       
   954     CleanupStack::PushL( cmd );
       
   955     
       
   956     cmd->SetTObjectValueL<TInt>(KMPXCommandGeneralId, KMPXCommandIdPlaybackGeneral);
       
   957     cmd->SetTObjectValueL<TBool>(KMPXCommandGeneralDoSync, ETrue);
       
   958     cmd->SetTObjectValueL<TInt>(KMPXCommandPlaybackGeneralType, EPbCmdPlay);
       
   959     cmd->SetTObjectValueL<TInt>(KMPXCommandPlaybackGeneralData, 0);
       
   960     
       
   961     
       
   962     TRAPD(err,iMPXPlaybackUtility->CommandL( *cmd ));
       
   963     
       
   964     iLog->Log(_L("MMPXPlaybackUtilityCommandPlayL err from commandl: , err = %d."), err);
       
   965     MPX_DEBUG2(("MMPXPlaybackUtilityCommandPlayL err from commandl: , err = %d."), err);
       
   966     
       
   967     if ( !err )
       
   968     {
       
   969         iLog->Log(_L("MMPXPlaybackUtilityCommandPlayL no error from commandl:"));
       
   970         MPX_DEBUG1(("MMPXPlaybackUtilityCommandPlayL no err from commandl:"));   
       
   971      
       
   972         TMPXPlaybackState s = iMPXPlaybackUtility->StateL();
       
   973         
       
   974         if ( s != EPbStatePlaying )
       
   975         {
       
   976             TInt event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EStateChanged;        
       
   977             AddExpectedEventL(event, EPbStatePlaying, 0);
       
   978         }
       
   979     }
       
   980         
       
   981     CleanupStack::PopAndDestroy (cmd);
       
   982     
       
   983     return err;
       
   984 }
       
   985 
       
   986 // -----------------------------------------------------------------------------
       
   987 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityCommandStopL
       
   988 // -----------------------------------------------------------------------------
       
   989 //
       
   990 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityCommandStopL( CStifItemParser& /*aItem*/ )
       
   991 {
       
   992     MPX_FUNC_EX("Cmpxplaybackutilitytest::MMPXPlaybackUtilityCommandStopL(CStifItemParser&)");
       
   993     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityCommandStopL")); 
       
   994     
       
   995     //create command
       
   996     CMPXCommand* cmd = CMPXCommand::NewL();
       
   997     CleanupStack::PushL( cmd );
       
   998     
       
   999     cmd->SetTObjectValueL<TInt>(KMPXCommandGeneralId, KMPXCommandIdPlaybackGeneral);
       
  1000     cmd->SetTObjectValueL<TBool>(KMPXCommandGeneralDoSync, ETrue);
       
  1001     cmd->SetTObjectValueL<TInt>(KMPXCommandPlaybackGeneralType, EPbCmdStop);
       
  1002     cmd->SetTObjectValueL<TInt>(KMPXCommandPlaybackGeneralData, 0);
       
  1003     
       
  1004     
       
  1005     TRAPD(err,iMPXPlaybackUtility->CommandL( *cmd ));
       
  1006     
       
  1007     iLog->Log(_L("MMPXPlaybackUtilityCommandStopL err from commandl: , err = %d."), err);
       
  1008     MPX_DEBUG2(("MMPXPlaybackUtilityCommandStopL err from commandl: , err = %d."), err);
       
  1009     
       
  1010     if ( !err )
       
  1011     {
       
  1012         iLog->Log(_L("MMPXPlaybackUtilityCommandStopL no error from commandl:"));
       
  1013         MPX_DEBUG1(("MMPXPlaybackUtilityCommandStopL no err from commandl:"));   
       
  1014         
       
  1015         TMPXPlaybackState s = iMPXPlaybackUtility->StateL();
       
  1016         
       
  1017         if ( s != EPbStateStopped )
       
  1018         {
       
  1019             TInt event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EStateChanged;
       
  1020             AddExpectedEventL(event, EPbStateStopped, 0);
       
  1021         }
       
  1022                 
       
  1023     }
       
  1024         
       
  1025     CleanupStack::PopAndDestroy (cmd);
       
  1026     
       
  1027     return err;          
       
  1028 }
       
  1029 
       
  1030 // -----------------------------------------------------------------------------
       
  1031 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityCommandPauseL
       
  1032 // -----------------------------------------------------------------------------
       
  1033 //
       
  1034 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityCommandPauseL( CStifItemParser& /*aItem*/ )
       
  1035 {
       
  1036     MPX_FUNC_EX("Cmpxplaybackutilitytest::MMPXPlaybackUtilityCommandPauseL(CStifItemParser&)");
       
  1037     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityCommandPauseL")); 
       
  1038     
       
  1039     //create command
       
  1040     CMPXCommand* cmd = CMPXCommand::NewL();
       
  1041     CleanupStack::PushL( cmd );
       
  1042     
       
  1043     cmd->SetTObjectValueL<TInt>(KMPXCommandGeneralId, KMPXCommandIdPlaybackGeneral);
       
  1044     cmd->SetTObjectValueL<TBool>(KMPXCommandGeneralDoSync, ETrue);
       
  1045     cmd->SetTObjectValueL<TInt>(KMPXCommandPlaybackGeneralType, EPbCmdPause);
       
  1046     cmd->SetTObjectValueL<TInt>(KMPXCommandPlaybackGeneralData, 0);
       
  1047     
       
  1048     
       
  1049     TRAPD(err,iMPXPlaybackUtility->CommandL( *cmd ));
       
  1050     
       
  1051     iLog->Log(_L("MMPXPlaybackUtilityCommandPauseL err from commandl: , err = %d."), err);
       
  1052     MPX_DEBUG2(("MMPXPlaybackUtilityCommandPauseL err from commandl: , err = %d."), err);
       
  1053     
       
  1054     if ( !err )
       
  1055     {    
       
  1056         iLog->Log(_L("MMPXPlaybackUtilityCommandPauseL no error from commandl:"));
       
  1057         MPX_DEBUG1(("MMPXPlaybackUtilityCommandPauseL no err from commandl:"));   
       
  1058         
       
  1059         TMPXPlaybackState s = iMPXPlaybackUtility->StateL();
       
  1060         
       
  1061         if ( s == EPbStatePlaying )
       
  1062         {
       
  1063             TInt event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EStateChanged;
       
  1064             AddExpectedEventL(event, EPbStatePaused, 0);
       
  1065         }
       
  1066                 
       
  1067     }
       
  1068         
       
  1069     CleanupStack::PopAndDestroy (cmd);    
       
  1070     
       
  1071     return err;               
       
  1072 }
       
  1073 
       
  1074 // -----------------------------------------------------------------------------
       
  1075 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityCommandPlayPauseL
       
  1076 // -----------------------------------------------------------------------------
       
  1077 //
       
  1078 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityCommandPlayPauseL( CStifItemParser& /*aItem*/ )
       
  1079 {
       
  1080     MPX_FUNC_EX("Cmpxplaybackutilitytest::MMPXPlaybackUtilityCommandPlayPauseL(CStifItemParser&)");
       
  1081     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityCommandPlayPauseL")); 
       
  1082     
       
  1083     //create command
       
  1084     CMPXCommand* cmd = CMPXCommand::NewL();
       
  1085     CleanupStack::PushL( cmd );
       
  1086     
       
  1087     cmd->SetTObjectValueL<TInt>(KMPXCommandGeneralId, KMPXCommandIdPlaybackGeneral);
       
  1088     cmd->SetTObjectValueL<TBool>(KMPXCommandGeneralDoSync, ETrue);
       
  1089     cmd->SetTObjectValueL<TInt>(KMPXCommandPlaybackGeneralType, EPbCmdPlayPause);
       
  1090     cmd->SetTObjectValueL<TInt>(KMPXCommandPlaybackGeneralData, 0);
       
  1091     
       
  1092     TMPXPlaybackState s = iMPXPlaybackUtility->StateL();
       
  1093     
       
  1094     TRAPD(err,iMPXPlaybackUtility->CommandL( *cmd ));
       
  1095     
       
  1096     iLog->Log(_L("MMPXPlaybackUtilityCommandPlayPauseL err from commandl: err = %d."), err);
       
  1097     MPX_DEBUG2(("MMPXPlaybackUtilityCommandPlayPauseL err from commandl: err = %d."), err);
       
  1098     
       
  1099     if ( !err )
       
  1100     {
       
  1101         iLog->Log(_L("MMPXPlaybackUtilityCommandPlayPauseL no error from commandl"));
       
  1102         MPX_DEBUG1(("MMPXPlaybackUtilityCommandPlayPauseL no error from commandl"));
       
  1103         
       
  1104         
       
  1105         
       
  1106         if (s == EPbStatePlaying)
       
  1107         {
       
  1108             iLog->Log(_L("MMPXPlaybackUtilityCommandPlayPauseL EPbStatePlaying:"));
       
  1109             MPX_DEBUG1(("MMPXPlaybackUtilityCommandPlayPauseL EPbStatePlaying:")); 
       
  1110             TInt event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EStateChanged;
       
  1111             AddExpectedEventL(event, EPbStatePaused, 0);
       
  1112         }
       
  1113         else
       
  1114         {
       
  1115             iLog->Log(_L("MMPXPlaybackUtilityCommandPlayPauseL State is not playing:"));
       
  1116             MPX_DEBUG1(("MMPXPlaybackUtilityCommandPlayPauseL State is not playing:")); 
       
  1117             TInt event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EStateChanged;
       
  1118             AddExpectedEventL(event, EPbStatePlaying, 0);
       
  1119         }
       
  1120     }
       
  1121         
       
  1122     CleanupStack::PopAndDestroy (cmd);
       
  1123     
       
  1124     return err;               
       
  1125 }
       
  1126 
       
  1127 // -----------------------------------------------------------------------------
       
  1128 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityCommandPlayCompleteL
       
  1129 // -----------------------------------------------------------------------------
       
  1130 //
       
  1131 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityCommandPlayCompleteL( CStifItemParser& /*aItem*/ )
       
  1132 {
       
  1133     MPX_FUNC_EX("Cmpxplaybackutilitytest::MMPXPlaybackUtilityCommandPlayCompleteL(CStifItemParser&)");
       
  1134     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityCommandPlayCompleteL")); 
       
  1135     
       
  1136     //create command
       
  1137     CMPXCommand* cmd = CMPXCommand::NewL();
       
  1138     CleanupStack::PushL( cmd );
       
  1139     
       
  1140     cmd->SetTObjectValueL<TInt>(KMPXCommandGeneralId, KMPXMessageStif);
       
  1141     cmd->SetTObjectValueL<TBool>(KMPXCommandGeneralDoSync, ETrue);
       
  1142     cmd->SetTObjectValueL<TInt>(KMPXCommandPlaybackGeneralData, 0);
       
  1143     
       
  1144     cmd->SetTObjectValueL<TMPXStifCommand>( KMPXStifPlaybackCommand,
       
  1145                                              EPbStifPlayComplete );
       
  1146         
       
  1147     TRAPD(err,iMPXPlaybackUtility->CommandL( *cmd ));    
       
  1148     
       
  1149     iLog->Log(_L("MMPXPlaybackUtilityCommandPlayCompleteL error from commandl: err = %d."), err);
       
  1150     MPX_DEBUG2(("MMPXPlaybackUtilityCommandPlayCompleteL error from commandl: err = %d."), err);
       
  1151     
       
  1152     if ( !err )
       
  1153     {
       
  1154         iLog->Log(_L("MMPXPlaybackUtilityCommandPlayCompleteL no error from commandl"));
       
  1155         MPX_DEBUG1(("MMPXPlaybackUtilityCommandPlayCompleteL no error from commandl"));
       
  1156         
       
  1157         TInt event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EPropertyChanged;
       
  1158         AddExpectedEventL(event, EPbPropertyPosition, 0);
       
  1159         
       
  1160         event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EStateChanged;
       
  1161         AddExpectedEventL(event, EPbStateStopped, 0);            
       
  1162     }
       
  1163     
       
  1164     CleanupStack::PopAndDestroy (cmd);
       
  1165     
       
  1166     return err;
       
  1167 }
       
  1168 
       
  1169 
       
  1170 // -----------------------------------------------------------------------------
       
  1171 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityCommandSeekForwardL
       
  1172 // -----------------------------------------------------------------------------
       
  1173 //
       
  1174 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityCommandSeekForwardL( CStifItemParser& /*aItem*/ )
       
  1175 {
       
  1176     MPX_FUNC_EX("Cmpxplaybackutilitytest::MMPXPlaybackUtilityCommandSeekForwardL(CStifItemParser&)");
       
  1177     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityCommandSeekForwardL")); 
       
  1178     
       
  1179     TMPXPlaybackState s = iMPXPlaybackUtility->StateL();
       
  1180     
       
  1181     //create command
       
  1182     CMPXCommand* cmd = CMPXCommand::NewL();
       
  1183     CleanupStack::PushL( cmd );
       
  1184     
       
  1185     cmd->SetTObjectValueL<TInt>(KMPXCommandGeneralId, KMPXMessageStif);
       
  1186     cmd->SetTObjectValueL<TBool>(KMPXCommandGeneralDoSync, ETrue);
       
  1187     cmd->SetTObjectValueL<TMPXStifCommand>( KMPXStifPlaybackCommand,
       
  1188                                              EPbStifSeekForward );
       
  1189     cmd->SetTObjectValueL<TInt>(KMPXCommandPlaybackGeneralData, s);
       
  1190     
       
  1191     TRAPD(err,iMPXPlaybackUtility->CommandL( *cmd ));
       
  1192 
       
  1193     iLog->Log(_L("MMPXPlaybackUtilityCommandSeekForwardL error from commandl: err = %d"), err);
       
  1194     MPX_DEBUG2(("MMPXPlaybackUtilityCommandSeekForwardL error from commandl: err = %d."), err);
       
  1195     
       
  1196     if ( !err )
       
  1197     {
       
  1198         iLog->Log(_L("MMPXPlaybackUtilityCommandSeekForwardL no error from commandl"));
       
  1199         MPX_DEBUG1(("MMPXPlaybackUtilityCommandSeekForwardL no error from commandl"));
       
  1200         
       
  1201         TInt event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EStateChanged;
       
  1202         AddExpectedEventL(event, EPbStatePluginSeeking, 0);
       
  1203         
       
  1204         event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EPropertyChanged;
       
  1205         AddExpectedEventL(event, EPbPropertyPosition, 0);
       
  1206         
       
  1207         if ( s == EPbStatePlaying )
       
  1208         {
       
  1209             event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EStateChanged;
       
  1210             AddExpectedEventL(event, EPbStatePlaying, 0);
       
  1211         }
       
  1212         else if ( s == EPbStatePaused )
       
  1213         {
       
  1214             event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EStateChanged;
       
  1215             AddExpectedEventL(event, EPbStatePaused, 0);    
       
  1216         }
       
  1217     }
       
  1218     CleanupStack::PopAndDestroy (cmd);
       
  1219     
       
  1220     return err;
       
  1221 }
       
  1222 
       
  1223 
       
  1224 
       
  1225 // -----------------------------------------------------------------------------
       
  1226 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityCommandSeekBackwardL
       
  1227 // -----------------------------------------------------------------------------
       
  1228 //
       
  1229 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityCommandSeekBackwardL( CStifItemParser& /*aItem*/ )
       
  1230 {
       
  1231     MPX_FUNC_EX("Cmpxplaybackutilitytest::MMPXPlaybackUtilityCommandSeekBackwardL(CStifItemParser&)");
       
  1232     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityCommandSeekBackwardL")); 
       
  1233     
       
  1234     TMPXPlaybackState s = iMPXPlaybackUtility->StateL();
       
  1235     
       
  1236     //create command
       
  1237     CMPXCommand* cmd = CMPXCommand::NewL();
       
  1238     CleanupStack::PushL( cmd );
       
  1239     
       
  1240     cmd->SetTObjectValueL<TInt>(KMPXCommandGeneralId, KMPXMessageStif);
       
  1241     cmd->SetTObjectValueL<TBool>(KMPXCommandGeneralDoSync, ETrue);
       
  1242     cmd->SetTObjectValueL<TMPXStifCommand>( KMPXStifPlaybackCommand,
       
  1243                                              EPbStifSeekBackward );
       
  1244     cmd->SetTObjectValueL<TInt>(KMPXCommandPlaybackGeneralData, s);
       
  1245     
       
  1246     TRAPD(err,iMPXPlaybackUtility->CommandL( *cmd ));
       
  1247 
       
  1248     iLog->Log(_L("MMPXPlaybackUtilityCommandSeekBackwardL error from commandl: err = %d."), err);
       
  1249     MPX_DEBUG2(("MMPXPlaybackUtilityCommandSeekBackwardL error from commandl: err = %d."), err);
       
  1250     
       
  1251     if ( !err )
       
  1252     {
       
  1253         iLog->Log(_L("MMPXPlaybackUtilityCommandSeekForwardL no error from commandl"));
       
  1254         MPX_DEBUG1(("MMPXPlaybackUtilityCommandSeekForwardL no error from commandl"));
       
  1255         
       
  1256         TInt event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EStateChanged;
       
  1257         AddExpectedEventL(event, EPbStatePluginSeeking, 0);
       
  1258         
       
  1259         event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EPropertyChanged;
       
  1260         AddExpectedEventL(event, EPbPropertyPosition, 0);
       
  1261         
       
  1262         if ( s == EPbStatePlaying )
       
  1263         {
       
  1264             event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EStateChanged;
       
  1265             AddExpectedEventL(event, EPbStatePlaying, 0);
       
  1266         }
       
  1267         else if ( s == EPbStatePaused )
       
  1268         {
       
  1269             event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EStateChanged;
       
  1270             AddExpectedEventL(event, EPbStatePaused, 0);    
       
  1271         }        
       
  1272     }
       
  1273     
       
  1274     CleanupStack::PopAndDestroy (cmd);
       
  1275        
       
  1276     return err;
       
  1277 }
       
  1278 
       
  1279 
       
  1280 // -----------------------------------------------------------------------------
       
  1281 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityCommandCloseL
       
  1282 // -----------------------------------------------------------------------------
       
  1283 //
       
  1284 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityCommandCloseL( CStifItemParser& /*aItem*/ )
       
  1285 {
       
  1286     MPX_FUNC_EX("Cmpxplaybackutilitytest::MMPXPlaybackUtilityCommandCloseL(CStifItemParser&)");
       
  1287     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityCommandCloseL")); 
       
  1288     
       
  1289     TMPXPlaybackState s = iMPXPlaybackUtility->StateL();
       
  1290     
       
  1291     //create command
       
  1292     CMPXCommand* cmd = CMPXCommand::NewL();
       
  1293     CleanupStack::PushL( cmd );
       
  1294     
       
  1295     cmd->SetTObjectValueL<TInt>(KMPXCommandGeneralId, KMPXCommandIdPlaybackGeneral);
       
  1296     cmd->SetTObjectValueL<TBool>(KMPXCommandGeneralDoSync, ETrue);
       
  1297     cmd->SetTObjectValueL<TInt>(KMPXCommandPlaybackGeneralType, EPbCmdClose);
       
  1298     cmd->SetTObjectValueL<TInt>(KMPXCommandPlaybackGeneralData, 0);
       
  1299         
       
  1300     TRAPD(err,iMPXPlaybackUtility->CommandL( *cmd ));
       
  1301     
       
  1302     iLog->Log(_L("MMPXPlaybackUtilityCommandCloseL err from commandl: err = %d."), err);
       
  1303     MPX_DEBUG2(("MMPXPlaybackUtilityCommandCloseL err from commandl: err = %d."), err);
       
  1304     
       
  1305     if ( !err )
       
  1306     {
       
  1307         iLog->Log(_L("MMPXPlaybackUtilityCommandCloseL no error from commandl:"));
       
  1308         MPX_DEBUG1(("MMPXPlaybackUtilityCommandCloseL no err from commandl:")); 
       
  1309         
       
  1310         TInt event;
       
  1311         
       
  1312         if ( s != EPbStateStopped )
       
  1313         {
       
  1314             event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EStateChanged;
       
  1315             AddExpectedEventL(event, EPbStateStopped, 0);
       
  1316         }                    
       
  1317     }
       
  1318         
       
  1319     CleanupStack::PopAndDestroy (cmd);
       
  1320     
       
  1321     return err;                
       
  1322 }
       
  1323 
       
  1324 
       
  1325 // -----------------------------------------------------------------------------
       
  1326 // Cmpxplaybackutilitytest::MMPXPlaybackUtilitySetL
       
  1327 // -----------------------------------------------------------------------------
       
  1328 //
       
  1329 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilitySetL( CStifItemParser& aItem )
       
  1330 {
       
  1331     MPX_FUNC_EX("Cmpxplaybackutilitytest::MMPXPlaybackUtilitySetL(CStifItemParser&)");
       
  1332     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilitySetL")); 
       
  1333     
       
  1334     TInt err = KErrNone;
       
  1335     TInt property;
       
  1336     TInt value;
       
  1337     
       
  1338 
       
  1339     if( aItem.GetNextInt( property ) != KErrNone )
       
  1340     {
       
  1341         MPX_DEBUG1(("Cmpxplaybackutilitytest::MMPXPlaybackUtilitySetL missing property " ));
       
  1342         iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilitySetL missing property " ));
       
  1343         err = KErrArgument;
       
  1344         return err;
       
  1345     }
       
  1346 
       
  1347     if ( aItem.GetNextInt( value ) != KErrNone)
       
  1348     {
       
  1349         MPX_DEBUG1(("Cmpxplaybackutilitytest::MMPXPlaybackUtilitySetL missing value " ));
       
  1350         iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilitySetL missing value " ));
       
  1351         err = KErrArgument;
       
  1352         return err;
       
  1353     }
       
  1354 
       
  1355     MPX_DEBUG3(("Cmpxplaybackutilitytest::MMPXPlaybackUtilitySetL property = %d, value = %d"), property, value );
       
  1356     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilitySetL property = %d, value %d") , property, value );
       
  1357 
       
  1358     TRAP(err, iMPXPlaybackUtility->SetL((TMPXPlaybackProperty)property, value ));    
       
  1359     
       
  1360     iLog->Log(_L("MMPXPlaybackUtilitySetL err from SetL: err = %d."), err);
       
  1361     MPX_DEBUG2(("MMPXPlaybackUtilitySetL err from SetL: err = %d."), err);
       
  1362     
       
  1363     if ( !err )
       
  1364     {
       
  1365         iLog->Log(_L("MMPXPlaybackUtilitySetL no error from SetL"));
       
  1366         MPX_DEBUG1(("MMPXPlaybackUtilitySetL no err from SetL")); 
       
  1367         
       
  1368         TInt event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EPropertyChanged;
       
  1369         AddExpectedEventL(event, property, value);
       
  1370     }
       
  1371     
       
  1372     return err;                
       
  1373 }
       
  1374 
   734 
  1375 
   735 // -----------------------------------------------------------------------------
  1376 // -----------------------------------------------------------------------------
   736 // Cmpxplaybackutilitytest::EndTest
  1377 // Cmpxplaybackutilitytest::EndTest
   737 // -----------------------------------------------------------------------------
  1378 // -----------------------------------------------------------------------------
   738 //
  1379 //
   739 TInt Cmpxplaybackutilitytest::EndTest( CStifItemParser& /*aItem*/ )
  1380 TInt Cmpxplaybackutilitytest::EndTest( CStifItemParser& /*aItem*/ )
   740     {
  1381 {
   741     iLog->Log(_L("Cmpxplaybackutilitytest::EndTest"));
  1382     iLog->Log(_L("Cmpxplaybackutilitytest::EndTest"));
   742     TInt err = iCallbackError;
  1383     TInt err = iCallbackError;
   743     
  1384     
   744     // check if event queue is empty
  1385     // check if event queue is empty
   745     if ( !err && (iExpectedEventArray->Count() > 0 ) ) 
  1386     if ( !err && (iExpectedEventArray->Count() > 0 ) ) 
   746         {
  1387     {
   747         iLog->Log(_L("Cmpxplaybackutilitytest::EndTest error = KErrTimedOut"));
  1388         iLog->Log(_L("Cmpxplaybackutilitytest::EndTest error = KErrTimedOut"));
   748         err = KErrTimedOut;
  1389         err = KErrTimedOut;
   749         }
  1390     }
   750     return err;
  1391      
   751     }
  1392     return err;
       
  1393 }
   752 
  1394 
   753 // end of file
  1395 // end of file