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