mds_pub/content_listing_framework_api/tsrc/inc/ContentListingFrameworkTest.h
branchRCL_3
changeset 8 50de4d668bb6
equal deleted inserted replaced
7:3cebc1a84278 8:50de4d668bb6
       
     1 /*
       
     2 * Copyright (c) 2008-2009 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: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CONTENTLISTINGFRAMEWORKTEST_H
       
    20 #define CONTENTLISTINGFRAMEWORKTEST_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <bautils.h>
       
    24 #include <barsc.h>
       
    25 #include <StifLogger.h>
       
    26 #include <TestScripterInternal.h>
       
    27 #include <StifTestModule.h>
       
    28 #include <CLFContentListing.hrh>
       
    29 #include <CLFContentListing.h>
       
    30 
       
    31 // Logging path
       
    32 _LIT( KContentListingFrameworkTestLogPath, "\\logs\\testframework\\ContentListingFrameworkTest\\" ); 
       
    33 // Log file
       
    34 _LIT( KContentListingFrameworkTestLogFile, "ContentListingFrameworkTest.txt" ); 
       
    35 _LIT( KContentListingFrameworkTestLogFileWithTitle, "ContentListingFrameworkTest_[%S].txt" );
       
    36 
       
    37 // FORWARD DECLARATIONS
       
    38 class MCLFContentListingEngine;
       
    39 class MCLFItemListModel;
       
    40 class MCLFSortingStyle;
       
    41 class TTestOperationObserver;
       
    42 class TTestCustomSorter;
       
    43 class TTestCustomGrouper;
       
    44 class TTestPostFilter;
       
    45 class TTestChangedItemObserver;
       
    46 class MCLFModifiableItem;
       
    47 class TTestCLFProcessObserver;
       
    48 class MCLFItem;
       
    49 
       
    50 // CLASS DECLARATION
       
    51 NONSHARABLE_CLASS(CContentListingFrameworkTest) : public CScriptBase
       
    52     {
       
    53     public:  // Constructors and destructor
       
    54 
       
    55         /**
       
    56         * Two-phased constructor.
       
    57         */
       
    58         static CContentListingFrameworkTest* NewL( CTestModuleIf& aTestModuleIf );
       
    59 
       
    60         /**
       
    61         * Destructor.
       
    62         */
       
    63         virtual ~CContentListingFrameworkTest();
       
    64 
       
    65     public: // Functions from base classes
       
    66 
       
    67         virtual TInt RunMethodL( CStifItemParser& aItem );
       
    68         
       
    69     private:
       
    70 
       
    71         /**
       
    72         * C++ default constructor.
       
    73         */
       
    74         CContentListingFrameworkTest( CTestModuleIf& aTestModuleIf );
       
    75 
       
    76         /**
       
    77         * By default Symbian 2nd phase constructor is private.
       
    78         */
       
    79         void ConstructL();
       
    80 
       
    81         /**
       
    82         * Frees all resources allocated from test methods.
       
    83         */
       
    84         void Delete();
       
    85         
       
    86         /**
       
    87         * Test methods are listed below. 
       
    88         */
       
    89         // setups
       
    90         virtual TInt BaseSetupL( CStifItemParser& aItem );
       
    91         virtual TInt SortingStyleResourceSetupL( CStifItemParser& aItem );
       
    92         virtual TInt CreateModelSetupL( CStifItemParser& aItem );
       
    93         virtual TInt CreateModelFromResourceSetupL( CStifItemParser& aItem );
       
    94         virtual TInt ListModelSetupL( CStifItemParser& aItem );
       
    95         virtual TInt ListModelSetupFromResourceL( CStifItemParser& aItem );
       
    96         virtual TInt ListModelAllFileItemsSetupL( CStifItemParser& aItem );
       
    97         virtual TInt EngineTestSetupL( CStifItemParser& aItem );
       
    98         virtual TInt SortingStyleTestSetupL( CStifItemParser& aItem );
       
    99         virtual TInt SortingStyleResourceTestSetupL( CStifItemParser& aItem );
       
   100         virtual TInt ModifiableItemTestSetupL( CStifItemParser& aItem );
       
   101         virtual TInt ItemTestSetupL( CStifItemParser& aItem );
       
   102         virtual TInt MultibleSortingSetupL( CStifItemParser& aItem );
       
   103         virtual TInt MultibleSortingResourceSetupL( CStifItemParser& aItem );
       
   104 
       
   105         // teardowns
       
   106         virtual TInt Teardown( CStifItemParser& aItem );
       
   107 
       
   108         // tests
       
   109         // Constructor test
       
   110         virtual TInt CreateEngineTestL( CStifItemParser& aItem );
       
   111         virtual TInt CreateModifiableItemTestL( CStifItemParser& aItem );
       
   112         virtual TInt CreateSortignStyleTestL( CStifItemParser& aItem );
       
   113         virtual TInt CreateSortignStyleFromResourceTestL( CStifItemParser& aItem );
       
   114         virtual TInt CreateListModelTestL( CStifItemParser& aItem );
       
   115         virtual TInt CreateListModelFromResourceTestL( CStifItemParser& aItem );
       
   116 
       
   117         // Engine test
       
   118         virtual TInt UpdateItemsTestL( CStifItemParser& aItem );
       
   119         virtual TInt UpdateItemsWithIdTestL( CStifItemParser& aItem );
       
   120         virtual TInt UpdateItemsWithOpaqueDataFolderTestL( CStifItemParser& aItem );
       
   121 
       
   122         // Sorting Style test;
       
   123         virtual TInt SortingStyleResourceTestL( CStifItemParser& aItem );
       
   124         virtual TInt SortingStyleOrderingTestL( CStifItemParser& aItem );
       
   125         virtual TInt SortingStyleDataTypeTestL( CStifItemParser& aItem );
       
   126         virtual TInt SortingStyleUndefinedItemPositionTestL( CStifItemParser& aItem );
       
   127         virtual TInt SortingStyleFieldTestL( CStifItemParser& aItem );
       
   128 
       
   129         // List model test
       
   130         virtual TInt RefreshTestL( CStifItemParser& aItem );
       
   131         virtual TInt SetSortingStyleTestL( CStifItemParser& aItem );
       
   132         virtual TInt SetCustomSorterTestL( CStifItemParser& aItem );
       
   133         virtual TInt GroupingTestL( CStifItemParser& aItem );
       
   134         virtual TInt SetPostFilterTestL( CStifItemParser& aItem );
       
   135         virtual TInt SetWantedMimeTypesTestL( CStifItemParser& aItem );
       
   136         virtual TInt SetWantedMediaTypesTestL( CStifItemParser& aItem );
       
   137         virtual TInt SetWantedMediaAndMimeTypesTestL( CStifItemParser& aItem );
       
   138         virtual TInt MultibleSortingTestL( CStifItemParser& aItem );
       
   139         virtual TInt ModelItemsChangedTestL( CStifItemParser& aItem );
       
   140 
       
   141         // item test
       
   142         virtual TInt ItemFieldTestL( CStifItemParser& aItem );
       
   143 
       
   144         // Modifiable item test
       
   145         virtual TInt MIFieldTestL( CStifItemParser& aItem );
       
   146         
       
   147     private:    // Assistance methods
       
   148         void ResourceL( TInt aResourceId );
       
   149         void SortingStyleResourceL();
       
   150         void ListModelResourceL();
       
   151         void CreateNewFileL( TInt aNumber, TDes& aFileName );
       
   152         TCLFItemId FindTestFileIdL( TInt aNumber );
       
   153         TBool CheckFileNameShortingL();
       
   154         TBool CheckFileSizeShortingL();
       
   155         TBool CheckFileDateShortingL();
       
   156         TBool CheckFileTypesL( const MDesCArray& aMimeTypeArray, const TArray<TInt>& aMediaTypes );
       
   157         TBool CheckMimeTypesL( const MDesCArray& aMimeTypeArray, const TDesC& aMimeType );
       
   158         TBool CheckMediaTypesL( const TArray<TInt>& aMediaTypes, TCLFMediaType aMediaType );
       
   159         HBufC8* MakeOpaqueDataL( const MDesCArray& aFiles );
       
   160         void MakeMultibleSortingItemsL( RPointerArray<MCLFModifiableItem>& aItemArray );
       
   161         TBool CheckMultibleSortingShortingL();
       
   162         TBool CheckMultibleSortingShorting2L();
       
   163         const MCLFItem* FindItem( MCLFItemListModel& aModel, TCLFItemId aItemId );
       
   164         
       
   165     private:    // Data
       
   166         MCLFContentListingEngine* iEngine;
       
   167         MCLFItemListModel* iListModel;
       
   168         MCLFSortingStyle* iSortingStyle;
       
   169         MCLFSortingStyle* iSortingStyle1;
       
   170         MCLFSortingStyle* iSortingStyle2;
       
   171         MCLFSortingStyle* iSortingStyle3;
       
   172         MCLFModifiableItem* iModifiableItem;
       
   173         const MCLFItem* iItem; // ref. not owned
       
   174 
       
   175         TTestOperationObserver* iTestObserver;
       
   176         TTestCustomSorter* iTestSorter;
       
   177         TTestCustomSorter* iTestSorter1;
       
   178         TTestCustomGrouper* iTestGrouper;
       
   179         TTestCustomGrouper* iTestGrouper1;
       
   180         TTestPostFilter* iTestFilter;
       
   181         TTestPostFilter* iTestFilter1;
       
   182         TTestCLFProcessObserver* iTestCLFProcessObserver;
       
   183         TTestCLFProcessObserver* iTestCLFProcessObserver1;
       
   184 
       
   185         CDesCArray* iMimeTypeArray;
       
   186         CDesCArray* iMimeTypeArray1;
       
   187         RArray<TInt> iMediaTypeArray;
       
   188         RArray<TInt> iMediaTypeArray1;
       
   189 
       
   190         TTestChangedItemObserver* iChangedItemObserver;
       
   191         TTestChangedItemObserver* iChangedItemObserver1;
       
   192         RArray<TCLFItemId> iUpdateItemIdArray;
       
   193         HBufC8* iOpaqueData;
       
   194         TInt iSemanticId;
       
   195 
       
   196         RFs iFs;
       
   197         RResourceFile iResourceFile;
       
   198         HBufC8* iDataBuffer;
       
   199         TResourceReader iResourceReader;
       
   200         CActiveSchedulerWait iWait;
       
   201         RArray<TCLFItemId> iChangedArray;
       
   202         TInt iItemCount;
       
   203         RPointerArray<MCLFModifiableItem> iModifiableItems;
       
   204         TFileName iFileName;
       
   205     };
       
   206 
       
   207 #endif      // CONTENTLISTINGFRAMEWORKTEST_H
       
   208 
       
   209 // End of File