|
1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of the License "Symbian Foundation License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Tests CApaAppRegFinder APIs. |
|
15 // |
|
16 // |
|
17 |
|
18 |
|
19 |
|
20 /** |
|
21 @file |
|
22 @internalComponent - Internal Symbian test code |
|
23 */ |
|
24 |
|
25 #include "T_File2Step.h" |
|
26 #include "..\apfile\aprfndr.h" |
|
27 |
|
28 // |
|
29 #if !defined(__E32TEST_H__) |
|
30 #include <e32test.h> |
|
31 #endif |
|
32 |
|
33 /** |
|
34 @SYMTestCaseID T-FileStep-testFindAllAppsRegL |
|
35 |
|
36 @SYMPREQ |
|
37 |
|
38 @SYMTestCaseDesc Test CApaAppRegFinder::FindAllAppsL() API. |
|
39 |
|
40 @SYMTestPriority High |
|
41 |
|
42 @SYMTestStatus Implemented |
|
43 |
|
44 @SYMTestActions The method creates an Application Finder object and calls |
|
45 CApaAppRegFinder::FindAllAppsL() to perform a complete scan of all |
|
46 available applications. It traverses through the application list by calling |
|
47 CApaAppRegFinder::NextL() to confirm that the list contains entries.\n |
|
48 API Calls:\n |
|
49 CApaAppRegFinder::FindAllAppsL()\n |
|
50 |
|
51 @SYMTestExpectedResults Test checks the number of applications present in the list. |
|
52 |
|
53 */ |
|
54 void CT_File2Step::testFindAllAppsRegL() |
|
55 { |
|
56 INFO_PRINTF1(_L("Testing CApaAppRegFinder::FindAllAppsL()")); |
|
57 RFs fSession; |
|
58 fSession.Connect(); |
|
59 CApaAppRegFinder* regFinder=CApaAppRegFinder::NewL(fSession); |
|
60 // |
|
61 TRAPD(ret, regFinder->FindAllAppsL() ); |
|
62 TEST(ret==KErrNone); |
|
63 // |
|
64 TBool more=ETrue; |
|
65 TInt count=0; |
|
66 while (more) |
|
67 { |
|
68 TApaAppEntry entry; |
|
69 RPointerArray<HBufC> dummy; |
|
70 TRAPD(ret, more=regFinder->NextL(entry, dummy) ); |
|
71 TEST(ret==KErrNone); |
|
72 if (more) |
|
73 count++; |
|
74 } |
|
75 TEST(count>0); |
|
76 INFO_PRINTF2(_L(" Apps found: %D"),count); |
|
77 // |
|
78 delete regFinder; |
|
79 fSession.Close(); |
|
80 } |
|
81 |
|
82 CT_File2Step::~CT_File2Step() |
|
83 /** |
|
84 Destructor |
|
85 */ |
|
86 { |
|
87 } |
|
88 |
|
89 CT_File2Step::CT_File2Step() |
|
90 /** |
|
91 Constructor |
|
92 */ |
|
93 { |
|
94 // Call base class method to set up the human readable name for logging |
|
95 SetTestStepName(KT_File2Step); |
|
96 } |
|
97 |
|
98 TVerdict CT_File2Step::doTestStepPreambleL() |
|
99 /** |
|
100 @return - TVerdict code |
|
101 Override of base class virtual |
|
102 */ |
|
103 { |
|
104 SetTestStepResult(EPass); |
|
105 return TestStepResult(); |
|
106 } |
|
107 |
|
108 TVerdict CT_File2Step::doTestStepPostambleL() |
|
109 /** |
|
110 @return - TVerdict code |
|
111 Override of base class virtual |
|
112 */ |
|
113 { |
|
114 return TestStepResult(); |
|
115 } |
|
116 |
|
117 TVerdict CT_File2Step::doTestStepL() |
|
118 /** |
|
119 @return - TVerdict code |
|
120 Override of base class virtual |
|
121 */ |
|
122 { |
|
123 INFO_PRINTF1(_L("Testing the APFILE dll...")); |
|
124 // |
|
125 |
|
126 __UHEAP_MARK; |
|
127 TRAPD(r,testFindAllAppsRegL()); |
|
128 TEST(r==KErrNone); |
|
129 __UHEAP_MARKEND; |
|
130 |
|
131 INFO_PRINTF1(_L("Test completed!")); |
|
132 return TestStepResult(); |
|
133 } |