mmappfw_plat/mpx_playback_utility_api/tsrc/mpxplaybackutilitytest/src/mpxplaybackutilitytestBlocks.cpp
branchRCL_3
changeset 67 16db3449d7ba
parent 59 666f9a5a90a9
equal deleted inserted replaced
63:91d5ad76f5c6 67:16db3449d7ba
    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 
       
    25 #include <e32svr.h>
    21 #include <e32svr.h>
    26 #include <StifParser.h>
    22 #include <StifParser.h>
    27 #include <Stiftestinterface.h>
    23 #include <Stiftestinterface.h>
    28 #include <mpxvideoplaybackdefs.h>
    24 #include <mpxvideoplaybackdefs.h>
    29 #include <mpxplaybackcommanddefs.h>
    25 #include <mpxplaybackcommanddefs.h>
    34 #include <mpxmediageneraldefs.h>
    30 #include <mpxmediageneraldefs.h>
    35 #include <mpxlog.h>
    31 #include <mpxlog.h>
    36 #include <mpxcollectionplaylist.h>
    32 #include <mpxcollectionplaylist.h>
    37 #include "mpxplaybackutilitytest.h"
    33 #include "mpxplaybackutilitytest.h"
    38 #include "mpxplaybackutilitytestdefs.h"
    34 #include "mpxplaybackutilitytestdefs.h"
    39 #include "testcommonpluginuids.h"
       
    40 
       
    41 const TUid KPbTestVideoPlugin = {KPlaybackTestVideoPluginImpId};
       
    42 
    35 
    43 // ============================ MEMBER FUNCTIONS ===============================
    36 // ============================ MEMBER FUNCTIONS ===============================
    44 // ---------------------------------------------------------------------------
    37 // ---------------------------------------------------------------------------
    45 // From MMPXPlaybackObserver
    38 // From MMPXPlaybackObserver
    46 // Handle playback message.
    39 // Handle playback message.
    47 // ---------------------------------------------------------------------------
    40 // ---------------------------------------------------------------------------
    48 //
    41 //
    49 void Cmpxplaybackutilitytest::HandlePlaybackMessage( CMPXMessage* aMessage, TInt aError )
    42 void Cmpxplaybackutilitytest::HandlePlaybackMessage( CMPXMessage* aMessage, TInt aError )
    50 {
    43     {
    51     MPX_FUNC_EX("Cmpxplaybackutilitytest::HandlePlaybackMessage( CMPXMessage* aMessage, TInt aError )");
    44     iLog->Log(_L("Cmpxharvestertest::HandlePlaybackMessage: Error %d"), aError);
    52     iLog->Log(_L("Cmpxplaybackutilitytest::HandlePlaybackMessage: Error %d"), aError);
       
    53     if ( !aError )
    45     if ( !aError )
    54     {
    46         {
    55         TMPXMessageId id( *(aMessage->Value<TMPXMessageId>(KMPXMessageGeneralId)) );
    47         TMPXMessageId id( *(aMessage->Value<TMPXMessageId>(KMPXMessageGeneralId)) );
    56         TInt event( *aMessage->Value<TInt>( KMPXMessageGeneralEvent ) );
    48         TInt event( *aMessage->Value<TInt>( KMPXMessageGeneralEvent ) );
    57         TInt type( *aMessage->Value<TInt>( KMPXMessageGeneralType ) );
    49         TInt type( *aMessage->Value<TInt>( KMPXMessageGeneralType ) );
    58         TInt data( *aMessage->Value<TInt>( KMPXMessageGeneralData ) );
    50         TInt data( *aMessage->Value<TInt>( KMPXMessageGeneralData ) );
    59 
    51 
    60         if ( KMPXMessageGeneral == id )
    52         if ( KMPXMessageGeneral == id )
    61         {
    53             {
    62             iLog->Log(_L("Cmpxplaybackutilitytest::HandlePlaybackMessage() General event = %d type = %d  value = %d"),
    54             iLog->Log(_L("Cmpxplaybackutilitytest::HandlePlaybackMessage() General event = %d type = %d  value = %d"),
    63                          event, type, data );
    55                          event, type, data );
    64             RemoveExpectedEventL( KGeneralPlaybackMsgOffset + event, type, data );
    56             RemoveExpectedEventL( KGeneralPlaybackMsgOffset + event, type, data );
    65         }
    57             }
    66         else if ( KMPXMediaIdVideoPlayback == id )
    58         else if ( KMPXMediaIdVideoPlayback == id )
    67         {
    59             {
    68             iLog->Log(_L("Cmpxplaybackutilitytest::HandlePlaybackMessage() Video event = %d type = %d  value = %d"),
    60             iLog->Log(_L("Cmpxplaybackutilitytest::HandlePlaybackMessage() Video event = %d type = %d  value = %d"),
    69                          event, type, data );
    61                          event, type, data );
    70             RemoveExpectedEventL( KVideoPlaybackMsgOffset + event, type, data );
    62             RemoveExpectedEventL( KVideoPlaybackMsgOffset + event, type, data );
    71         }
    63             }
    72         else if ( KMPXMessageStif )
    64         else if ( KMPXMessageStif )
    73         {
    65             {
    74             iLog->Log(_L("Cmpxplaybackutilitytest::HandlePlaybackMessage() STIF event = %d type = %d  value = %d"),
    66             iLog->Log(_L("Cmpxplaybackutilitytest::HandlePlaybackMessage() STIF event = %d type = %d  value = %d"),
    75                          event, type, data );
    67                          event, type, data );
    76             RemoveExpectedEventL( KStifPlaybackMsgOffset + event, type, data );
    68             RemoveExpectedEventL( KStifPlaybackMsgOffset + event, type, data );
    77         }
    69             }
    78     }
    70         }
    79     else
    71     else
    80     {
    72         {
    81         if ( !iCallbackError )
    73         if ( !iCallbackError )
    82         {
    74             {
    83             iCallbackError = aError;
    75             iCallbackError = aError;
    84         }
    76             }
    85     }
    77         }
    86 }
    78     }
    87 
    79 
    88 // ---------------------------------------------------------------------------
    80 // ---------------------------------------------------------------------------
    89 //  Handle playback property.
    81 //  Handle playback property.
    90 // ---------------------------------------------------------------------------
    82 // ---------------------------------------------------------------------------
    91 //
    83 //
    92 void Cmpxplaybackutilitytest::HandlePropertyL( TMPXPlaybackProperty aProperty, TInt aValue, TInt aError )
    84 void Cmpxplaybackutilitytest::HandlePropertyL( TMPXPlaybackProperty aProperty, TInt aValue, TInt aError )
    93 {
    85     {
    94     MPX_FUNC_EX("Cmpxplaybackutilitytest::HandlePropertyL( TMPXPlaybackProperty aProperty, TInt aValue, TInt aError )");
    86     iLog->Log(_L("Cmpxharvestertest::HandlePropertyL: Property %d, Value %d, Error %d"), 
    95     iLog->Log(_L("Cmpxplaybackutilitytest::HandlePropertyL: Property %d, Value %d, Error %d"), 
       
    96             aProperty, aValue, aError);   
    87             aProperty, aValue, aError);   
    97 }
    88     }
    98 
    89 
    99 // ---------------------------------------------------------------------------
    90 // ---------------------------------------------------------------------------
   100 //  Method is called continously until aComplete=ETrue, signifying that 
    91 //  Method is called continously until aComplete=ETrue, signifying that 
   101 //  it is done and there will be no more callbacks.
    92 //  it is done and there will be no more callbacks.
   102 //  Only new items are passed each time.
    93 //  Only new items are passed each time.
   104 //
    95 //
   105 void Cmpxplaybackutilitytest::HandleSubPlayerNamesL( TUid aPlayer, 
    96 void Cmpxplaybackutilitytest::HandleSubPlayerNamesL( TUid aPlayer, 
   106                                                      const MDesCArray* aSubPlayers,
    97                                                      const MDesCArray* aSubPlayers,
   107                                                      TBool aComplete,
    98                                                      TBool aComplete,
   108                                                      TInt aError )
    99                                                      TInt aError )
   109 {
   100     {
   110     MPX_FUNC_EX("Cmpxplaybackutilitytest::HandleSubPlayerNamesL( TUid aPlayer, const MDesCArray* aSubPlayers, TBool aComplete, TInt aError)");
   101     iLog->Log(_L("Cmpxharvestertest::HandleSubPlayerNamesL: Complete %d, Error %d"), aComplete, aError);   
   111     iLog->Log(_L("Cmpxplaybackutilitytest::HandleSubPlayerNamesL: Complete %d, Error %d"), aComplete, aError);   
   102     }
   112 }
       
   113 
   103 
   114 // ---------------------------------------------------------------------------
   104 // ---------------------------------------------------------------------------
   115 //  Call back of media request.
   105 //  Call back of media request.
   116 // ---------------------------------------------------------------------------
   106 // ---------------------------------------------------------------------------
   117 //
   107 //
   118 void Cmpxplaybackutilitytest::HandleMediaL( const CMPXMedia& aProperties, TInt aError )
   108 void Cmpxplaybackutilitytest::HandleMediaL( const CMPXMedia& aProperties, TInt aError )
   119 {
   109     {
   120     MPX_FUNC_EX("Cmpxplaybackutilitytest::HandleMediaL( const CMPXMedia& aProperties, TInt aError )");
   110     iLog->Log(_L("Cmpxharvestertest::HandleMediaL: Error %d"), aError);   
   121     iLog->Log(_L("Cmpxplaybackutilitytest::HandleMediaL: Error %d"), aError);   
   111     }
   122 }
       
   123 
   112 
   124 // ---------------------------------------------------------------------------
   113 // ---------------------------------------------------------------------------
   125 //  Handle completion of a asynchronous command.
   114 //  Handle completion of a asynchronous command.
   126 //  Note: All clients should implement this callback.
   115 //  Note: All clients should implement this callback.
   127 // ---------------------------------------------------------------------------
   116 // ---------------------------------------------------------------------------
   128 //
   117 //
   129 void Cmpxplaybackutilitytest::HandlePlaybackCommandComplete( CMPXCommand* aCommandResult, TInt aError )
   118 void Cmpxplaybackutilitytest::HandlePlaybackCommandComplete( CMPXCommand* aCommandResult, TInt aError )
   130 {
   119     {
   131     MPX_FUNC_EX("Cmpxplaybackutilitytest::HandlePlaybackCommandComplete( CMPXCommand* aCommandResult, TInt aError )");
   120     iLog->Log(_L("Cmpxharvestertest::HandlePlaybackCommandComplete: Error %d"), aError);   
   132     iLog->Log(_L("Cmpxplaybackutilitytest::HandlePlaybackCommandComplete: Error %d"), aError);   
   121     }
   133 }
       
   134 
   122 
   135 // -----------------------------------------------------------------------------
   123 // -----------------------------------------------------------------------------
   136 // Cmpxplaybackutilitytest::Delete
   124 // Cmpxplaybackutilitytest::Delete
   137 // Delete here all resources allocated and opened from test methods. 
   125 // Delete here all resources allocated and opened from test methods. 
   138 // Called from destructor. 
   126 // Called from destructor. 
   139 // -----------------------------------------------------------------------------
   127 // -----------------------------------------------------------------------------
   140 //
   128 //
   141 void Cmpxplaybackutilitytest::Delete()
   129 void Cmpxplaybackutilitytest::Delete()
   142 {
   130     {
   143     TInt delerr = KErrNone;
   131     iMPXPlaybackUtility->Close();
   144     
       
   145     iMPXPlaybackUtility->Close();    
       
   146 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   132 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   147     iFile64.Close();
   133     iFile64.Close();
   148 #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   134 #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   149     iFile.Close();
   135     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     }    
       
   157     iFs.Close();
   136     iFs.Close();
   158     iExpectedEventArray->ResetAndDestroy();
   137     iExpectedEventArray->ResetAndDestroy();
   159       
   138     }
   160 }
       
   161 
       
   162 
   139 
   163 // -----------------------------------------------------------------------------
   140 // -----------------------------------------------------------------------------
   164 // Cmpxplaybackutilitytest::CreateL
   141 // Cmpxplaybackutilitytest::CreateL
   165 // Create here all resources needed for test methods. 
   142 // Create here all resources needed for test methods. 
   166 // Called from ConstructL(). 
   143 // Called from ConstructL(). 
   167 // -----------------------------------------------------------------------------
   144 // -----------------------------------------------------------------------------
   168 //
   145 //
   169 void Cmpxplaybackutilitytest::CreateL()
   146 void Cmpxplaybackutilitytest::CreateL()
   170 {
   147     {
   171     iFs.Connect();
   148     iFs.Connect();
   172     iFs.ShareProtected();
   149     iFs.ShareProtected();
   173 
   150 
   174     iExpectedEventArray = new (ELeave) CArrayPtrFlat<TMpxPlaybackTestEvent>( 1 );
   151     iExpectedEventArray = new (ELeave) CArrayPtrFlat<TMpxPlaybackTestEvent>( 1 );
   175     iCallbackError = KErrNone;
   152     iCallbackError = KErrNone;
   176     iMPXPlaybackUtility = NULL;
   153     iMPXPlaybackUtility = NULL;
   177 }
   154     }
   178 
   155 
   179 // -----------------------------------------------------------------------------
   156 // -----------------------------------------------------------------------------
   180 // Cmpxplaybackutilitytest::AddExpectedEventL
   157 // Cmpxplaybackutilitytest::AddExpectedEventL
   181 // -----------------------------------------------------------------------------
   158 // -----------------------------------------------------------------------------
   182 //
   159 //
   183 void Cmpxplaybackutilitytest::AddExpectedEventL( TInt aEvent, TInt aType, TInt aData )
   160 void Cmpxplaybackutilitytest::AddExpectedEventL( TInt aEvent, TInt aType, TInt aData )
   184 {
   161     {
   185     MPX_FUNC_EX("Cmpxplaybackutilitytest::AddExpectedEventL( TInt aEvent, TInt aType, TInt aData )");
       
   186     iLog->Log(_L("Cmpxplaybackutilitytest::AddExpectedEventL() event = %d type = %d  value = %d"),
   162     iLog->Log(_L("Cmpxplaybackutilitytest::AddExpectedEventL() event = %d type = %d  value = %d"),
   187                  aEvent, aType, aData );
   163                  aEvent, aType, aData );
   188     
   164     
   189     TMpxPlaybackTestEvent* event = new (ELeave) TMpxPlaybackTestEvent;
   165     TMpxPlaybackTestEvent* event = new (ELeave) TMpxPlaybackTestEvent;
   190     event->iEvent = aEvent;
   166     event->iEvent = aEvent;
   191     event->iType = aType;
   167     event->iType = aType;
   192     event->iData = aData;
   168     event->iData = aData;
   193     iExpectedEventArray->AppendL( event );
   169     iExpectedEventArray->AppendL( event );
   194 }
   170     }
   195 
   171 
   196 // -----------------------------------------------------------------------------
   172 // -----------------------------------------------------------------------------
   197 // Cmpxplaybackutilitytest::RemoveExpectedEventL
   173 // Cmpxplaybackutilitytest::RemoveExpectedEventL
   198 // -----------------------------------------------------------------------------
   174 // -----------------------------------------------------------------------------
   199 //
   175 //
   200 void Cmpxplaybackutilitytest::RemoveExpectedEventL( TInt aEvent, TInt aType, TInt aData )
   176 void Cmpxplaybackutilitytest::RemoveExpectedEventL( TInt aEvent, TInt aType, TInt aData )
   201 {
   177     {
   202     MPX_FUNC_EX("Cmpxplaybackutilitytest::RemoveExpectedEventL( TInt aEvent, TInt aType, TInt aData )");
       
   203     iLog->Log(_L("Cmpxplaybackutilitytest::RemoveExpectedEventL() event = %d type = %d  value = %d"),
   178     iLog->Log(_L("Cmpxplaybackutilitytest::RemoveExpectedEventL() event = %d type = %d  value = %d"),
   204                  aEvent, aType, aData );
   179                  aEvent, aType, aData );
   205     
   180     
   206     if ( (iExpectedEventArray->Count() > 0) &&
   181     if ( (iExpectedEventArray->Count() > 0) &&
   207          ((*iExpectedEventArray)[0]->iEvent == aEvent) && ((*iExpectedEventArray)[0]->iType == aType))
   182          ((*iExpectedEventArray)[0]->iEvent == aEvent) )
   208     {
   183         {
   209         iLog->Log(_L("Cmpxplaybackutilitytest::RemoveExpectedEventL() event = %d removed."), aEvent);
   184         iLog->Log(_L("Cmpxplaybackutilitytest::RemoveExpectedEventL() event = %d removed."), aEvent);
   210         iExpectedEventArray->Delete( 0 );
   185         iExpectedEventArray->Delete( 0 );
   211     }
   186         }
   212 }
   187     }
   213 
   188 
   214 // -----------------------------------------------------------------------------
   189 // -----------------------------------------------------------------------------
   215 // Cmpxplaybackutilitytest::RunMethodL
   190 // Cmpxplaybackutilitytest::RunMethodL
   216 // Run specified method. Contains also table of test mothods and their names.
   191 // Run specified method. Contains also table of test mothods and their names.
   217 // -----------------------------------------------------------------------------
   192 // -----------------------------------------------------------------------------
   218 //
   193 //
   219 TInt Cmpxplaybackutilitytest::RunMethodL( CStifItemParser& aItem ) 
   194 TInt Cmpxplaybackutilitytest::RunMethodL( CStifItemParser& aItem ) 
   220 {
   195     {
   221     static TStifFunctionInfo const KFunctions[] =
   196     static TStifFunctionInfo const KFunctions[] =
   222     {  
   197         {  
   223         // Copy this line for every implemented function.
   198         // Copy this line for every implemented function.
   224         // First string is the function name used in TestScripter script file.
   199         // First string is the function name used in TestScripter script file.
   225         // Second is the actual implementation member function. 
   200         // Second is the actual implementation member function. 
   226 
   201 
   227         //ADD NEW ENTRY HERE
   202         //ADD NEW ENTRY HERE
   239         ENTRY( "MMPXPlaybackUtilityInitStreaming64L", Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreaming64L ),
   214         ENTRY( "MMPXPlaybackUtilityInitStreaming64L", Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreaming64L ),
   240         ENTRY( "MMPXPlaybackUtilityFile64L", Cmpxplaybackutilitytest::MMPXPlaybackUtilityFile64L ),
   215         ENTRY( "MMPXPlaybackUtilityFile64L", Cmpxplaybackutilitytest::MMPXPlaybackUtilityFile64L ),
   241         ENTRY( "MMPXPlaybackUtilityAddObserverL", Cmpxplaybackutilitytest::MMPXPlaybackUtilityAddObserverL ),
   216         ENTRY( "MMPXPlaybackUtilityAddObserverL", Cmpxplaybackutilitytest::MMPXPlaybackUtilityAddObserverL ),
   242         ENTRY( "MMPXPlaybackUtilityRemoveObserverL", Cmpxplaybackutilitytest::MMPXPlaybackUtilityRemoveObserverL ),
   217         ENTRY( "MMPXPlaybackUtilityRemoveObserverL", Cmpxplaybackutilitytest::MMPXPlaybackUtilityRemoveObserverL ),
   243         ENTRY( "MMPXPlaybackUtilityPlayerManagerSelectPlayerL", Cmpxplaybackutilitytest::MMPXPlaybackUtilityPlayerManagerSelectPlayerL ),
   218         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         
       
   255         ENTRY( "EndTest", Cmpxplaybackutilitytest::EndTest ),
   219         ENTRY( "EndTest", Cmpxplaybackutilitytest::EndTest ),
   256     };
   220         };
   257 
   221 
   258     const TInt count = sizeof( KFunctions ) / 
   222     const TInt count = sizeof( KFunctions ) / 
   259                         sizeof( TStifFunctionInfo );
   223                         sizeof( TStifFunctionInfo );
   260    
   224    
   261     return RunInternalL( KFunctions, count, aItem );
   225     return RunInternalL( KFunctions, count, aItem );
   262 }
   226     }
   263 
   227 
   264 // -----------------------------------------------------------------------------
   228 // -----------------------------------------------------------------------------
   265 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityNewL
   229 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityNewL
   266 // NewL test method function.
   230 // NewL test method function.
   267 // (other items were commented in a header).
   231 // (other items were commented in a header).
   268 // -----------------------------------------------------------------------------
   232 // -----------------------------------------------------------------------------
   269 //
   233 //
   270 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityNewL( CStifItemParser& aItem )
   234 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityNewL( CStifItemParser& aItem )
   271 {
   235 	{
   272     MPX_FUNC_EX("Cmpxplaybackutilitytest::MMPXPlaybackUtilityNewL( CStifItemParser& aItem )");
   236 	iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityNewL"));
   273     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityNewL"));
       
   274 	TInt err = KErrNone;
   237 	TInt err = KErrNone;
   275     TInt mode;
   238     TInt mode;
   276    
   239    
   277     if ( aItem.GetNextInt(mode) != KErrNone )
   240     if ( aItem.GetNextInt(mode) != KErrNone )
   278     {
   241         {
   279         iLog->Log(_L("MMPXPlaybackUtilityNewL - Missing playback mode."));
   242         iLog->Log(_L("MMPXPlaybackUtilityNewL - Missing playback mode."));
   280         err = KErrArgument;
   243         err = KErrArgument;
   281         return err;
   244         return err;
   282     }
   245         }
   283 
   246 
   284     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityNewL: mode %d"), mode);
   247     iLog->Log(_L("Cmpxharvestertest::MMPXPlaybackUtilityNewL: mode %d"), mode);
   285 	TRAP( err,iMPXPlaybackUtility = MMPXPlaybackUtility::NewL(TUid::Uid(mode), this ));
   248 	TRAP( err,iMPXPlaybackUtility = MMPXPlaybackUtility::NewL(TUid::Uid(mode), this ));
   286     
   249     
   287 	if (err!= KErrNone)
   250 	if (err!= KErrNone)
   288     {
   251 		{
   289 		iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityNewL: error %d"), err);
   252 		iLog->Log(_L("Cmpxharvestertest::MMPXPlaybackUtilityNewL: error %d"), err);
   290     }
   253 		}
   291 	
   254 	
   292 	return err;
   255 	return err;
   293 }
   256 	}
   294 
   257 
   295 // -----------------------------------------------------------------------------
   258 // -----------------------------------------------------------------------------
   296 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityNewWithCatL
   259 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityNewWithCatL
   297 // NewL test method function.
   260 // NewL test method function.
   298 // (other items were commented in a header).
   261 // (other items were commented in a header).
   299 // -----------------------------------------------------------------------------
   262 // -----------------------------------------------------------------------------
   300 //
   263 //
   301 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityNewWithCatL( CStifItemParser& aItem )
   264 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityNewWithCatL( CStifItemParser& aItem )
   302 {
   265     {
   303     MPX_FUNC_EX("Cmpxplaybackutilitytest::MMPXPlaybackUtilityNewWithCatL( CStifItemParser& aItem )");
       
   304     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityNewWithCatL"));
   266     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityNewWithCatL"));
   305     TInt err = KErrNone;
   267     TInt err = KErrNone;
   306     TInt mode;
   268     TInt mode;
   307     TInt category;
   269     TInt category;
   308     if ( aItem.GetNextInt(category) != KErrNone )
   270     if ( aItem.GetNextInt(category) != KErrNone )
   309     {
   271         {
   310         iLog->Log(_L("MMPXPlaybackUtilityNewWithCatL - Missing category."));
   272         iLog->Log(_L("MMPXPlaybackUtilityNewWithCatL - Missing category."));
   311         err = KErrArgument;
   273         err = KErrArgument;
   312         return err;
   274         return err;
   313     }
   275         }
   314 
   276 
   315     if ( aItem.GetNextInt(mode) != KErrNone )
   277     if ( aItem.GetNextInt(mode) != KErrNone )
   316     {
   278         {
   317         iLog->Log(_L("MMPXPlaybackUtilityNewWithCatL - Missing playback mode."));
   279         iLog->Log(_L("MMPXPlaybackUtilityNewWithCatL - Missing playback mode."));
   318         err = KErrArgument;
   280         err = KErrArgument;
   319         return err;
   281         return err;
   320     }
   282         }
   321 
   283 
   322     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityNewWithCatL: category %d"), category);
   284     iLog->Log(_L("Cmpxharvestertest::MMPXPlaybackUtilityNewWithCatL: category %d"), category);
   323     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityNewWithCatL: mode %d"), mode);
   285     iLog->Log(_L("Cmpxharvestertest::MMPXPlaybackUtilityNewWithCatL: mode %d"), mode);
   324     TRAP( err,iMPXPlaybackUtility = MMPXPlaybackUtility::NewL((TMPXCategory)category, TUid::Uid(mode), this ));
   286     TRAP( err,iMPXPlaybackUtility = MMPXPlaybackUtility::NewL((TMPXCategory)category, TUid::Uid(mode), this ));
   325     
   287     
   326     if (err!= KErrNone)
   288     if (err!= KErrNone)
   327     {
   289         {
   328         iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityNewWithCatL: error %d"), err);
   290         iLog->Log(_L("Cmpxharvestertest::MMPXPlaybackUtilityNewWithCatL: error %d"), err);
   329     }
   291         }
   330     return err;
   292     return err;
   331 }
   293     }
   332 
   294 
   333 // -----------------------------------------------------------------------------
   295 // -----------------------------------------------------------------------------
   334 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityUtilityL
   296 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityUtilityL
   335 // UtilityL test method function.
   297 // UtilityL test method function.
   336 // (other items were commented in a header).
   298 // (other items were commented in a header).
   337 // -----------------------------------------------------------------------------
   299 // -----------------------------------------------------------------------------
   338 //
   300 //
   339 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityUtilityL( CStifItemParser& aItem )
   301 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityUtilityL( CStifItemParser& aItem )
   340 {
   302 	{
   341     MPX_FUNC_EX("Cmpxplaybackutilitytest::MMPXPlaybackUtilityUtilityL( CStifItemParser& aItem )");
       
   342     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityUtilityL"));
   303     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityUtilityL"));
   343 	TInt err = KErrNone;
   304 	TInt err = KErrNone;
   344 	TInt mode = 0;
   305 	TInt mode = 0;
   345 	
   306 	
   346 	aItem.GetNextInt(mode);
   307 	aItem.GetNextInt(mode);
   347     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityUtilityL: mode %d"), mode);
   308     iLog->Log(_L("Cmpxharvestertest::MMPXPlaybackUtilityUtilityL: mode %d"), mode);
   348 	if ( mode )
   309 	if ( mode )
   349     {
   310 	    {
   350 	    TRAP(err,iMPXPlaybackUtility = MMPXPlaybackUtility::UtilityL(TUid::Uid(mode)));
   311 	    TRAP(err,iMPXPlaybackUtility = MMPXPlaybackUtility::UtilityL(TUid::Uid(mode)));
   351     }
   312 	    }
   352 	else
   313 	else
   353     {
   314 	    {
   354         TRAP(err,iMPXPlaybackUtility = MMPXPlaybackUtility::UtilityL());
   315         TRAP(err,iMPXPlaybackUtility = MMPXPlaybackUtility::UtilityL());
   355     }
   316 	    }
   356     
   317     
   357 	iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityUtilityL: error %d"), err);
   318 	iLog->Log(_L("Cmpxharvestertest::MMPXPlaybackUtilityUtilityL: error %d"), err);
   358 	
   319 	
   359 	return err;
   320 	return err;
   360 }
   321 	}
   361 
   322 
   362 // -----------------------------------------------------------------------------
   323 // -----------------------------------------------------------------------------
   363 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityUtilityWithCatL
   324 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityUtilityWithCatL
   364 // UtilityL test method function.
   325 // UtilityL test method function.
   365 // (other items were commented in a header).
   326 // (other items were commented in a header).
   366 // -----------------------------------------------------------------------------
   327 // -----------------------------------------------------------------------------
   367 //
   328 //
   368 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityUtilityWithCatL( CStifItemParser& aItem )
   329 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityUtilityWithCatL( CStifItemParser& aItem )
   369 {
   330     {
   370     MPX_FUNC_EX("Cmpxplaybackutilitytest::MMPXPlaybackUtilityUtilityWithCatL( CStifItemParser& aItem )");
       
   371     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityUtilityWithCatL"));
   331     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityUtilityWithCatL"));
   372     TInt err = KErrNone;
   332     TInt err = KErrNone;
   373     TInt category;
   333     TInt category;
   374     TInt mode = 0;
   334     TInt mode = 0;
   375     
   335     
   376     if ( aItem.GetNextInt(category) != KErrNone )
   336     if ( aItem.GetNextInt(category) != KErrNone )
   377     {
   337         {
   378         iLog->Log(_L("MMPXPlaybackUtilityNewWithCatL - Missing category."));
   338         iLog->Log(_L("MMPXPlaybackUtilityNewWithCatL - Missing category."));
   379         err = KErrArgument;
   339         err = KErrArgument;
   380         return err;
   340         return err;
   381     }
   341         }
   382 
   342 
   383     aItem.GetNextInt(mode);
   343     aItem.GetNextInt(mode);
   384     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityUtilityWithCatL: category %d"), category);
   344     iLog->Log(_L("Cmpxharvestertest::MMPXPlaybackUtilityUtilityWithCatL: category %d"), category);
   385     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityUtilityWithCatL: mode %d"), mode);
   345     iLog->Log(_L("Cmpxharvestertest::MMPXPlaybackUtilityUtilityWithCatL: mode %d"), mode);
   386     if ( mode )
   346     if ( mode )
   387     {
   347         {
   388         TRAP(err,iMPXPlaybackUtility = MMPXPlaybackUtility::UtilityL((TMPXCategory)category, TUid::Uid(mode)));
   348         TRAP(err,iMPXPlaybackUtility = MMPXPlaybackUtility::UtilityL((TMPXCategory)category, TUid::Uid(mode)));
   389     }
   349         }
   390     else
   350     else
   391     {
   351         {
   392         TRAP(err,iMPXPlaybackUtility = MMPXPlaybackUtility::UtilityL((TMPXCategory)category));
   352         TRAP(err,iMPXPlaybackUtility = MMPXPlaybackUtility::UtilityL((TMPXCategory)category));
   393     }
   353         }
   394     
   354     
   395     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityUtilityWithCatL: error %d"), err);
   355     iLog->Log(_L("Cmpxharvestertest::MMPXPlaybackUtilityUtilityWithCatL: error %d"), err);
   396     
   356     
   397     return err;
   357     return err;
   398 }
   358     }
   399 
   359 
   400 // -----------------------------------------------------------------------------
   360 // -----------------------------------------------------------------------------
   401 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithPlaylistL
   361 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithPlaylistL
   402 // InitL(CMPXCollectionPlaylist) test method function.
   362 // InitL(CMPXCollectionPlaylist) test method function.
   403 // (other items were commented in a header).
   363 // (other items were commented in a header).
   404 // -----------------------------------------------------------------------------
   364 // -----------------------------------------------------------------------------
   405 //
   365 //
   406 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithPlaylistL( CStifItemParser& /*aItem*/ )
   366 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithPlaylistL( CStifItemParser& /*aItem*/ )
   407 {
   367     {
   408     MPX_FUNC_EX("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithPlaylistL( CStifItemParser& )");
       
   409     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithPlaylistL"));
   368     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithPlaylistL"));
   410     TInt err = KErrNone;
   369     TInt err = KErrNone;
   411     CMPXCollectionPlaylist* playlist = CMPXCollectionPlaylist::NewL();
   370     CMPXCollectionPlaylist* playlist = CMPXCollectionPlaylist::NewL();
   412     CleanupStack::PushL(playlist);
   371     CleanupStack::PushL(playlist);
   413     TRAP(err,iMPXPlaybackUtility->InitL(*playlist));
   372     TRAP(err,iMPXPlaybackUtility->InitL(*playlist));
   414     CleanupStack::PopAndDestroy(playlist);
   373     CleanupStack::PopAndDestroy(playlist);
   415     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithPlaylistL - error=%d"),err);
   374     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithPlaylistL - error=%d"),err);
   416     return err;
   375     return err;
   417 }
   376     }
   418 
   377 
   419 // -----------------------------------------------------------------------------
   378 // -----------------------------------------------------------------------------
   420 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithUriL
   379 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithUriL
   421 // InitL(Uri) test method function.
   380 // InitL(Uri) test method function.
   422 // (other items were commented in a header).
   381 // (other items were commented in a header).
   423 // -----------------------------------------------------------------------------
   382 // -----------------------------------------------------------------------------
   424 //
   383 //
   425 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithUriL( CStifItemParser& aItem )
   384 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithUriL( CStifItemParser& aItem )
   426 {
   385     {
   427     MPX_FUNC_EX("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithUriL( CStifItemParser& aItem )");
       
   428     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithUriL"));
   386     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithUriL"));
   429     TInt err = KErrNone; 
   387     TInt err = KErrNone;
   430     TPtrC string;
   388     TPtrC string;
   431     
   389    
   432     MMPXPlayerManager& manager = iMPXPlaybackUtility->PlayerManager();
       
   433     MMPXPlayer* player = manager.CurrentPlayer();        
       
   434     
       
   435     if( aItem.GetNextString( string ) == KErrNone )
   390     if( aItem.GetNextString( string ) == KErrNone )
   436     {
   391         {
   437         //TBuf<120> uri;
   392         TBuf<120> uri;
   438         TFileName uri;
       
   439         uri.Append(KmpxplaybackutilityTestFilePath);
   393         uri.Append(KmpxplaybackutilityTestFilePath);
   440         uri.Append(string);
   394         uri.Append(string);
   441         iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithUriL - uri = %S."), &uri);
   395         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                                      
       
   451         TRAP(err,iMPXPlaybackUtility->InitL(uri));
   396         TRAP(err,iMPXPlaybackUtility->InitL(uri));
   452         
   397         
   453         if ( !err )
   398         if ( !err )
   454         {
   399             {
   455             TInt event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EPlayerChanged;
   400             TInt event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EPlayerChanged;
   456             AddExpectedEventL(event, 0, 0);
   401             AddExpectedEventL(event, 0, 0);
   457             
       
   458             event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EInitializeComplete;
   402             event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EInitializeComplete;
   459             AddExpectedEventL(event, 0, 0);
   403             AddExpectedEventL(event, 0, 0);
   460 
   404             }
   461             event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EStateChanged;
   405         iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithUriL - error=%d"),err);
   462             AddExpectedEventL(event, EPbStateInitialised, 0);
   406         }
   463             
   407     else
   464             if ( player->UidL() == KPbTestVideoPlugin )
   408         {
   465             {
       
   466                 event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EStateChanged;
       
   467                 AddExpectedEventL(event, EPbStateBuffering, 0);
       
   468             }
       
   469         }
       
   470         iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithUriL - error=%d"),err);                  
       
   471     }
       
   472     else
       
   473     {
       
   474         iLog->Log(_L("MMPXPlaybackUtilityInitWithUriL - Missing file name."));
   409         iLog->Log(_L("MMPXPlaybackUtilityInitWithUriL - Missing file name."));
   475         err = KErrArgument;
   410         err = KErrArgument;
   476     }
   411         }
   477     
   412     return err;
   478     return err;
   413     }
   479 }
       
   480 
   414 
   481 // -----------------------------------------------------------------------------
   415 // -----------------------------------------------------------------------------
   482 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithRFileL
   416 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithRFileL
   483 // Init64L test method function.
   417 // Init64L test method function.
   484 // (other items were commented in a header).
   418 // (other items were commented in a header).
   485 // -----------------------------------------------------------------------------
   419 // -----------------------------------------------------------------------------
   486 //
   420 //
   487 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithRFileL( CStifItemParser& aItem )
   421 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithRFileL( CStifItemParser& aItem )
   488 {
   422     {
   489     MPX_FUNC_EX("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithRFileL( CStifItemParser& aItem )");
       
   490     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithRFileL"));
   423     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithRFileL"));
   491     TInt err = KErrNone;
   424     TInt err = KErrNone;
   492     TPtrC string;
   425     TPtrC string;
   493     
       
   494     MMPXPlayerManager& manager = iMPXPlaybackUtility->PlayerManager();
       
   495     MMPXPlayer* player = manager.CurrentPlayer();
       
   496    
   426    
   497     if( aItem.GetNextString( string ) == KErrNone )
   427     if( aItem.GetNextString( string ) == KErrNone )
   498     {
   428         {
   499         TBuf<120> KFrom;
   429         TBuf<120> KFrom;
   500         KFrom.Append(KmpxplaybackutilityTestFilePath);
   430         KFrom.Append(KmpxplaybackutilityTestFilePath);
   501         KFrom.Append(string);
   431         KFrom.Append(string);
   502         iFileName = KFrom;
       
   503         
       
   504         if ( iFile.SubSessionHandle() )
   432         if ( iFile.SubSessionHandle() )
   505         {
   433             {
   506             iFile.Close();
   434             iFile.Close();
   507         }
   435             }
   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         
       
   516         err = iFile.Open(iFs, KFrom, EFileRead | EFileShareReadersOrWriters);
   436         err = iFile.Open(iFs, KFrom, EFileRead | EFileShareReadersOrWriters);
   517         
       
   518         if ( err == KErrNone )
   437         if ( err == KErrNone )
   519         {
   438             {
   520             iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithRFileL - Open passed."));
   439             iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithRFileL - Open passed."));
   521             TRAP(err,iMPXPlaybackUtility->InitL(iFile));
   440             TRAP(err,iMPXPlaybackUtility->InitL(iFile));
   522             
   441             
   523             if ( !err )
   442             if ( !err )
   524             {
   443                 {
   525                 TInt event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EPlayerChanged;
   444                 TInt event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EPlayerChanged;
   526                 AddExpectedEventL(event, 0, 0);
   445                 AddExpectedEventL(event, 0, 0);
   527                 
       
   528                 event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EInitializeComplete;
   446                 event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EInitializeComplete;
   529                 AddExpectedEventL(event, 0, 0);
   447                 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);
       
   538                 }
   448                 }
   539             }
   449             }
   540         }
       
   541         iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithRFileL - error=%d"),err);
   450         iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitWithRFileL - error=%d"),err);
   542     }
   451         }
   543     else
   452     else
   544     {
   453         {
   545         iLog->Log(_L("MMPXPlaybackUtilityInitWithRFileL - Missing file name."));
   454         iLog->Log(_L("MMPXPlaybackUtilityInitWithRFileL - Missing file name."));
   546         err = KErrArgument;
   455         err = KErrArgument;
   547     }
   456         }
   548     return err;
   457     return err;
   549 }
   458     }
   550 
   459 
   551 // -----------------------------------------------------------------------------
   460 // -----------------------------------------------------------------------------
   552 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreamingWithUriL
   461 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreamingWithUriL
   553 // InitStreamingL(Uri) test method function.
   462 // InitStreamingL(Uri) test method function.
   554 // (other items were commented in a header).
   463 // (other items were commented in a header).
   555 // -----------------------------------------------------------------------------
   464 // -----------------------------------------------------------------------------
   556 //
   465 //
   557 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreamingWithUriL( CStifItemParser& aItem )
   466 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreamingWithUriL( CStifItemParser& aItem )
   558 {
   467     {
   559     MPX_FUNC_EX("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreamingWithUriL( CStifItemParser& aItem )");
       
   560     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreamingWithUriL"));
   468     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreamingWithUriL"));
   561     TInt err = KErrNone;
   469     TInt err = KErrNone;
   562     TPtrC string;
   470     TPtrC string;
   563     TInt accessPoint = 1;
   471     TInt accessPoint = 1;
   564    
   472    
   565     MMPXPlayerManager& manager = iMPXPlaybackUtility->PlayerManager();
       
   566     MMPXPlayer* player = manager.CurrentPlayer();
       
   567     
       
   568     if( aItem.GetNextString( string ) == KErrNone )
   473     if( aItem.GetNextString( string ) == KErrNone )
   569     {
   474         {
   570         TBuf<120> uri;
   475         TBuf<120> uri;
   571         uri.Append(KmpxplaybackutilityTestFilePath);
   476         uri.Append(KmpxplaybackutilityTestFilePath);
   572         uri.Append(string);
   477         uri.Append(string);
   573         iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreamingWithUriL - uri = %S."), &uri);
   478         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         
       
   583         TRAP(err,iMPXPlaybackUtility->InitStreamingL(uri, NULL, accessPoint));
   479         TRAP(err,iMPXPlaybackUtility->InitStreamingL(uri, NULL, accessPoint));
   584         
   480         
   585         if ( !err )
   481         if ( !err )
   586         {
   482             {
   587             TInt event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EPlayerChanged;
   483             TInt event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EPlayerChanged;
   588             AddExpectedEventL(event, 0, 0);
   484             AddExpectedEventL(event, 0, 0);
   589             
       
   590             event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EInitializeComplete;
   485             event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EInitializeComplete;
   591             AddExpectedEventL(event, 0, 0);
   486             AddExpectedEventL(event, 0, 0);
   592             
   487             }
   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);
       
   600             }
       
   601                         
       
   602         }
       
   603         iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreamingWithUriL - error=%d"),err);
   488         iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreamingWithUriL - error=%d"),err);
   604     }
   489         }
   605     else
   490     else
   606     {
   491         {
   607         iLog->Log(_L("MMPXPlaybackUtilityInitStreamingWithUriL - Missing file name."));
   492         iLog->Log(_L("MMPXPlaybackUtilityInitStreamingWithUriL - Missing file name."));
   608         err = KErrArgument;
   493         err = KErrArgument;
   609     }
   494         }
   610     return err;
   495     return err;
   611 }
   496     }
   612 
   497 
   613 // -----------------------------------------------------------------------------
   498 // -----------------------------------------------------------------------------
   614 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreamingWithRFileL
   499 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreamingWithRFileL
   615 // InitStreamingL(RFile) test method function.
   500 // InitStreamingL(RFile) test method function.
   616 // (other items were commented in a header).
   501 // (other items were commented in a header).
   617 // -----------------------------------------------------------------------------
   502 // -----------------------------------------------------------------------------
   618 //
   503 //
   619 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreamingWithRFileL( CStifItemParser& aItem )
   504 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreamingWithRFileL( CStifItemParser& aItem )
   620 {
   505     {
   621     MPX_FUNC_EX("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreamingWithRFileL( CStifItemParser& aItem )");
       
   622     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreamingWithRFileL"));
   506     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreamingWithRFileL"));
   623     TInt err = KErrNone;
   507     TInt err = KErrNone;
   624     TPtrC string;
   508     TPtrC string;
   625     TInt accessPoint = 1;
   509     TInt accessPoint = 1;
   626     
   510     
   627     MMPXPlayerManager& manager = iMPXPlaybackUtility->PlayerManager();
       
   628     MMPXPlayer* player = manager.CurrentPlayer();
       
   629     
       
   630     if( aItem.GetNextString( string ) == KErrNone )
   511     if( aItem.GetNextString( string ) == KErrNone )
   631     {
   512         {
   632         TBuf<120> KFrom;
   513         TBuf<120> KFrom;
   633         KFrom.Append(KmpxplaybackutilityTestFilePath);
   514         KFrom.Append(KmpxplaybackutilityTestFilePath);
   634         KFrom.Append(string);
   515         KFrom.Append(string);
   635         iFileName = KFrom;
       
   636         
       
   637         if ( iFile.SubSessionHandle() )
   516         if ( iFile.SubSessionHandle() )
   638         {
   517             {
   639             iFile.Close();
   518             iFile.Close();
   640         }
   519             }
   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         
       
   649         err = iFile.Open(iFs, KFrom, EFileRead | EFileShareReadersOrWriters);
   520         err = iFile.Open(iFs, KFrom, EFileRead | EFileShareReadersOrWriters);
   650         if ( err == KErrNone )
   521         if ( err == KErrNone )
   651         {
   522             {
   652             iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreamingWithRFileL - Open passed."));
   523             iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreamingWithRFileL - Open passed."));
   653             TRAP(err,iMPXPlaybackUtility->InitStreamingL(iFile, accessPoint));
   524             TRAP(err,iMPXPlaybackUtility->InitStreamingL(iFile, accessPoint));
   654 
   525 
   655             if ( !err )
   526             if ( !err )
   656             {
   527                 {
   657                 TInt event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EPlayerChanged;
   528                 TInt event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EPlayerChanged;
   658                 AddExpectedEventL(event, 0, 0);
   529                 AddExpectedEventL(event, 0, 0);
   659                 
       
   660                 event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EInitializeComplete;
   530                 event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EInitializeComplete;
   661                 AddExpectedEventL(event, 0, 0);
   531                 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);
       
   670                 }
   532                 }
   671                                 
   533             }
   672             }
       
   673         }
       
   674         iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreamingWithRFileL - error=%d"),err);
   534         iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreamingWithRFileL - error=%d"),err);
   675     }
   535         }
   676     else
   536     else
   677     {
   537         {
   678         iLog->Log(_L("MMPXPlaybackUtilityInitStreamingWithRFileL - Missing file name."));
   538         iLog->Log(_L("MMPXPlaybackUtilityInitStreamingWithRFileL - Missing file name."));
   679         err = KErrArgument;
   539         err = KErrArgument;
   680     }
   540         }
   681     return err;
   541     return err;
   682 }
   542     }
   683 
   543 
   684 // -----------------------------------------------------------------------------
   544 // -----------------------------------------------------------------------------
   685 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityInit64L
   545 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityInit64L
   686 // Init64L test method function.
   546 // Init64L test method function.
   687 // (other items were commented in a header).
   547 // (other items were commented in a header).
   688 // -----------------------------------------------------------------------------
   548 // -----------------------------------------------------------------------------
   689 //
   549 //
   690 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityInit64L( CStifItemParser& aItem )
   550 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityInit64L( CStifItemParser& aItem )
   691 {
   551     {
   692     MPX_FUNC_EX("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInit64L( CStifItemParser& aItem )");
       
   693     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInit64L"));
   552     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInit64L"));
   694     TInt err = KErrNone;
   553     TInt err = KErrNone;
   695 #ifndef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   554 #ifndef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   696     err = KErrNotSupported;
   555     err = KErrNotSupported;
   697     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInit64L testing Init64L() error=%d"),err);
   556     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInit64L testing Init64L() error=%d"),err);
   698 #else // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   557 #else // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   699     TPtrC string;
   558     TPtrC string;
   700    
   559    
   701     MMPXPlayerManager& manager = iMPXPlaybackUtility->PlayerManager();
       
   702     MMPXPlayer* player = manager.CurrentPlayer();
       
   703     
       
   704     if( aItem.GetNextString( string ) == KErrNone )
   560     if( aItem.GetNextString( string ) == KErrNone )
   705     {
   561         {
   706         TBuf<120> KFrom;
   562         TBuf<120> KFrom;
   707         KFrom.Append(KmpxplaybackutilityTestFilePath);
   563         KFrom.Append(KmpxplaybackutilityTestFilePath);
   708         KFrom.Append(string);
   564         KFrom.Append(string);
   709         iFileName = KFrom;
       
   710         
       
   711         if ( iFile64.SubSessionHandle() )
   565         if ( iFile64.SubSessionHandle() )
   712         {
   566             {
   713             iFile64.Close();
   567             iFile64.Close();
   714         }
   568             }
   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         
       
   723         err = iFile64.Open(iFs, KFrom, EFileRead | EFileShareReadersOrWriters);
   569         err = iFile64.Open(iFs, KFrom, EFileRead | EFileShareReadersOrWriters);
   724         
       
   725         if ( err == KErrNone )
   570         if ( err == KErrNone )
   726         {
   571             {
   727             iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInit64L - Open passed."));
   572             iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInit64L - Open passed."));
   728             TRAP(err,iMPXPlaybackUtility->Init64L(iFile64));
   573             TRAP(err,iMPXPlaybackUtility->Init64L(iFile64));
   729             
   574             
   730             if ( !err )
   575             if ( !err )
   731             {
   576                 {
   732                 TInt event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EPlayerChanged;
   577                 TInt event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EPlayerChanged;
   733                 AddExpectedEventL(event, 0, 0);
   578                 AddExpectedEventL(event, 0, 0);
   734                 
       
   735                 event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EInitializeComplete;
   579                 event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EInitializeComplete;
   736                 AddExpectedEventL(event, 0, 0);
   580                 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);
       
   745                 }
   581                 }
   746                                 
   582             }
   747             }
       
   748         }
       
   749         iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInit64L - error=%d"),err);
   583         iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInit64L - error=%d"),err);
   750     }
   584         }
   751     else
   585     else
   752     {
   586         {
   753         iLog->Log(_L("MMPXPlaybackUtilityInit64L - Missing file name."));
   587         iLog->Log(_L("MMPXPlaybackUtilityInit64L - Missing file name."));
   754         err = KErrArgument;
   588         err = KErrArgument;
   755     }
   589         }
   756 #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   590 #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   757     return err;
   591     return err;
   758 }
   592     }
   759 
   593 
   760 // -----------------------------------------------------------------------------
   594 // -----------------------------------------------------------------------------
   761 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreaming64L
   595 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreaming64L
   762 // InitStreaming64L test method function.
   596 // InitStreaming64L test method function.
   763 // (other items were commented in a header).
   597 // (other items were commented in a header).
   764 // -----------------------------------------------------------------------------
   598 // -----------------------------------------------------------------------------
   765 //
   599 //
   766 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreaming64L( CStifItemParser& aItem )
   600 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreaming64L( CStifItemParser& aItem )
   767 {
   601     {
   768     MPX_FUNC_EX("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreaming64L( CStifItemParser& aItem )");
       
   769     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreaming64L"));
   602     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreaming64L"));
   770     TInt err = KErrNone;
   603     TInt err = KErrNone;
   771 #ifndef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   604 #ifndef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   772     err = KErrNotSupported;
   605     err = KErrNotSupported;
   773     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreaming64L - error=%d"),err);
   606     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreaming64L - error=%d"),err);
   774 #else // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   607 #else // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   775     TPtrC string;
   608     TPtrC string;
   776     TInt accessPoint = 1;
   609     TInt accessPoint = 1;
   777     
   610     
   778     MMPXPlayerManager& manager = iMPXPlaybackUtility->PlayerManager();
       
   779     MMPXPlayer* player = manager.CurrentPlayer();
       
   780     
       
   781     if( aItem.GetNextString( string ) == KErrNone )
   611     if( aItem.GetNextString( string ) == KErrNone )
   782     {
   612         {
   783         TBuf<120> KFrom;
   613         TBuf<120> KFrom;
   784         KFrom.Append(KmpxplaybackutilityTestFilePath);
   614         KFrom.Append(KmpxplaybackutilityTestFilePath);
   785         KFrom.Append(string);
   615         KFrom.Append(string);
   786         iFileName = KFrom;
       
   787         
       
   788         if ( iFile64.SubSessionHandle() )
   616         if ( iFile64.SubSessionHandle() )
   789         {
   617             {
   790             iFile64.Close();
   618             iFile64.Close();
   791         }
   619             }
   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         
       
   800         err = iFile64.Open(iFs, KFrom, EFileRead | EFileShareReadersOrWriters);
   620         err = iFile64.Open(iFs, KFrom, EFileRead | EFileShareReadersOrWriters);
   801         
       
   802         if ( err == KErrNone )
   621         if ( err == KErrNone )
   803         {
   622             {
   804             iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreaming64L - Open passed."));
   623             iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreaming64L - Open passed."));
   805             TRAP(err,iMPXPlaybackUtility->InitStreaming64L(iFile64, accessPoint));
   624             TRAP(err,iMPXPlaybackUtility->InitStreaming64L(iFile64, accessPoint));
   806 
   625 
   807             if ( !err )
   626             if ( !err )
   808             {
   627                 {
   809                 TInt event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EPlayerChanged;
   628                 TInt event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EPlayerChanged;
   810                 AddExpectedEventL(event, 0, 0);
   629                 AddExpectedEventL(event, 0, 0);
   811                 
       
   812                 event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EInitializeComplete;
   630                 event = KGeneralPlaybackMsgOffset + TMPXPlaybackMessage::EInitializeComplete;
   813                 AddExpectedEventL(event, 0, 0);
   631                 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);                                
       
   822                 }
   632                 }
   823             }
   633             }
   824         }
       
   825         iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreaming64L - error=%d"),err);
   634         iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreaming64L - error=%d"),err);
   826     }
   635         }
   827     else
   636     else
   828     {
   637         {
   829         iLog->Log(_L("MMPXPlaybackUtilityInitStreaming64L - Missing file name."));
   638         iLog->Log(_L("MMPXPlaybackUtilityInitStreaming64L - Missing file name."));
   830         err = KErrArgument;
   639         err = KErrArgument;
   831     }
   640         }
   832 #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   641 #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   833     return err;
   642     return err;
   834 }
   643     }
   835 
   644 
   836 // -----------------------------------------------------------------------------
   645 // -----------------------------------------------------------------------------
   837 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityFile64L
   646 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityFile64L
   838 // File64L test method function.
   647 // File64L test method function.
   839 // (other items were commented in a header).
   648 // (other items were commented in a header).
   840 // -----------------------------------------------------------------------------
   649 // -----------------------------------------------------------------------------
   841 //
   650 //
   842 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityFile64L( CStifItemParser& /*aItem*/ )
   651 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityFile64L( CStifItemParser& /*aItem*/ )
   843 {
   652     {
   844     MPX_FUNC_EX("Cmpxplaybackutilitytest::MMPXPlaybackUtilityFile64L( CStifItemParser& )");
       
   845     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityFile64L"));
   653     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityFile64L"));
   846     TInt err = KErrNone;
   654     TInt err = KErrNone;
   847 #ifndef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   655 #ifndef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   848     err = KErrNotSupported;
   656     err = KErrNotSupported;
   849     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityFile64L - error=%d"),err);
   657     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityFile64L - error=%d"),err);
   850 #else // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   658 #else // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   851     RFile64* file64Ptr=NULL;
   659     RFile64* file64Ptr=NULL;
   852     TRAP(err, file64Ptr=iMPXPlaybackUtility->Source()->File64L());
   660     TRAP(err, file64Ptr=iMPXPlaybackUtility->Source()->File64L());
   853     if ( !file64Ptr->SubSessionHandle() )
   661     if ( !file64Ptr->SubSessionHandle() )
   854     {
   662         {
   855         iLog->Log(_L("MMPXPlaybackUtilityFile64L - file64 = NULL."));
   663         iLog->Log(_L("MMPXPlaybackUtilityFile64L - file64 = NULL."));
   856     }
   664         }
   857     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityFile64L - error=%d"),err);
   665     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityFile64L - error=%d"),err);
   858 #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   666 #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   859     return err;
   667     return err;
   860 }
   668     }
   861 
   669 
   862 // -----------------------------------------------------------------------------
   670 // -----------------------------------------------------------------------------
   863 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityAddObserverL
   671 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityAddObserverL
   864 // AddObserverL test method function.
   672 // AddObserverL test method function.
   865 // (other items were commented in a header).
   673 // (other items were commented in a header).
   866 // -----------------------------------------------------------------------------
   674 // -----------------------------------------------------------------------------
   867 //
   675 //
   868 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityAddObserverL( CStifItemParser& /*aItem*/ )
   676 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityAddObserverL( CStifItemParser& /*aItem*/ )
   869 {
   677     {
   870     MPX_FUNC_EX("Cmpxplaybackutilitytest::MMPXPlaybackUtilityAddObserverL( CStifItemParser&)");
       
   871     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityAddObserverL"));
   678     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityAddObserverL"));
   872     TInt err = KErrNone;
   679     TInt err = KErrNone;
   873     TRAP(err, iMPXPlaybackUtility->AddObserverL(*this));
   680     TRAP(err, iMPXPlaybackUtility->AddObserverL(*this));
   874     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityAddObserverL - error=%d"),err);
   681     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityAddObserverL - error=%d"),err);
   875     return err;
   682     return err;
   876 }
   683     }
   877 
   684 
   878 // -----------------------------------------------------------------------------
   685 // -----------------------------------------------------------------------------
   879 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityRemoveObserverL
   686 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityRemoveObserverL
   880 // RemoveObserverL test method function.
   687 // RemoveObserverL test method function.
   881 // (other items were commented in a header).
   688 // (other items were commented in a header).
   882 // -----------------------------------------------------------------------------
   689 // -----------------------------------------------------------------------------
   883 //
   690 //
   884 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityRemoveObserverL( CStifItemParser& /*aItem*/ )
   691 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityRemoveObserverL( CStifItemParser& /*aItem*/ )
   885 {
   692     {
   886     MPX_FUNC_EX("Cmpxplaybackutilitytest::MMPXPlaybackUtilityRemoveObserverL( CStifItemParser&)");
       
   887     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityRemoveObserverL"));
   693     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityRemoveObserverL"));
   888     TInt err = KErrNone;
   694     TInt err = KErrNone;
   889     TRAP(err, iMPXPlaybackUtility->RemoveObserverL(*this));
   695     TRAP(err, iMPXPlaybackUtility->RemoveObserverL(*this));
   890     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityRemoveObserverL - error=%d"),err);
   696     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityRemoveObserverL - error=%d"),err);
   891     return err;
   697     return err;
   892 }
   698     }
   893 
   699 
   894 // -----------------------------------------------------------------------------
   700 // -----------------------------------------------------------------------------
   895 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityPlayerManagerSelectPlayerL
   701 // Cmpxplaybackutilitytest::MMPXPlaybackUtilityPlayerManagerSelectPlayerL
   896 // RemoveObserverL test method function.
   702 // RemoveObserverL test method function.
   897 // (other items were commented in a header).
   703 // (other items were commented in a header).
   898 // -----------------------------------------------------------------------------
   704 // -----------------------------------------------------------------------------
   899 //
   705 //
   900 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityPlayerManagerSelectPlayerL( CStifItemParser& aItem )
   706 TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityPlayerManagerSelectPlayerL(CStifItemParser& aItem)
   901 {
   707     {
   902     MPX_FUNC_EX("Cmpxplaybackutilitytest::MMPXPlaybackUtilityPlayerManagerSelectPlayerL(CStifItemParser& aItem)");
       
   903     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityPlayerManagerSelectPlayerL"));
   708     iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityPlayerManagerSelectPlayerL"));
   904     TInt uidInt;
   709     TInt uidInt;
   905     TInt err = KErrNone;
   710     TInt err = KErrNone;
   906     
   711     
   907     // read in UID
   712     // read in UID
   908     if ( aItem.GetNextInt(uidInt) != KErrNone )
   713     if ( aItem.GetNextInt(uidInt) != KErrNone )
   909     {
   714         {
   910         iLog->Log(_L("MMPXPlaybackUtilityPlayerManagerSelectPlayerL - Missing UID."));
   715         iLog->Log(_L("MMPXPlaybackUtilityPlayerManagerSelectPlayerL - Missing UID."));
   911         err = KErrArgument;
   716         err = KErrArgument;
   912         return err;
   717         return err;
   913     }
   718         }
   914 
   719 
   915     iLog->Log(_L("MMPXPlaybackUtilityPlayerManagerSelectPlayerL - UID = 0x%x."), uidInt);
   720     iLog->Log(_L("MMPXPlaybackUtilityPlayerManagerSelectPlayerL - UID = 0x%x."), uidInt);
   916     if ( iMPXPlaybackUtility )
   721     if ( iMPXPlaybackUtility )
   917     {
   722         {
   918         MMPXPlayerManager& manager = iMPXPlaybackUtility->PlayerManager();
   723         MMPXPlayerManager& manager = iMPXPlaybackUtility->PlayerManager();
   919         
   724         TRAP( err, manager.SelectPlayerL( TUid::Uid(uidInt) ) );
   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         }
       
   932         iLog->Log(_L("MMPXPlaybackUtilityPlayerManagerSelectPlayerL - SelectPlayer err = %d."), err);
   725         iLog->Log(_L("MMPXPlaybackUtilityPlayerManagerSelectPlayerL - SelectPlayer err = %d."), err);
   933     }
   726         }
   934     else
   727     else
   935     {
   728         {
   936         iLog->Log(_L("MMPXPlaybackUtilityPlayerManagerSelectPlayerL - MPX Playback Utility not created."));
   729         iLog->Log(_L("MMPXPlaybackUtilityPlayerManagerSelectPlayerL - MPX Playback Utility not created."));
   937         err = KErrGeneral;
   730         err = KErrGeneral;
   938     }
   731         }
   939     return err;
   732     return err;
   940 }
   733     }
   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 
       
  1375 
   734 
  1376 // -----------------------------------------------------------------------------
   735 // -----------------------------------------------------------------------------
  1377 // Cmpxplaybackutilitytest::EndTest
   736 // Cmpxplaybackutilitytest::EndTest
  1378 // -----------------------------------------------------------------------------
   737 // -----------------------------------------------------------------------------
  1379 //
   738 //
  1380 TInt Cmpxplaybackutilitytest::EndTest( CStifItemParser& /*aItem*/ )
   739 TInt Cmpxplaybackutilitytest::EndTest( CStifItemParser& /*aItem*/ )
  1381 {
   740     {
  1382     iLog->Log(_L("Cmpxplaybackutilitytest::EndTest"));
   741     iLog->Log(_L("Cmpxplaybackutilitytest::EndTest"));
  1383     TInt err = iCallbackError;
   742     TInt err = iCallbackError;
  1384     
   743     
  1385     // check if event queue is empty
   744     // check if event queue is empty
  1386     if ( !err && (iExpectedEventArray->Count() > 0 ) ) 
   745     if ( !err && (iExpectedEventArray->Count() > 0 ) ) 
  1387     {
   746         {
  1388         iLog->Log(_L("Cmpxplaybackutilitytest::EndTest error = KErrTimedOut"));
   747         iLog->Log(_L("Cmpxplaybackutilitytest::EndTest error = KErrTimedOut"));
  1389         err = KErrTimedOut;
   748         err = KErrTimedOut;
  1390     }
   749         }
  1391      
   750     return err;
  1392     return err;
   751     }
  1393 }
       
  1394 
   752 
  1395 // end of file
   753 // end of file