1 // Copyright (c) 2006-2010 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 "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". |
32 */ |
32 */ |
33 |
33 |
34 |
34 |
35 #include <apgcli.h> |
35 #include <apgcli.h> |
36 #include "T_AppListFileUpdateStep.h" |
36 #include "T_AppListFileUpdateStep.h" |
37 #include "T_SisFileInstaller.h" |
37 |
38 |
38 _LIT(KTestAppZPath,"Z:\\ApparcTest\\TestAppInstall_reg.RSC"); |
39 _LIT(KApparcTestAppSisFile, "z:\\apparctest\\apparctestsisfiles\\TApparcTestApp.sis"); |
|
40 _LIT(KApparcTestAppComponent, "TApparcTestApp"); |
|
41 |
|
42 _LIT(KAppListFileName,"C:\\private\\10003a3f\\AppsListCache\\AppsList.bin"); |
39 _LIT(KAppListFileName,"C:\\private\\10003a3f\\AppsListCache\\AppsList.bin"); |
43 _LIT(KAppTimeFormat,"%:0%H%:1%T%:2%S%:3"); |
40 _LIT(KAppTimeFormat,"%:0%H%:1%T%:2%S%:3"); |
|
41 _LIT(KAppDirectory,"C:\\Private\\10003a3f\\Import\\apps\\"); |
|
42 _LIT(KTestAppObsolutePath1,"C:\\Private\\10003a3f\\Import\\apps\\TestAppInstall_reg.RSC"); |
44 |
43 |
45 const TInt KMaxTimeCount = 18; // 18 * 10 is 180 Seconds |
44 const TInt KMaxTimeCount = 18; // 18 * 10 is 180 Seconds |
46 |
45 |
47 |
46 |
48 CT_AppListFileUpdateStep::CT_AppListFileUpdateStep() |
47 CT_AppListFileUpdateStep::CT_AppListFileUpdateStep() |
127 @SYMTestExpectedResults Modified time of AppsList.bin after installation must be greater than before installation. |
126 @SYMTestExpectedResults Modified time of AppsList.bin after installation must be greater than before installation. |
128 */ |
127 */ |
129 |
128 |
130 void CT_AppListFileUpdateStep::TestTimeStampL() |
129 void CT_AppListFileUpdateStep::TestTimeStampL() |
131 { |
130 { |
|
131 // Create KAppDirectory |
|
132 TInt err = iUtils.CreateDirectoryL(KAppDirectory); |
|
133 TEST(err == KErrNone || err == KErrAlreadyExists); |
132 |
134 |
133 // Wait until KAppListFileName is present and check that the file has been created indeed |
135 // Wait until KAppListFileName is present and check that the file has been created indeed |
134 TBool present = CheckForFilePresent(); |
136 TBool present = CheckForFilePresent(); |
135 TEST(present); |
137 TEST(present); |
136 |
138 |
139 TTime timeBeforeAppListModification; |
141 TTime timeBeforeAppListModification; |
140 AppsListModifiedTimeL(timeBeforeAppListModification); |
142 AppsListModifiedTimeL(timeBeforeAppListModification); |
141 |
143 |
142 // Install an application |
144 // Install an application |
143 INFO_PRINTF1(_L("Install application...")); |
145 INFO_PRINTF1(_L("Install application...")); |
144 |
146 InstallApplicationL(KTestAppObsolutePath1); |
145 CSisFileInstaller sisFileInstaller; |
147 |
146 INFO_PRINTF2(_L("Installing sis file from -> %S"), &KApparcTestAppSisFile); |
|
147 sisFileInstaller.InstallSisAndWaitForAppListUpdateL(KApparcTestAppSisFile); |
|
148 |
|
149 // wait 5 seconds for the app to be properly installed |
148 // wait 5 seconds for the app to be properly installed |
150 User::After(5 * 1000000); |
149 User::After(5 * 1000000); |
151 |
150 |
152 // Wait until KAppListFileName is present and check that the file has been created indeed. |
151 // Wait until KAppListFileName is present and check that the file has been created indeed. |
153 present = CheckForFilePresent(); |
152 present = CheckForFilePresent(); |
161 // Check that the modification time "after" is after the modification time "before" |
160 // Check that the modification time "after" is after the modification time "before" |
162 TEST(timeAfterAppListModification > timeBeforeAppListModification); |
161 TEST(timeAfterAppListModification > timeBeforeAppListModification); |
163 |
162 |
164 // Uninstall & delete... |
163 // Uninstall & delete... |
165 INFO_PRINTF1(_L("Uninstalling application...")); |
164 INFO_PRINTF1(_L("Uninstalling application...")); |
166 sisFileInstaller.UninstallSisAndWaitForAppListUpdateL(KApparcTestAppComponent); |
165 DeleteApplicationL(KTestAppObsolutePath1); |
167 } |
166 } |
168 |
167 |
169 |
168 |
|
169 /* |
|
170 Delete a registration resource file (TestAppInstall.rsc) in the path "C:\private\10003a3f\import\apps" . |
|
171 */ |
|
172 void CT_AppListFileUpdateStep::DeleteApplicationL(const TDesC& aAppName) |
|
173 { |
|
174 INFO_PRINTF2(_L("Deleting file '%S'"), &aAppName); |
|
175 |
|
176 TInt ret = iUtils.SetReadOnly(aAppName, 0); |
|
177 TEST(ret == KErrNone); |
|
178 ret = iUtils.DeleteFileL(aAppName); |
|
179 TEST(ret == KErrNone); |
|
180 } |
|
181 |
|
182 |
|
183 /* |
|
184 Copy a registration resource file (TestAppInstall.rsc) in the path "c:\private\10003a3f\import\apps" . |
|
185 */ |
|
186 void CT_AppListFileUpdateStep::InstallApplicationL(const TDesC& aAppName) |
|
187 { |
|
188 INFO_PRINTF3(_L("Copying file '%S' to folder '%S'"), &aAppName, &KTestAppZPath); |
|
189 |
|
190 TInt ret = iUtils.CopyFileL(KTestAppZPath, aAppName); |
|
191 TEST(ret == KErrNone); |
|
192 } |
170 |
193 |
171 |
194 |
172 /* |
195 /* |
173 Gets the modified time for AppsList.bin |
196 Gets the modified time for AppsList.bin |
174 */ |
197 */ |
222 present = CheckForFilePresent(); |
245 present = CheckForFilePresent(); |
223 TEST(!present); |
246 TEST(!present); |
224 |
247 |
225 // Do a rescan and check that the file exists again. |
248 // Do a rescan and check that the file exists again. |
226 INFO_PRINTF1(_L("Do a rescan and check that the file exists again....")); |
249 INFO_PRINTF1(_L("Do a rescan and check that the file exists again....")); |
227 CSisFileInstaller sisFileInstaller; |
250 RPointerArray<TDesC> dummy; |
228 INFO_PRINTF2(_L("Installing sis file from -> %S"), &KApparcTestAppSisFile); |
251 TEST(iSession.ForceRegistration(dummy) == KErrNone); |
229 sisFileInstaller.InstallSisAndWaitForAppListUpdateL(KApparcTestAppSisFile); |
|
230 |
|
231 present = CheckForFilePresent(); |
252 present = CheckForFilePresent(); |
232 TEST(present); |
253 TEST(present); |
233 sisFileInstaller.UninstallSisAndWaitForAppListUpdateL(KApparcTestAppComponent); |
|
234 } |
254 } |
235 |
255 |
236 |
256 |
237 /* |
257 /* |
238 Checks whether the "AppList.Bin" exists, if not waits for a maximum time of (KMaxTimeCount * 10) seconds for the file to create. |
258 Checks whether the "AppList.Bin" exists, if not waits for a maximum time of (KMaxTimeCount * 10) seconds for the file to create. |