1 /* |
|
2 * Copyright (c) 2009-2010 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 * Implements the test steps for component management APIs in the SCR |
|
16 * |
|
17 */ |
|
18 |
|
19 #include "appreginfoapparcsteps.h" |
|
20 #include "tscrdefs.h" |
|
21 #include <scs/cleanuputils.h> |
|
22 #include <barsread.h> |
|
23 using namespace Usif; |
|
24 |
|
25 void CScrGetApplicationRegistrationViewSubsessionStep::PrintPerformanceLog(TTime aTime) |
|
26 { |
|
27 TDateTime timer = aTime.DateTime(); |
|
28 INFO_PRINTF6(_L("%S,%d:%d:%d:%d"), &KPerformanceTestInfo(), timer.Hour(), timer.Minute(), timer.Second(), timer.MicroSecond()); |
|
29 } |
|
30 |
|
31 void CScrGetApplicationRegistrationViewSubsessionStep::StartTimer() |
|
32 { |
|
33 iStartTime.HomeTime(); |
|
34 PrintPerformanceLog(iStartTime); |
|
35 } |
|
36 |
|
37 void CScrGetApplicationRegistrationViewSubsessionStep::StopTimerAndPrintResultL() |
|
38 { |
|
39 TTime endTime; |
|
40 endTime.HomeTime(); |
|
41 PrintPerformanceLog(endTime); |
|
42 |
|
43 TTimeIntervalMicroSeconds duration = endTime.MicroSecondsFrom(iStartTime); |
|
44 TInt actualDuration = I64INT(duration.Int64())/1000; // in millisecond |
|
45 |
|
46 TInt maxDuration = 0; |
|
47 if(!GetIntFromConfig(ConfigSection(), KMaxDurationName, maxDuration)) |
|
48 { |
|
49 ERR_PRINTF2(_L("%S could not be found in configuration."), &KMaxDurationName()); |
|
50 User::Leave(KErrNotFound); |
|
51 } |
|
52 else |
|
53 { |
|
54 INFO_PRINTF3(_L("%S,%d"), &KMaxTestCaseDuration(), maxDuration); |
|
55 INFO_PRINTF3(_L("%S,%d"), &KActualTestCaseDuration(), actualDuration); |
|
56 } |
|
57 |
|
58 if(actualDuration <= maxDuration) |
|
59 { |
|
60 INFO_PRINTF2(_L("This test meets performance requirement (Duration=%d)."), actualDuration); |
|
61 } |
|
62 else |
|
63 { |
|
64 ERR_PRINTF2(_L("This test does not meet performance requirement (Duration=%d)."), actualDuration); |
|
65 SetTestStepResult(EFail); |
|
66 } |
|
67 } |
|
68 |
|
69 void CScrGetApplicationRegistrationViewSubsessionStep::GenerateIndexedAttributeNameL(TDes& aInitialAttributeName, TInt aIndex) |
|
70 { |
|
71 const TInt MAX_INT_STR_LEN = 8; |
|
72 TBuf<MAX_INT_STR_LEN> integerAppendStr; |
|
73 integerAppendStr.Format(_L("%d"), aIndex); |
|
74 aInitialAttributeName.Append(integerAppendStr); |
|
75 } |
|
76 |
|
77 void CScrGetApplicationRegistrationViewSubsessionStep::GetAppOwnedFilesL(RPointerArray<HBufC>& aOwnedFileArray,HBufC* aConfigSection) |
|
78 { |
|
79 TInt ownedFileCount = 0; |
|
80 HBufC* configsection; |
|
81 if(aConfigSection == NULL) |
|
82 configsection = ConfigSection().AllocL(); |
|
83 else |
|
84 configsection = aConfigSection->AllocL(); |
|
85 |
|
86 GetIntFromConfig(*configsection, _L("OwnedFileCount"), ownedFileCount); |
|
87 for (TUint i = 0; i < ownedFileCount; ++i) |
|
88 { |
|
89 TPtrC tOwnedFileName; |
|
90 TBuf<20> fileName; |
|
91 fileName = KOwnedFileName; |
|
92 GenerateIndexedAttributeNameL(fileName, i); |
|
93 GetStringFromConfig(*configsection, fileName, tOwnedFileName); |
|
94 HBufC* ownedFileName = tOwnedFileName.AllocLC(); |
|
95 aOwnedFileArray.AppendL(ownedFileName); |
|
96 CleanupStack::Pop(ownedFileName); |
|
97 } |
|
98 delete configsection; |
|
99 } |
|
100 |
|
101 TBool CScrGetApplicationRegistrationViewSubsessionStep::GetUidFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TUid& aUid) |
|
102 { |
|
103 TInt val; |
|
104 if(GetHexFromConfig(aSectName, aKeyName, val)) |
|
105 { |
|
106 aUid = TUid::Uid(val); |
|
107 return ETrue; |
|
108 } |
|
109 else |
|
110 { |
|
111 return EFalse; |
|
112 } |
|
113 } |
|
114 |
|
115 void CScrGetApplicationRegistrationViewSubsessionStep::PrintErrorL(const TDesC& aMsg, TInt aErrNum,...) |
|
116 { |
|
117 VA_LIST list; |
|
118 VA_START(list, aErrNum); |
|
119 |
|
120 RBuf msgBuf; |
|
121 msgBuf.CreateL(MAX_SCR_ERROR_MESSAGE_LENGTH); |
|
122 msgBuf.CleanupClosePushL(); |
|
123 msgBuf.AppendFormatList(aMsg, list); |
|
124 |
|
125 ERR_PRINTF1(msgBuf); |
|
126 SetTestStepResult(EFail); |
|
127 |
|
128 CleanupStack::PopAndDestroy(&msgBuf); |
|
129 User::Leave(aErrNum); |
|
130 } |
|
131 |
|
132 void CScrGetApplicationRegistrationViewSubsessionStep::GetAppUidL(TUid& aAppUid, HBufC* aConfigSection) |
|
133 { |
|
134 HBufC* configsection; |
|
135 if(aConfigSection == NULL) |
|
136 configsection = ConfigSection().AllocL(); |
|
137 else |
|
138 configsection = aConfigSection->AllocL(); |
|
139 |
|
140 if (!GetUidFromConfig(*configsection, _L("AppUid"), aAppUid)) |
|
141 { |
|
142 delete configsection; |
|
143 PrintErrorL(_L("AppUid was not found!"), KErrNotFound); |
|
144 } |
|
145 INFO_PRINTF2(_L("AppUid is 0x%x"), aAppUid.iUid); |
|
146 delete configsection; |
|
147 } |
|
148 |
|
149 void CScrGetApplicationRegistrationViewSubsessionStep::GetAppServiceInfoL( |
|
150 RPointerArray<CServiceInfo>& aServiceInfoArray, HBufC* aConfigSection) |
|
151 { |
|
152 TInt serviceInfoCount = 0; |
|
153 TInt totalOpaqueDataCount = 0; |
|
154 TInt totalServiceDataTypeCount = 0; |
|
155 HBufC* configsection; |
|
156 if (aConfigSection == NULL) |
|
157 configsection = ConfigSection().AllocL(); |
|
158 else |
|
159 configsection = aConfigSection->AllocL(); |
|
160 |
|
161 GetIntFromConfig(*configsection, _L("ServiceInfoCount"), |
|
162 serviceInfoCount); |
|
163 for (TUint i = 0; i < serviceInfoCount; ++i) |
|
164 { |
|
165 // service Uid |
|
166 TBuf<20> uid; |
|
167 TUid serviceUid; |
|
168 uid = KServiceUid; |
|
169 GenerateIndexedAttributeNameL(uid, i); |
|
170 GetUidFromConfig(*configsection, uid, serviceUid); |
|
171 |
|
172 // service opaque data |
|
173 RPointerArray<COpaqueData> serviceOpaqueDataInfoArray; |
|
174 TBuf<27> servOpaqueDataCountStr; |
|
175 servOpaqueDataCountStr = KServiceOpaqueDataInfoCount; |
|
176 GenerateIndexedAttributeNameL(servOpaqueDataCountStr, i); |
|
177 TInt serviceOpaqueDataInfoCount = 0; |
|
178 GetIntFromConfig(*configsection, servOpaqueDataCountStr, serviceOpaqueDataInfoCount); |
|
179 GetServiceOpaqueDataInfoL(serviceOpaqueDataInfoArray, serviceOpaqueDataInfoCount, totalOpaqueDataCount, configsection); |
|
180 totalOpaqueDataCount += serviceOpaqueDataInfoCount; |
|
181 |
|
182 //GetServiceOpaqueDataInfoL(serviceOpaqueDataInfoArray); |
|
183 //CleanupStack::PushL(&serviceOpaqueDataInfoArray); |
|
184 |
|
185 // service data type |
|
186 TBuf<21> serviceDataTypeCountString; |
|
187 serviceDataTypeCountString = KServiceDataTypeCount; |
|
188 GenerateIndexedAttributeNameL(serviceDataTypeCountString, i); |
|
189 TInt serviceDataTypeCount = 0; |
|
190 GetIntFromConfig(*configsection, serviceDataTypeCountString, |
|
191 serviceDataTypeCount); |
|
192 totalServiceDataTypeCount += serviceDataTypeCount; |
|
193 RPointerArray<CDataType> serviceDataTypeArray; |
|
194 for (TUint j = 0; j < serviceDataTypeCount; ++j) |
|
195 { |
|
196 TInt indexToRead = totalServiceDataTypeCount |
|
197 - serviceDataTypeCount + j; |
|
198 TInt serviceDataTypePriority; |
|
199 TPtrC serviceType; |
|
200 TBuf<25> priority, type; |
|
201 priority = KServiceDataTypePriority; |
|
202 GenerateIndexedAttributeNameL(priority, indexToRead); |
|
203 GetIntFromConfig(*configsection, priority, |
|
204 serviceDataTypePriority); |
|
205 type = KServiceDataType; |
|
206 GenerateIndexedAttributeNameL(type, indexToRead); |
|
207 GetStringFromConfig(*configsection, type, serviceType); |
|
208 CDataType* serviceDataType = CDataType::NewLC( |
|
209 serviceDataTypePriority, serviceType); |
|
210 serviceDataTypeArray.AppendL(serviceDataType); |
|
211 CleanupStack::Pop(serviceDataType); |
|
212 } |
|
213 |
|
214 CServiceInfo* serviceInfo = CServiceInfo::NewLC(serviceUid, |
|
215 serviceOpaqueDataInfoArray, serviceDataTypeArray); |
|
216 aServiceInfoArray.AppendL(serviceInfo); |
|
217 CleanupStack::Pop(serviceInfo); |
|
218 } |
|
219 delete configsection; |
|
220 } |
|
221 |
|
222 void CScrGetApplicationRegistrationViewSubsessionStep::GetAppLocalizableInfoL(RPointerArray<CLocalizableAppInfo>& aLocalizableAppInfoArray, HBufC* aConfigSection) |
|
223 { |
|
224 TInt localizableAppInfoCount = 0; |
|
225 TInt totalViewDataCount=0; |
|
226 HBufC* configsection; |
|
227 if(aConfigSection == NULL) |
|
228 configsection = ConfigSection().AllocL(); |
|
229 else |
|
230 configsection = aConfigSection->AllocL(); |
|
231 |
|
232 GetIntFromConfig(*configsection, _L("LocalizableAppInfoCount"), localizableAppInfoCount); |
|
233 for (TUint i = 0; i < localizableAppInfoCount; ++i) |
|
234 { |
|
235 TPtrC locShortCaption; |
|
236 TLanguage locLanguage = (TLanguage)0; |
|
237 TInt lang; |
|
238 TPtrC locGroupName; |
|
239 TBuf<20> shortCaption, language, groupName, viewDataCount; |
|
240 shortCaption = KLocShortCaption; |
|
241 GenerateIndexedAttributeNameL(shortCaption, i); |
|
242 GetStringFromConfig(*configsection, shortCaption, locShortCaption); |
|
243 language = KLocAppLanguage; |
|
244 GenerateIndexedAttributeNameL(language, i); |
|
245 GetIntFromConfig(*configsection, language, lang); |
|
246 locLanguage = static_cast<TLanguage>(lang); |
|
247 groupName = KLocGroupName; |
|
248 GenerateIndexedAttributeNameL(groupName, i); |
|
249 GetStringFromConfig(*configsection, groupName, locGroupName); |
|
250 |
|
251 TPtrC locCaption; |
|
252 TPtrC locIconFileName; |
|
253 TInt locNoOfAppIcons = 0; |
|
254 TBuf<20> caption, iconFileName, noOfAppIcons; |
|
255 caption = KLocCaption; |
|
256 GenerateIndexedAttributeNameL(caption, i); |
|
257 GetStringFromConfig(*configsection, caption, locCaption); |
|
258 iconFileName = KLocIconFileName; |
|
259 GenerateIndexedAttributeNameL(iconFileName, i); |
|
260 GetStringFromConfig(*configsection, iconFileName, locIconFileName); |
|
261 noOfAppIcons = KLocNumberOfAppIcons; |
|
262 GenerateIndexedAttributeNameL(noOfAppIcons, i); |
|
263 GetIntFromConfig(*configsection, noOfAppIcons, locNoOfAppIcons); |
|
264 CCaptionAndIconInfo* captionAndIconInfo = NULL; |
|
265 if(locCaption.Length() != 0 || locIconFileName.Length() !=0 || locNoOfAppIcons != 0) |
|
266 { |
|
267 captionAndIconInfo = CCaptionAndIconInfo::NewLC(locCaption,locIconFileName,locNoOfAppIcons); |
|
268 } |
|
269 else |
|
270 CleanupStack::PushL(captionAndIconInfo); |
|
271 |
|
272 TInt viewDataCountForLocale = 0; |
|
273 viewDataCount=KViewDataCount; |
|
274 GenerateIndexedAttributeNameL(viewDataCount, i); |
|
275 GetIntFromConfig(*configsection, viewDataCount , viewDataCountForLocale); |
|
276 totalViewDataCount+=viewDataCountForLocale; |
|
277 RPointerArray<CAppViewData> viewDataArray; |
|
278 for (TUint i = 0; i < viewDataCountForLocale; ++i) |
|
279 { |
|
280 TInt viewScreenMode = 0 ,vUid,indexToRead; |
|
281 TBuf<20> uid, screenMode; |
|
282 uid = KVwUid; |
|
283 indexToRead=totalViewDataCount-viewDataCountForLocale+i; |
|
284 GenerateIndexedAttributeNameL(uid, indexToRead); |
|
285 GetIntFromConfig(*configsection, uid, vUid); |
|
286 TUid viewUid = TUid::Uid(vUid); |
|
287 screenMode = KVwScreenMode; |
|
288 GenerateIndexedAttributeNameL(screenMode, indexToRead); |
|
289 GetIntFromConfig(*configsection, screenMode, viewScreenMode); |
|
290 |
|
291 TPtrC viewCaption; |
|
292 TPtrC viewIconFileName; |
|
293 TInt viewNoOfAppIcons = 0; |
|
294 TBuf<20> caption, iconFileName, noOfAppIcons; |
|
295 caption = KVwCaption; |
|
296 GenerateIndexedAttributeNameL(caption, indexToRead); |
|
297 GetStringFromConfig(*configsection, caption, viewCaption); |
|
298 iconFileName = KVwIconFileName; |
|
299 GenerateIndexedAttributeNameL(iconFileName, indexToRead); |
|
300 GetStringFromConfig(*configsection, iconFileName, viewIconFileName); |
|
301 noOfAppIcons = KVwNumberOfAppIcons; |
|
302 GenerateIndexedAttributeNameL(noOfAppIcons, indexToRead); |
|
303 GetIntFromConfig(*configsection, noOfAppIcons, viewNoOfAppIcons); |
|
304 CCaptionAndIconInfo* viewCaptionAndIconInfo = NULL; |
|
305 if(viewCaption.Length() != 0 || viewIconFileName.Length() !=0 || viewNoOfAppIcons != 0) |
|
306 { |
|
307 viewCaptionAndIconInfo = CCaptionAndIconInfo::NewLC(viewCaption,viewIconFileName,viewNoOfAppIcons); |
|
308 } |
|
309 else |
|
310 CleanupStack::PushL(viewCaptionAndIconInfo); |
|
311 |
|
312 CAppViewData* viewData = CAppViewData::NewLC(viewUid,viewScreenMode,viewCaptionAndIconInfo); |
|
313 viewDataArray.AppendL(viewData); |
|
314 CleanupStack::Pop(2, viewCaptionAndIconInfo); |
|
315 } |
|
316 |
|
317 CLocalizableAppInfo* localizableAppInfo = CLocalizableAppInfo::NewLC(locShortCaption,locLanguage,locGroupName,captionAndIconInfo,viewDataArray); |
|
318 aLocalizableAppInfoArray.AppendL(localizableAppInfo); |
|
319 CleanupStack::Pop(localizableAppInfo); |
|
320 CleanupStack::Pop(captionAndIconInfo); |
|
321 } |
|
322 delete configsection; |
|
323 } |
|
324 |
|
325 void CScrGetApplicationRegistrationViewSubsessionStep::GetAppOpaqueDataInfoL(RPointerArray<Usif::COpaqueData>& aAppOpaqueDataInfoArray, HBufC* aConfigSection) |
|
326 { |
|
327 TInt appOpaqueDataInfoCount = 0; |
|
328 HBufC* configsection; |
|
329 if(aConfigSection == NULL) |
|
330 configsection = ConfigSection().AllocL(); |
|
331 else |
|
332 configsection = aConfigSection->AllocL(); |
|
333 |
|
334 GetIntFromConfig(*configsection, _L("AppOpaqueDataInfoCount"), appOpaqueDataInfoCount); |
|
335 for (TUint i = 0; i < appOpaqueDataInfoCount; ++i) |
|
336 { |
|
337 TBuf<16> localeAttr; |
|
338 localeAttr = KAppOpaqueDataLocale; |
|
339 TInt locale = 0; |
|
340 GenerateIndexedAttributeNameL(localeAttr, i); |
|
341 GetIntFromConfig(*configsection, localeAttr, locale); |
|
342 |
|
343 TBuf<14> opaqueDataAttr; |
|
344 opaqueDataAttr = KAppOpaqueData; |
|
345 TPtrC opaqueData; |
|
346 GenerateIndexedAttributeNameL(opaqueDataAttr, i); |
|
347 GetStringFromConfig(*configsection, opaqueDataAttr, opaqueData); |
|
348 |
|
349 TPtrC8 blobOpaqueData((TUint8*)opaqueData.Ptr(), opaqueData.Length()*2); |
|
350 |
|
351 COpaqueData* appOpaqueData = COpaqueData::NewLC(blobOpaqueData, (TLanguage) locale); |
|
352 aAppOpaqueDataInfoArray.AppendL(appOpaqueData); |
|
353 CleanupStack::Pop(1, appOpaqueData); |
|
354 } |
|
355 delete configsection; |
|
356 } |
|
357 |
|
358 void CScrGetApplicationRegistrationViewSubsessionStep::GetServiceOpaqueDataInfoL(RPointerArray<Usif::COpaqueData>& aServiceOpaqueDataInfoArray, TInt aServiceOpaqueDataInfoCount, TInt aStartingIndex, HBufC* aConfigSection) |
|
359 { |
|
360 for (TUint i = 0; i < aServiceOpaqueDataInfoCount; ++i) |
|
361 { |
|
362 TBuf<20> localeAttr; |
|
363 localeAttr = KServiceOpaqueLocale; |
|
364 TInt locale = 0; |
|
365 TInt indexToRead = i + aStartingIndex; |
|
366 GenerateIndexedAttributeNameL(localeAttr, indexToRead); |
|
367 GetIntFromConfig(*aConfigSection, localeAttr, locale); |
|
368 |
|
369 TBuf<18> opaqueDataAttr; |
|
370 opaqueDataAttr = KServiceOpaqueData; |
|
371 TPtrC opaqueData; |
|
372 GenerateIndexedAttributeNameL(opaqueDataAttr, indexToRead); |
|
373 GetStringFromConfig(*aConfigSection, opaqueDataAttr, opaqueData); |
|
374 |
|
375 TPtrC8 blobOpaqueData((TUint8*)opaqueData.Ptr(), opaqueData.Length()*2); |
|
376 COpaqueData* serviceOpaqueData = COpaqueData::NewLC(blobOpaqueData, (TLanguage) locale); |
|
377 aServiceOpaqueDataInfoArray.AppendL(serviceOpaqueData); |
|
378 CleanupStack::Pop(1, serviceOpaqueData); |
|
379 } |
|
380 } |
|
381 |
|
382 TBool CScrGetApplicationRegistrationViewSubsessionStep::Get64BitIntegerFromConfigL(const TDesC& aConfigKeyName, TInt64& aRetVal,HBufC* aConfigSection) |
|
383 { |
|
384 TPtrC int64Str; |
|
385 HBufC* configsection; |
|
386 if(aConfigSection == NULL) |
|
387 configsection = ConfigSection().AllocLC(); |
|
388 else |
|
389 configsection = aConfigSection->AllocLC(); |
|
390 |
|
391 if (!GetStringFromConfig(*configsection, aConfigKeyName, int64Str)) |
|
392 return EFalse; |
|
393 |
|
394 TLex lex(int64Str); |
|
395 User::LeaveIfError(lex.Val(aRetVal)); |
|
396 CleanupStack::PopAndDestroy(configsection); |
|
397 return ETrue; |
|
398 } |
|
399 |
|
400 CPropertyEntry* CScrGetApplicationRegistrationViewSubsessionStep::GetPropertyFromConfigLC(TBool aIsSingle, TInt aIndex, TBool aSupportLocalized,HBufC* aConfigSection) |
|
401 { |
|
402 // This function can be used for getting a single property, which is defined by attributes such as PropertyName etc. |
|
403 // or a property in a set - in this case the properties would be PropertyType0, PropertyName0 etc. |
|
404 // aIsSingle defines the working mode. aIndex applies only if aIsSingle is false |
|
405 |
|
406 // First, we need to generate the property name |
|
407 TBuf<MAX_SCR_PARAM_LENGTH> propertyTypeParam, propertyNameParam, propertyValueParam, propertyLocaleParam; |
|
408 propertyTypeParam = KPropertyTypeParam; |
|
409 propertyNameParam = KPropertyNameParam; |
|
410 propertyValueParam = KPropertyValueParam; |
|
411 propertyLocaleParam = KPropertyLocaleParam; |
|
412 if (!aIsSingle) |
|
413 { |
|
414 GenerateIndexedAttributeNameL(propertyTypeParam, aIndex); |
|
415 GenerateIndexedAttributeNameL(propertyNameParam, aIndex); |
|
416 GenerateIndexedAttributeNameL(propertyValueParam, aIndex); |
|
417 GenerateIndexedAttributeNameL(propertyLocaleParam, aIndex); |
|
418 } |
|
419 HBufC* configsection; |
|
420 if(aConfigSection == NULL) |
|
421 configsection = ConfigSection().AllocLC(); |
|
422 else |
|
423 configsection = aConfigSection->AllocLC(); |
|
424 |
|
425 TPtrC propertyName; |
|
426 if (!GetStringFromConfig(*configsection, propertyNameParam, propertyName)) |
|
427 { |
|
428 ERR_PRINTF2(_L("The property name param %S could not be found in configuration."), &propertyNameParam); |
|
429 User::Leave(KErrNotFound); |
|
430 } |
|
431 |
|
432 TInt propertyTypeInt; |
|
433 if (!GetIntFromConfig(*configsection, propertyTypeParam, propertyTypeInt)) |
|
434 { |
|
435 ERR_PRINTF2(_L("The property type param %S could not be found in configuration."), &propertyTypeParam); |
|
436 User::Leave(KErrNotFound); |
|
437 } |
|
438 |
|
439 CPropertyEntry::TPropertyType propertyType = static_cast<CPropertyEntry::TPropertyType>(propertyTypeInt); |
|
440 |
|
441 CPropertyEntry* propertyEntry(NULL); |
|
442 switch (propertyType) |
|
443 { |
|
444 case CPropertyEntry::EBinaryProperty: |
|
445 case CPropertyEntry::ELocalizedProperty: |
|
446 { |
|
447 TPtrC propertyStrValue; |
|
448 if (!GetStringFromConfig(*configsection, propertyValueParam, propertyStrValue)) |
|
449 { |
|
450 ERR_PRINTF2(_L("The property value param %S could not be found in configuration."), &propertyValueParam); |
|
451 User::Leave(KErrNotFound); |
|
452 } |
|
453 if(!aSupportLocalized || propertyType == CPropertyEntry::EBinaryProperty) |
|
454 { |
|
455 HBufC8* buffer8Bit = ConvertBufferTo8bitL(propertyStrValue); |
|
456 CleanupStack::PushL(buffer8Bit); |
|
457 propertyEntry = CBinaryPropertyEntry::NewL(propertyName, *buffer8Bit); |
|
458 CleanupStack::PopAndDestroy(buffer8Bit); |
|
459 break; |
|
460 } |
|
461 // Handle ELocalProperty case |
|
462 TLanguage locale; |
|
463 TInt localeParam; |
|
464 if (!GetIntFromConfig(*configsection, propertyLocaleParam, localeParam)) |
|
465 { |
|
466 ERR_PRINTF2(_L("The property locale param %S could not be found in configuration."), &propertyLocaleParam); |
|
467 User::Leave(KErrNotFound); |
|
468 } |
|
469 locale = static_cast<TLanguage>(localeParam); |
|
470 propertyEntry = CLocalizablePropertyEntry::NewL(propertyName, propertyStrValue, locale); |
|
471 break; |
|
472 } |
|
473 case CPropertyEntry::EIntProperty: |
|
474 { |
|
475 TInt64 int64Value; |
|
476 if (!Get64BitIntegerFromConfigL(propertyValueParam, int64Value, configsection)) |
|
477 { |
|
478 ERR_PRINTF2(_L("The integer param %S could not be found in configuration."), &propertyValueParam); |
|
479 User::Leave(KErrNotFound); |
|
480 } |
|
481 propertyEntry = CIntPropertyEntry::NewL(propertyName, int64Value); |
|
482 break; |
|
483 } |
|
484 } |
|
485 CleanupStack::PopAndDestroy(configsection); |
|
486 CleanupStack::PushL(propertyEntry); |
|
487 return propertyEntry; |
|
488 } |
|
489 |
|
490 void CScrGetApplicationRegistrationViewSubsessionStep::GetAppPropertiesL(RPointerArray<CPropertyEntry>& aAppPropertyArray,TBool aSupportLocalized, HBufC* aConfigSection) |
|
491 { |
|
492 TInt propertiesCount = 0; |
|
493 HBufC* configsection; |
|
494 if(aConfigSection == NULL) |
|
495 configsection = ConfigSection().AllocLC(); |
|
496 else |
|
497 configsection = aConfigSection->AllocLC(); |
|
498 |
|
499 if (!GetIntFromConfig(*configsection, KPropertiesCountParamName, propertiesCount)) |
|
500 { |
|
501 INFO_PRINTF1(_L("Properties count was not found!")); |
|
502 CleanupStack::PopAndDestroy(configsection); |
|
503 return; |
|
504 } |
|
505 |
|
506 if (propertiesCount < 0) |
|
507 { |
|
508 INFO_PRINTF1(_L("Properties count was negative !")); |
|
509 CleanupStack::PopAndDestroy(configsection); |
|
510 return; |
|
511 } |
|
512 |
|
513 for (TInt i = 0; i < propertiesCount; ++i) |
|
514 { |
|
515 CPropertyEntry *propertyEntry = GetPropertyFromConfigLC(EFalse, i, aSupportLocalized,configsection); |
|
516 User::LeaveIfError(aAppPropertyArray.Append(propertyEntry)); |
|
517 CleanupStack::Pop(propertyEntry); |
|
518 } |
|
519 CleanupStack::PopAndDestroy(configsection); |
|
520 } |
|
521 |
|
522 CApplicationRegistrationData* CScrGetApplicationRegistrationViewSubsessionStep::GetAppRegInfoFromConfigLC(HBufC* aConfigSection ) |
|
523 { |
|
524 TUid appUid; |
|
525 HBufC* configsection; |
|
526 if(aConfigSection == NULL) |
|
527 configsection = ConfigSection().AllocLC(); |
|
528 else |
|
529 configsection = aConfigSection->AllocLC(); |
|
530 |
|
531 GetAppUidL(appUid, configsection); |
|
532 |
|
533 TPtrC appFile; |
|
534 |
|
535 GetStringFromConfig(*configsection, _L("AppFile"), appFile); |
|
536 |
|
537 TInt attributes = 0, hidden = 0, embeddability = 0, newFile = 0, launch = 0, defScreenNo = 0; |
|
538 GetIntFromConfig(*configsection, _L("Attributes"), attributes); |
|
539 GetIntFromConfig(*configsection, _L("Hidden"), hidden); |
|
540 GetIntFromConfig(*configsection, _L("Embeddability"), embeddability); |
|
541 GetIntFromConfig(*configsection, _L("NewFile"), newFile); |
|
542 GetIntFromConfig(*configsection, _L("Launch"), launch); |
|
543 |
|
544 TPtrC groupName; |
|
545 GetStringFromConfig(*configsection, _L("GroupName"), groupName); |
|
546 |
|
547 GetIntFromConfig(*configsection, _L("DefaultScreenNumber"), defScreenNo); |
|
548 |
|
549 RPointerArray<HBufC> ownedFileArray; |
|
550 GetAppOwnedFilesL(ownedFileArray, configsection); |
|
551 CleanupStack::PushL(&ownedFileArray); |
|
552 RPointerArray<CServiceInfo> serviceInfoArray; |
|
553 GetAppServiceInfoL(serviceInfoArray, configsection); |
|
554 CleanupStack::PushL(&serviceInfoArray); |
|
555 RPointerArray<CLocalizableAppInfo> localizableAppInfoArray; |
|
556 GetAppLocalizableInfoL(localizableAppInfoArray, configsection); |
|
557 CleanupStack::PushL(&localizableAppInfoArray); |
|
558 RPointerArray<COpaqueData> appOpaqueDataInfoArray; |
|
559 GetAppOpaqueDataInfoL(appOpaqueDataInfoArray, configsection); |
|
560 CleanupStack::PushL(&appOpaqueDataInfoArray); |
|
561 RPointerArray<CPropertyEntry> appPropertyArray; |
|
562 GetAppPropertiesL(appPropertyArray,ETrue, configsection); |
|
563 CleanupStack::PushL(&appPropertyArray); |
|
564 INFO_PRINTF1(_L("Going to create CApplicationRegistrationData obj.")); |
|
565 |
|
566 TApplicationCharacteristics appCharacteristics; |
|
567 appCharacteristics.iAttributes = attributes; |
|
568 appCharacteristics.iAppIsHidden = hidden; |
|
569 appCharacteristics.iEmbeddability = TApplicationCharacteristics::TAppEmbeddability(embeddability); |
|
570 appCharacteristics.iGroupName = groupName; |
|
571 appCharacteristics.iLaunchInBackground = launch; |
|
572 CApplicationRegistrationData* appRegData = CApplicationRegistrationData::NewLC(ownedFileArray, serviceInfoArray, localizableAppInfoArray, appPropertyArray, appOpaqueDataInfoArray, appUid, appFile, appCharacteristics, defScreenNo); |
|
573 INFO_PRINTF1(_L("Created CApplicationRegistrationData obj.")); |
|
574 CleanupStack::Pop(6); |
|
575 CleanupStack::PopAndDestroy(configsection); |
|
576 CleanupStack::PushL(appRegData); |
|
577 return appRegData; |
|
578 } |
|
579 |
|
580 TBool CScrGetApplicationRegistrationViewSubsessionStep::CompareFileOwnershipInfo(RPointerArray<HBufC> aActualData, RPointerArray<HBufC> aExpectedData) |
|
581 { |
|
582 TInt expectedAppOwnedFilesCount = aExpectedData.Count(); |
|
583 TInt actualAppOwnedFilesCount = aActualData.Count(); |
|
584 |
|
585 if(actualAppOwnedFilesCount != expectedAppOwnedFilesCount) |
|
586 { |
|
587 INFO_PRINTF1(_L("The no of expected owned files by an app is not same as the no of actual owned files")); |
|
588 return EFalse; |
|
589 } |
|
590 |
|
591 for (TInt i=0 ; i < expectedAppOwnedFilesCount ; i++) |
|
592 { |
|
593 if(!aExpectedData.Find(aActualData[i])) |
|
594 { |
|
595 INFO_PRINTF1(_L("The expected owned file name is not same as the actual file name")); |
|
596 return EFalse; |
|
597 } |
|
598 } |
|
599 return ETrue; |
|
600 } |
|
601 |
|
602 TBool CScrGetApplicationRegistrationViewSubsessionStep::CompareDataType(RPointerArray<Usif::CDataType> aActualData, RPointerArray<Usif::CDataType> aExpectedData) |
|
603 { |
|
604 TInt expectedDataTypeCount = aExpectedData.Count(); |
|
605 TInt actualDataTypeCount = aActualData.Count(); |
|
606 |
|
607 if(actualDataTypeCount != expectedDataTypeCount) |
|
608 { |
|
609 INFO_PRINTF1(_L("The no of expected data types for a service is not same as the no of actual recieved data types")); |
|
610 return EFalse; |
|
611 } |
|
612 for(TInt i = 0 ; i < expectedDataTypeCount ; i++) |
|
613 { |
|
614 if(aExpectedData[i]->Priority()!= aActualData[i]->Priority()) |
|
615 { |
|
616 INFO_PRINTF1(_L("The expected priority for a service data type is not same as the actual recieved")); |
|
617 return EFalse; |
|
618 } |
|
619 |
|
620 if(!(aExpectedData[i]->Type() == aActualData[i]->Type())) |
|
621 { |
|
622 INFO_PRINTF1(_L("The expected type for a service data type is not same as the actual recieved")); |
|
623 return EFalse; |
|
624 } |
|
625 } |
|
626 return ETrue; |
|
627 } |
|
628 |
|
629 TBool CScrGetApplicationRegistrationViewSubsessionStep::CompareOpaqueDataL(RPointerArray<Usif::COpaqueData> aActualData, RPointerArray<Usif::COpaqueData> aExpectedData) |
|
630 { |
|
631 TInt expectedCount = aExpectedData.Count(); |
|
632 TInt actualCount = aActualData.Count(); |
|
633 |
|
634 if(actualCount != expectedCount) |
|
635 { |
|
636 |
|
637 INFO_PRINTF1(_L("The no of expected opaque data is not same as the no of actual opaque data")); |
|
638 INFO_PRINTF2(_L("The expected data : %d"), expectedCount); |
|
639 INFO_PRINTF2(_L("The actual data : %d"), actualCount); |
|
640 return EFalse; |
|
641 } |
|
642 for(TInt i = 0 ; i < expectedCount ; i++) |
|
643 { |
|
644 if(aExpectedData[i]->Language()!= aActualData[i]->Language()) |
|
645 { |
|
646 INFO_PRINTF1(_L("The expected lang for a service data type is not same as the actual recieved")); |
|
647 return EFalse; |
|
648 } |
|
649 |
|
650 TBool compareWithDb = EFalse; |
|
651 GetBoolFromConfig(ConfigSection(), _L("CompareWithDb"), compareWithDb); |
|
652 |
|
653 if(compareWithDb) |
|
654 { |
|
655 TResourceReader reader; |
|
656 reader.SetBuffer(&aActualData[i]->OpaqueData()); |
|
657 HBufC16* actualDataBuffer = reader.ReadHBufCL(); |
|
658 CleanupStack::PushL(actualDataBuffer); |
|
659 |
|
660 TPtrC16 ptr16(reinterpret_cast<const TUint16*>(aExpectedData[i]->OpaqueData().Ptr()),(aExpectedData[i]->OpaqueData().Length()/2)); |
|
661 HBufC16* expectedDataBuffer = ptr16.AllocLC(); |
|
662 |
|
663 if(*actualDataBuffer != *expectedDataBuffer) |
|
664 { |
|
665 INFO_PRINTF1(_L("The expected data for a service opqdata is not same as the actual recieved")); |
|
666 INFO_PRINTF2(_L("The expected data %S"), expectedDataBuffer); |
|
667 INFO_PRINTF2(_L("The Actual data %S"), actualDataBuffer); |
|
668 CleanupStack::PopAndDestroy(2, actualDataBuffer); |
|
669 return EFalse; |
|
670 } |
|
671 CleanupStack::PopAndDestroy(2, actualDataBuffer); |
|
672 |
|
673 } |
|
674 else |
|
675 { |
|
676 if(aActualData[i]->OpaqueData() != aExpectedData[i]->OpaqueData()) |
|
677 { |
|
678 INFO_PRINTF1(_L("The expected data for a service opqdata is not same as the actual recieved")); |
|
679 INFO_PRINTF2(_L("The expected data %S"), &aExpectedData[i]->OpaqueData()); |
|
680 INFO_PRINTF2(_L("The Actual data %S"), &aActualData[i]->OpaqueData()); |
|
681 return EFalse; |
|
682 } |
|
683 } |
|
684 } |
|
685 return ETrue; |
|
686 } |
|
687 |
|
688 TBool CScrGetApplicationRegistrationViewSubsessionStep::CompareServiceInfoL(RPointerArray<Usif::CServiceInfo> aActualData, RPointerArray<Usif::CServiceInfo> aExpectedData) |
|
689 { |
|
690 TInt expectedServicesCount = aExpectedData.Count(); |
|
691 TInt actualServicesCount = aActualData.Count(); |
|
692 |
|
693 if(actualServicesCount != expectedServicesCount) |
|
694 { |
|
695 INFO_PRINTF1(_L("The no of expected services for an app is not same as the no of actual services")); |
|
696 return EFalse; |
|
697 } |
|
698 |
|
699 for (TInt i=0 ; i < expectedServicesCount ; i++) |
|
700 { |
|
701 // Compare uids |
|
702 if(aExpectedData[i]->Uid() != aActualData[i]->Uid()) |
|
703 { |
|
704 INFO_PRINTF2(_L("Expected Uid 0x%08x"), aExpectedData[i]->Uid()); |
|
705 INFO_PRINTF2(_L("Actual Uid 0x%08x"), aActualData[i]->Uid()); |
|
706 INFO_PRINTF1(_L("The expected service uid is not same as the actual service uid")); |
|
707 return EFalse; |
|
708 } |
|
709 |
|
710 // Compare Opaque data |
|
711 if(!CompareOpaqueDataL(aActualData[i]->OpaqueData(), aExpectedData[i]->OpaqueData())) |
|
712 { |
|
713 return EFalse; |
|
714 } |
|
715 |
|
716 //compare data type |
|
717 if(!CompareDataType(aActualData[i]->DataTypes(), aExpectedData[i]->DataTypes())) |
|
718 { |
|
719 return EFalse; |
|
720 } |
|
721 } |
|
722 return ETrue; |
|
723 } |
|
724 |
|
725 TBool CScrGetApplicationRegistrationViewSubsessionStep::CompareCaptionandIconInfo(const CCaptionAndIconInfo* aActualData,const CCaptionAndIconInfo* aExpectedData) |
|
726 { |
|
727 if(aExpectedData == NULL && aActualData == NULL) |
|
728 { |
|
729 return ETrue; |
|
730 } |
|
731 |
|
732 if((aExpectedData == NULL && aActualData != NULL) || (aExpectedData != NULL && aActualData == NULL)) |
|
733 { |
|
734 INFO_PRINTF1(_L("The caption and icon info for a localizable is either not present ot not expected")); |
|
735 return EFalse; |
|
736 } |
|
737 |
|
738 if(aActualData->NumOfAppIcons() != aExpectedData->NumOfAppIcons()) |
|
739 { |
|
740 INFO_PRINTF1(_L("The expected no od icons for a locale is not same as the actual recieved")); |
|
741 return EFalse; |
|
742 } |
|
743 |
|
744 if(aActualData->Caption().Compare(aExpectedData->Caption())) |
|
745 { |
|
746 INFO_PRINTF1(_L("The expected caption for a locale is not same as the actual recieved")); |
|
747 return EFalse; |
|
748 } |
|
749 |
|
750 if(aActualData->IconFileName().Compare(aExpectedData->IconFileName())) |
|
751 { |
|
752 INFO_PRINTF2(_L("Expected Icon File %S"), &aExpectedData->IconFileName()); |
|
753 INFO_PRINTF2(_L("Actual Icon File %S"), &aActualData->IconFileName()); |
|
754 INFO_PRINTF1(_L("The expected icon file name is not same as the actual recieves")); |
|
755 return EFalse; |
|
756 } |
|
757 return ETrue; |
|
758 } |
|
759 |
|
760 TBool CScrGetApplicationRegistrationViewSubsessionStep::CompareViewData(RPointerArray<Usif::CAppViewData> aActualData, RPointerArray<Usif::CAppViewData> aExpectedData) |
|
761 { |
|
762 TInt expectedViewDataCount = aExpectedData.Count(); |
|
763 TInt actualViewDataCount = aActualData.Count(); |
|
764 |
|
765 if(actualViewDataCount != expectedViewDataCount) |
|
766 { |
|
767 INFO_PRINTF1(_L("The no of expected localizable info for an app is not same as the no of actual recieved")); |
|
768 return EFalse; |
|
769 } |
|
770 for (TInt i=0 ; i < expectedViewDataCount ; i++) |
|
771 { |
|
772 if(aExpectedData[i]->ScreenMode() != aActualData[i]->ScreenMode()) |
|
773 { |
|
774 INFO_PRINTF1(_L("The expected screen mode for a view is not same as the actual recieved")); |
|
775 return EFalse; |
|
776 } |
|
777 |
|
778 if(aExpectedData[i]->Uid() != aActualData[i]->Uid()) |
|
779 { |
|
780 INFO_PRINTF1(_L("The expected uid for a view is not same as the actual recieved")); |
|
781 return EFalse; |
|
782 } |
|
783 |
|
784 //compare captionandicon info |
|
785 if(!CompareCaptionandIconInfo(aActualData[i]->CaptionAndIconInfo(),aExpectedData[i]->CaptionAndIconInfo())) |
|
786 { |
|
787 return EFalse; |
|
788 } |
|
789 } |
|
790 return ETrue; |
|
791 } |
|
792 |
|
793 TBool CScrGetApplicationRegistrationViewSubsessionStep::CompareLocalizableAppInfo(RPointerArray<Usif::CLocalizableAppInfo> aActualData, RPointerArray<Usif::CLocalizableAppInfo> aExpectedData) |
|
794 { |
|
795 TInt expectedLocalizableCount = aExpectedData.Count(); |
|
796 TInt actualLocalizableCount = aActualData.Count(); |
|
797 |
|
798 if(actualLocalizableCount != expectedLocalizableCount) |
|
799 { |
|
800 INFO_PRINTF1(_L("The no of expected localizable info for an app is not same as the no of actual recieved")); |
|
801 return EFalse; |
|
802 } |
|
803 for (TInt i=0 ; i < expectedLocalizableCount ; i++) |
|
804 { |
|
805 if(aExpectedData[i]->ShortCaption().Compare(aActualData[i]->ShortCaption())) |
|
806 { |
|
807 INFO_PRINTF1(_L("The expected short caption for a localizable info is not same as the actual recieved")); |
|
808 return EFalse; |
|
809 } |
|
810 |
|
811 if(aExpectedData[i]->GroupName().Compare(aActualData[i]->GroupName())) |
|
812 { |
|
813 INFO_PRINTF1(_L("The expected group name for a localizable info is not same as the actual recieved")); |
|
814 return EFalse; |
|
815 } |
|
816 |
|
817 if(aExpectedData[i]->ApplicationLanguage() != aActualData[i]->ApplicationLanguage()) |
|
818 { |
|
819 INFO_PRINTF1(_L("The expected locale for a localizable info is not same as the actual recieved")); |
|
820 INFO_PRINTF2(_L("The expected language %d"), aExpectedData[i]->ApplicationLanguage()); |
|
821 INFO_PRINTF2(_L("The Actual language %d"), aActualData[i]->ApplicationLanguage()); |
|
822 return EFalse; |
|
823 } |
|
824 |
|
825 //compare caption and icon info |
|
826 if(!CompareCaptionandIconInfo(aActualData[i]->CaptionAndIconInfo(),aExpectedData[i]->CaptionAndIconInfo())) |
|
827 { |
|
828 return EFalse; |
|
829 } |
|
830 |
|
831 // compare view data |
|
832 if(!CompareViewData(aActualData[i]->ViewDataList(), aExpectedData[i]->ViewDataList())) |
|
833 { |
|
834 return EFalse; |
|
835 } |
|
836 } |
|
837 return ETrue; |
|
838 } |
|
839 |
|
840 TBool CScrGetApplicationRegistrationViewSubsessionStep::CompareApplicationRegistrationDataL( |
|
841 Usif::CApplicationRegistrationData *aActualData, |
|
842 Usif::CApplicationRegistrationData *aExpectedData) |
|
843 { |
|
844 //comparing AppRegistrationInfo |
|
845 if (aActualData->AppUid() != aExpectedData->AppUid()) |
|
846 { |
|
847 INFO_PRINTF2(_L("Actual AppUid is 0x%x"), aActualData->AppUid().iUid); |
|
848 INFO_PRINTF2(_L("Expected AppUid is 0x%x"), aExpectedData->AppUid().iUid); |
|
849 INFO_PRINTF1(_L("The expected App Uid is not same as the actual AppUid")); |
|
850 return EFalse; |
|
851 } |
|
852 |
|
853 if (aActualData->AppFile().Compare(aExpectedData->AppFile())) |
|
854 { |
|
855 INFO_PRINTF2(_L("Expected app File %S"), &aExpectedData->AppFile()); |
|
856 INFO_PRINTF2(_L("Actual app File %S"), &aActualData->AppFile()); |
|
857 INFO_PRINTF1(_L("The expected App File is not same as the actual App File")); |
|
858 return EFalse; |
|
859 } |
|
860 |
|
861 if (aActualData->Attributes() != aExpectedData->Attributes()) |
|
862 { |
|
863 INFO_PRINTF1(_L("The expected App Attribute is not same as the actual App Attribute")); |
|
864 return EFalse; |
|
865 } |
|
866 |
|
867 if (aActualData->Hidden() != aExpectedData->Hidden()) |
|
868 { |
|
869 INFO_PRINTF1(_L("The expected Hidden Value is not same as the actual App Hidden Value")); |
|
870 return EFalse; |
|
871 } |
|
872 |
|
873 if (aActualData->Embeddability() != aExpectedData->Embeddability()) |
|
874 { |
|
875 INFO_PRINTF1(_L("The expected embeddability value is not same as the actual embeddability value")); |
|
876 return EFalse; |
|
877 } |
|
878 |
|
879 if (aActualData->NewFile() != aExpectedData->NewFile()) |
|
880 { |
|
881 INFO_PRINTF1(_L("The expected App NewFile Value is not same as the actual App NewFile Value")); |
|
882 return EFalse; |
|
883 } |
|
884 |
|
885 if (aActualData->Launch() != aExpectedData->Launch()) |
|
886 { |
|
887 INFO_PRINTF1(_L("The expected App Launch Value is not same as the actual App Launch Value")); |
|
888 return EFalse; |
|
889 } |
|
890 |
|
891 if (aActualData->GroupName().Compare(aExpectedData->GroupName())) |
|
892 { |
|
893 INFO_PRINTF1(_L("The expected App Group Name is not same as the actual App Group Name")); |
|
894 return EFalse; |
|
895 } |
|
896 |
|
897 if (aActualData->DefaultScreenNumber() |
|
898 != aExpectedData->DefaultScreenNumber()) |
|
899 { |
|
900 INFO_PRINTF1(_L("The expected App DefaultScreenNumber is not same as the actual App DefaultScreenNumber")); |
|
901 return EFalse; |
|
902 } |
|
903 |
|
904 // Compare Opaque data |
|
905 if (!CompareOpaqueDataL(aActualData->AppOpaqueData(), |
|
906 aExpectedData->AppOpaqueData())) |
|
907 { |
|
908 return EFalse; |
|
909 } |
|
910 |
|
911 // comparing FileOwnershipInfo |
|
912 if (!CompareFileOwnershipInfo(aActualData->OwnedFileArray(), |
|
913 aExpectedData->OwnedFileArray())) |
|
914 { |
|
915 return EFalse; |
|
916 } |
|
917 |
|
918 // comparing Service info |
|
919 if (!CompareServiceInfoL(aActualData->ServiceArray(), |
|
920 aExpectedData->ServiceArray())) |
|
921 { |
|
922 return EFalse; |
|
923 } |
|
924 |
|
925 //comparing localizable app info |
|
926 if (!CompareLocalizableAppInfo(aActualData->LocalizableAppInfoList(), |
|
927 aExpectedData->LocalizableAppInfoList())) |
|
928 { |
|
929 return EFalse; |
|
930 } |
|
931 |
|
932 return ETrue; |
|
933 } |
|
934 |
|
935 //-----------------CScrGetApplicationRegistrationViewStep------------- |
|
936 |
|
937 CScrGetApplicationRegistrationViewSubsessionStep::CScrGetApplicationRegistrationViewSubsessionStep() |
|
938 { |
|
939 |
|
940 } |
|
941 |
|
942 CScrGetApplicationRegistrationViewSubsessionStep::~CScrGetApplicationRegistrationViewSubsessionStep() |
|
943 // Destructor. |
|
944 { |
|
945 iScrSession.Close(); |
|
946 } |
|
947 |
|
948 void CScrGetApplicationRegistrationViewSubsessionStep:: MarkAsPerformanceStep() |
|
949 { |
|
950 iIsPerformanceTest = ETrue; |
|
951 } |
|
952 |
|
953 void CScrGetApplicationRegistrationViewSubsessionStep::ImplTestStepPreambleL() |
|
954 { |
|
955 User::LeaveIfError(iScrSession.Connect()); |
|
956 } |
|
957 |
|
958 |
|
959 void CScrGetApplicationRegistrationViewSubsessionStep::GetApplicationRegistrationDataFromConfigL(RPointerArray<Usif::CApplicationRegistrationData>& aEntries) |
|
960 { |
|
961 TInt configSectionCount(0); |
|
962 CApplicationRegistrationData *applicationRegistrationData = NULL; |
|
963 TPtrC configSectionName(ConfigSection()); |
|
964 HBufC* cnfSecName = NULL; |
|
965 |
|
966 GetIntFromConfig(ConfigSection(), _L("AppRegEntriesConfigCount"), configSectionCount); |
|
967 |
|
968 for (TUint i = 0; i < configSectionCount; ++i) |
|
969 { |
|
970 TBuf<20> configSection = _L("configsection"); |
|
971 GenerateIndexedAttributeNameL(configSection, i); |
|
972 GetStringFromConfig(ConfigSection(),configSection, configSectionName); |
|
973 cnfSecName = configSectionName.AllocLC(); |
|
974 applicationRegistrationData = GetAppRegInfoFromConfigLC(cnfSecName); |
|
975 aEntries.AppendL(applicationRegistrationData); |
|
976 CleanupStack::Pop(applicationRegistrationData); |
|
977 CleanupStack::PopAndDestroy(cnfSecName); |
|
978 } |
|
979 } |
|
980 |
|
981 void CScrGetApplicationRegistrationViewSubsessionStep::ImplTestStepL() |
|
982 { |
|
983 TInt locale; |
|
984 TInt expextedAppRegDataCount(0); |
|
985 TInt actualAppRegDataCount(0); |
|
986 TInt count = 0; |
|
987 TInt remainingExpectedCount = 0; |
|
988 TBool isFinish = EFalse; |
|
989 TBool isError = EFalse; |
|
990 TInt index = 0; |
|
991 |
|
992 RPointerArray<Usif::CApplicationRegistrationData> expectedAppRegData; |
|
993 CleanupClosePushL(expectedAppRegData); |
|
994 INFO_PRINTF1(_L("Read expected entries for verification ")); |
|
995 GetApplicationRegistrationDataFromConfigL(expectedAppRegData); |
|
996 expextedAppRegDataCount = expectedAppRegData.Count(); |
|
997 remainingExpectedCount = expextedAppRegDataCount; |
|
998 |
|
999 TInt noOfEntries(1); |
|
1000 GetIntFromConfig(ConfigSection(), _L("NoOfEntries"), noOfEntries); |
|
1001 |
|
1002 TInt noOfAppRegAppUid = 0; |
|
1003 TBuf<20> appRegAppUidName; |
|
1004 RArray<TUid> expectedAppRegAppUids; |
|
1005 CleanupClosePushL(expectedAppRegAppUids); |
|
1006 |
|
1007 GetIntFromConfig(ConfigSection(), _L("AppRegAppUidCount"), noOfAppRegAppUid); |
|
1008 for (TUint i = 0; i < noOfAppRegAppUid; ++i) |
|
1009 { |
|
1010 TUid appRegAppUid; |
|
1011 appRegAppUidName = _L("AppRegAppUid"); |
|
1012 GenerateIndexedAttributeNameL(appRegAppUidName, i); |
|
1013 GetUidFromConfig(ConfigSection(), appRegAppUidName, appRegAppUid); |
|
1014 expectedAppRegAppUids.AppendL(appRegAppUid); |
|
1015 } |
|
1016 |
|
1017 TInt err = KErrNone; |
|
1018 RApplicationRegistryView subSession; |
|
1019 CleanupClosePushL(subSession); |
|
1020 if(GetIntFromConfig(ConfigSection(), _L("Locale"), locale)) |
|
1021 { |
|
1022 if(expectedAppRegAppUids.Count()) |
|
1023 { |
|
1024 TRAP(err,subSession.OpenViewL(iScrSession, expectedAppRegAppUids, (TLanguage)locale)); |
|
1025 } |
|
1026 else |
|
1027 { |
|
1028 TRAP(err,subSession.OpenViewL(iScrSession, (TLanguage)locale)); |
|
1029 } |
|
1030 if(KErrNone != err) |
|
1031 { |
|
1032 CleanupStack::PopAndDestroy(1,&subSession); |
|
1033 expectedAppRegAppUids.Close(); |
|
1034 CleanupStack::Pop(2); //poping expectedAppRegAppUids expectedAppRegData |
|
1035 expectedAppRegData.ResetAndDestroy(); |
|
1036 User::Leave(err); |
|
1037 } |
|
1038 } |
|
1039 else |
|
1040 { |
|
1041 if(expectedAppRegAppUids.Count()) |
|
1042 { |
|
1043 TRAP(err,subSession.OpenViewL(iScrSession, expectedAppRegAppUids)); |
|
1044 } |
|
1045 else |
|
1046 { |
|
1047 TRAP(err,subSession.OpenViewL(iScrSession)); |
|
1048 } |
|
1049 if(KErrNone != err) |
|
1050 { |
|
1051 CleanupStack::PopAndDestroy(1,&subSession); |
|
1052 expectedAppRegAppUids.Close(); |
|
1053 CleanupStack::Pop(2); //poping expectedAppRegAppUids expectedAppRegData |
|
1054 expectedAppRegData.ResetAndDestroy(); |
|
1055 User::Leave(err); |
|
1056 } |
|
1057 } |
|
1058 |
|
1059 RPointerArray<CApplicationRegistrationData> actualAppRegData; |
|
1060 CleanupClosePushL(actualAppRegData); |
|
1061 |
|
1062 while(1) |
|
1063 { |
|
1064 actualAppRegData.ResetAndDestroy(); |
|
1065 |
|
1066 if(iIsPerformanceTest) |
|
1067 StartTimer(); |
|
1068 TRAP(err,subSession.GetNextApplicationRegistrationInfoL(noOfEntries, actualAppRegData)) |
|
1069 if(iIsPerformanceTest) |
|
1070 StopTimerAndPrintResultL(); |
|
1071 |
|
1072 if( (KErrNone != err) || (iIsPerformanceTest && (EFail == TestStepResult())) ) |
|
1073 { |
|
1074 CleanupStack::Pop(1); //poping actualAppRegData |
|
1075 actualAppRegData.ResetAndDestroy(); |
|
1076 CleanupStack::PopAndDestroy(1,&subSession); |
|
1077 expectedAppRegAppUids.Close(); |
|
1078 CleanupStack::Pop(2); //poping expectedAppRegAppUids expectedAppRegData |
|
1079 expectedAppRegData.ResetAndDestroy(); |
|
1080 User::Leave(err); |
|
1081 } |
|
1082 |
|
1083 actualAppRegDataCount = actualAppRegData.Count(); |
|
1084 |
|
1085 if(remainingExpectedCount > noOfEntries) |
|
1086 { |
|
1087 count = noOfEntries; |
|
1088 remainingExpectedCount -= count; |
|
1089 } |
|
1090 else |
|
1091 { |
|
1092 count = remainingExpectedCount; |
|
1093 isFinish = ETrue; |
|
1094 } |
|
1095 |
|
1096 if(isFinish) |
|
1097 { |
|
1098 break; |
|
1099 } |
|
1100 |
|
1101 if (count != actualAppRegDataCount) |
|
1102 { |
|
1103 INFO_PRINTF1(_L("actualAppRegDataCount is not same as expextedAppRegDataCount")); |
|
1104 SetTestStepResult(EFail); |
|
1105 CleanupStack::Pop(1); //poping actualAppRegData |
|
1106 actualAppRegData.ResetAndDestroy(); |
|
1107 CleanupStack::PopAndDestroy(1,&subSession); |
|
1108 expectedAppRegAppUids.Close(); |
|
1109 CleanupStack::Pop(2); //poping expectedAppRegAppUids expectedAppRegData |
|
1110 expectedAppRegData.ResetAndDestroy(); |
|
1111 return; |
|
1112 } |
|
1113 |
|
1114 for(TInt i=0 ; i < count ; i++) |
|
1115 { |
|
1116 if(!CompareApplicationRegistrationDataL(actualAppRegData[i], expectedAppRegData[index])) |
|
1117 { |
|
1118 SetTestStepResult(EFail); |
|
1119 isError = ETrue; |
|
1120 break; |
|
1121 } |
|
1122 index++; |
|
1123 } |
|
1124 |
|
1125 if(isError) |
|
1126 { |
|
1127 break; |
|
1128 } |
|
1129 } |
|
1130 |
|
1131 CleanupStack::Pop(1); //poping actualAppRegData |
|
1132 actualAppRegData.ResetAndDestroy(); |
|
1133 CleanupStack::PopAndDestroy(1,&subSession); |
|
1134 expectedAppRegAppUids.Close(); |
|
1135 CleanupStack::Pop(2); //poping expectedAppRegAppUids expectedAppRegData |
|
1136 expectedAppRegData.ResetAndDestroy(); |
|
1137 } |
|
1138 |
|
1139 void CScrGetApplicationRegistrationViewSubsessionStep::ImplTestStepPostambleL() |
|
1140 { |
|
1141 |
|
1142 } |
|
1143 //-----------------CScrMultipleSubsessionsForAppRegistryViewStep------------- |
|
1144 |
|
1145 CScrMultipleSubsessionsForAppRegistryViewStep::CScrMultipleSubsessionsForAppRegistryViewStep() |
|
1146 { |
|
1147 |
|
1148 } |
|
1149 |
|
1150 CScrMultipleSubsessionsForAppRegistryViewStep::~CScrMultipleSubsessionsForAppRegistryViewStep() |
|
1151 // Destructor. |
|
1152 { |
|
1153 iScrSession.Close(); |
|
1154 } |
|
1155 |
|
1156 void CScrMultipleSubsessionsForAppRegistryViewStep::ImplTestStepPreambleL() |
|
1157 { |
|
1158 User::LeaveIfError(iScrSession.Connect()); |
|
1159 } |
|
1160 |
|
1161 void CScrMultipleSubsessionsForAppRegistryViewStep::ImplTestStepL() |
|
1162 { |
|
1163 TInt locale; |
|
1164 TInt actualAppRegDataCount(0); |
|
1165 TInt count = 0; |
|
1166 TInt index = 0; |
|
1167 |
|
1168 RPointerArray<Usif::CApplicationRegistrationData> expectedAppRegData; |
|
1169 CleanupClosePushL(expectedAppRegData); |
|
1170 INFO_PRINTF1(_L("Read expected entries for verification ")); |
|
1171 GetApplicationRegistrationDataFromConfigL(expectedAppRegData); |
|
1172 |
|
1173 TInt noOfEntries(1); |
|
1174 GetIntFromConfig(ConfigSection(), _L("NoOfEntries"), noOfEntries); |
|
1175 |
|
1176 TInt noOfAppRegAppUid = 0; |
|
1177 TBuf<20> appRegAppUidName; |
|
1178 RArray<TUid> appUidsBeingQueried; |
|
1179 CleanupClosePushL(appUidsBeingQueried); |
|
1180 |
|
1181 GetIntFromConfig(ConfigSection(), _L("AppRegAppUidCount"), noOfAppRegAppUid); |
|
1182 for (TUint i = 0; i < noOfAppRegAppUid; ++i) |
|
1183 { |
|
1184 TUid appRegAppUid; |
|
1185 appRegAppUidName = _L("AppRegAppUid"); |
|
1186 GenerateIndexedAttributeNameL(appRegAppUidName, i); |
|
1187 GetUidFromConfig(ConfigSection(), appRegAppUidName, appRegAppUid); |
|
1188 appUidsBeingQueried.AppendL(appRegAppUid); |
|
1189 } |
|
1190 |
|
1191 GetIntFromConfig(ConfigSection(), _L("Locale"), locale); |
|
1192 |
|
1193 TInt err = KErrNone; |
|
1194 RApplicationRegistryView subSession; |
|
1195 CleanupClosePushL(subSession); |
|
1196 |
|
1197 TRAP(err,subSession.OpenViewL(iScrSession, (TLanguage)locale)); |
|
1198 if(KErrNone != err) |
|
1199 { |
|
1200 CleanupStack::PopAndDestroy(1,&subSession); |
|
1201 appUidsBeingQueried.Close(); |
|
1202 CleanupStack::Pop(2); //poping appUidsBeingQueried expectedAppRegData |
|
1203 expectedAppRegData.ResetAndDestroy(); |
|
1204 User::Leave(err); |
|
1205 } |
|
1206 |
|
1207 RPointerArray<CApplicationRegistrationData> actualAppRegData; |
|
1208 CleanupClosePushL(actualAppRegData); |
|
1209 |
|
1210 actualAppRegData.ResetAndDestroy(); |
|
1211 TRAP(err,subSession.GetNextApplicationRegistrationInfoL(noOfEntries, actualAppRegData)); |
|
1212 if(KErrNone != err) |
|
1213 { |
|
1214 CleanupStack::Pop(1); //poping actualAppRegData |
|
1215 actualAppRegData.ResetAndDestroy(); |
|
1216 CleanupStack::PopAndDestroy(1,&subSession); |
|
1217 appUidsBeingQueried.Close(); |
|
1218 CleanupStack::Pop(2); //poping appUidsBeingQueried expectedAppRegData |
|
1219 expectedAppRegData.ResetAndDestroy(); |
|
1220 User::Leave(err); |
|
1221 } |
|
1222 |
|
1223 actualAppRegDataCount = actualAppRegData.Count(); |
|
1224 count = noOfEntries; |
|
1225 |
|
1226 if (count != actualAppRegDataCount) |
|
1227 { |
|
1228 INFO_PRINTF1(_L("actualAppRegDataCount is not same as noOfEntries")); |
|
1229 SetTestStepResult(EFail); |
|
1230 CleanupStack::Pop(1); //poping actualAppRegData |
|
1231 actualAppRegData.ResetAndDestroy(); |
|
1232 CleanupStack::PopAndDestroy(1,&subSession); |
|
1233 appUidsBeingQueried.Close(); |
|
1234 CleanupStack::Pop(2); //poping appUidsBeingQueried expectedAppRegData |
|
1235 expectedAppRegData.ResetAndDestroy(); |
|
1236 return; |
|
1237 } |
|
1238 |
|
1239 for(TInt i=0 ; i < count ; i++) |
|
1240 { |
|
1241 // Compare the first "count" number of entries in the DB to the entries specified in the config file. |
|
1242 if(!CompareApplicationRegistrationDataL(actualAppRegData[i], expectedAppRegData[index])) |
|
1243 { |
|
1244 SetTestStepResult(EFail); |
|
1245 break; |
|
1246 } |
|
1247 index++; |
|
1248 } |
|
1249 |
|
1250 actualAppRegData.ResetAndDestroy(); |
|
1251 TRAP(err,subSession.OpenViewL(iScrSession, appUidsBeingQueried, (TLanguage)locale)); |
|
1252 if(KErrNone != err) |
|
1253 { |
|
1254 CleanupStack::PopAndDestroy(1,&subSession); |
|
1255 appUidsBeingQueried.Close(); |
|
1256 CleanupStack::Pop(2); //poping appUidsBeingQueried expectedAppRegData |
|
1257 expectedAppRegData.ResetAndDestroy(); |
|
1258 User::Leave(err); |
|
1259 } |
|
1260 |
|
1261 TRAP(err,subSession.GetNextApplicationRegistrationInfoL(noOfEntries, actualAppRegData)) |
|
1262 if(KErrNone != err) |
|
1263 { |
|
1264 CleanupStack::Pop(1); //poping actualAppRegData |
|
1265 actualAppRegData.ResetAndDestroy(); |
|
1266 CleanupStack::PopAndDestroy(1,&subSession); |
|
1267 appUidsBeingQueried.Close(); |
|
1268 CleanupStack::Pop(2); //poping appUidsBeingQueried expectedAppRegData |
|
1269 expectedAppRegData.ResetAndDestroy(); |
|
1270 User::Leave(err); |
|
1271 } |
|
1272 |
|
1273 actualAppRegDataCount = actualAppRegData.Count(); |
|
1274 count = noOfAppRegAppUid; |
|
1275 |
|
1276 if (count != actualAppRegDataCount) |
|
1277 { |
|
1278 INFO_PRINTF1(_L("actualAppRegDataCount is not same as noOfAppRegAppUid to be fetched")); |
|
1279 SetTestStepResult(EFail); |
|
1280 CleanupStack::Pop(1); //poping actualAppRegData |
|
1281 actualAppRegData.ResetAndDestroy(); |
|
1282 CleanupStack::PopAndDestroy(1,&subSession); |
|
1283 appUidsBeingQueried.Close(); |
|
1284 CleanupStack::Pop(2); //poping appUidsBeingQueried expectedAppRegData |
|
1285 expectedAppRegData.ResetAndDestroy(); |
|
1286 return; |
|
1287 } |
|
1288 |
|
1289 index = 0; |
|
1290 for(TInt i=0 ; i < count ; i++) |
|
1291 { |
|
1292 // Compare the entries fetched from the DB to the entries specified in the config file. |
|
1293 if(!CompareApplicationRegistrationDataL(actualAppRegData[i], expectedAppRegData[index])) |
|
1294 { |
|
1295 SetTestStepResult(EFail); |
|
1296 break; |
|
1297 } |
|
1298 index++; |
|
1299 } |
|
1300 |
|
1301 CleanupStack::Pop(1); //poping actualAppRegData |
|
1302 actualAppRegData.ResetAndDestroy(); |
|
1303 CleanupStack::PopAndDestroy(1,&subSession); |
|
1304 appUidsBeingQueried.Close(); |
|
1305 CleanupStack::Pop(2); //poping appUidsBeingQueried expectedAppRegData |
|
1306 expectedAppRegData.ResetAndDestroy(); |
|
1307 } |
|
1308 |
|
1309 void CScrMultipleSubsessionsForAppRegistryViewStep::ImplTestStepPostambleL() |
|
1310 { |
|
1311 |
|
1312 } |
|