photosgallery/viewframework/medialists/tsrc/t_cglxcache/t_cglxcache.h
changeset 0 4e91876724a2
equal deleted inserted replaced
-1:000000000000 0:4e91876724a2
       
     1 /*
       
     2 * Copyright (c) 2007 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:    CGlxCache unit tests
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef __T_CGLXCACHE_H__
       
    22 #define __T_CGLXCACHE_H__
       
    23 
       
    24 //  EXTERNAL INCLUDES
       
    25 #include <digia/eunit/ceunittestsuiteclass.h>
       
    26 #include <digia/eunit/eunitdecorators.h>
       
    27 
       
    28 #include <e32base.h>
       
    29 
       
    30 #include <glxmediaid.h>
       
    31 
       
    32 //  INTERNAL INCLUDES
       
    33 #include "mglxcacheobserver.h"
       
    34 #include "mglxmediauser.h"
       
    35 
       
    36 //  FORWARD DECLARATIONS
       
    37 class CGlxCache;
       
    38 class CGlxMedia;
       
    39 class CGlxCacheManager;
       
    40 
       
    41 //  CLASS DEFINITION
       
    42 /**
       
    43  * T_CGlxCache Auto-generated EUnit test suite
       
    44  *
       
    45  */
       
    46 NONSHARABLE_CLASS( T_CGlxCache )
       
    47 	: public CEUnitTestSuiteClass
       
    48     {
       
    49     public:     // Constructors and destructors
       
    50 
       
    51         /**
       
    52          * Two phase construction
       
    53          */
       
    54         static T_CGlxCache* NewL();
       
    55         static T_CGlxCache* NewLC();
       
    56         /**
       
    57          * Destructor
       
    58          */
       
    59         ~T_CGlxCache();
       
    60 
       
    61     private:    // Constructors and destructors
       
    62 
       
    63         T_CGlxCache();
       
    64         void ConstructL();
       
    65 
       
    66     private:    // New methods
       
    67 
       
    68         void SetupL();
       
    69         
       
    70         void Teardown();
       
    71         
       
    72         void T_CGlxCache_IdSpaceIdL();
       
    73         
       
    74         void T_CGlxCache_MediaUpdatedLL();
       
    75         
       
    76         void T_CGlxCache_UpdateMediaLL();
       
    77         
       
    78         void T_CGlxCache_HandleItemModifiedL();
       
    79         
       
    80         void T_CGlxCache_MediaL();
       
    81         
       
    82         void T_CGlxCache_FindItemForceCreateLL();
       
    83         
       
    84         void T_CGlxCache_CountL();
       
    85         
       
    86         void T_CGlxCache_Media2L();
       
    87         
       
    88         void T_CGlxCache_Delete_SubTest1L();
       
    89         
       
    90         void T_CGlxCache_Delete_SubTest2L();
       
    91         
       
    92         void T_CGlxCache_Delete_SubTest3L();
       
    93         
       
    94         void T_CGlxCache_Delete_SubTest4L();
       
    95         
       
    96         void T_CGlxCache_Delete_SubTest5L();
       
    97         
       
    98         void T_CGlxCache_ReserveUsersLL();
       
    99         
       
   100     private:    // Internal methods
       
   101 
       
   102         void SetupCacheL();
       
   103 
       
   104 
       
   105     private:    // Data
       
   106 		
       
   107         CGlxCache* iCGlxCache;
       
   108 		CGlxCacheManager *iCacheManager;
       
   109         EUNIT_DECLARE_TEST_TABLE; 
       
   110 
       
   111 
       
   112     private:    // Test classes
       
   113 
       
   114         // Test cache observer
       
   115         class CGlxCacheObserverTest : public CBase, public MGlxCacheObserver
       
   116             {
       
   117             public:
       
   118                 static CGlxCacheObserverTest* NewL();
       
   119                 virtual ~CGlxCacheObserverTest();
       
   120 
       
   121             public:
       
   122                 TBool AttributesAvailableNotified() const;
       
   123                 void ResetCalls();
       
   124 
       
   125                 const TGlxIdSpaceId& IdSpaceId() const;
       
   126                 const TGlxMediaId& MediaId() const;
       
   127                 const RArray<TMPXAttribute>& Attributes() const;
       
   128                 const CGlxMedia* Media() const;
       
   129 
       
   130             private:
       
   131                 CGlxCacheObserverTest();
       
   132                 void ConstructL();
       
   133 
       
   134             private: // From MGlxCacheObserver
       
   135                 void HandleAttributesAvailableL(const TGlxIdSpaceId& aIdSpaceId, 
       
   136                                                 const TGlxMediaId& aMediaId, 
       
   137                                                 const RArray<TMPXAttribute>& aAttributes, 
       
   138                                                 const CGlxMedia* aMedia);
       
   139                 virtual void CleanupMedia(const TGlxMediaId& aMediaId);
       
   140 
       
   141             private: // Data
       
   142                 TBool iAttributesAvailableNotified;
       
   143 
       
   144                 TGlxIdSpaceId iIdSpaceId;
       
   145                 TGlxMediaId iMediaId;
       
   146                 RArray<TMPXAttribute> iAttributes;
       
   147                 CGlxMedia* iMedia;
       
   148             };
       
   149 
       
   150         // Test media user
       
   151         class CGlxMediaUserTest : public CBase, public MGlxMediaUser
       
   152             {
       
   153             public:
       
   154                 static CGlxMediaUserTest* NewL();
       
   155                 virtual ~CGlxMediaUserTest();
       
   156 
       
   157             public:
       
   158                 TBool AttributesAvailableNotified() const;
       
   159                 TBool RemoveReferenceCalled() const;
       
   160                 void ResetCalls();
       
   161 
       
   162                 const TGlxIdSpaceId& IdSpaceId() const;
       
   163                 const TGlxMediaId& MediaId() const;
       
   164                 const RArray<TMPXAttribute>& Attributes() const;
       
   165 
       
   166             private:
       
   167                 CGlxMediaUserTest();
       
   168                 void ConstructL();
       
   169 
       
   170             private: // From MGlxMediaUser
       
   171                 void GetRequiredAttributesL(TInt /*aIndex*/, 
       
   172                                             RArray<TMPXAttribute>& /*aAttributes*/) {};
       
   173                 void HandleAttributesAvailableL(TInt aIndex, 
       
   174                                                 const RArray<TMPXAttribute>& aAttributes);
       
   175 				void HandleAttributesAvailableL(const TGlxIdSpaceId& aIdSpaceId, 
       
   176         								const TGlxMediaId& aItemId, 
       
   177         								const RArray<TMPXAttribute>& aAttributes);
       
   178 				                                                
       
   179                 void RemoveReference(TInt aIndex);
       
   180                 void RemoveReference(CGlxMedia& aMedia);
       
   181                 void HandleError(TInt /*aError*/) {};
       
   182 
       
   183             private: // Data
       
   184                 TBool iAttributesAvailableNotified;
       
   185                 TBool iRemoveReferenceCalled;
       
   186 
       
   187                 TGlxIdSpaceId iIdSpaceId;
       
   188                 TGlxMediaId iMediaId;
       
   189                 RArray<TMPXAttribute> iAttributes;
       
   190             };
       
   191     };
       
   192 
       
   193 #endif      //  __T_CGLXCACHE_H__
       
   194 
       
   195 // End of file