|
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: CGlxGarbageCollector unit tests |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef __T_CGLXGARBAGECOLLECTOR_H__ |
|
22 #define __T_CGLXGARBAGECOLLECTOR_H__ |
|
23 |
|
24 // EXTERNAL INCLUDES |
|
25 #include <digia/eunit/CEUnitTestSuiteClass.h> |
|
26 #include <digia/eunit/EUnitDecorators.h> |
|
27 |
|
28 #include <glxmediaid.h> |
|
29 |
|
30 // INTERNAL INCLUDES |
|
31 #include "mglxmediauser.h" |
|
32 #include "t_mglxreferenceobserver.h" |
|
33 |
|
34 // FORWARD DECLARATIONS |
|
35 class CGlxCache; |
|
36 class CGlxGarbageCollector; |
|
37 class CGlxCacheManager; |
|
38 |
|
39 // CLASS DEFINITION |
|
40 /** |
|
41 * T_CGlxGarbageCollector Auto-generated EUnit test suite |
|
42 * |
|
43 */ |
|
44 NONSHARABLE_CLASS( T_CGlxGarbageCollector ) |
|
45 : public CEUnitTestSuiteClass, |
|
46 public MGlxReferenceObserver |
|
47 { |
|
48 public: // Constructors and destructors |
|
49 |
|
50 /** |
|
51 * Two phase construction |
|
52 */ |
|
53 static T_CGlxGarbageCollector* NewL(); |
|
54 static T_CGlxGarbageCollector* NewLC(); |
|
55 /** |
|
56 * Destructor |
|
57 */ |
|
58 ~T_CGlxGarbageCollector(); |
|
59 |
|
60 public: |
|
61 |
|
62 void IdleCallbackCalledL(); |
|
63 |
|
64 public: |
|
65 //From ReferenceObserver |
|
66 void RemoveMediaReference(TInt aIndex); |
|
67 |
|
68 private: // Constructors and destructors |
|
69 |
|
70 T_CGlxGarbageCollector(); |
|
71 void ConstructL(); |
|
72 |
|
73 private: // New methods |
|
74 |
|
75 void SetupL(); |
|
76 |
|
77 void Teardown(); |
|
78 |
|
79 void T_CGlxGarbageCollector_Cleanup_SubTest0L(); |
|
80 void T_CGlxGarbageCollector_Cleanup_SubTest1L(); |
|
81 void T_CGlxGarbageCollector_Cleanup_SubTest2L(); |
|
82 void T_CGlxGarbageCollector_Cleanup_SubTest3L(); |
|
83 void T_CGlxGarbageCollector_Cleanup_SubTest4L(); |
|
84 |
|
85 void T_CGlxGarbageCollector_CleanupCachesL(); |
|
86 |
|
87 void T_CGlxGarbageCollector_CleanupCache_SubTest1L(); |
|
88 void T_CGlxGarbageCollector_CleanupCache_SubTest2L(); |
|
89 void T_CGlxGarbageCollector_CleanupCache_SubTest3L(); |
|
90 void T_CGlxGarbageCollector_CleanupCache_SubTest4L(); |
|
91 void T_CGlxGarbageCollector_CleanupCache_SubTest5L(); |
|
92 |
|
93 void T_CGlxGarbageCollector_CleanupMediaL_SubTest1L(); |
|
94 void T_CGlxGarbageCollector_CleanupMediaL_SubTest2L(); |
|
95 void T_CGlxGarbageCollector_CleanupMediaL_SubTest3L(); |
|
96 void T_CGlxGarbageCollector_CleanupMediaL_SubTest4L(); |
|
97 void T_CGlxGarbageCollector_CleanupMediaL_SubTest5L(); |
|
98 void T_CGlxGarbageCollector_CleanupMediaL_SubTest6L(); |
|
99 void T_CGlxGarbageCollector_CleanupMediaL_SubTest7L(); |
|
100 void T_CGlxGarbageCollector_CleanupMediaL_SubTest8L(); |
|
101 void T_CGlxGarbageCollector_CleanupMediaL_SubTest9L(); |
|
102 void T_CGlxGarbageCollector_CleanupMediaL_SubTest10L(); |
|
103 void T_CGlxGarbageCollector_CleanupMediaL_SubTest11L(); |
|
104 void T_CGlxGarbageCollector_CleanupMediaL_SubTest12L(); |
|
105 |
|
106 void T_CGlxGarbageCollector_GetAttributesInUseLL(); |
|
107 |
|
108 void T_CGlxGarbageCollector_DeleteOtherAttributes_SubTest1L(); |
|
109 void T_CGlxGarbageCollector_DeleteOtherAttributes_SubTest2L(); |
|
110 void T_CGlxGarbageCollector_DeleteOtherAttributes_SubTest3L(); |
|
111 void T_CGlxGarbageCollector_DeleteOtherAttributes_SubTest4L(); |
|
112 void T_CGlxGarbageCollector_DeleteOtherAttributes_SubTest5L(); |
|
113 void T_CGlxGarbageCollector_DeleteOtherAttributes_SubTest6L(); |
|
114 void T_CGlxGarbageCollector_DeleteOtherAttributes_SubTest7L(); |
|
115 void T_CGlxGarbageCollector_DeleteOtherAttributes_SubTest8L(); |
|
116 void T_CGlxGarbageCollector_DeleteOtherAttributes_SubTest9L(); |
|
117 |
|
118 private: // Internal methods |
|
119 |
|
120 void TimerCallback(); |
|
121 |
|
122 void UpdateMediaL(); |
|
123 |
|
124 void SetupCachesL(); |
|
125 |
|
126 void AddMediaUserToCacheMediasL(CGlxCache& aCache, MGlxMediaUser& aMediaUser); |
|
127 void RemoveMediaUserFromCacheMedias(CGlxCache& aCache, MGlxMediaUser& aMediaUser); |
|
128 |
|
129 void AddMediaUserToMediaL(CGlxCache& aCache, TInt aIndex, MGlxMediaUser& aMediaUser); |
|
130 void RemoveMediaUserFromMedia(CGlxCache& aCache, TInt aIndex, MGlxMediaUser& aMediaUser); |
|
131 |
|
132 void CheckCache1MediaAttributes(const CGlxMedia& aMedia, TInt aAttributeCount, |
|
133 TBool aTitleSupported, TBool aSubtitleSupported, TBool aSystemItemSupported, |
|
134 TBool aErrorSupported = EFalse); |
|
135 void CheckCache2MediaAttributes(const CGlxMedia& aMedia, TInt aAttributeCount, |
|
136 TBool aTitleSupported, TBool aSubtitleSupported, TBool aSystemItemSupported, |
|
137 TBool aErrorSupported = EFalse); |
|
138 void CheckCache3MediaAttributes(const CGlxMedia& aMedia, TInt aAttributeCount, |
|
139 TBool aThumbnailSupported, TBool aTitleSupported, TBool aDateSupported, |
|
140 TBool aSizeSupported, TBool aErrorSupported = EFalse); |
|
141 |
|
142 void CheckCache1MediaErrors(const CGlxMedia& aMedia, TBool aError, |
|
143 TBool aTitleError = EFalse, TBool aSubtitleError = EFalse, |
|
144 TBool aSystemItemError = EFalse); |
|
145 void CheckCache2MediaErrors(const CGlxMedia& aMedia, TBool aError, |
|
146 TBool aTitleError = EFalse, TBool aSubtitleError = EFalse, |
|
147 TBool aSystemItemError = EFalse); |
|
148 void CheckCache3MediaErrors(const CGlxMedia& aMedia, TBool aError, |
|
149 TBool aThumbnailError = EFalse, TBool aTitleError = EFalse, |
|
150 TBool aDateError = EFalse, TBool aSizeError = EFalse); |
|
151 |
|
152 |
|
153 |
|
154 private: // Test classes |
|
155 |
|
156 // Test media user |
|
157 class CGlxMediaUserTest : public CBase, public MGlxMediaUser |
|
158 { |
|
159 public: |
|
160 static CGlxMediaUserTest* NewL(const RArray<TMPXAttribute>& aAttributes, T_CGlxGarbageCollector& aGarbageCollector); |
|
161 virtual ~CGlxMediaUserTest(); |
|
162 |
|
163 private: |
|
164 CGlxMediaUserTest(T_CGlxGarbageCollector& aGarbageCollector); |
|
165 void ConstructL(const RArray<TMPXAttribute>& aAttributes); |
|
166 |
|
167 private: // From MGlxMediaUser |
|
168 void GetRequiredAttributesL(TInt aIndex, RArray<TMPXAttribute>& aAttributes); |
|
169 void HandleAttributesAvailableL(TInt /*aIndex*/, |
|
170 const RArray<TMPXAttribute>& /*aAttributes*/) {}; |
|
171 void RemoveReference(TInt aIndex); |
|
172 void HandleError(TInt /*aError*/) {}; |
|
173 |
|
174 private: // Data |
|
175 RArray<TMPXAttribute> iAttributes; |
|
176 T_CGlxGarbageCollector& iGarbageCollector; |
|
177 }; |
|
178 |
|
179 // Test timer |
|
180 class CTimerTest : public CTimer |
|
181 { |
|
182 public: |
|
183 static CTimerTest* NewL(T_CGlxGarbageCollector* aTestGarbageCollector); |
|
184 virtual ~CTimerTest(); |
|
185 |
|
186 public: |
|
187 void StartTimer(TInt aSeconds); |
|
188 |
|
189 private: |
|
190 CTimerTest(T_CGlxGarbageCollector* aTestGarbageCollector); |
|
191 void ConstructL(); |
|
192 |
|
193 private: // From CTimer/CActive |
|
194 void RunL(); |
|
195 |
|
196 private: |
|
197 T_CGlxGarbageCollector* iTestGarbageCollector; |
|
198 }; |
|
199 |
|
200 public: // Data |
|
201 |
|
202 static T_CGlxGarbageCollector* iGarbageCollectorTest; |
|
203 |
|
204 private: // Data |
|
205 |
|
206 CGlxGarbageCollector* iCGlxGarbageCollector; |
|
207 |
|
208 RPointerArray<CGlxCache> iCaches; |
|
209 |
|
210 CActiveSchedulerWait iWait; |
|
211 |
|
212 TInt iIdleCallbackCount; |
|
213 |
|
214 CGlxCacheManager* iCacheManager; |
|
215 |
|
216 MGlxMediaUser* iMediaUser_Test; |
|
217 |
|
218 EUNIT_DECLARE_TEST_TABLE; |
|
219 }; |
|
220 |
|
221 #endif // __T_CGLXGARBAGECOLLECTOR_H__ |
|
222 |
|
223 // End of file |