1 // Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2007-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". |
48 #include "appfwk_test_utils.h" |
48 #include "appfwk_test_utils.h" |
49 |
49 |
50 #if !defined(__E32TEST_H__) |
50 #if !defined(__E32TEST_H__) |
51 #include <e32test.h> |
51 #include <e32test.h> |
52 #endif |
52 #endif |
53 #include "T_SisFileInstaller.h" |
|
54 |
|
55 _LIT(KMCtrlAppV2SisFile, "z:\\apparctest\\apparctestsisfiles\\m_ctrl_v2.sis"); |
|
56 _LIT(KMCtrlAppV2Component, "m_ctrl_v2"); |
|
57 |
|
58 _LIT(KTstAppStandAloneSisFile, "z:\\apparctest\\apparctestsisfiles\\TSTAPP_standalone.sis"); |
|
59 _LIT(KTstAppStandAloneComponent, "TSTAPP_standalone"); |
|
60 |
|
61 |
53 |
62 TInt PanicTestThread(TAny* aOption); |
54 TInt PanicTestThread(TAny* aOption); |
63 |
55 |
64 enum TPanicOption |
56 enum TPanicOption |
65 { |
57 { |
67 ENegativePanicTest, |
59 ENegativePanicTest, |
68 EUnknownPanicOption, |
60 EUnknownPanicOption, |
69 ELast |
61 ELast |
70 }; |
62 }; |
71 |
63 |
|
64 |
|
65 _LIT(KCTLDIR,"C:\\private\\10003a3f\\import\\apps\\"); |
|
66 _LIT(KSOURCEPATH,"z:\\private\\10003a3f\\import\\apps\\m_ctrl_reg.rsc"); |
|
67 _LIT(KNEWCTLPATH,"C:\\private\\10003a3f\\import\\apps\\m_ctrl_reg.rsc"); |
72 _LIT(KNEWPATH,"C:\\cm.txt"); |
68 _LIT(KNEWPATH,"C:\\cm.txt"); |
73 _LIT(KEMPTYFILEPATH,"z:\\system\\data\\Testpath\\FilterTests\\testfile1.txt"); |
69 _LIT(KEMPTYFILEPATH,"z:\\system\\data\\Testpath\\FilterTests\\testfile1.txt"); |
74 |
70 |
|
71 _LIT(KRSCDIR,"C:\\Resource\\apps\\"); |
|
72 _LIT(KLOCPATH,"z:\\Resource\\apps\\M_ctrl_loc.rsc"); |
|
73 _LIT(KNEWLOCPATH,"C:\\Resource\\apps\\M_ctrl_loc.rsc"); |
75 _LIT(KCTRLNAME,"C:\\sys\\bin\\m_ctrl.exe"); |
74 _LIT(KCTRLNAME,"C:\\sys\\bin\\m_ctrl.exe"); |
76 TFileName ctlPath=_L("z:\\sys\\bin\\m_ctrl.exe"); |
75 TFileName ctlPath=_L("z:\\sys\\bin\\m_ctrl.exe"); |
77 |
76 |
78 |
77 |
79 LOCAL_D TInt SimulateKeyL(TAny*) |
78 LOCAL_D TInt SimulateKeyL(TAny*) |
1014 void CT_ProStep::testControls2L() |
1013 void CT_ProStep::testControls2L() |
1015 { |
1014 { |
1016 RSmlTestUtils testSession; |
1015 RSmlTestUtils testSession; |
1017 User::LeaveIfError(testSession.Connect()); |
1016 User::LeaveIfError(testSession.Connect()); |
1018 |
1017 |
1019 CSisFileInstaller sisFileInstaller; |
1018 testSession.CreateDirectoryL(KCTLDIR); |
1020 INFO_PRINTF2(_L("Installing sis file from -> %S"), &KMCtrlAppV2SisFile); |
1019 testSession.CreateDirectoryL(KRSCDIR); |
1021 sisFileInstaller.InstallSisL(KMCtrlAppV2SisFile); |
1020 |
1022 TInt ret; |
1021 TInt ret=testSession.CopyFileL(KSOURCEPATH,KNEWCTLPATH); |
|
1022 TEST(ret==KErrNone); |
|
1023 ret=testSession.CopyFileL(KLOCPATH,KNEWLOCPATH); |
|
1024 TEST(ret==KErrNone); |
|
1025 |
1023 TInt controlCount=iControlList->UpdateCount(); |
1026 TInt controlCount=iControlList->UpdateCount(); |
1024 while(iControlList->UpdateCount()<=controlCount) |
1027 while(iControlList->UpdateCount()<=controlCount) |
1025 { |
1028 { |
1026 TRAP(ret, iControlList->UpdateL()); |
1029 TRAP(ret, iControlList->UpdateL()); |
1027 if(ret!=KErrNone) |
1030 if(ret!=KErrNone) |
1043 TFileName name=iControlList->Control(index)->FileName(); |
1046 TFileName name=iControlList->Control(index)->FileName(); |
1044 TEST(name.CompareF(KCTRLNAME)==0); |
1047 TEST(name.CompareF(KCTRLNAME)==0); |
1045 } |
1048 } |
1046 |
1049 |
1047 // hide the control and do an update - there should be changes |
1050 // hide the control and do an update - there should be changes |
1048 sisFileInstaller.UninstallSisAndWaitForAppListUpdateL(KMCtrlAppV2Component); |
1051 testSession.SetReadOnly(KNEWCTLPATH,0); // remove the read only attribute |
1049 |
1052 ret=testSession.DeleteFileL(KNEWCTLPATH); |
|
1053 TEST(ret==KErrNone); |
|
1054 testSession.SetReadOnly(KNEWLOCPATH,0); // remove the read only attribute |
|
1055 ret=testSession.DeleteFileL(KNEWLOCPATH); |
1050 TEST(ret==KErrNone); |
1056 TEST(ret==KErrNone); |
1051 controlCount=iControlList->UpdateCount(); |
1057 controlCount=iControlList->UpdateCount(); |
1052 while(iControlList->UpdateCount()<=controlCount) |
1058 while(iControlList->UpdateCount()<=controlCount) |
1053 { |
1059 { |
1054 TRAPD(ret, iControlList->UpdateL()); |
1060 TRAPD(ret, iControlList->UpdateL()); |
1137 */ |
1143 */ |
1138 void CT_ProStep::testControlsL() |
1144 void CT_ProStep::testControlsL() |
1139 { |
1145 { |
1140 INFO_PRINTF1(_L("Testing CApaSystemControlList")); |
1146 INFO_PRINTF1(_L("Testing CApaSystemControlList")); |
1141 |
1147 |
1142 RApaLsSession ls; |
|
1143 User::LeaveIfError(ls.Connect()); |
|
1144 |
|
1145 TRequestStatus status; |
|
1146 ls.SetNotify(ETrue, status); |
|
1147 User::WaitForRequest(status); |
|
1148 |
|
1149 //Create a session with F & B server |
1148 //Create a session with F & B server |
1150 TInt ret = RFbsSession::Connect(); |
1149 TInt ret = RFbsSession::Connect(); |
1151 TEST(ret == KErrNone); |
1150 TEST(ret == KErrNone); |
1152 |
1151 |
1153 CFileMan* fileMan=CFileMan::NewL(iFs); |
1152 CFileMan* fileMan=CFileMan::NewL(iFs); |
1299 @SYMTestExpectedResults Test confirms that RApaLsSession::EAppListInvalid is never returned. |
1298 @SYMTestExpectedResults Test confirms that RApaLsSession::EAppListInvalid is never returned. |
1300 |
1299 |
1301 */ |
1300 */ |
1302 void CT_ProStep::DoAppListInvalidTestL(RApaLsSession& aLs) |
1301 void CT_ProStep::DoAppListInvalidTestL(RApaLsSession& aLs) |
1303 { |
1302 { |
1304 |
1303 _LIT(KTempAppDir, "C:\\private\\10003a3f\\import\\apps\\"); |
|
1304 _LIT(KTempRegPath, "C:\\private\\10003a3f\\import\\apps\\tstapp_reg.rsc"); |
1305 TFullName regPath=_L("z:\\private\\10003a3f\\import\\apps\\tstapp_reg.rsc"); |
1305 TFullName regPath=_L("z:\\private\\10003a3f\\import\\apps\\tstapp_reg.rsc"); |
1306 |
1306 |
1307 CFileMan* fileMan = CFileMan::NewL (iFs); |
1307 CFileMan* fileMan = CFileMan::NewL (iFs); |
1308 CleanupStack::PushL(fileMan); |
1308 CleanupStack::PushL(fileMan); |
1309 |
1309 |
1310 INFO_PRINTF1(_L("Copy tstapp files to C: drive.......")); |
1310 INFO_PRINTF1(_L("Copy tstapp files to C: drive.......")); |
1311 |
1311 TInt ret = iFs.MkDirAll(KTempAppDir); |
1312 CSisFileInstaller sisFileInstaller; |
1312 TEST(ret==KErrNone || ret==KErrAlreadyExists); |
1313 INFO_PRINTF2(_L("Installing sis file from -> %S"), &KTstAppStandAloneSisFile); |
1313 TEST(fileMan->Copy(regPath, KTempRegPath)==KErrNone); //Just to start the idle update. |
1314 sisFileInstaller.InstallSisAndWaitForAppListUpdateL(KTstAppStandAloneSisFile); |
1314 |
|
1315 User::After(8000000); |
1315 |
1316 |
1316 INFO_PRINTF1(_L("Get app list.......")); |
1317 INFO_PRINTF1(_L("Get app list.......")); |
1317 TInt ret; |
|
1318 ret = aLs.GetAllApps(); |
1318 ret = aLs.GetAllApps(); |
1319 TEST(ret==KErrNone); |
1319 TEST(ret==KErrNone); |
1320 |
1320 |
1321 INFO_PRINTF1(_L("Remove temp files from C: drive.......")); |
1321 INFO_PRINTF1(_L("Remove temp files from C: drive.......")); |
1322 |
1322 TRequestStatus status; |
1323 sisFileInstaller.UninstallSisAndWaitForAppListUpdateL(KTstAppStandAloneComponent); |
1323 TTime tempTime(0); // added tempTime to avoid asynch CFileMan::Attribs request completing with KErrArgument |
|
1324 TInt err=fileMan->Attribs(KTempAppDir,0,KEntryAttReadOnly, tempTime, CFileMan::ERecurse, status); |
|
1325 TEST(err==KErrNone); |
|
1326 User::WaitForRequest(status); |
|
1327 TEST(status.Int() == KErrNone); |
|
1328 TEST(fileMan->Delete(KTempRegPath)==KErrNone); //Just to start the idle update. |
|
1329 TEST(fileMan->RmDir(KTempAppDir)==KErrNone); |
|
1330 |
|
1331 User::After(8000000); |
|
1332 |
1324 INFO_PRINTF1(_L("Testing GetNextApp() never returns RApaLsSession::EAppListInvalid.")); |
1333 INFO_PRINTF1(_L("Testing GetNextApp() never returns RApaLsSession::EAppListInvalid.")); |
1325 TApaAppInfo info; |
1334 TApaAppInfo info; |
1326 |
|
1327 while(ret==KErrNone) |
1335 while(ret==KErrNone) |
1328 { |
1336 { |
1329 ret=aLs.GetNextApp(info); |
1337 ret=aLs.GetNextApp(info); |
1330 } |
1338 } |
1331 TEST(ret!=RApaLsSession::EAppListInvalid); |
1339 TEST(ret!=RApaLsSession::EAppListInvalid); |