camcordermmfplugin/tsrc/public/basic/src/camcTest_1.cpp
changeset 0 9b3e960ffc8a
child 42 605672cc2a86
equal deleted inserted replaced
-1:000000000000 0:9b3e960ffc8a
       
     1 /*
       
     2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Camcorder MMF API Test DLL
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include "CamcTest_1.h"
       
    22 #include <bldvariant.hrh>
       
    23 
       
    24 
       
    25 // EXTERNAL DATA STRUCTURES
       
    26 
       
    27 // EXTERNAL FUNCTION PROTOTYPES 
       
    28 
       
    29 // CONSTANTS
       
    30 
       
    31 // MACROS
       
    32 #ifdef _DEBUG
       
    33 #include <e32svr.h>
       
    34 #define PRINT(x) RDebug::Print x
       
    35 #else
       
    36 #define PRINT(x)
       
    37 #endif
       
    38 // LOCAL CONSTANTS AND MACROS
       
    39 
       
    40 // MODULE DATA STRUCTURES
       
    41 
       
    42 // LOCAL FUNCTION PROTOTYPES
       
    43 
       
    44 // FORWARD DECLARATIONS
       
    45 
       
    46 
       
    47 
       
    48 CCamcTest_1::CCamcTest_1 ()
       
    49     {
       
    50     }
       
    51 
       
    52 
       
    53 
       
    54 CCamcTest_1::~CCamcTest_1 ()
       
    55     {
       
    56     delete iCamcTestClient;
       
    57     iCamcTestClient = NULL;
       
    58     }
       
    59 
       
    60 
       
    61 void CCamcTest_1::setUpL ()
       
    62     {
       
    63     iCamcTestClient = CCamcTestClient_1::NewL( );
       
    64     iWaitScheduler = new (ELeave) CActiveSchedulerWait;	
       
    65 
       
    66     // Create a new Camera API implementation object, if supported
       
    67     TRAPD( err, iUiLevelCamera = CCamera::New2L( static_cast<MCameraObserver2&>(*this), 0 /*index*/, 0 /*Priority*/ ) );
       
    68     if ( err )
       
    69         {
       
    70         PRINT( ( _L( "CCamcTest_1::setUpL CCamera::New2L return code=%d" ), err ) ); 
       
    71         // Create old Camera API implementation object.
       
    72         iUiLevelCamera = CCamera::NewL( static_cast<MCameraObserver&>(*this), 0 /*Index*/ );
       
    73         }
       
    74     else 
       
    75        {
       
    76        PRINT( ( _L( "CCamcTest_1::setUp() using new MCameraObserver2" )) ); 
       
    77        }
       
    78 
       
    79 
       
    80 	iUiLevelCameraHandle = iUiLevelCamera->Handle();
       
    81 	iUiLevelCamera->Reserve();
       
    82 	iWaitScheduler->Start();
       
    83     }
       
    84 
       
    85 
       
    86 void CCamcTest_1::tearDown ()
       
    87     {
       
    88     delete iCamcTestClient;
       
    89     iCamcTestClient = NULL;
       
    90     delete iWaitScheduler;
       
    91     delete iUiLevelCamera;
       
    92 	REComSession::FinalClose();
       
    93     
       
    94     }
       
    95 
       
    96 
       
    97 //
       
    98 // Own test functions.
       
    99 //
       
   100 
       
   101 // //////////////////////////////////////////////////////////////////
       
   102 //                       OpenFileL tests
       
   103 // //////////////////////////////////////////////////////////////////
       
   104 
       
   105 void CCamcTest_1::OpenFileL_001_L()
       
   106     {
       
   107     ///////////////////////////////////////
       
   108     //   ID: CAMC_API.OPENFILEL_001
       
   109     //   Action :
       
   110     //       CtrUid = OK
       
   111     //   Output : 
       
   112     //       OpenFile = OK
       
   113     //   Precondition :
       
   114     //       CVideoRecorderUtility is ready
       
   115     ///////////////////////////////////////
       
   116     
       
   117     TUid controllerUid = {CONTROLLER_UID};	
       
   118     TUid formatUid = {VIDEO_FORMAT_UID};
       
   119     
       
   120     iCamcTestClient->Test_OpenFileL(
       
   121         _L("recordQCIF.3gp"),		// File
       
   122         iUiLevelCameraHandle,		//CameraHandle
       
   123         controllerUid,					//Controller UID
       
   124         formatUid,      				//Format UID
       
   125         MIME_VIDEO_FORMAT,
       
   126         NO_AUDIO_FOURCC  				//Audio Type
       
   127         );
       
   128     
       
   129     // Succeed, if it doesn't leave.
       
   130     }
       
   131 
       
   132 
       
   133 void CCamcTest_1::OpenFileL_002_L()
       
   134     {
       
   135     
       
   136     ///////////////////////////////////////
       
   137     //   ID: CAMC_API.OPENFILEL_002
       
   138     //   
       
   139     //     Action :
       
   140     //        CtrUid = None (0x0)
       
   141     //        FileName = OK
       
   142     //     Output : 
       
   143     //        OpenFile Leaves with KErrNotFound
       
   144     //        or Callback is called with error msg
       
   145     //    Precondition :
       
   146     //        CVideoRecorderUtility is ready
       
   147     ///////////////////////////////////////   
       
   148     
       
   149     TUid controllerUid = {0x0};	
       
   150     TUid formatUid = {VIDEO_FORMAT_UID};
       
   151     
       
   152     TRAPD(err, iCamcTestClient->Test_OpenFileL(
       
   153         _L("recordQCIF.3gp"),		// File
       
   154         iUiLevelCameraHandle,								//CameraHandle
       
   155         controllerUid,					//Controller UID
       
   156         formatUid,						//Format UID
       
   157         MIME_VIDEO_FORMAT,
       
   158         NO_AUDIO_FOURCC				    //Audio Type
       
   159         ));
       
   160 
       
   161     // Function may leave with KErrNotFound, that's ok
       
   162     if (err==KErrNotFound)
       
   163         return;
       
   164     // Otherwise, the MvruoOpenComplete should return with an error
       
   165 
       
   166     assertTIntsEqualL( KErrNotFound, iCamcTestClient->WaitForCallbackWithErrors() );
       
   167 
       
   168     }
       
   169 
       
   170 void CCamcTest_1::OpenFileL_003_L()
       
   171     {
       
   172     
       
   173     ///////////////////////////////////////
       
   174     //   ID: CAMC_API.OPENFILEL_003
       
   175     //   
       
   176     //     Action :
       
   177     //        CtrUid = none
       
   178     //        FileName = Extension not OK to find the controller
       
   179     //     Output : 
       
   180     //        OpenFile = Leave with KErrArgument 
       
   181     //     Precondition :
       
   182     //        CVideoRecorderUtility is ready
       
   183     ///////////////////////////////////////    
       
   184     
       
   185     ////////////////////////////////////////
       
   186     // Due to functionality changes, Test case is not relevant anymore
       
   187     ////////////////////////////////////////
       
   188     assertL(0);
       
   189     
       
   190     //TUid controllerUid = {0};	
       
   191     //TUid formatUid = {0};
       
   192     
       
   193     //TRAPD(err,
       
   194     //    iCamcTestClient->Test_OpenFileL(
       
   195     //   _L("c:\\recordQCIF.txt"),		// File
       
   196     //    0,								//CameraHandle
       
   197     //    controllerUid,					//Controller UID
       
   198     //    formatUid,						//Format UID
       
   199     //    //TFourCC('2', '6', '3', 'B'),	//Video Type
       
   200     //    _L8("video/3gpp"),
       
   201     //    KMMFFourCCCodeNULL				//Audio Type
       
   202     //    ));
       
   203     
       
   204     // OpenFile should not succeed...
       
   205     // assertL (err==KErrArgument);
       
   206     }
       
   207 
       
   208 void CCamcTest_1::OpenFileL_004_L()
       
   209     {
       
   210     
       
   211     ///////////////////////////////////////
       
   212     //	   ID: CAMC_API.OPENFILEL_004
       
   213     //    
       
   214     //     Action :
       
   215     //	        CtrUid  = incorrect
       
   216     //     Output : 
       
   217     //         OpenFile = Leaves 
       
   218     //           or MvruoOpenComplete return with an error
       
   219     //         
       
   220     //     Precondition :
       
   221     //        CVideoRecorderUtility is ready
       
   222     ///////////////////////////////////////   
       
   223     
       
   224     TUid controllerUid = {0x101F5023};   // This is a real Controller UID
       
   225     // The Rubik Audio Controller
       
   226     TUid formatUid = {VIDEO_FORMAT_UID};
       
   227     
       
   228     TRAPD(err, iCamcTestClient->Test_OpenFileL(
       
   229         _L("recordQCIF.3gp"),		// File
       
   230         iUiLevelCameraHandle,								//CameraHandle
       
   231         controllerUid,					//Controller UID
       
   232         formatUid,						//Format UID
       
   233         MIME_VIDEO_FORMAT,
       
   234         NO_AUDIO_FOURCC				    //Audio Type
       
   235         ));
       
   236 
       
   237     // Function may leave with KErrNotFound, that's ok
       
   238     if (err==KErrNotFound)
       
   239         return;
       
   240     // Otherwise, the MvruoOpenComplete should return with an error
       
   241 
       
   242     assertTIntsEqualL( KErrNotFound, iCamcTestClient->WaitForCallbackWithErrors() );
       
   243     
       
   244     }
       
   245 
       
   246 void CCamcTest_1::OpenFileL_005_L()
       
   247     {
       
   248     ///////////////////////////////////////
       
   249     //   ID: CAMC_API.OPENFILEL_005
       
   250     //   Action :
       
   251     //       videoFormat ok
       
   252     //   Output : 
       
   253     //       No leave
       
   254     //   Precondition :
       
   255     //       CVideoRecorderUtility is ready
       
   256     ///////////////////////////////////////
       
   257     
       
   258     TUid controllerUid = {CONTROLLER_UID};	
       
   259     TUid formatUid = {VIDEO_FORMAT_UID};
       
   260     
       
   261     iCamcTestClient->Test_OpenFileL(
       
   262         _L("recordQCIF.3gp"),		// File
       
   263         iUiLevelCameraHandle,								//CameraHandle
       
   264         controllerUid,					//Controller UID
       
   265         formatUid,      				//Format UID
       
   266         NEW_MIME_VIDEO_FORMAT,
       
   267         NO_AUDIO_FOURCC  				//Audio Type
       
   268         );
       
   269     
       
   270     // Succeed, if it doesn't leave.
       
   271     }
       
   272 
       
   273 void CCamcTest_1::OpenFileL_006_L()
       
   274     {
       
   275     ///////////////////////////////////////
       
   276     //  ID: CAMC_API.OPENFILEL_006
       
   277     //
       
   278     //   Action :
       
   279     //      Incorrect Video format UID
       
   280     //   Output : 
       
   281     //      OpenFile = Leaves with KErrNotSupported
       
   282     //           or MvruoOpenComplete return with an error
       
   283     //   Precondition :
       
   284     //      CVideoRecorderUtility is ready
       
   285     ///////////////////////////////////////
       
   286     
       
   287     
       
   288     TUid controllerUid = {CONTROLLER_UID};	
       
   289     TUid formatUid = {0x101f5c51};  // This is an audio Format, not supported
       
   290     // by the video controller.
       
   291     
       
   292     TRAPD(err, iCamcTestClient->Test_OpenFileL(
       
   293         _L("recordQCIF.3gp"),		// File
       
   294         iUiLevelCameraHandle,								//CameraHandle
       
   295         controllerUid,					//Controller UID
       
   296         formatUid,						//Format UID
       
   297         MIME_VIDEO_FORMAT,
       
   298         NO_AUDIO_FOURCC				    //Audio Type
       
   299         ));
       
   300     // Function may leave with KErrNotSupported, that's ok
       
   301     if (err==KErrNotSupported)
       
   302         return;
       
   303     // Otherwise, the MvruoOpenComplete should return with an error
       
   304 
       
   305     assertTIntsEqualL( KErrNotSupported, iCamcTestClient->WaitForCallbackWithErrors() );
       
   306 
       
   307     }
       
   308 
       
   309 
       
   310 void CCamcTest_1::OpenFileL_008_L()
       
   311     {
       
   312     ///////////////////////////////////////
       
   313     //   ID: CAMC_API.OPENFILEL_008
       
   314     //   
       
   315     //     Action :
       
   316     //        Video Mime Type Supported
       
   317     //     Output : 
       
   318     //        OpenFile = OK
       
   319     //     Precondition :
       
   320     //        CVideoRecorderUtility is ready
       
   321     ///////////////////////////////////////
       
   322     
       
   323     TUid controllerUid = {CONTROLLER_UID};	
       
   324     TUid formatUid = {VIDEO_FORMAT_UID};
       
   325     
       
   326     iCamcTestClient->Test_OpenFileL(
       
   327         _L("recordQCIF.3gp"),		// File
       
   328         iUiLevelCameraHandle,								//CameraHandle
       
   329         controllerUid,					//Controller UID
       
   330         formatUid,      				//Format UID
       
   331         MIME_VIDEO_FORMAT,
       
   332         NO_AUDIO_FOURCC  				//Audio Type
       
   333         );
       
   334     
       
   335     // Succeed, if it doesn't leave.
       
   336     }
       
   337 
       
   338 void CCamcTest_1::OpenFileL_009_L()
       
   339     {
       
   340     ///////////////////////////////////////
       
   341     //  ID: CAMC_API.OPENFILEL_009
       
   342     //  
       
   343     //    Action :
       
   344     //       Video Mime Type = Not Present
       
   345     //    Output : 
       
   346     //       OpenFile = OK
       
   347     //    Precondition :
       
   348     //       CVideoRecorderUtility is ready
       
   349     ///////////////////////////////////////
       
   350     
       
   351     TUid controllerUid = {CONTROLLER_UID};	
       
   352     TUid formatUid = {VIDEO_FORMAT_UID};
       
   353     
       
   354     iCamcTestClient->Test_OpenFileL(
       
   355         _L("recordQCIF.3gp"),		// File
       
   356         iUiLevelCameraHandle,								//CameraHandle
       
   357         controllerUid,					//Controller UID
       
   358         formatUid      			    	//Format UID
       
   359         );
       
   360     }
       
   361 
       
   362 void CCamcTest_1::OpenFileL_010_L()
       
   363     {
       
   364     ///////////////////////////////////////
       
   365     //  ID: CAMC_API.OPENFILEL_010
       
   366     //
       
   367     //  Action :
       
   368     //    VideoMimeType Unsupported
       
   369     //  Output : 
       
   370     //    OpenFile Leaves
       
   371     //           or MvruoOpenComplete return with an error
       
   372     //  Precondition :
       
   373     //    CVideoRecorderUtility is ready
       
   374     ///////////////////////////////////////  
       
   375     
       
   376     
       
   377     TUid controllerUid = {CONTROLLER_UID};	
       
   378     TUid formatUid = {VIDEO_FORMAT_UID};
       
   379     
       
   380     TRAPD(err, iCamcTestClient->Test_OpenFileL(
       
   381         _L("recordQCIF.3gp"),		// File
       
   382         iUiLevelCameraHandle,								//CameraHandle
       
   383         controllerUid,					//Controller UID
       
   384         formatUid,						//Format UID
       
   385         _L8("video/3gpp"),              //Usupported type...
       
   386         NO_AUDIO_FOURCC				    //Audio Type
       
   387         ));
       
   388     
       
   389      // Function may leave with KErrNotSupported, that's ok
       
   390     if (err==KErrNotSupported)
       
   391         return;
       
   392     // Otherwise, the MvruoOpenComplete should return with an error
       
   393 
       
   394     assertTIntsEqualL( KErrNotSupported, iCamcTestClient->WaitForCallbackWithErrors() );
       
   395  
       
   396     }
       
   397 
       
   398 
       
   399 void CCamcTest_1::OpenFileL_011_L()
       
   400     {   
       
   401     ///////////////////////////////////////
       
   402     //  ID: CAMC_API.OPENFILEL_011
       
   403     //
       
   404     //  Action :
       
   405     //    Give a valid Camera Handler
       
   406     //  Output : 
       
   407     //    OK
       
   408     //  Precondition :
       
   409     //    Camera already used by someone else
       
   410     ///////////////////////////////////////  
       
   411     
       
   412     // Create a new Camera API implementation object, if supported
       
   413     TRAPD( err, iCamera = CCamera::New2L( static_cast<MCameraObserver2&>(*this), 0 /*index*/, 0 /*Priority*/ ) );
       
   414     if ( err )
       
   415         {
       
   416         PRINT( ( _L( "CCamcTest_1::OpenFileL_011_L CCamera::New2L return code=%d" ), err ) ); 
       
   417         // Create old Camera API implementation object.
       
   418         iCamera = CCamera::NewL( static_cast<MCameraObserver&>(*this), 0 /*Index*/ );
       
   419         }
       
   420     else 
       
   421        {
       
   422        PRINT( ( _L( "CCamcTest_1::OpenFileL_011_L() using new MCameraObserver2" )) ); 
       
   423        }
       
   424     
       
   425     
       
   426     CleanupStack::PushL(iCamera);	
       
   427     
       
   428     TUid controllerUid = {CONTROLLER_UID};	
       
   429     TUid formatUid = {VIDEO_FORMAT_UID};
       
   430     
       
   431     iCamcTestClient->Test_OpenFileL(
       
   432         _L("recordQCIF.3gp"),		// File
       
   433         iCamera->Handle(),				//CameraHandle
       
   434         controllerUid,					//Controller UID
       
   435         formatUid,						//Format UID
       
   436         MIME_VIDEO_FORMAT,
       
   437         NO_AUDIO_FOURCC				    //Audio Type
       
   438         );
       
   439     
       
   440     CleanupStack::PopAndDestroy();
       
   441     
       
   442     }
       
   443 
       
   444 void CCamcTest_1::OpenFileL_017_L()
       
   445     {
       
   446     ///////////////////////////////////////
       
   447     //   ID: CAMC_API.OPENFILEL_017
       
   448     //   Action :
       
   449     //       videoFormat ok
       
   450     //   Output : 
       
   451     //       No leave
       
   452     //   Precondition :
       
   453     //       CVideoRecorderUtility is ready
       
   454     ///////////////////////////////////////
       
   455     
       
   456     TUid controllerUid = {CONTROLLER_UID};	
       
   457     TUid formatUid = {VIDEO_FORMAT_UID_NEW};
       
   458     
       
   459     iCamcTestClient->Test_OpenFileL(
       
   460         _L("recordQCIF.3g2"),		// File
       
   461         iUiLevelCameraHandle,								//CameraHandle
       
   462         controllerUid,					//Controller UID
       
   463         formatUid,      				//Format UID
       
   464         MIME_VIDEO_FORMAT,
       
   465         NO_AUDIO_FOURCC  				//Audio Type
       
   466         );
       
   467     
       
   468     // Succeed, if it doesn't leave.
       
   469     }
       
   470 
       
   471 void CCamcTest_1::OpenFileL_018_L()
       
   472     {
       
   473     ///////////////////////////////////////
       
   474     //   ID: CAMC_API.OPENFILEL_018
       
   475     //   Action :
       
   476     //       videoFormat ok
       
   477     //   Output : 
       
   478     //       No leave
       
   479     //   Precondition :
       
   480     //       CVideoRecorderUtility is ready
       
   481     ///////////////////////////////////////
       
   482     
       
   483     TUid controllerUid = {CONTROLLER_UID};	
       
   484     TUid formatUid = {VIDEO_FORMAT_UID_NEW};
       
   485     
       
   486     iCamcTestClient->Test_OpenFileL(
       
   487         _L("recordQCIF.3g2"),		// File
       
   488         iUiLevelCameraHandle,								//CameraHandle
       
   489         controllerUid,					//Controller UID
       
   490         formatUid,      				//Format UID
       
   491         NEW_MIME_VIDEO_FORMAT,
       
   492         NO_AUDIO_FOURCC  				//Audio Type
       
   493         );
       
   494     
       
   495     // Succeed, if it doesn't leave.
       
   496     }
       
   497 
       
   498 void CCamcTest_1::OpenFileL_020_L()
       
   499     {
       
   500     ///////////////////////////////////////
       
   501     //   ID: CAMC_API.OPENFILEL_020
       
   502     //   Action :
       
   503     //       videoFormat ok
       
   504     //   Output : 
       
   505     //       No leave
       
   506     //   Precondition :
       
   507     //       CVideoRecorderUtility is ready
       
   508     ///////////////////////////////////////
       
   509     
       
   510     TUid controllerUid = {CONTROLLER_UID};	
       
   511     TUid formatUid = {VIDEO_FORMAT_UID_MP4};
       
   512     
       
   513     iCamcTestClient->Test_OpenFileL(
       
   514         _L("recordQCIF.mp4"),		// File
       
   515         iUiLevelCameraHandle,								//CameraHandle
       
   516         controllerUid,					//Controller UID
       
   517         formatUid,      				//Format UID
       
   518         MPEG4_MIME_VIDEO_FORMAT,
       
   519         ACC_AUDIO_FORMAT  				//Audio Type
       
   520         );
       
   521     
       
   522     // Succeed, if it doesn't leave.
       
   523     }
       
   524 
       
   525 void CCamcTest_1::OpenFileL_021_L()
       
   526     {
       
   527     ///////////////////////////////////////
       
   528     //   ID: CAMC_API.OPENFILEL_021
       
   529     //   Action :
       
   530     //       videoFormat Unsupported
       
   531     //   Output : 
       
   532     //    OpenFile Leaves
       
   533     //           or MvruoOpenComplete return with an error
       
   534     //   Precondition :
       
   535     //       CVideoRecorderUtility is ready
       
   536     ///////////////////////////////////////
       
   537     
       
   538     TUid controllerUid = {CONTROLLER_UID};	
       
   539     TUid formatUid = {VIDEO_FORMAT_UID_MP4};
       
   540     
       
   541     TRAPD(err, iCamcTestClient->Test_OpenFileL(
       
   542         _L("recordQCIF.mp4"),		// File
       
   543         iUiLevelCameraHandle,								//CameraHandle
       
   544         controllerUid,					//Controller UID
       
   545         formatUid,      				//Format UID
       
   546         UNSUPPORTED_VIDEO_FORMAT,
       
   547         AMR_AUDIO_FORMAT  				//Audio Type
       
   548         ));
       
   549 
       
   550     // Function may leave with KErrNotSupported, that's ok
       
   551     if (err==KErrNotSupported)
       
   552         return;
       
   553     // Otherwise, the MvruoOpenComplete should return with an error
       
   554 
       
   555     assertTIntsEqualL( KErrNotSupported, iCamcTestClient->WaitForCallbackWithErrors() );
       
   556 
       
   557     }
       
   558 
       
   559 void CCamcTest_1::OpenFileL_030_L()
       
   560     {
       
   561     ///////////////////////////////////////
       
   562     //   ID: CAMC_API.OPENFILEL_030
       
   563     //   Action :
       
   564     //       videoFormat ok
       
   565     //   Output : 
       
   566     //       No leave
       
   567     //   Precondition :
       
   568     //       CVideoRecorderUtility is ready
       
   569     ///////////////////////////////////////
       
   570     
       
   571     TUid controllerUid = {CONTROLLER_UID};  
       
   572     TUid formatUid = {VIDEO_FORMAT_UID_MP4};
       
   573     
       
   574     iCamcTestClient->Test_OpenFileL(
       
   575         _L("recordVGA.mp4"),       // File
       
   576         iUiLevelCameraHandle,                               //CameraHandle
       
   577         controllerUid,                  //Controller UID
       
   578         formatUid,                      //Format UID
       
   579         H264_MIME_BASELINE_VIDEO_FORMAT,
       
   580         ACC_AUDIO_FORMAT                //Audio Type
       
   581         );
       
   582     
       
   583     // Succeed, if it doesn't leave.
       
   584     }
       
   585 
       
   586 void CCamcTest_1::OpenFileL_031_L()
       
   587     {
       
   588     ///////////////////////////////////////
       
   589     //   ID: CAMC_API.OPENFILEL_031
       
   590     //   Action :
       
   591     //       videoFormat ok
       
   592     //   Output : 
       
   593     //       No leave
       
   594     //   Precondition :
       
   595     //       CVideoRecorderUtility is ready
       
   596     ///////////////////////////////////////
       
   597     
       
   598     TUid controllerUid = {CONTROLLER_UID};  
       
   599     TUid formatUid = {VIDEO_FORMAT_UID_MP4};
       
   600     
       
   601     iCamcTestClient->Test_OpenFileL(
       
   602         _L("recordVGA.mp4"),       // File
       
   603         iUiLevelCameraHandle,                               //CameraHandle
       
   604         controllerUid,                  //Controller UID
       
   605         formatUid,                      //Format UID
       
   606         H264_MIME_HIGH_VIDEO_FORMAT,
       
   607         ACC_AUDIO_FORMAT                //Audio Type
       
   608         );
       
   609     
       
   610     // Succeed, if it doesn't leave.
       
   611     }
       
   612 
       
   613 
       
   614 // //////////////////////////////////////////////////////////////////
       
   615 //                       OpenDescL tests
       
   616 // //////////////////////////////////////////////////////////////////
       
   617 void CCamcTest_1::OpenDesL_001_L()
       
   618     {
       
   619     ///////////////////////////////////////
       
   620     //   ID: CAMC_API.OPENDESCL_001
       
   621     //   
       
   622     //     Action :
       
   623     //        Call to openDesc
       
   624     //     Output : 
       
   625     //        OpenDesc Leaves, unsupported.
       
   626     //           or MvruoOpenComplete return with an error
       
   627     //     Precondition :
       
   628     //        CVideoRecorderUtility is ready
       
   629     /////////////////////////////////////// 
       
   630     
       
   631     TUid controllerUid = {0x101F8503};   
       
   632     TUid formatUid = {0};
       
   633     TBuf8 <100> myDescriptor;	 
       
   634     TRAPD(err,iCamcTestClient->Test_OpenDesL(
       
   635         myDescriptor,		// Descriptor
       
   636         iUiLevelCameraHandle,								//CameraHandle
       
   637         controllerUid,					//Controller UID
       
   638         formatUid,						//Format UID
       
   639         _L8("video/H263-2000"),
       
   640         KMMFFourCCCodeNULL				//Audio Type
       
   641         ));
       
   642     
       
   643     // Function may leave with KErrNotSupported, that's ok
       
   644     if (err==KErrNotSupported)
       
   645         return;
       
   646     // Otherwise, the MvruoOpenComplete should return with an error
       
   647 
       
   648     assertTIntsEqualL( KErrNotSupported, iCamcTestClient->WaitForCallbackWithErrors() );
       
   649  
       
   650     }
       
   651 
       
   652 // //////////////////////////////////////////////////////////////////
       
   653 //                       OpenUrlL tests
       
   654 // //////////////////////////////////////////////////////////////////
       
   655 void CCamcTest_1::OpenUrlL_001_L()
       
   656     {
       
   657     ///////////////////////////////////////
       
   658     //   ID: CAMC_API.OPENURLL_001
       
   659     //   
       
   660     //     Action :
       
   661     //        Call to openUrl
       
   662     //     Output : 
       
   663     //        OpenDesc Leaves, unsupported.
       
   664     //           or MvruoOpenComplete return with an error
       
   665     //  Precondition :
       
   666     //        CVideoRecorderUtility is ready
       
   667     /////////////////////////////////////// 
       
   668     
       
   669     TUid controllerUid = {0x101F8503};   
       
   670     TUid formatUid = {0};	 
       
   671     TRAPD(err,iCamcTestClient->Test_OpenUrlL(
       
   672         _L("http:\\nokia.com"),		    // Descriptor
       
   673         iUiLevelCameraHandle,								//CameraHandle
       
   674         controllerUid,					//Controller UID
       
   675         formatUid,						//Format UID
       
   676         _L8("video/H263-2000"),
       
   677         KMMFFourCCCodeNULL				//Audio Type
       
   678         ));
       
   679     
       
   680      // Function may leave with KErrNotSupported, that's ok
       
   681     if (err==KErrNotSupported)
       
   682         return;
       
   683     // Otherwise, the MvruoOpenComplete should return with an error
       
   684 
       
   685     assertTIntsEqualL( KErrNotSupported, iCamcTestClient->WaitForCallbackWithErrors() );
       
   686  
       
   687     }
       
   688 
       
   689 
       
   690 
       
   691 
       
   692 // //////////////////////////////////////////////////////////////////
       
   693 //   Dummy Camera API callback functions
       
   694 // //////////////////////////////////////////////////////////////////
       
   695 
       
   696 void CCamcTest_1::ReserveComplete(TInt aError)
       
   697     {
       
   698     RDebug::Print(_L("CCamcTest_1::ReserveComplete"));
       
   699     if (aError)
       
   700         {
       
   701         SomethingInActiveObjectIsLeaving(aError);  
       
   702         return;
       
   703         }
       
   704         
       
   705     // UI level camera is being initialized        
       
   706     if (iWaitScheduler->IsStarted())
       
   707 	    {
       
   708     	 iUiLevelCamera->PowerOn();
       
   709 	    }
       
   710     }
       
   711 
       
   712 void CCamcTest_1::PowerOnComplete(TInt aError)
       
   713     {   
       
   714     RDebug::Print(_L("CCamcTest_1::PowerOnComplete"));
       
   715     if (aError)
       
   716         {
       
   717         SomethingInActiveObjectIsLeaving(aError);  
       
   718         return;
       
   719         } 
       
   720         
       
   721     // UI level camera is being initialized
       
   722     if (iWaitScheduler->IsStarted())
       
   723     	{
       
   724     	 iWaitScheduler->AsyncStop();
       
   725 	    }        
       
   726 	}
       
   727 
       
   728 void CCamcTest_1::ViewFinderFrameReady(CFbsBitmap& /*aFrame*/)
       
   729     {
       
   730     }
       
   731 void CCamcTest_1::ImageReady(CFbsBitmap* /*aBitmap */,HBufC8* /*aData*/,TInt aError)
       
   732     {    
       
   733     TBuf<128> str;
       
   734     str.Format(_L("CCamcTest_1::ImageReady %i"), aError);
       
   735     RDebug::Print(str);   
       
   736     }
       
   737 void CCamcTest_1::FrameBufferReady(MFrameBuffer* /*aFrameBuffer*/,TInt aError )
       
   738     {
       
   739     TBuf<128> str;
       
   740     str.Format(_L("CCamcTest_1::FrameBufferReady %i"), aError);
       
   741     RDebug::Print(str);  
       
   742     }
       
   743 
       
   744 void CCamcTest_1::SomethingInActiveObjectIsLeaving (TInt aError)
       
   745     {
       
   746     // Something in the active object is leaving
       
   747     // or a fatal error has been found.  
       
   748     
       
   749     TBuf<128> str;
       
   750     str.Format(_L("CCamcTest_1::Something In Active Object is leaving %i"), aError);
       
   751     RDebug::Print(str);   
       
   752 
       
   753     // Stop the active object scheduler.
       
   754     iError=aError;
       
   755     CActiveScheduler::Stop();
       
   756     }
       
   757 
       
   758 // -----------------------------------------------------------------------------
       
   759 // CCamcTest_1::HandleEvent
       
   760 // MCameraObserver2 call-back handler
       
   761 // -----------------------------------------------------------------------------
       
   762 //
       
   763 void CCamcTest_1::HandleEvent( const TECAMEvent& aEvent)
       
   764     {
       
   765     PRINT(( _L( "CCamcTest_1::HandleEvent() entering, type=%x, err=%d" ), aEvent.iEventType.iUid, aEvent.iErrorCode ));
       
   766 
       
   767     if ( aEvent.iEventType == KUidECamEventCameraNoLongerReserved )
       
   768         {
       
   769         PRINT(( _L( "CCamcTest_1::HandleEvent() KUidECamEventCameraNoLongerReserved" ) ));
       
   770         }
       
   771     else if ( aEvent.iEventType == KUidECamEventPowerOnComplete )
       
   772         {
       
   773         PRINT(( _L( "CCamcTest_1::HandleEvent() KUidECamEventPowerOnComplete" ) ));
       
   774         PowerOnComplete( aEvent.iErrorCode );
       
   775         }
       
   776     else if ( aEvent.iEventType == KUidECamEventReserveComplete )
       
   777        {
       
   778        PRINT(( _L( "CCamcTest_1::HandleEvent() KUidECamEventReserveComplete" ) ));
       
   779        ReserveComplete( aEvent.iErrorCode );
       
   780        }
       
   781 
       
   782     PRINT(( _L( "CCamcTestClient_7::HandleEvent() returning" ) ));
       
   783     }
       
   784 
       
   785 // -----------------------------------------------------------------------------
       
   786 // CCamcTest_1::ViewFinderReady
       
   787 // MCameraObserver2 call-back handler
       
   788 // -----------------------------------------------------------------------------
       
   789 //
       
   790 void CCamcTest_1::ViewFinderReady( MCameraBuffer& aCameraBuffer, TInt aError)
       
   791     {
       
   792     PRINT(( _L( "CCamcTest_1::ViewFinderReady() NOT HANDLED err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
       
   793     CFbsBitmap *buffer = NULL;
       
   794     if ( !aError )
       
   795         {
       
   796 	    aCameraBuffer.Release();
       
   797         }
       
   798     ViewFinderFrameReady( *buffer );
       
   799     }
       
   800 
       
   801 // -----------------------------------------------------------------------------
       
   802 // CCamcTest_1::ImageBufferReady
       
   803 // MCameraObserver2 call-back handler
       
   804 // -----------------------------------------------------------------------------
       
   805 //
       
   806 void CCamcTest_1::ImageBufferReady( MCameraBuffer& aCameraBuffer, TInt aError)
       
   807     {
       
   808     PRINT(( _L( "CCamcTest_1::ImageBufferReady() BUFFER NOT HANDLED, err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
       
   809 	
       
   810     if ( !aError )
       
   811         {
       
   812 	    aCameraBuffer.Release();
       
   813         }
       
   814     ImageReady( NULL, NULL, aError );
       
   815     }
       
   816     
       
   817 // -----------------------------------------------------------------------------
       
   818 // CCamcTest_1::VideoBufferReady
       
   819 // MCameraObserver2 call-back handler
       
   820 // -----------------------------------------------------------------------------
       
   821 //
       
   822 void CCamcTest_1::VideoBufferReady( MCameraBuffer& aCameraBuffer, TInt aError)
       
   823     {
       
   824     PRINT(( _L( "CCamcTest_1::VideoBufferReady() entering, err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() ));
       
   825     MFrameBuffer* buffer = NULL;
       
   826 	
       
   827     if ( !aError )
       
   828         {
       
   829         aCameraBuffer.Release();
       
   830         }
       
   831     // Call old Camera-API observer handler
       
   832     FrameBufferReady( buffer, aError );
       
   833     
       
   834     PRINT(( _L( "CCamcTest_1::VideoBufferReady() returning" )));
       
   835     }
       
   836 
       
   837 
       
   838 //
       
   839 // An own static function to collect the test functions into one 
       
   840 // suite of tests. The framework will run the tests and free the
       
   841 // memory allocated for the test suite.
       
   842 // 
       
   843 
       
   844 MTest* CCamcTest_1::suiteL ()
       
   845     {
       
   846     // Always use NewL (Do not use NewLC) !!!
       
   847     CTestSuite *suite = CTestSuite::NewL(_L8("CCamcTest_1"));
       
   848 
       
   849     suite->addTestL(CTestCaller<CCamcTest_1>::NewL(_L8("CAMC_API.OPENFILEL_001"), &OpenFileL_001_L));
       
   850     suite->addTestL(CTestCaller<CCamcTest_1>::NewL(_L8("CAMC_API.OPENFILEL_002"), &OpenFileL_002_L));
       
   851     // OPENFILEL_003 is not a valid test case.
       
   852     suite->addTestL(CTestCaller<CCamcTest_1>::NewL(_L8("CAMC_API.OPENFILEL_004"), &OpenFileL_004_L));
       
   853     // OPENFILEL_005 is not relevent in current configuration.
       
   854       
       
   855 #ifdef __MPEG4_VIDEO_ENCODING
       
   856     suite->addTestL(CTestCaller<CCamcTest_1>::NewL(_L8("CAMC_API.OPENFILEL_005"), &OpenFileL_005_L));
       
   857 #endif
       
   858     suite->addTestL(CTestCaller<CCamcTest_1>::NewL(_L8("CAMC_API.OPENFILEL_006"), &OpenFileL_006_L));
       
   859     suite->addTestL(CTestCaller<CCamcTest_1>::NewL(_L8("CAMC_API.OPENFILEL_008"), &OpenFileL_008_L));
       
   860     suite->addTestL(CTestCaller<CCamcTest_1>::NewL(_L8("CAMC_API.OPENFILEL_009"), &OpenFileL_009_L));
       
   861     suite->addTestL(CTestCaller<CCamcTest_1>::NewL(_L8("CAMC_API.OPENFILEL_010"), &OpenFileL_010_L));
       
   862     suite->addTestL(CTestCaller<CCamcTest_1>::NewL(_L8("CAMC_API.OPENFILEL_011"), &OpenFileL_011_L));
       
   863   
       
   864     suite->addTestL(CTestCaller<CCamcTest_1>::NewL(_L8("CAMC_API.OPENFILEL_017"), &OpenFileL_017_L));
       
   865 #ifdef __MPEG4_VIDEO_ENCODING
       
   866     suite->addTestL(CTestCaller<CCamcTest_1>::NewL(_L8("CAMC_API.OPENFILEL_018"), &OpenFileL_018_L));   
       
   867 #endif
       
   868 #ifdef MP4_FILE_FORMAT_SUPPORTED
       
   869     suite->addTestL(CTestCaller<CCamcTest_1>::NewL(_L8("CAMC_API.OPENFILEL_020"), &OpenFileL_020_L));   
       
   870     suite->addTestL(CTestCaller<CCamcTest_1>::NewL(_L8("CAMC_API.OPENFILEL_021"), &OpenFileL_021_L));
       
   871     suite->addTestL(CTestCaller<CCamcTest_1>::NewL(_L8("CAMC_API.OPENFILEL_030"), &OpenFileL_030_L));   
       
   872     suite->addTestL(CTestCaller<CCamcTest_1>::NewL(_L8("CAMC_API.OPENFILEL_031"), &OpenFileL_031_L));      
       
   873 #endif
       
   874     
       
   875     suite->addTestL(CTestCaller<CCamcTest_1>::NewL(_L8("CAMC_API.OPENDESCL_001"), &OpenDesL_001_L));
       
   876     suite->addTestL(CTestCaller<CCamcTest_1>::NewL(_L8("CAMC_API.OPENURLL_001"), &OpenUrlL_001_L));
       
   877     
       
   878     
       
   879     return suite;
       
   880     }
       
   881