videofeeds/server/tsrc/VCXVodContentApiTest/inc/VCXVodContentApiTest.h
changeset 0 96612d01cf9f
equal deleted inserted replaced
-1:000000000000 0:96612d01cf9f
       
     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 the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:   ?Description*
       
    15 */
       
    16 
       
    17 
       
    18 
       
    19 #ifndef IPTVVODCONTENTAPITEST_H
       
    20 #define IPTVVODCONTENTAPITEST_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <StifLogger.h>
       
    24 #include <TestScripterInternal.h>
       
    25 #include <StifTestModule.h>
       
    26 #include "MIptvVodContentClientObserver.h"
       
    27 
       
    28 #include "CIptvVodContentClient.h"
       
    29 #include "CIptvVodContentCategoryBriefDetails.h"
       
    30 #include "CIptvVodContentContentBriefDetails.h"
       
    31 #include "CIptvVodContentContentFullDetails.h"
       
    32 #include "MIptvTestTimerObserver.h"
       
    33 #include "TIptvRssSearchQuery.h"
       
    34 
       
    35 // CONSTANTS
       
    36 const TInt KBadCharacters = 6001;
       
    37 const TInt KIptvTestSearchCategoryId = -3; // STIF does not understand real search category id which is KMaxTUint32 - 1
       
    38 
       
    39 _LIT( KBadCharactersString, "\t\\\"\a\b\f\n\r\t\v\'\?");
       
    40 // Logging path
       
    41 _LIT( KIptvVodContentApiTestLogPath, "\\logs\\testframework\\IptvVodContentApiTest\\" );
       
    42 // Log file
       
    43 _LIT( KIptvVodContentApiTestLogFile, "IptvVodContentApiTest.txt" );
       
    44 
       
    45 
       
    46 // MACROS
       
    47 
       
    48 // FUNCTION PROTOTYPES
       
    49 
       
    50 // FORWARD DECLARATIONS
       
    51 class CIptvVodContentApiTest;
       
    52 class CIptvVodContentClient;
       
    53 class CIptvTestTimer;
       
    54 class CIptvTestUtilities;
       
    55 class CIptvTestEcgUpdateInfo;
       
    56 
       
    57 // DATA TYPES
       
    58 
       
    59 // CLASS DECLARATION
       
    60 
       
    61 /**
       
    62 *  CIptvVodContentApiTest test class for STIF Test Framework TestScripter.
       
    63 *
       
    64 *  @lib
       
    65 *  @since
       
    66 */
       
    67 NONSHARABLE_CLASS(CIptvVodContentApiTest) : public CScriptBase, public MIptvVodContentClientObserver, public MIptvTestTimerObserver
       
    68     {
       
    69     public:  // Constructors and destructor
       
    70 
       
    71         /**
       
    72         * Two-phased constructor.
       
    73         */
       
    74         static CIptvVodContentApiTest* NewL( CTestModuleIf& aTestModuleIf );
       
    75 
       
    76         /**
       
    77         * Destructor.
       
    78         */
       
    79         virtual ~CIptvVodContentApiTest();
       
    80 
       
    81         /**
       
    82         * TIptvVodContentApiTestSpecialAction
       
    83         */
       
    84         enum TIptvVodContentApiTestSpecialAction
       
    85             {
       
    86             ENone,
       
    87             EIgnoreUpdateNotStarted,    // Used when testing sending multiple UpdateECG requests without waiting previous to complete.
       
    88             EBriefContentDetails,       // Writes only one line into verify file from content getters
       
    89             EUpdateSucceedsAlways,      // ECG update always signals KErrNone to script, possible errors show only in log
       
    90             };
       
    91 
       
    92     public: // New functions
       
    93 
       
    94 
       
    95     public: // Functions from base classes
       
    96 
       
    97         /**
       
    98         * From CScriptBase Runs a script line.
       
    99         * @since
       
   100         * @param aItem                  Script line containing method name and parameters
       
   101         * @return Symbian OS error code
       
   102         */
       
   103         virtual TInt RunMethodL( CStifItemParser& aItem );
       
   104 
       
   105         /**
       
   106         * From MIptvVodContentClientObserver Messages from EPG manager are handled here. Messages are defined in CIptvUtil.h
       
   107         * @since
       
   108         * @param aMsg                   Message
       
   109         * @param aInfo                  Info
       
   110         * @param aServiceId             Service id.
       
   111         */
       
   112         virtual void HandleEpgManagerMsgL(TInt aMsg, TInt aInfo, TIptvServiceId aServiceId);
       
   113 
       
   114         /**
       
   115         * From MIptvTestTimerObserver Asynchronous callback observer function signaling application that timer has elapsed.
       
   116         * @since
       
   117         * @param aError                 Error code.
       
   118         */
       
   119         virtual void TimerComplete(TInt aTimerId, TInt aError);
       
   120 
       
   121     protected:  // New functions
       
   122 
       
   123     protected:  // Functions from base classes
       
   124 
       
   125     private:
       
   126 
       
   127         /**
       
   128         * C++ default constructor.
       
   129         */
       
   130         CIptvVodContentApiTest( CTestModuleIf& aTestModuleIf );
       
   131 
       
   132         /**
       
   133         * By default Symbian 2nd phase constructor is private.
       
   134         */
       
   135         void ConstructL();
       
   136 
       
   137         /**
       
   138         * Frees all resources allocated from test methods.
       
   139         * @since
       
   140         */
       
   141         void Delete();
       
   142 
       
   143         /**
       
   144         * Test methods are listed below.
       
   145         */
       
   146 
       
   147         /**
       
   148         * Enables writing the content data etc. into file which can be used for verifying the test case result.
       
   149         * @since
       
   150         * @param aItem                  Contains the parameters for the method.
       
   151         * @return Symbian OS error code.
       
   152         */
       
   153         virtual TInt EnableVerifying( CStifItemParser& aItem );
       
   154 
       
   155         /**
       
   156         * Compares the current verifying file against file which has been verified by the user.
       
   157         * @since
       
   158         * @param aItem                  Contains the parameters for the method.
       
   159         * @return Symbian OS error code.
       
   160         */
       
   161         virtual TInt Verify( CStifItemParser& aItem );
       
   162 
       
   163         /**
       
   164         * This is used to perform more rare and special actions. See TIptvVodContentApiTestSpecialAction.
       
   165         * @since
       
   166         * @param aItem                  Contains the parameters for the method.
       
   167         * @return Symbian OS error code.
       
   168         */
       
   169         virtual TInt SetSpecialAction( CStifItemParser& aItem );
       
   170 
       
   171         /**
       
   172         * Creates and initializes the test module.
       
   173         * @since
       
   174         * @param aItem                  Contains the parameters for the method.
       
   175         * @return Symbian OS error code.
       
   176         */
       
   177         virtual TInt CreateL( CStifItemParser& aItem );
       
   178 
       
   179         /**
       
   180         * Deletes all Video Center EPG data.
       
   181         * @since
       
   182         * @param aItem                  Contains the parameters for the method.
       
   183         * @return Symbian OS error code.
       
   184         */
       
   185         virtual TInt DeleteEpgDb( CStifItemParser& aItem );
       
   186 
       
   187         /**
       
   188         * Tests CIptvVodContentClient::GetEcgListL.
       
   189         * @since
       
   190         * @param aItem                  Contains the parameters for the method.
       
   191         * @return Symbian OS error code.
       
   192         */
       
   193         virtual TInt GetEcgList( CStifItemParser& aItem );
       
   194 
       
   195         /**
       
   196         * Tests CIptvVodContentClient::GetEcgCategoryListL.
       
   197         * @since
       
   198         * @param aItem                  Contains the parameters for the method.
       
   199         * @return Symbian OS error code.
       
   200         */
       
   201         virtual TInt EcgCategoryList( CStifItemParser& aItem );
       
   202 
       
   203         /**
       
   204         * Tests CIptvVodContentClient::GetEcgAllListL.
       
   205         * @since
       
   206         * @param aItem                  Contains the parameters for the method.
       
   207         * @return Symbian OS error code.
       
   208         */
       
   209         virtual TInt EcgEcgAllList( CStifItemParser& aItem );
       
   210 
       
   211         /**
       
   212         * CIptvVodContentClient::GetCategoryDetailsL
       
   213         * @since
       
   214         * @param aItem                  Contains the parameters for the method.
       
   215         * @return Symbian OS error code.
       
   216         */
       
   217         virtual TInt CategoryDetails( CStifItemParser& aItem );
       
   218 
       
   219         /**
       
   220         * Calls CIptvVodContentClient::GetEcgCategoryListL and verifies that CIptvVodContentClient::GetParentCategoryL for
       
   221         * all returned categories returns the correct category Id.
       
   222         * @since
       
   223         * @param aItem                  Contains the parameters for the method.
       
   224         * @return Symbian OS error code.
       
   225         */
       
   226         virtual TInt ParentCategory( CStifItemParser& aItem );
       
   227 
       
   228         /**
       
   229         * Calls GetContentDetailsL.
       
   230         * @since
       
   231         * @param aItem                  Contains the parameters for the method.
       
   232         * @return Symbian OS error code.
       
   233         */
       
   234         virtual TInt ContentDetailsList( CStifItemParser& aItem );
       
   235 
       
   236         /**
       
   237         * Prints CIptvVodContentCategoryBriefDetails of defined category and CIptvVodContentContentBriefDetails and CIptvVodContentContentFullDetails
       
   238         * for all the content of the category.
       
   239         * @since
       
   240         * @param aItem                  Contains the parameters for the method.
       
   241         * @return Symbian OS error code.
       
   242         */
       
   243         virtual TInt VerifyAllCategoryContentL ( CStifItemParser& aItem );
       
   244 
       
   245         /**
       
   246         * Starts asyncronous ECG update by calling CIptvVodContentClient::UpdateEcgL.
       
   247         * @since
       
   248         * @param aItem                  Contains the parameters for the method.
       
   249         * @return Symbian OS error code.
       
   250         */
       
   251         virtual TInt UpdateEcg( CStifItemParser& aItem );
       
   252 
       
   253         /**
       
   254         * Sets the timeout in seconds for the case.
       
   255         * @since
       
   256         * @param aItem                  Contains the parameters for the method.
       
   257         * @return Symbian OS error code.
       
   258         */
       
   259         virtual TInt SetTestCaseTimeOut( CStifItemParser& aItem );
       
   260 
       
   261         /**
       
   262         * Gets id for the defined IAP name and calls CIptvVodContentClient::SetIapL.
       
   263         * @since
       
   264         * @param aItem                  Contains the parameters for the method.
       
   265         * @return Symbian OS error code.
       
   266         */
       
   267         virtual TInt SelectIapL( CStifItemParser& aItem );
       
   268 
       
   269         /**
       
   270         * Calls CIptvVodContentClient::GetUpdateTimeL.
       
   271         * @since
       
   272         * @param aItem                  Contains the parameters for the method.
       
   273         * @return Symbian OS error code.
       
   274         */
       
   275         virtual TInt GetUpdateTimeL( CStifItemParser& aItem );
       
   276 
       
   277         /**
       
   278         * Disables thumbnail downloading for Video Center using cenrep.
       
   279         * @since
       
   280         * @param aItem                  Contains the parameters for the method.
       
   281         * @return Symbian OS error code.
       
   282         */
       
   283         virtual TInt DisableThumbnails( CStifItemParser& aItem );
       
   284 
       
   285         /**
       
   286         * Enables thumbnail downloading for Video Center using cenrep.
       
   287         * @since
       
   288         * @param aItem                  Contains the parameters for the method.
       
   289         * @return Symbian OS error code.
       
   290         */
       
   291         virtual TInt EnableThumbnails( CStifItemParser& aItem );
       
   292 
       
   293         /**
       
   294         * Sets Video Center parental control age in the cenrep.
       
   295         * @since
       
   296         * @param aItem                  Contains the parameters for the method.
       
   297         * @return Symbian OS error code.
       
   298         */
       
   299         virtual TInt SetParentalControlAge( CStifItemParser& aItem );
       
   300 
       
   301         /**
       
   302         * Starts asynchronous search operation by calling CIptvVodContentClient::Search.
       
   303         * @since
       
   304         * @param aItem                  Contains the parameters for the method.
       
   305         * @return Symbian OS error code.
       
   306         */
       
   307         virtual TInt Search( CStifItemParser& aItem );
       
   308 
       
   309         /**
       
   310         * Calls CIptvVodContentClient::CancelSearch.
       
   311         * @since
       
   312         * @param aItem                  Contains the parameters for the method.
       
   313         * @return Symbian OS error code.
       
   314         */
       
   315         virtual TInt CancelSearch( CStifItemParser& aItem );
       
   316 
       
   317         /**
       
   318         * Calls CIptvVodContentClient::CancelUpdate.
       
   319         * @since
       
   320         * @param aItem                  No params.
       
   321         * @return Symbian OS error code.
       
   322         */
       
   323         virtual TInt CancelUpdate( CStifItemParser& aItem );
       
   324         
       
   325         /**
       
   326         * Calls CIptvVodContentClient::SetLastPositionL.
       
   327         * @since
       
   328         * @param aItem                  Contains the parameters for the method.
       
   329         * @return Symbian OS error code.
       
   330         */
       
   331         virtual TInt SetLastPosition( CStifItemParser& aItem );
       
   332         
       
   333         /**
       
   334         * Calls CIptvVodContentClient::UpdateAvailableL.
       
   335         * @since
       
   336         * @param aItem TBool, ETrue if there's need for update.
       
   337         * @return Symbian OS error code.
       
   338         */
       
   339         virtual TInt UpdateAvailableL( CStifItemParser& aItem );
       
   340         
       
   341         /**
       
   342         * Verifies category count.
       
   343         * @since
       
   344         * @param aCount                  Expected count of categories. 
       
   345         * @return Symbian OS error code.
       
   346         */
       
   347         virtual TInt CategoryCountL( CStifItemParser& aItem );
       
   348         
       
   349         /**
       
   350         * Verifies content count.
       
   351         * @since
       
   352         * @param aCount                  Expected count of content. 
       
   353         * @return Symbian OS error code.
       
   354         */
       
   355         virtual TInt ContentCountL( CStifItemParser& aItem );        
       
   356         
       
   357         /**
       
   358         * Deletes the resources used by the test module.
       
   359         * @since
       
   360         * @param aItem                  Contains the parameters for the method.
       
   361         * @return Symbian OS error code.
       
   362         */
       
   363         virtual TInt Destroy( CStifItemParser& aItem );
       
   364 
       
   365         /**
       
   366         * Sets message which will be signaled to the test scripter.
       
   367         * @since
       
   368         * @param aItem                  Contains the parameters for the method.
       
   369         * @return Symbian OS error code.
       
   370         */
       
   371         virtual TInt SetMsgWhichToSignal( CStifItemParser& aItem );
       
   372 
       
   373         /**
       
   374         * Sets message which will be ignored
       
   375         * @since
       
   376         * @param aItem                  Contains the parameters for the method.
       
   377         * @return Symbian OS error code.
       
   378         */
       
   379         virtual TInt IgnoreMsg( CStifItemParser& aItem );
       
   380 
       
   381         /**
       
   382         * Other methods
       
   383         */
       
   384 
       
   385         /**
       
   386         * Creates the instance of CIptvVodContentClient for defined service and initializes other member variables.
       
   387         * @since
       
   388         * @param aServiceName           Service name or order number in services database.
       
   389         * @return Symbian OS error code.
       
   390         */
       
   391         TInt CreateInstance(TDesC& aServiceName);
       
   392 
       
   393         /**
       
   394         * Deallocates the resources.
       
   395         */
       
   396         void DeAllocateResources();
       
   397 
       
   398         /**
       
   399         * TestGetEcgList
       
   400         */
       
   401         TInt TestGetEcgList(TIptvCategoryId aCategoryId, TDesC& aSearchString, TUint32 aFrom, TUint32 aAmount);
       
   402 
       
   403         /**
       
   404         * TestGetEcgCategoryList
       
   405         */
       
   406         TInt TestGetEcgCategoryList(TIptvCategoryId aParentCategoryId);
       
   407 
       
   408         /**
       
   409         * TestGetEcgAllList
       
   410         */
       
   411         TInt TestGetEcgAllList(TDesC& aSearchString, TUint32 aFrom, TUint32 aAmount);
       
   412 
       
   413         /**
       
   414         * TestGetEcgCategoryDetails
       
   415         */
       
   416         TInt TestGetEcgCategoryDetails(TIptvCategoryId aCategoryId);
       
   417 
       
   418         /**
       
   419         * TestGetParentCategory
       
   420         */
       
   421         TInt TestGetParentCategory(TIptvCategoryId aParentCategoryId);
       
   422 
       
   423         /**
       
   424         * TestGetContentDetailsList
       
   425         */
       
   426         TInt TestGetContentDetailsList(TIptvContentId aContentId);
       
   427 
       
   428         /**
       
   429         * TestUpdateEcg
       
   430         */
       
   431         TInt TestUpdateEcg( );
       
   432 
       
   433         /**
       
   434         * TestGetUpdateTimeL
       
   435         */
       
   436         TInt TestGetUpdateTimeL( TTime& aTime );
       
   437 
       
   438         /**
       
   439         * TestVerifyAllCategoryContentL
       
   440         */
       
   441         TInt TestVerifyAllCategoryContentL(TIptvCategoryId aParentCategoryId);
       
   442 
       
   443         /**
       
   444         * Test category count.
       
   445         * @since
       
   446         * @param aCount                  Expected count of categories. 
       
   447         * @return Symbian OS error code.
       
   448         */
       
   449         virtual TInt TestCategoryCountL( TInt aExpectedCount );
       
   450         
       
   451         /**
       
   452         * Test content count.
       
   453         * @since
       
   454         * @param aCount                  Expected count of content. 
       
   455         * @return Symbian OS error code.
       
   456         */
       
   457         virtual TInt TestContentCountL( TInt aExpectedCount );  
       
   458         
       
   459         /**
       
   460         * PrintVodContentBriefDetails
       
   461         */
       
   462         void PrintVodContentBriefDetails(CIptvVodContentContentBriefDetails& aDetails);
       
   463 
       
   464         /**
       
   465         * PrintVodContentFullDetails
       
   466         */
       
   467         void PrintVodContentFullDetails(TUint32 aContentId, CIptvVodContentContentFullDetails& aDetails);
       
   468 
       
   469         /**
       
   470         * PrintVodContentCategoryBriefDetails
       
   471         */
       
   472         void PrintVodContentCategoryBriefDetails(CIptvVodContentCategoryBriefDetails& aDetails);
       
   473 
       
   474         /**
       
   475         * WriteVerifyVodContentBriefDetails
       
   476         */
       
   477         void WriteVerifyVodContentBriefDetails(CIptvVodContentContentBriefDetails& aDetails);
       
   478 
       
   479         /**
       
   480         * WriteVerifyVodContentFullDetails
       
   481         */
       
   482         void WriteVerifyVodContentFullDetails(TUint32 aContentId, CIptvVodContentContentFullDetails& aDetails);
       
   483 
       
   484         /**
       
   485         * WriteVerifyVodContentCategoryBriefDetails
       
   486         */
       
   487         void WriteVerifyVodContentCategoryBriefDetails(CIptvVodContentCategoryBriefDetails& aDetails);
       
   488 
       
   489         /**
       
   490         * WriteVerifyCAList
       
   491         */
       
   492         void WriteVerifyCAList(RPointerArray<CIptvMediaContent>& aCAList);
       
   493 
       
   494         /**
       
   495         * SetIap
       
   496         */
       
   497         TInt SetIap(const TUint32 aIap);
       
   498 
       
   499         /**
       
   500         * AsyncCompleted
       
   501         */
       
   502         void AsyncCompleted(TInt aError);
       
   503 
       
   504         /**
       
   505         * GetDateInts
       
   506         */
       
   507         void GetDateInts(TDateTime aDateTime, TInt& year, TInt& month, TInt& day, TInt& hour, TInt& minute, TInt& second );
       
   508 
       
   509         /**
       
   510         * RemoveServiceNumberFromThumbnailPathL
       
   511         */
       
   512         void RemoveServiceNumberFromThumbnailPathL(TDes16& aThumbnailPath);
       
   513 
       
   514     public:     // Data
       
   515 
       
   516     protected:  // Data
       
   517 
       
   518     private:    // Data
       
   519 
       
   520         // Instance of VodContentClient
       
   521         CIptvVodContentClient*   iIptvVodContenClient;
       
   522 
       
   523         //Update log
       
   524         CIptvTestEcgUpdateInfo* iIptvTestEcgUpdateInfo;
       
   525 
       
   526         // ID of current service
       
   527         TIptvServiceId iServiceId;
       
   528 
       
   529         // ID of used IAP
       
   530         TUint32 iIapId;
       
   531 
       
   532         // Instance of IptvTestTimer
       
   533         CIptvTestTimer*          iIptvTestTimer;
       
   534 
       
   535         //Instance of IptvTestUtility class
       
   536         CIptvTestUtilities* iIptvTestUtilities;
       
   537 
       
   538         // Current CaseID
       
   539         TBuf<32> iCaseId;
       
   540 
       
   541         // Current SpecialAction
       
   542         TIptvVodContentApiTestSpecialAction iSpecialAction;
       
   543 
       
   544         // Was last ECG update successfull
       
   545         TBool iEcgUpdateSuccesfull;
       
   546 
       
   547         // Timeout in minutes
       
   548         TInt iTimeoutMinutes;
       
   549 
       
   550         // The expected count of downloaded thumbnails.
       
   551         TInt iExpectedThumbnailCount;
       
   552 
       
   553         // Current count of downloaded thumbnails
       
   554         TInt iThumbnailCount;
       
   555 
       
   556         // The last update time for service when update started.
       
   557         TTime iLastUpdateTimeFromService;
       
   558 
       
   559         // EPG message which will be signaled to the test scripter.
       
   560         TInt iMsgWhichToSignal;
       
   561 
       
   562         // Next EPG msg which matches with this is ignored.
       
   563         TInt iIgnoreMsg;
       
   564 
       
   565         // Retries to do if update fails.
       
   566         TInt iRetryCount;
       
   567 
       
   568         // String used in search
       
   569         TIptvRssSearchQuery iSearchQuery;
       
   570     };
       
   571 
       
   572 #endif      // IPTVVODCONTENTAPITEST_H
       
   573 
       
   574 // End of File