videoutils_plat/videoconnutility_api/tsrc/VCXTestUtilModule/inc/IptvTestUtilModule.h
changeset 41 d88d70d98bbc
parent 34 814ba97beeb9
child 46 3bc36dbd63c2
equal deleted inserted replaced
34:814ba97beeb9 41:d88d70d98bbc
     1 /*
       
     2 * Copyright (c) 2008 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: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef IPTVTESTUTILMODULE_H
       
    20 #define IPTVTESTUTILMODULE_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <f32file.h>
       
    24 #include <BAUTILS.H>
       
    25 
       
    26 #include <StifLogger.h>
       
    27 #include <TestScripterInternal.h>
       
    28 #include <StifTestModule.h>
       
    29 
       
    30 #include "MTestUtilConnectionObserver.h"
       
    31 #include "MTestUtilDownloadObserver.h"
       
    32 #include "MIptvTestTimerObserver.h"
       
    33 
       
    34 // CONSTANTS
       
    35 const TInt KConnectionTimerId = 500;
       
    36 
       
    37 // Logging path
       
    38 _LIT( KIptvTestUtilModuleLogPath, "\\logs\\testframework\\IptvTestUtilModule\\" );
       
    39 // Log file
       
    40 _LIT( KIptvTestUtilModuleLogFile, "IptvTestUtilModule.txt" );
       
    41 
       
    42 // MACROS
       
    43 
       
    44 // FUNCTION PROTOTYPES
       
    45 //?type ?function_name(?arg_list);
       
    46 
       
    47 // FORWARD DECLARATIONS
       
    48 //class ?FORWARD_CLASSNAME;
       
    49 class CIptvTestUtilModule;
       
    50 class CTestUtilConnection;
       
    51 class CTestUtilConnectionWaiter;
       
    52 class CIptvTestDownloadManager;
       
    53 class CIptvTestTimer;
       
    54 class CIptvTestMobilecrashWatcher;
       
    55 class CIptvTestUtilALR;
       
    56 class CVCXTestCommon;
       
    57 class CZipFile;
       
    58 
       
    59 // DATA TYPES
       
    60 //enum ?declaration
       
    61 //typedef ?declaration
       
    62 //extern ?data_type;
       
    63 
       
    64 // CLASS DECLARATION
       
    65 
       
    66 /**
       
    67 *  CIptvTestUtilModule test class for STIF Test Framework TestScripter.
       
    68 *  This class should have no depencies to Video Center code.
       
    69 *
       
    70 *  @lib ?library
       
    71 *  @since ?Series60_version
       
    72 */
       
    73 NONSHARABLE_CLASS(CIptvTestUtilModule) : public CScriptBase, public MTestUtilConnectionObserver, public MTestUtilDownloadObserver, public MIptvTestTimerObserver
       
    74     {
       
    75     public:  // Constructors and destructor
       
    76 
       
    77         /**
       
    78         * Two-phased constructor.
       
    79         */
       
    80         static CIptvTestUtilModule* NewL( CTestModuleIf& aTestModuleIf );
       
    81 
       
    82         /**
       
    83         * Destructor.
       
    84         */
       
    85         virtual ~CIptvTestUtilModule();
       
    86 
       
    87     public: // New functions
       
    88 
       
    89         /**
       
    90         * ?member_description.
       
    91         * @since ?Series60_version
       
    92         * @param ?arg1 ?description
       
    93         * @return ?description
       
    94         */
       
    95         //?type ?member_function( ?type ?arg1 );
       
    96 
       
    97     public: // Functions from base classes
       
    98 
       
    99         /**
       
   100         * From CScriptBase Runs a script line.
       
   101         * @since ?Series60_version
       
   102         * @param aItem Script line containing method name and parameters
       
   103         * @return Symbian OS error code
       
   104         */
       
   105         virtual TInt RunMethodL( CStifItemParser& aItem );
       
   106 
       
   107     	void ConnectionCreated();
       
   108     	void ConnectionClosed();
       
   109     	void ConnectionFailed();
       
   110 	    void ConnectionAlreadyExists();
       
   111 	    void ConnectionTimeout();
       
   112 
       
   113 	    void DownloadFinished(TInt aError);
       
   114 
       
   115 	    void TimerComplete(TInt aTimerId, TInt aError);
       
   116 
       
   117     protected:  // New functions
       
   118 
       
   119         /**
       
   120         * ?member_description.
       
   121         * @since ?Series60_version
       
   122         * @param ?arg1 ?description
       
   123         * @return ?description
       
   124         */
       
   125         //?type ?member_function( ?type ?arg1 );
       
   126 
       
   127     protected:  // Functions from base classes
       
   128 
       
   129     private:
       
   130 
       
   131         /**
       
   132         * C++ default constructor.
       
   133         */
       
   134         CIptvTestUtilModule( CTestModuleIf& aTestModuleIf );
       
   135 
       
   136         /**
       
   137         * By default Symbian 2nd phase constructor is private.
       
   138         */
       
   139         void ConstructL();
       
   140 
       
   141         // Prohibit copy constructor if not deriving from CBase.
       
   142         // ?classname( const ?classname& );
       
   143         // Prohibit assigment operator if not deriving from CBase.
       
   144         // ?classname& operator=( const ?classname& );
       
   145 
       
   146         /**
       
   147         * Frees all resources allocated from test methods.
       
   148         * @since ?Series60_version
       
   149         */
       
   150         void Delete();
       
   151 
       
   152         /**
       
   153         * Test methods are listed below.
       
   154         */
       
   155 
       
   156         /**
       
   157         * Creates MobilecrashesWatcher
       
   158         * @return Symbian OS error code.
       
   159         */
       
   160         virtual TInt CreateMobilecrashWatcherL( CStifItemParser& aItem );
       
   161 
       
   162         /**
       
   163         * Checks if there's any new mobilecrashes since the watcher was created.
       
   164         * @param aItem Script line containing IptvTest Case ID. Required.
       
   165         * @return KErrNone if there's no new mobilecrash files, else KErrAbort.
       
   166         */
       
   167         virtual TInt CheckMobilecrashesL( CStifItemParser& aItem );
       
   168 
       
   169         /**
       
   170         * Checks if there's any mobilecrash files.
       
   171         * @param aItem Script line containing IptvTest Case ID. Required.
       
   172         * @return KErrNone if there's no mobilecrash files, else KErrAbort.
       
   173         */
       
   174         virtual TInt CheckMobilecrashesZeroToleranceL( CStifItemParser& aItem );
       
   175 
       
   176         /**
       
   177         * Writes line ">>> Case start: <parameters>" using Iptv logging methods.
       
   178         * @param aItem Script line containing IptvTest Case ID. Required.
       
   179         * @return Symbian OS error code.
       
   180         */
       
   181         virtual TInt IptvLogCaseStart( CStifItemParser& aItem );
       
   182 
       
   183         /**
       
   184         * Writes line "<<< Case end." using Iptv logging methods.
       
   185         * @param
       
   186         * @return Symbian OS error code.
       
   187         */
       
   188         virtual TInt IptvLogCaseEnd( CStifItemParser& aItem );
       
   189 
       
   190         /**
       
   191         * Writes line using Iptv logging methods.
       
   192         * @param aItem Text which is written into the log. Not required.
       
   193         * @return Symbian OS error code.
       
   194         */
       
   195         virtual TInt IptvLogWrite( CStifItemParser& aItem );
       
   196 
       
   197         /**
       
   198         * Opens a socket to a specified IAP.
       
   199         * ASYNC.
       
   200         * @param aItem IAP name.
       
   201         * @return Symbian OS error code.
       
   202         */
       
   203         virtual TInt ConnectL( CStifItemParser& aItem );
       
   204 
       
   205         /**
       
   206         * Attached to open connection specified by IAP.
       
   207         * SYNC.
       
   208         * @param aItem IAP name.
       
   209         * @return Symbian OS error code.
       
   210         */
       
   211         virtual TInt AttachL( CStifItemParser& aItem );
       
   212 
       
   213         /**
       
   214         * Disconnects from the currently open connection.
       
   215         * SYNC.
       
   216         * @param none
       
   217         * @return Symbian OS error code.
       
   218         */
       
   219         virtual TInt DisconnectL( CStifItemParser& aItem );
       
   220 
       
   221         /**
       
   222         * Terminates the currently open connection, i.e. closes it immediately.
       
   223         * The connection can be opened by this module or other application.
       
   224         * SYNC.
       
   225         * @param none
       
   226         * @return Symbian OS error code.
       
   227         */
       
   228         virtual TInt TerminateConnectionL( CStifItemParser& aItem );
       
   229 
       
   230         /**
       
   231         * Starts observing the connection until it's activated, Signals test script.
       
   232         * @param IAP name
       
   233         * @return Symbian OS error code.
       
   234         */
       
   235 		virtual TInt WaitForConnectionActivityL( CStifItemParser& aItem );
       
   236 
       
   237         /**
       
   238         * Starts observing the connection until it's closed, Signals test script.
       
   239         * @param IAP name
       
   240         * @return Symbian OS error code.
       
   241         */
       
   242 		virtual TInt WaitUntilConnectionIsClosed(CStifItemParser& aItem );
       
   243 
       
   244 		/**
       
   245         * Start a download.
       
   246         */
       
   247 		virtual TInt DownloadL( CStifItemParser& aItem );
       
   248 
       
   249         /**
       
   250         * Stop downloads.
       
   251         */
       
   252 		virtual TInt StopDownloadsL( CStifItemParser& aItem );
       
   253 
       
   254         /**
       
   255         * Advance system time for 1 second.
       
   256         */
       
   257 		virtual TInt AdvanceSystemTime1Second( CStifItemParser& aItem );
       
   258 
       
   259         /**
       
   260         * Advance system time for X seconds.
       
   261         */
       
   262         virtual TInt AdvanceSystemTimeSeconds( CStifItemParser& aItem );
       
   263 
       
   264         /**
       
   265         * Advance system time for X minute.
       
   266         */
       
   267         virtual TInt AdvanceSystemTimeMinutes( CStifItemParser& aItem );
       
   268 
       
   269         /**
       
   270         * Advance system time for X hour.
       
   271         */
       
   272         virtual TInt AdvanceSystemTimeHours( CStifItemParser& aItem );
       
   273 
       
   274         /**
       
   275         * Advance system time for specified number of days.
       
   276         */
       
   277 		virtual TInt AdvanceSystemTimeDays(CStifItemParser& aItem );
       
   278 
       
   279         /**
       
   280         * Set the system time.
       
   281         * Must be in format YYYYMMDD:HHMMSS.MMMMMM (First day / month is 0)
       
   282         */
       
   283 		virtual TInt SetSystemTime(CStifItemParser& aItem );
       
   284 
       
   285         /**
       
   286         * Set the system time within the ongoing day.
       
   287         *
       
   288         */
       
   289 		virtual TInt SetSystemTimeToday(CStifItemParser& aItem );
       
   290 
       
   291         /**
       
   292         * Set the system timezone.
       
   293         */
       
   294 		virtual TInt SetTimeZone(CStifItemParser& aItem );
       
   295 
       
   296         /**
       
   297         * Sets the default iap id value to cenrep.
       
   298         */
       
   299 		virtual TInt SetDefaultIapCenRepL(CStifItemParser& aItem );
       
   300 		
       
   301         /**
       
   302         * Removes the used destination cenrep value.
       
   303         */
       
   304         virtual TInt DeleteUsedDestinationCenRepL( CStifItemParser& aItem );
       
   305 
       
   306         /**
       
   307         * Set the used destination cenrep value for Video Center & IPTV_Engine.
       
   308         */
       
   309         virtual TInt SetUsedDestinationL( CStifItemParser& aItem );
       
   310 
       
   311         /**
       
   312         * Create new destination (SNAP)
       
   313         */
       
   314         virtual TInt CreateDestinationL( CStifItemParser& aItem );
       
   315 
       
   316         /**
       
   317         * Delete a destination (SNAP)
       
   318         */
       
   319         virtual TInt DeleteDestinationL( CStifItemParser& aItem );
       
   320 
       
   321         /**
       
   322         * Copy existing connection method to defined SNAP.
       
   323         */
       
   324         virtual TInt CopyMethodL( CStifItemParser& aItem );
       
   325 
       
   326         /**
       
   327         * Delete a connection method.
       
   328         */
       
   329         virtual TInt DeleteMethodL( CStifItemParser& aItem );
       
   330 
       
   331         /**
       
   332         * Set priority for a connection method.
       
   333         */
       
   334         virtual TInt SetMethodPriorityL( CStifItemParser& aItem );
       
   335 
       
   336         /**
       
   337         * Delete the destination when classes destructor is run.
       
   338         */
       
   339         virtual TInt DeleteDestinationAfterwardsL( CStifItemParser& aItem );
       
   340 
       
   341         /**
       
   342         * Sets string attribute for connection method.
       
   343         */
       
   344         virtual TInt SetConnectionMethodStringAttributeL( CStifItemParser& aItem );
       
   345 
       
   346         /**
       
   347         * Sets integer attribute for connection method.
       
   348         */
       
   349         virtual TInt SetConnectionMethodIntAttributeL( CStifItemParser& aItem );
       
   350 
       
   351         /**
       
   352         * Sets boolean attribute for connection method.
       
   353         */
       
   354         virtual TInt SetConnectionMethodBoolAttributeL( CStifItemParser& aItem );
       
   355 
       
   356         /**
       
   357          * CreateFileL
       
   358          */
       
   359         virtual TInt CreateFileL( CStifItemParser& aItem );
       
   360 
       
   361         /**
       
   362          * DeleteFileL
       
   363          */
       
   364         virtual TInt DeleteFileL( CStifItemParser& aItem );
       
   365 
       
   366         /*
       
   367          * CreateFolderL
       
   368          */
       
   369         virtual TInt CreateFolderL( CStifItemParser& aItem );
       
   370 
       
   371         /*
       
   372          * DeleteFolderL
       
   373          */
       
   374         virtual TInt DeleteFolderL( CStifItemParser& aItem );
       
   375 
       
   376         /*
       
   377          * LockFileL
       
   378          */
       
   379         virtual TInt LockFileL( CStifItemParser& aItem );
       
   380 
       
   381         /*
       
   382          * UnlockFileL
       
   383          */
       
   384         virtual TInt UnlockFileL( CStifItemParser& aItem );
       
   385 
       
   386         /*
       
   387          * ExtractFile
       
   388          */
       
   389         virtual TInt ExtractFileL( CStifItemParser& aItem );
       
   390 
       
   391         /*
       
   392          * FileExistsInZip
       
   393          */
       
   394         virtual TBool FileExistsInZip( CZipFile* aZipFile, const TDesC& aFileName );
       
   395 
       
   396         /**
       
   397         * Prints IAPs from commdb to debug output.
       
   398         */
       
   399 		virtual void PrintIAPs();
       
   400 
       
   401         /**
       
   402         * Gets IAp by name.
       
   403         */
       
   404         virtual void GetIap(TDesC& aIapName, TUint32& aIapId);
       
   405 
       
   406         /**
       
   407         * Sets free space on drive.
       
   408         * @param aDriveLetter
       
   409         * @param aDesiredSpace, bytes
       
   410         */
       
   411         virtual TInt SetDriveFreeSpaceL( CStifItemParser& aItem );
       
   412 
       
   413     public:     // Data
       
   414         // ?one_line_short_description_of_data
       
   415         //?data_declaration;
       
   416 
       
   417     protected:  // Data
       
   418         // ?one_line_short_description_of_data
       
   419         //?data_declaration;
       
   420 
       
   421     private:    // Data
       
   422 
       
   423         // ?one_line_short_description_of_data
       
   424         //?data_declaration;
       
   425 
       
   426         // Reserved pointer for future extension
       
   427         //TAny* iReserved;
       
   428 
       
   429 		CTestUtilConnection* iConnect;
       
   430 		CTestUtilConnectionWaiter* iConnectionWaiter;
       
   431 		TInt iRetryCount;
       
   432 		CIptvTestDownloadManager* iDownload;
       
   433 		CIptvTestTimer* iTimer;
       
   434 		CIptvTestMobilecrashWatcher* iIptvTestMobilecrashWatcher;
       
   435 		HBufC* iObservedServicePath;
       
   436 		RPointerArray<HBufC> iObservedFiles;
       
   437 		RArray<TTime> iFileModifiedDates;
       
   438 
       
   439 		RPointerArray<HBufC> iToBeDeletedDestinations;
       
   440 
       
   441         CIptvTestUtilALR* iTestUtilALR;
       
   442         RFs iFs;
       
   443         RFile iLockedFile;
       
   444         TBool iFileIsLocked;
       
   445 
       
   446         TBool iCaseStarted;
       
   447 
       
   448         CVCXTestCommon* iTestCommon;
       
   449 
       
   450         TBool iDummyFilesCreated;
       
   451     };
       
   452 
       
   453 #endif      // IPTVTESTUTILMODULE_H
       
   454 
       
   455 // End of File