1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of the License "Eclipse Public License v1.0" |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 // |
7 // |
8 // Initial Contributors: |
8 // Initial Contributors: |
9 // Nokia Corporation - initial contribution. |
9 // Nokia Corporation - initial contribution. |
11 // Contributors: |
11 // Contributors: |
12 // |
12 // |
13 // Description: |
13 // Description: |
14 // Tests CApaAppRegFinder APIs. |
14 // Tests CApaAppRegFinder APIs. |
15 // |
15 // |
|
16 // t_file3step.cpp |
16 // |
17 // |
17 |
18 |
18 |
19 /** |
19 |
20 @file t_file3step.cpp |
20 /** |
|
21 @file |
|
22 @internalComponent - Internal Symbian test code |
21 @internalComponent - Internal Symbian test code |
23 */ |
22 */ |
24 |
23 |
25 #include <apgicnfl.h> |
24 #include <apgicnfl.h> |
|
25 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
26 #include <apgicnflpartner.h> |
|
27 #endif //SYMBIAN_ENABLE_SPLIT_HEADERS |
26 #include <e32property.h> |
28 #include <e32property.h> |
27 #include "T_File3Step.h" |
29 #include "T_File3Step.h" |
28 #include "..\apfile\aprfndr.h" |
30 #include "../aplist/aplappregfinder.h" // class CApaAppRegFinder |
29 #include "TSidChecker\TestSidChecker.h" |
31 #include "../aplist/aplapplistitem.h" // class TApaAppEntry |
|
32 #include "TSidChecker/TestSidChecker.h" |
30 |
33 |
31 #include <e32test.h> |
34 #include <e32test.h> |
32 #include <f32file.h> |
35 #include <f32file.h> |
33 |
36 |
34 _LIT(KCallBackAppRsc,"\\private\\10003a3f\\import\\apps\\NonNative\\Resource\\10281fe0_reg.rsc"); |
37 _LIT(KCallBackAppRsc,"\\private\\10003a3f\\import\\apps\\NonNative\\Resource\\10281fe0_reg.rsc"); |
209 RFs fSession; |
212 RFs fSession; |
210 User::LeaveIfError(fSession.Connect()); |
213 User::LeaveIfError(fSession.Connect()); |
211 CleanupClosePushL(fSession); |
214 CleanupClosePushL(fSession); |
212 CApaAppRegFinder* regFinder=CApaAppRegFinder::NewLC(fSession); |
215 CApaAppRegFinder* regFinder=CApaAppRegFinder::NewLC(fSession); |
213 |
216 |
214 TRAPD(ret, regFinder->FindAllAppsL() ); |
217 TRAPD(ret, regFinder->FindAllAppsL(CApaAppRegFinder::EScanAllDrives) ); |
215 TEST(ret==KErrNone); |
218 TEST(ret==KErrNone); |
216 |
219 |
|
220 CDesCArray* dummyArray = new (ELeave) CDesCArraySeg(1); |
|
221 CleanupStack::PushL(dummyArray); |
|
222 TApaAppEntry entry; |
217 TBool more = ETrue; |
223 TBool more = ETrue; |
218 TBool foundGoodApp = EFalse; |
224 TBool foundGoodApp = EFalse; |
219 TBool foundBadApp = EFalse; |
225 TBool foundBadApp = EFalse; |
220 while (more) |
226 while (more) |
221 { |
227 { |
222 TApaAppEntry entry; |
228 TRAPD(ret, more=regFinder->NextL(entry, *dummyArray) ); |
223 RPointerArray<HBufC> dummy; |
|
224 TRAPD(ret, more=regFinder->NextL(entry, dummy) ); |
|
225 TEST(ret==KErrNone); |
229 TEST(ret==KErrNone); |
226 if(entry.iUidType[2] == KApFileTestBadApp) |
230 if(entry.iUidType[2] == KApFileTestBadApp) |
227 foundBadApp = ETrue; |
231 foundBadApp = ETrue; |
228 if(entry.iUidType[2] == KApFileTestGoodApp) |
232 if(entry.iUidType[2] == KApFileTestGoodApp) |
229 foundGoodApp = ETrue; |
233 foundGoodApp = ETrue; |
230 } |
234 } |
231 TEST(foundGoodApp); |
235 TEST(foundGoodApp); |
232 TEST(!foundBadApp); |
236 TEST(!foundBadApp); |
233 |
237 |
|
238 CleanupStack::PopAndDestroy(dummyArray); |
234 CleanupStack::PopAndDestroy(2,&fSession); |
239 CleanupStack::PopAndDestroy(2,&fSession); |
235 |
240 |
236 /* |
241 /* |
237 * Cleanup |
242 * Cleanup |
238 */ |
243 */ |
476 |
481 |
477 RTimer timer; |
482 RTimer timer; |
478 CleanupClosePushL(timer); |
483 CleanupClosePushL(timer); |
479 User::LeaveIfError(timer.CreateLocal()); |
484 User::LeaveIfError(timer.CreateLocal()); |
480 TRequestStatus timerStatus; |
485 TRequestStatus timerStatus; |
481 timer.After(timerStatus,50 * 1000000); |
486 timer.After(timerStatus,30 * 1000000); |
482 |
487 |
483 RPointerArray<TDesC> empty; |
488 RPointerArray<TDesC> empty; |
484 ret = iSession.ForceRegistration(empty); |
489 ret = iSession.ForceRegistration(empty); |
485 TEST(ret==KErrNone); |
490 TEST(ret==KErrNone); |
486 |
491 |