appfw/apparchitecture/tef/T_Serv2Step.CPP
branchRCL_3
changeset 20 c2c61fdca848
parent 19 924385140d98
equal deleted inserted replaced
19:924385140d98 20:c2c61fdca848
     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".
    46 
    46 
    47 #include <coemain.h>
    47 #include <coemain.h>
    48 #include <eikenv.h>
    48 #include <eikenv.h>
    49 #include "TAppEmbedUids.h"
    49 #include "TAppEmbedUids.h"
    50 #include "appfwk_test_utils.h"
    50 #include "appfwk_test_utils.h"
    51 #include "T_SisFileInstaller.h"  
       
    52 
       
    53 _LIT(KTstAppStandAloneSisFile, "z:\\apparctest\\apparctestsisfiles\\TSTAPP_standalone.sis");
       
    54 _LIT(KTstAppStandAloneComponent, "TSTAPP_standalone");
       
    55 
       
    56 _LIT(KAppEmbeddableEmbeddedSisFile, "z:\\apparctest\\apparctestsisfiles\\TAppEmbeddable_embedded.sis");
       
    57 _LIT(KAppEmbeddableEmbeddedComponent, "TAppEmbeddable_embedded");
       
    58 
       
    59 _LIT(KAppNotEmbeddableV2SisFile, "z:\\apparctest\\apparctestsisfiles\\TAppNotEmbeddable_v2.sis");
       
    60 _LIT(KAppNotEmbeddableV2Component, "TAppNotEmbeddable_v2");
       
    61 
       
    62 _LIT(KAppEmbeddableOnlyV2SisFile, "z:\\apparctest\\apparctestsisfiles\\TAppEmbeddableOnly_v2.sis");
       
    63 _LIT(KAppEmbeddableOnlyV2Component, "TAppEmbeddableOnly_v2");
       
    64 
       
    65 _LIT(KAppEmbeddableStandaloneSisFile, "z:\\apparctest\\apparctestsisfiles\\TAppEmbeddable_standalone.sis");
       
    66 _LIT(KAppEmbeddableStandaloneComponent, "TAppEmbeddable_standalone");
       
    67 
       
    68 _LIT(KAppEmbeddableUiNotStandAloneV2SisFile, "z:\\apparctest\\apparctestsisfiles\\TAppEmbeddableUiNotStandAlone_v2.sis");
       
    69 _LIT(KAppEmbeddableUiNotStandAloneV2Component, "TAppEmbeddableUiNotStandAlone_v2");
       
    70 
       
    71 _LIT(KAppEmbeddableUiOrStandAloneEmbeddedSisFile, "z:\\apparctest\\apparctestsisfiles\\TAppEmbeddableUiOrStandAlone_embedded.sis");
       
    72 _LIT(KAppEmbeddableUiOrStandAloneEmbeddedComponent, "TAppEmbeddableUiOrStandAlone_embedded");
       
    73 
       
    74 
       
    75 _LIT(KAppEmbeddableUiOrStandAloneStandaloneSisFile, "z:\\apparctest\\apparctestsisfiles\\TAppEmbeddableUiOrStandAlone_standalone.sis");
       
    76 _LIT(KAppEmbeddableUiOrStandAloneStandaloneComponent, "TAppEmbeddableUiOrStandalone_standalone");
       
    77                                                        
       
    78 _LIT(KSimpleAppSisFile, "z:\\apparctest\\apparctestsisfiles\\SimpleApparcTestApp.sis");
       
    79 _LIT(KSimpleAppComponent, "SimpleApparcTestApp");
       
    80 
       
    81 
    51 
    82 // Constants
    52 // Constants
    83 const TInt KOneSecondDelay = 1000000;
    53 const TInt KOneSecondDelay = 1000000;
    84 
    54 
    85 
    55 
   133  */
   103  */
   134 void CT_Serv2Step::AppInfoTest1(RApaLsSession& aLs)
   104 void CT_Serv2Step::AppInfoTest1(RApaLsSession& aLs)
   135 	{
   105 	{
   136 	_LIT(KLitAppPath,"z:\\sys\\bin\\tstapp.exe");
   106 	_LIT(KLitAppPath,"z:\\sys\\bin\\tstapp.exe");
   137 	TFullName appPath(KLitAppPath);
   107 	TFullName appPath(KLitAppPath);
   138 	
       
   139 
       
   140 	//Search for TestApp
   108 	//Search for TestApp
   141 	TApaAppInfo info;
   109 	TApaAppInfo info;
   142 	
       
   143 	TInt ret = aLs.GetAllApps();
   110 	TInt ret = aLs.GetAllApps();
   144 	TEST(ret==KErrNone);
   111 	TEST(ret==KErrNone);
   145 	
   112 	
   146 	do
   113 	do
   147 		{
   114 		{
  1418    server updates the application list on installation of a new application.
  1385    server updates the application list on installation of a new application.
  1419     
  1386     
  1420  */
  1387  */
  1421 void CT_Serv2Step::DoInstallationTestL (RApaLsSession ls)
  1388 void CT_Serv2Step::DoInstallationTestL (RApaLsSession ls)
  1422  	{
  1389  	{
  1423 
  1390  	_LIT(KTestAppDestDir, "C:\\private\\10003a3f\\import\\apps\\" );
       
  1391  	_LIT(KTestAppSource, "Z:\\private\\10003a3f\\import\\apps\\tstapp_reg.rsc" );
       
  1392  	_LIT(KTestAppDest, "C:\\private\\10003a3f\\import\\apps\\tstapp_reg.rsc" );
       
  1393 
       
  1394  	_LIT(KTestWaitingForApplistUpdate,"\nWaiting %d microseconds for applist to be updated");
       
  1395  	const TInt KApplistUpdateTime = 8000000;
       
  1396 
       
  1397  	// Copy App files around and delete them to check whether 
       
  1398 	// the app list updates and stores the cache correctly.
       
  1399  	RFs	theFs;
       
  1400  	theFs.Connect();
  1424  
  1401  
  1425     CSisFileInstaller sisFileInstaller;
  1402  	// Remove Test app from the file system
  1426     INFO_PRINTF2(_L("Installing sis file from -> %S"), &KTstAppStandAloneSisFile);
  1403  	CFileMan* fileManager = CFileMan::NewL (theFs);
  1427     sisFileInstaller.InstallSisAndWaitForAppListUpdateL(KTstAppStandAloneSisFile);
  1404  
  1428     
  1405  	INFO_PRINTF1(_L("Copying the app to C"));
       
  1406  	TEST(KErrNone == fileManager->Copy (KTestAppSource, KTestAppDest, CFileMan::ERecurse));
       
  1407  	
       
  1408  	INFO_PRINTF2(KTestWaitingForApplistUpdate, KApplistUpdateTime);
       
  1409  	User::After(KApplistUpdateTime);
       
  1410  
  1429  	TApaAppInfo aInfo;
  1411  	TApaAppInfo aInfo;
  1430  	TEST(KErrNone == ls.GetAppInfo (aInfo, KUidTestApp));
  1412  	TEST(KErrNone == ls.GetAppInfo (aInfo, KUidTestApp));
  1431 
  1413 
  1432 	TParsePtrC parse (aInfo.iFullName);
  1414 	TParsePtrC parse (aInfo.iFullName);
  1433  	_LIT (KCdrive, "C:");
  1415  	_LIT (KCdrive, "C:");
  1434 	INFO_PRINTF1(_L("Comparing App drive location is C:... "));
  1416 	INFO_PRINTF1(_L("Comparing App drive location is C:... "));
  1435 	TEST(parse.Drive ().CompareF (KCdrive) == 0);
  1417 	TEST(parse.Drive ().CompareF (KCdrive) == 0);
  1436  
  1418  
  1437  	INFO_PRINTF1(_L("Removing the app from C"));
  1419  	INFO_PRINTF1(_L("Removing the app from C"));
  1438 
  1420 	TTime tempTime(0);
       
  1421 	fileManager->Attribs(KTestAppDest,0,KEntryAttReadOnly, tempTime, CFileMan::ERecurse);
       
  1422  	TEST(KErrNone == fileManager->Delete (KTestAppDest, CFileMan::ERecurse));
       
  1423 	INFO_PRINTF1(_L("Removing the app dir from C"));
       
  1424 	TEST(fileManager->RmDir(KTestAppDestDir)==KErrNone);
       
  1425  	
       
  1426 	INFO_PRINTF2(KTestWaitingForApplistUpdate, KApplistUpdateTime);
       
  1427 	User::After(KApplistUpdateTime);
  1439  
  1428  
  1440  	
       
  1441  	sisFileInstaller.UninstallSisAndWaitForAppListUpdateL(KTstAppStandAloneComponent);
       
  1442  	// That should put the file in the right place
  1429  	// That should put the file in the right place
  1443  	TEST(KErrNone == ls.GetAppInfo( aInfo, KUidTestApp));
  1430  	TEST(KErrNone == ls.GetAppInfo( aInfo, KUidTestApp));
  1444 
  1431 
  1445  	TParsePtrC parse1 (aInfo.iFullName);
  1432  	TParsePtrC parse1 (aInfo.iFullName);
  1446  	_LIT (KZdrive, "Z:");
  1433  	_LIT (KZdrive, "Z:");
  1447 	INFO_PRINTF1(_L("Comparing App drive location is Z:... "));
  1434 	INFO_PRINTF1(_L("Comparing App drive location is Z:... "));
  1448  	TEST((parse1.Drive().CompareF(KZdrive)) == 0);
  1435  	TEST((parse1.Drive().CompareF(KZdrive)) == 0);
  1449 
  1436  	
       
  1437  	delete fileManager;
       
  1438  	theFs.Close();
  1450  }
  1439  }
  1451 
  1440 
  1452 //
  1441 //
  1453 // Tests the new RApaLsSession::NumberOfOwnDefinedIcons function
  1442 // Tests the new RApaLsSession::NumberOfOwnDefinedIcons function
  1454 // See TeamTrack 'DEF037571 - Provide a better alternative to CApaAppInfoFileReader::NumberOfBitmaps'
  1443 // See TeamTrack 'DEF037571 - Provide a better alternative to CApaAppInfoFileReader::NumberOfBitmaps'
  1766 /**
  1755 /**
  1767    @return - TVerdict code
  1756    @return - TVerdict code
  1768    Override of base class virtual
  1757    Override of base class virtual
  1769  */
  1758  */
  1770 	{
  1759 	{
  1771     CSisFileInstaller sisFileInstaller;
       
  1772     INFO_PRINTF2(_L("Installing sis file from -> %S"), &KAppEmbeddableEmbeddedSisFile);
       
  1773     sisFileInstaller.InstallSisL(KAppEmbeddableEmbeddedSisFile);
       
  1774     INFO_PRINTF2(_L("Installing sis file from -> %S"), &KAppNotEmbeddableV2SisFile);
       
  1775     sisFileInstaller.InstallSisL(KAppNotEmbeddableV2SisFile);
       
  1776     INFO_PRINTF2(_L("Installing sis file from -> %S"), &KAppEmbeddableOnlyV2SisFile);
       
  1777     sisFileInstaller.InstallSisL(KAppEmbeddableOnlyV2SisFile);
       
  1778     INFO_PRINTF2(_L("Installing sis file from -> %S"), &KAppEmbeddableStandaloneSisFile);
       
  1779     sisFileInstaller.InstallSisL(KAppEmbeddableStandaloneSisFile);
       
  1780     INFO_PRINTF2(_L("Installing sis file from -> %S"), &KAppEmbeddableUiNotStandAloneV2SisFile);
       
  1781     sisFileInstaller.InstallSisL(KAppEmbeddableUiNotStandAloneV2SisFile);
       
  1782     INFO_PRINTF2(_L("Installing sis file from -> %S"), &KAppEmbeddableUiOrStandAloneEmbeddedSisFile);
       
  1783     sisFileInstaller.InstallSisL(KAppEmbeddableUiOrStandAloneEmbeddedSisFile);
       
  1784     INFO_PRINTF2(_L("Installing sis file from -> %S"), &KSimpleAppSisFile);
       
  1785     sisFileInstaller.InstallSisL(KSimpleAppSisFile);
       
  1786     INFO_PRINTF2(_L("Installing sis file from -> %S"), &KAppEmbeddableUiOrStandAloneStandaloneSisFile);
       
  1787     sisFileInstaller.InstallSisAndWaitForAppListUpdateL(KAppEmbeddableUiOrStandAloneStandaloneSisFile); 
       
  1788     
       
  1789 	SetTestStepResult(EPass);
  1760 	SetTestStepResult(EPass);
  1790 	return TestStepResult();
  1761 	return TestStepResult();
  1791 	}
  1762 	}
  1792 
  1763 
  1793 TVerdict CT_Serv2Step::doTestStepPostambleL()
  1764 TVerdict CT_Serv2Step::doTestStepPostambleL()
  1794 /**
  1765 /**
  1795    @return - TVerdict code
  1766    @return - TVerdict code
  1796    Override of base class virtual
  1767    Override of base class virtual
  1797  */
  1768  */
  1798 	{
  1769 	{
  1799     CSisFileInstaller sisFileInstaller;
       
  1800     sisFileInstaller.UninstallSisL(KAppEmbeddableEmbeddedComponent);
       
  1801     sisFileInstaller.UninstallSisL(KAppNotEmbeddableV2Component);
       
  1802     sisFileInstaller.UninstallSisL(KAppEmbeddableOnlyV2Component);
       
  1803     sisFileInstaller.UninstallSisL(KAppEmbeddableStandaloneComponent);
       
  1804     sisFileInstaller.UninstallSisL(KAppEmbeddableUiNotStandAloneV2Component);
       
  1805     sisFileInstaller.UninstallSisL(KAppEmbeddableUiOrStandAloneEmbeddedComponent);
       
  1806     sisFileInstaller.UninstallSisL(KAppEmbeddableUiOrStandAloneStandaloneComponent);
       
  1807     sisFileInstaller.UninstallSisL(KSimpleAppComponent);
       
  1808     
       
  1809 	return TestStepResult();
  1770 	return TestStepResult();
  1810 	}
  1771 	}
  1811 
  1772 
  1812 TVerdict CT_Serv2Step::doTestStepL()
  1773 TVerdict CT_Serv2Step::doTestStepL()
  1813 /**
  1774 /**