|
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 "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Tests CApaAppRegFinder APIs. |
|
15 // |
|
16 // t_file2step.cpp |
|
17 // |
|
18 |
|
19 /** |
|
20 @file t_file2step.cpp |
|
21 @internalComponent - Internal Symbian test code |
|
22 */ |
|
23 |
|
24 #include "T_File2Step.h" |
|
25 #include "../aplist/aplappregfinder.h" // class CApaAppRegFinder |
|
26 #include "../aplist/aplapplistitem.h" // class TApaAppEntry |
|
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(CApaAppRegFinder::EScanAllDrives) ); |
|
62 TEST(ret==KErrNone); |
|
63 // |
|
64 CDesCArray* dummyArray = new (ELeave) CDesCArraySeg(1); |
|
65 CleanupStack::PushL(dummyArray); |
|
66 TBool more=ETrue; |
|
67 TInt count=0; |
|
68 while (more) |
|
69 { |
|
70 TApaAppEntry entry; |
|
71 TRAPD(ret, more=regFinder->NextL(entry, *dummyArray) ); |
|
72 TEST(ret==KErrNone); |
|
73 if (more) |
|
74 count++; |
|
75 } |
|
76 TEST(count>0); |
|
77 INFO_PRINTF2(_L(" Apps found: %D"),count); |
|
78 // |
|
79 CleanupStack::PopAndDestroy(dummyArray); |
|
80 delete regFinder; |
|
81 fSession.Close(); |
|
82 } |
|
83 |
|
84 CT_File2Step::~CT_File2Step() |
|
85 /** |
|
86 Destructor |
|
87 */ |
|
88 { |
|
89 } |
|
90 |
|
91 CT_File2Step::CT_File2Step() |
|
92 /** |
|
93 Constructor |
|
94 */ |
|
95 { |
|
96 // Call base class method to set up the human readable name for logging |
|
97 SetTestStepName(KT_File2Step); |
|
98 } |
|
99 |
|
100 TVerdict CT_File2Step::doTestStepPreambleL() |
|
101 /** |
|
102 @return - TVerdict code |
|
103 Override of base class virtual |
|
104 */ |
|
105 { |
|
106 SetTestStepResult(EPass); |
|
107 return TestStepResult(); |
|
108 } |
|
109 |
|
110 TVerdict CT_File2Step::doTestStepPostambleL() |
|
111 /** |
|
112 @return - TVerdict code |
|
113 Override of base class virtual |
|
114 */ |
|
115 { |
|
116 return TestStepResult(); |
|
117 } |
|
118 |
|
119 TVerdict CT_File2Step::doTestStepL() |
|
120 /** |
|
121 @return - TVerdict code |
|
122 Override of base class virtual |
|
123 */ |
|
124 { |
|
125 INFO_PRINTF1(_L("Testing the APFILE dll...")); |
|
126 // |
|
127 |
|
128 __UHEAP_MARK; |
|
129 TRAPD(r,testFindAllAppsRegL()); |
|
130 TEST(r==KErrNone); |
|
131 __UHEAP_MARKEND; |
|
132 |
|
133 INFO_PRINTF1(_L("Test completed!")); |
|
134 return TestStepResult(); |
|
135 } |
|
136 |