appfw/apparchitecture/tef/T_RApaLsSessionStep.cpp
branchRCL_3
changeset 62 924385140d98
parent 0 2e3d3ce01487
child 63 c2c61fdca848
equal deleted inserted replaced
58:0818dd463d41 62:924385140d98
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2007-2010 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".
    59 #include "TIconLoaderAndIconArrayForLeaks.h"  
    59 #include "TIconLoaderAndIconArrayForLeaks.h"  
    60 
    60 
    61 #if !defined(__E32TEST_H__)
    61 #if !defined(__E32TEST_H__)
    62 #include <e32test.h>
    62 #include <e32test.h>
    63 #endif
    63 #endif
    64 
    64 #include "T_SisFileInstaller.h"
    65 // Literals & Constants
    65 
       
    66 _LIT(KTstAppStandAloneSisFile, "z:\\apparctest\\apparctestsisfiles\\TSTAPP_standalone.sis");
       
    67 _LIT(KTstAppStandAloneComponent, "TSTAPP_standalone");
       
    68 
       
    69 _LIT(KZeroSizeIconAppSisFile, "z:\\apparctest\\apparctestsisfiles\\zerosizedicontestapp.sis");
       
    70 _LIT(KZeroSizeIconAppComponent, "zerosizedicontestapp");
       
    71 
       
    72 _LIT(KApparcTestAppSisFile, "z:\\apparctest\\apparctestsisfiles\\TApparcTestApp.sis");
       
    73 _LIT(KApparcTestAppComponent, "TApparcTestApp");
       
    74 
       
    75 _LIT(KGroupNameTestAppSisFile, "z:\\apparctest\\apparctestsisfiles\\t_groupname.sis");
       
    76 _LIT(KGroupNameTestAppComponent, "T_groupname");
       
    77 
       
    78 _LIT(KAppNotEmbeddableSisFile, "z:\\apparctest\\apparctestsisfiles\\TAppNotEmbeddable_v2.sis");
       
    79 _LIT(KAppNotEmbeddableComponent, "TAppNotEmbeddable_v2");
       
    80 
       
    81 _LIT(KAppEmbeddableOnlySisFile, "z:\\apparctest\\apparctestsisfiles\\TAppEmbeddableOnly_v2.sis");
       
    82 _LIT(KAppEmbeddableOnlyComponent, "TAppEmbeddableOnly_v2");
       
    83 
       
    84 _LIT(KAppEmbeddableStandaloneSisFile, "z:\\apparctest\\apparctestsisfiles\\TAppEmbeddable_standalone.sis");
       
    85 _LIT(KAppEmbeddableStandaloneComponent, "TAppEmbeddable_standalone");
       
    86 
       
    87 _LIT(KAppEmbeddableEmbeddedSisFile, "z:\\apparctest\\apparctestsisfiles\\TAppEmbeddable_embedded.sis");
       
    88 _LIT(KAppEmbeddableEmbeddedComponent, "TAppEmbeddable_embedded");
       
    89 
       
    90 _LIT(KAppEmbeddableUiNotStandAloneSisFile, "z:\\apparctest\\apparctestsisfiles\\TAppEmbeddableUiNotStandAlone_v2.sis");
       
    91 _LIT(KAppEmbeddableUiNotStandAloneComponent, "TAppEmbeddableUiNotStandAlone_v2");
       
    92 
       
    93 _LIT(KAppEmbeddableUiOrStandAloneEmbeddedSisFile, "z:\\apparctest\\apparctestsisfiles\\TAppEmbeddableUiOrStandAlone_embedded.sis");
       
    94 _LIT(KAppEmbeddableUiOrStandAloneEmbeddedComponent, "TAppEmbeddableUiOrStandAlone_embedded");
       
    95 
       
    96 _LIT(KAppEmbeddableUiOrStandAloneStandaloneSisFile, "z:\\apparctest\\apparctestsisfiles\\TAppEmbeddableUiOrStandalone_standalone.sis");
       
    97 _LIT(KAppEmbeddableUiOrStandAloneStandaloneComponent, "TAppEmbeddableUiOrStandalone_standalone");
       
    98 
       
    99 _LIT(KSimpleAppSisFile, "z:\\apparctest\\apparctestsisfiles\\SimpleApparcTestApp.sis");
       
   100 _LIT(KSimpleAppComponent, "SimpleApparcTestApp");
       
   101 
       
   102 _LIT(KWinChainAppSisFile, "z:\\apparctest\\apparctestsisfiles\\t_winchainLaunch.sis");
       
   103 _LIT(KWinChainAppComponent, "t_winchainLaunch");
       
   104 
       
   105 _LIT(KServerApp7SisFile, "z:\\apparctest\\apparctestsisfiles\\serverapp7.sis");
       
   106 _LIT(KServerApp7Component, "serverapp7");
       
   107 
       
   108 _LIT(KTestTrustedPriorityApp1SisFile, "z:\\apparctest\\apparctestsisfiles\\TestTrustedPriorityApp1.sis");
       
   109 _LIT(KTestTrustedPriorityApp1Component, "TestTrustedPriorityApp1");
       
   110 
       
   111 _LIT(KTestUnTrustedPriorityApp1SisFile, "z:\\apparctest\\apparctestsisfiles\\TestUnTrustedPriorityApp1.sis");
       
   112 _LIT(KTestUnTrustedPriorityApp1Component, "TestUnTrustedPriorityApp1");
       
   113 
       
   114 _LIT(KTestTrustedPriorityApp2SisFile, "z:\\apparctest\\apparctestsisfiles\\TestTrustedPriorityApp2.sis");
       
   115 _LIT(KTestTrustedPriorityApp2Component, "TestTrustedPriorityApp2");
       
   116 
       
   117 // Literals & Constants 
    66 _LIT(KCompleted, "Completed.");
   118 _LIT(KCompleted, "Completed.");
    67 const TUint KBytesToRead=100;
   119 const TUint KBytesToRead=100;
    68 
   120 
    69 
   121 
    70 /****************************************
   122 /****************************************
   494 
   546 
   495 void CT_RApaLsSessionTestStep::TestAppListInvalidSetupL()
   547 void CT_RApaLsSessionTestStep::TestAppListInvalidSetupL()
   496 	{
   548 	{
   497 	INFO_PRINTF1(_L("Setting up Applist invalid test."));
   549 	INFO_PRINTF1(_L("Setting up Applist invalid test."));
   498 	
   550 	
   499 	_LIT(KTempAppDir, "C:\\private\\10003a3f\\import\\apps\\");
   551     TRequestStatus status;
   500 	_LIT(KTempRegPath, "C:\\private\\10003a3f\\import\\apps\\tstapp_reg.rsc");
   552     iLs.SetNotify(EFalse,status);
   501 	TFullName regPath=_L("z:\\private\\10003a3f\\import\\apps\\tstapp_reg.rsc");
   553     CSisFileInstaller sisFileInstaller;
   502 	
   554     INFO_PRINTF2(_L("Installing sis file from -> %S"), &KTstAppStandAloneSisFile);
   503 	CFileMan* iAppListInvalidTestFileMan = CFileMan::NewL (iFs);
   555     sisFileInstaller.InstallSisL(KTstAppStandAloneSisFile);
   504 	CleanupStack::PushL(iAppListInvalidTestFileMan);
       
   505 	
       
   506 	INFO_PRINTF1(_L("Copy tstapp files to C: drive......."));
       
   507 	TInt rtn=iFs.MkDirAll(KTempAppDir);
       
   508 	TEST(rtn==KErrNone||rtn==KErrAlreadyExists); 
       
   509 	TEST(iAppListInvalidTestFileMan->Copy(regPath, KTempRegPath)==KErrNone);	//Just to start the idle update.
       
   510 
   556 
   511 	INFO_PRINTF1(_L("Get app list......."));
   557 	INFO_PRINTF1(_L("Get app list......."));
   512 	TInt ret = iLs.GetAllApps();
   558 	TInt ret = iLs.GetAllApps();
   513 	TEST(ret==KErrNone);
   559 	TEST(ret==KErrNone);
   514 
       
   515 	INFO_PRINTF1(_L("Remove temp files from C: drive......."));
       
   516 	TRequestStatus status;
       
   517 	TTime tempTime(0); // added tempTime to avoid asynch CFileMan::Attribs request completing with KErrArgument
       
   518 	TEST(iAppListInvalidTestFileMan->Attribs(KTempAppDir,0,KEntryAttReadOnly, tempTime, CFileMan::ERecurse, status)==KErrNone);
       
   519 	
   560 	
   520 	User::WaitForRequest(status);
   561 	User::WaitForRequest(status);
   521 	TEST(status.Int() == KErrNone);
   562 
   522 	INFO_PRINTF1(_L("Deleting Reg file......."));
   563 	sisFileInstaller.UninstallSisAndWaitForAppListUpdateL(KTstAppStandAloneComponent);
   523 	TEST(iAppListInvalidTestFileMan->Delete(KTempRegPath)==KErrNone);	//Just to start the idle update.
       
   524 	INFO_PRINTF1(_L("Removing App dir......."));
       
   525 	TEST(iAppListInvalidTestFileMan->RmDir(KTempAppDir)==KErrNone);
       
   526 	CleanupStack::PopAndDestroy(iAppListInvalidTestFileMan);
       
   527 
       
   528 	INFO_PRINTF1(KCompleted);
   564 	INFO_PRINTF1(KCompleted);
   529 	}
   565 	}
   530 
   566 
   531 
   567 
   532 
   568 
  1744 	const TApaAppViewInfo& viewInfo=(*appViews)[0];
  1780 	const TApaAppViewInfo& viewInfo=(*appViews)[0];
  1745 	TEST(viewInfo.iUid != KNullUid);
  1781 	TEST(viewInfo.iUid != KNullUid);
  1746 
  1782 
  1747 	HBufC* fullIconFileName = NULL;
  1783 	HBufC* fullIconFileName = NULL;
  1748 	ret = iLs.GetAppViewIcon(TUid::Uid(KGroupNameApp), viewInfo.iUid, fullIconFileName);
  1784 	ret = iLs.GetAppViewIcon(TUid::Uid(KGroupNameApp), viewInfo.iUid, fullIconFileName);
  1749 	TEST(ret == KErrNone);
  1785 
  1750 	TEST(fullIconFileName != NULL);
  1786     TEST(ret == KErrNone);
  1751 	INFO_PRINTF2(_L("The View icon's UID is - %X"), viewInfo.iUid);
  1787     TEST(fullIconFileName != NULL);
  1752 	TEST(!fullIconFileName->Compare(_L("file://c/resource/apps/tcheckiconapp.xyz")));
  1788     INFO_PRINTF2(_L("The View icon's UID is - %X"), viewInfo.iUid);
  1753 	INFO_PRINTF2(_L("View's icon file name is - %S"), fullIconFileName);
  1789     TEST(!fullIconFileName->Compare(_L("file://c/resource/apps/tcheckiconapp.xyz")));
  1754 	
  1790     INFO_PRINTF2(_L("View's icon file name is - %S"), fullIconFileName);
       
  1791 
  1755 	delete fullIconFileName;		
  1792 	delete fullIconFileName;		
  1756 	CleanupStack::PopAndDestroy(appViews);
  1793 	CleanupStack::PopAndDestroy(appViews);
  1757 	
  1794 	
  1758 	//Testing GetAppIcon with an invalid app UID.
  1795 	//Testing GetAppIcon with an invalid app UID.
  1759 	INFO_PRINTF1(_L("Testing GetAppIcon API with unknown app uid"));
  1796 	INFO_PRINTF1(_L("Testing GetAppIcon API with unknown app uid"));
  1825 	INFO_PRINTF1(_L("Testing GetAppIcon API for an app to retrieve an open file handle to an SVG icon file"));
  1862 	INFO_PRINTF1(_L("Testing GetAppIcon API for an app to retrieve an open file handle to an SVG icon file"));
  1826 	const TUint KApparcTestApp = 0x100048F3; //Tstapp app, has SVG icon file
  1863 	const TUint KApparcTestApp = 0x100048F3; //Tstapp app, has SVG icon file
  1827 	TInt err = iLs.GetAppIcon(TUid::Uid(KApparcTestApp), svgIconFile);
  1864 	TInt err = iLs.GetAppIcon(TUid::Uid(KApparcTestApp), svgIconFile);
  1828 	TEST(err == KErrNone);
  1865 	TEST(err == KErrNone);
  1829 	
  1866 	
  1830 	_LIT(KSVGIconFileName, "z:\\resource\\apps\\svg_icon.svg");
  1867 	_LIT(KSVGIconFileName, "c:\\resource\\apps\\svg_icon.svg");
  1831 	//Get the name of the icon file 
  1868 	//Get the name of the icon file 
  1832 	TBuf<KMaxFileName> svgIconFileName;	
  1869 	TBuf<KMaxFileName> svgIconFileName;	
  1833 	svgIconFile.FullName(svgIconFileName);
  1870 	svgIconFile.FullName(svgIconFileName);
  1834 	TEST(svgIconFileName.Length() != 0);
  1871 	TEST(svgIconFileName.Length() != 0);
  1835 	if (svgIconFileName.Length() != 0)
  1872 	if (svgIconFileName.Length() != 0)
  1893    updates the applist and uses the application residing on non-ROM drive's import\apps folder.
  1930    updates the applist and uses the application residing on non-ROM drive's import\apps folder.
  1894     
  1931     
  1895  */
  1932  */
  1896 void CT_RApaLsSessionTestStep::TestAppListInstallationL()
  1933 void CT_RApaLsSessionTestStep::TestAppListInstallationL()
  1897  	{ 
  1934  	{ 
  1898  	_LIT(KTestAppDestDir, "C:\\private\\10003a3f\\import\\apps\\" );
       
  1899  	_LIT(KTestAppSource, "Z:\\private\\10003a3f\\import\\apps\\tstapp_reg.rsc" );
       
  1900  	_LIT(KTestAppDest, "C:\\private\\10003a3f\\import\\apps\\tstapp_reg.rsc" );
       
  1901 
       
  1902  	_LIT(KTestWaitingForApplistUpdate,"Waiting %d microseconds for applist to be updated");
       
  1903  	const TInt KApplistUpdateTime = 10000000;
       
  1904 
  1935 
  1905  	// Copy App files around and delete them to check whether 
  1936  	// Copy App files around and delete them to check whether 
  1906 	// the app list updates and stores the cache correctly.
  1937 	// the app list updates and stores the cache correctly.
  1907  	RFs	theFS;
       
  1908  	theFS.Connect();
       
  1909  
       
  1910  	// Remove Test app from the file system
       
  1911  	CFileMan* fileManager = CFileMan::NewL (theFS);
       
  1912  
       
  1913  	INFO_PRINTF1(_L("Copying the app to C"));
       
  1914  	TEST(KErrNone == fileManager->Copy (KTestAppSource, KTestAppDest, CFileMan::ERecurse));
       
  1915  	
  1938  	
  1916  	INFO_PRINTF2(KTestWaitingForApplistUpdate, KApplistUpdateTime);
  1939     INFO_PRINTF1(_L("Installing the app from C"));
  1917  	User::After(KApplistUpdateTime);
  1940  	CSisFileInstaller sisInstaller;
  1918  
  1941  	INFO_PRINTF2(_L("Installing sis file from -> %S"), &KTstAppStandAloneSisFile);
       
  1942  	sisInstaller.InstallSisAndWaitForAppListUpdateL(KTstAppStandAloneSisFile);
       
  1943  	
  1919  	TApaAppInfo aInfo;
  1944  	TApaAppInfo aInfo;
  1920  	TEST(KErrNone == iLs.GetAppInfo (aInfo, KUidTestApp));
  1945  	TEST(KErrNone == iLs.GetAppInfo (aInfo, KUidTestApp));
  1921 
  1946 
  1922 	TParsePtrC parse (aInfo.iFullName);
  1947 	TParsePtrC parse (aInfo.iFullName);
  1923  	_LIT (KCdrive, "C:");
  1948  	_LIT (KCdrive, "C:");
  1924 	INFO_PRINTF1(_L("Comparing App drive location is C:... "));
  1949 	INFO_PRINTF1(_L("Comparing App drive location is C:... "));
  1925 	TEST(parse.Drive ().CompareF (KCdrive) == 0);
  1950 	TEST(parse.Drive ().CompareF (KCdrive) == 0);
  1926  
  1951  
  1927  	INFO_PRINTF1(_L("Removing the app from C"));
  1952  	INFO_PRINTF1(_L("Removing the app from C"));
  1928 	TRequestStatus status;
  1953 	sisInstaller.UninstallSisAndWaitForAppListUpdateL(KTstAppStandAloneComponent);
  1929 	TTime tempTime(0); // added tempTime to avoid asynch CFileMan::Attribs request completing with KErrArgument
  1954 	
  1930 	TEST(fileManager->Attribs(KTestAppDest,0,KEntryAttReadOnly, tempTime, CFileMan::ERecurse, status)==KErrNone);
       
  1931 	User::WaitForRequest(status);
       
  1932 	TEST(status.Int() == KErrNone);
       
  1933  	TEST(KErrNone == fileManager->Delete (KTestAppDest, CFileMan::ERecurse));
       
  1934 	INFO_PRINTF1(_L("Removing the app dir from C"));
       
  1935 	TEST(fileManager->RmDir(KTestAppDestDir)==KErrNone);
       
  1936  	
       
  1937 	INFO_PRINTF2(KTestWaitingForApplistUpdate, KApplistUpdateTime);
       
  1938 	User::After(KApplistUpdateTime);
       
  1939  
       
  1940  	// That should put the file in the right place
  1955  	// That should put the file in the right place
  1941  	TEST(KErrNone == iLs.GetAppInfo( aInfo, KUidTestApp));
  1956  	TEST(KErrNone == iLs.GetAppInfo( aInfo, KUidTestApp));
  1942 
  1957 
  1943  	TParsePtrC parse1 (aInfo.iFullName);
  1958  	TParsePtrC parse1 (aInfo.iFullName);
  1944  	_LIT (KZdrive, "Z:");
  1959  	_LIT (KZdrive, "Z:");
  1945 	INFO_PRINTF1(_L("Comparing App drive location is Z:... "));
  1960 	INFO_PRINTF1(_L("Comparing App drive location is Z:... "));
  1946  	TEST((parse1.Drive().CompareF(KZdrive)) == 0);
  1961  	TEST((parse1.Drive().CompareF(KZdrive)) == 0);
  1947 
  1962 
  1948  	delete fileManager;
       
  1949  	theFS.Close();
       
  1950 
       
  1951  	INFO_PRINTF1(_L("Test TestAppListInstallationL completed"));
  1963  	INFO_PRINTF1(_L("Test TestAppListInstallationL completed"));
  1952  	}
  1964  	}
  1953  	
  1965  	
       
  1966 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
  1954 /**
  1967 /**
  1955    @SYMTestCaseID T-RApaLsSessionTestStep-TestAppListInstallation1L
  1968    @SYMTestCaseID T-RApaLsSessionTestStep-TestAppListInstallation1L
  1956   
  1969   
  1957    @SYMDEF DEF055654: Platform-security loop-hole for "import-directory" applications
  1970    @SYMDEF DEF055654: Platform-security loop-hole for "import-directory" applications
  1958   
  1971   
  2037  	
  2050  	
  2038  	CleanupStack::PopAndDestroy(2, &theFS);
  2051  	CleanupStack::PopAndDestroy(2, &theFS);
  2039 
  2052 
  2040  	INFO_PRINTF1(_L("Test TestAppListInstallation1L completed"));
  2053  	INFO_PRINTF1(_L("Test TestAppListInstallation1L completed"));
  2041  	} 	
  2054  	} 	
       
  2055 #endif
  2042 
  2056 
  2043 	/**
  2057 	/**
  2044    @SYMTestCaseID APPFWK-APPARC-0107
  2058    @SYMTestCaseID APPFWK-APPARC-0107
  2045    
  2059    
  2046    @SYMDEF DEF141484 
  2060    @SYMDEF DEF141484 
  2061 void CT_RApaLsSessionTestStep::TestZeroSizedIconFileL()
  2075 void CT_RApaLsSessionTestStep::TestZeroSizedIconFileL()
  2062     {
  2076     {
  2063     
  2077     
  2064     INFO_PRINTF1(_L("Test TestZeroSizedIconFileL Started.........."));
  2078     INFO_PRINTF1(_L("Test TestZeroSizedIconFileL Started.........."));
  2065     
  2079     
  2066     _LIT(KTestAppDestDir, "C:\\private\\10003a3f\\import\\apps\\" );
       
  2067     _LIT(KTestAppResourceDir, "C:\\resource\\apps\\" );
       
  2068     
       
  2069     _LIT(KTestAppSource, "Z:\\apparctest\\zerosizedicon_reg.rsc" );
       
  2070     _LIT(KTestAppDest, "C:\\private\\10003a3f\\import\\apps\\zerosizedicon_reg.rsc" );
       
  2071     
       
  2072     _LIT(KTestMbmSource, "Z:\\resource\\apps\\zerosizedicon.mbm");
       
  2073     _LIT(KTestMbmDest, "C:\\resource\\apps\\zerosizedicon.mbm");
       
  2074     
       
  2075     _LIT(KTestLocSource, "Z:\\apparctest\\zerosizedicon_loc.rsc");
       
  2076     _LIT(KTestLocDest, "C:\\resource\\apps\\zerosizedicon_loc.rsc");
       
  2077    
       
  2078     TRequestStatus appScanCompleted=KRequestPending; 
  2080     TRequestStatus appScanCompleted=KRequestPending; 
  2079     iLs.SetNotify(EFalse,appScanCompleted); 
  2081     iLs.SetNotify(EFalse,appScanCompleted); 
  2080     
  2082     
  2081     RSmlTestUtils utils;
  2083     RSmlTestUtils utils;
  2082     CleanupClosePushL(utils);
  2084     CleanupClosePushL(utils);
  2083     TEST(KErrNone == utils.Connect());
  2085     TEST(KErrNone == utils.Connect());
  2084   
  2086   
  2085     INFO_PRINTF1(_L("Creating directory C:\\private\\10003a3f\\import\\apps\\ folder"));
  2087     CSisFileInstaller sisFileInstaller;
  2086     TInt err=utils.CreateDirectoryL(KTestAppDestDir);
  2088     INFO_PRINTF2(_L("Installing sis file from -> %S"), &KZeroSizeIconAppSisFile);
  2087     TESTEL((err==KErrNone) ||  (err==KErrAlreadyExists),err);
  2089     sisFileInstaller.InstallSisL(KZeroSizeIconAppSisFile);
  2088 
  2090     
  2089     INFO_PRINTF1(_L("Creating directory C:\\resource\\apps\\ folder"));
       
  2090     err=utils.CreateDirectoryL(KTestAppResourceDir);
       
  2091     TESTEL((err==KErrNone) ||  (err==KErrAlreadyExists),err);
       
  2092 
       
  2093     INFO_PRINTF1(_L("Copying _reg.rsc to C:\\private\\10003a3f\\import\\apps\\ folder"));    
       
  2094     User::LeaveIfError(utils.CopyFileL(KTestAppSource,KTestAppDest));
       
  2095     INFO_PRINTF1(_L("Copying the mbm and _loc.rsc to C:\\resource\\apps\\ folder"));
       
  2096     User::LeaveIfError(utils.CopyFileL(KTestMbmSource,KTestMbmDest));
       
  2097     User::LeaveIfError(utils.CopyFileL(KTestLocSource,KTestLocDest));
       
  2098 
       
  2099     User::WaitForRequest(appScanCompleted);
  2091     User::WaitForRequest(appScanCompleted);
  2100     TEST(appScanCompleted.Int()==MApaAppListServObserver::EAppListChanged);
  2092     TEST(appScanCompleted.Int()==MApaAppListServObserver::EAppListChanged);
  2101 
  2093 
  2102 	appScanCompleted=KRequestPending;
  2094 	appScanCompleted=KRequestPending;
  2103 	iLs.SetNotify(EFalse,appScanCompleted);
  2095 	iLs.SetNotify(EFalse,appScanCompleted);
  2104     INFO_PRINTF1(_L("Removing _reg.rsc from C:\\private\\10003a3f\\import\\apps\\ folder"));
  2096 
  2105     TEST(KErrNone == DeleteFileL(utils, KTestAppDest));
  2097 	sisFileInstaller.UninstallSisL(KZeroSizeIconAppComponent);
  2106     INFO_PRINTF1(_L("Removing the mbm and _loc.rsc from C:\\resource\\apps\\ folder"));
       
  2107     TEST(KErrNone == DeleteFileL(utils, KTestMbmDest));
       
  2108     TEST(KErrNone == DeleteFileL(utils, KTestLocDest));
       
  2109     INFO_PRINTF1(_L("Removing the C:\\private\\10003a3f\\import\\apps\\ dir "));
       
  2110     TEST(KErrNone == utils.DeleteDirectoryL(KTestAppDestDir));
       
  2111   
       
  2112 	User::WaitForRequest(appScanCompleted);
  2098 	User::WaitForRequest(appScanCompleted);
  2113     CleanupStack::PopAndDestroy(&utils);//utils
  2099     CleanupStack::PopAndDestroy(&utils);//utils
  2114     INFO_PRINTF1(_L("Test TestZeroSizedIconFileL completed"));
  2100     INFO_PRINTF1(_L("Test TestZeroSizedIconFileL completed"));
  2115     } 
  2101     } 
  2116 
  2102 
  2135         }
  2121         }
  2136 
  2122 
  2137     return(err);
  2123     return(err);
  2138 }
  2124 }
  2139 
  2125 
  2140 	
  2126 
       
  2127 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
  2141 /**
  2128 /**
  2142    @SYMTestCaseID T-RApaLsSessionTestStep-TestAppFolderNonRomDrivesL
  2129    @SYMTestCaseID T-RApaLsSessionTestStep-TestAppFolderNonRomDrivesL
  2143   
  2130   
  2144    @SYMDEF DEF055654: Platform-security loop-hole for "import-directory" applications
  2131    @SYMDEF DEF055654: Platform-security loop-hole for "import-directory" applications
  2145   
  2132   
  2211  	
  2198  	
  2212  	CleanupStack::PopAndDestroy(2, &theFS);
  2199  	CleanupStack::PopAndDestroy(2, &theFS);
  2213 
  2200 
  2214  	INFO_PRINTF1(_L("Test scanning of app folder for non-ROM drives completed"));
  2201  	INFO_PRINTF1(_L("Test scanning of app folder for non-ROM drives completed"));
  2215  	}
  2202  	}
  2216  	
  2203 #endif
       
  2204 
  2217 /**
  2205 /**
  2218    @SYMTestCaseID T-RApaLsSessionTestStep-DoNumDefIconsTestL
  2206    @SYMTestCaseID T-RApaLsSessionTestStep-DoNumDefIconsTestL
  2219   
  2207   
  2220    @SYMDEF DEF037571 - Provide a better alternative to CApaAppInfoFileReader::NumberOfBitmaps'
  2208    @SYMDEF DEF037571 - Provide a better alternative to CApaAppInfoFileReader::NumberOfBitmaps'
  2221   
  2209   
  2443    @SYMTestExpectedResults All tests compare the results obtained with the desired result.
  2431    @SYMTestExpectedResults All tests compare the results obtained with the desired result.
  2444 */
  2432 */
  2445 void CT_RApaLsSessionTestStep::TestDataPriorityForUnTrustedApps()
  2433 void CT_RApaLsSessionTestStep::TestDataPriorityForUnTrustedApps()
  2446 	{
  2434 	{
  2447 	INFO_PRINTF1(_L("TestDataPriorityForUnTrustedApps about to start..."));
  2435 	INFO_PRINTF1(_L("TestDataPriorityForUnTrustedApps about to start..."));
  2448 	const TUid KUidUnTrustedApp = {0x10207f8C};
  2436 	const TUid KUidUnTrustedApp = {0x80207f8C};
  2449 	const TUid KUidTrustedApp = {0x10207f8D};
  2437 	const TUid KUidTrustedApp = {0x10207f8D};
  2450 	TInt ret;
  2438 	TInt ret;
  2451 	TBool insertVal = EFalse;
  2439 	TBool insertVal = EFalse;
  2452 	//There is no restriction for the Trusted Apps datapriority
  2440 	//There is no restriction for the Trusted Apps datapriority
  2453 	TDataTypePriority KTrustedAppPriority = {KDataTypeUnTrustedPriorityThreshold+1};
  2441 	TDataTypePriority KTrustedAppPriority = {KDataTypeUnTrustedPriorityThreshold+1};
  2525 	CFbsBitmap* bufferAllocator = new(ELeave) CFbsBitmap;
  2513 	CFbsBitmap* bufferAllocator = new(ELeave) CFbsBitmap;
  2526 	CleanupStack::PushL(bufferAllocator);
  2514 	CleanupStack::PushL(bufferAllocator);
  2527 	bufferAllocator->Create(TSize(200,1), EColor16M);
  2515 	bufferAllocator->Create(TSize(200,1), EColor16M);
  2528 	CleanupStack::PopAndDestroy(bufferAllocator);
  2516 	CleanupStack::PopAndDestroy(bufferAllocator);
  2529 
  2517 
  2530 	
  2518     TRequestStatus status;
  2531 	HEAP_TEST_LS_SESSION(iLs, 0, 0, TestAppListInvalidL(), iLs.ClearAppInfoArray() );
  2519     iLs.SetNotify(ETrue, status);
       
  2520     User::WaitForRequest(status);
       
  2521     
       
  2522 	HEAP_TEST_LS_SESSION(iLs, 0, DONT_CHECK, TestAppListInvalidL(), iLs.ClearAppInfoArray() );
  2532 	//DONT_CHECK due to file system changes
  2523 	//DONT_CHECK due to file system changes
  2533 	HEAP_TEST_LS_SESSION(iLs, 0, DONT_CHECK, TestAppListInstallationL(), NO_CLEANUP);
  2524 	HEAP_TEST_LS_SESSION(iLs, 0, DONT_CHECK, TestAppListInstallationL(), NO_CLEANUP);
  2534 	HEAP_TEST_LS_SESSION(iLs, 0, DONT_CHECK, TestAppListInstallation1L(), NO_CLEANUP);
  2525 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
       
  2526     HEAP_TEST_LS_SESSION(iLs, 0, DONT_CHECK, TestAppListInstallation1L(), NO_CLEANUP);
  2535 	HEAP_TEST_LS_SESSION(iLs, 0, DONT_CHECK, TestAppFolderNonRomDrivesL(), NO_CLEANUP);
  2527 	HEAP_TEST_LS_SESSION(iLs, 0, DONT_CHECK, TestAppFolderNonRomDrivesL(), NO_CLEANUP);
       
  2528 #endif	
  2536     HEAP_TEST_LS_SESSION(iLs, 0, DONT_CHECK, TestZeroSizedIconFileL(), NO_CLEANUP);
  2529     HEAP_TEST_LS_SESSION(iLs, 0, DONT_CHECK, TestZeroSizedIconFileL(), NO_CLEANUP);
  2537     HEAP_TEST_LS_SESSION(iLs, 0, 0, IconLoadingTestCasesL(), NO_CLEANUP);
  2530     HEAP_TEST_LS_SESSION(iLs, 0, 0, IconLoadingTestCasesL(), NO_CLEANUP);
  2538 	HEAP_TEST_LS_SESSION(iLs, 0, 0, AppInfoTestCasesL(), iLs.ClearAppInfoArray(); NO_CLEANUP);
  2531 	HEAP_TEST_LS_SESSION(iLs, 0, DONT_CHECK, AppInfoTestCasesL(), iLs.ClearAppInfoArray(); NO_CLEANUP);
  2539 	HEAP_TEST_LS_SESSION(iLs, 0, 0, EmbeddedAppsTestCases(), iLs.ClearAppInfoArray() );
  2532 	HEAP_TEST_LS_SESSION(iLs, 0, DONT_CHECK, EmbeddedAppsTestCases(), iLs.ClearAppInfoArray() );
  2540 	HEAP_TEST_LS_SESSION(iLs, 0, DONT_CHECK, DoNumDefIconsTestL(), NO_CLEANUP);
  2533 	HEAP_TEST_LS_SESSION(iLs, 0, DONT_CHECK, DoNumDefIconsTestL(), NO_CLEANUP);
  2541 	HEAP_TEST_LS_SESSION(iLs, 0, 0, TestMatchesSecurityPolicy(), NO_CLEANUP);
  2534 	HEAP_TEST_LS_SESSION(iLs, 0, 0, TestMatchesSecurityPolicy(), NO_CLEANUP);
  2542 	//DONT_CHECK since there's a new typestore
  2535 	//DONT_CHECK since there's a new typestore
  2543 	HEAP_TEST_LS_SESSION(iLs, 0, DONT_CHECK, TestNotifyOnDataMappingChangeL(), NO_CLEANUP);
  2536 	HEAP_TEST_LS_SESSION(iLs, 0, DONT_CHECK, TestNotifyOnDataMappingChangeL(), NO_CLEANUP);
  2544 	HEAP_TEST_LS_SESSION(iLs, 0, 0, TestAppListRecognizeDataBufferOnlyL(), iLs.FlushRecognitionCache() );
  2537 	HEAP_TEST_LS_SESSION(iLs, 0, 0, TestAppListRecognizeDataBufferOnlyL(), iLs.FlushRecognitionCache() );
  2545 	HEAP_TEST_LS_SESSION(iLs, 0, 0, TestAppListRecognizeDataPassedByBufferL(), iLs.FlushRecognitionCache() );
  2538 	HEAP_TEST_LS_SESSION(iLs, 0, 0, TestAppListRecognizeDataPassedByBufferL(), iLs.FlushRecognitionCache() );
  2546 	HEAP_TEST_LS_SESSION(iLs, 0, 0, TestAppListRecognizeDataL(), iLs.FlushRecognitionCache() );
  2539 	HEAP_TEST_LS_SESSION(iLs, 0, DONT_CHECK, TestAppListRecognizeDataL(), iLs.FlushRecognitionCache() );
  2547 	HEAP_TEST_LS_SESSION(iLs, 0, 0, TestDataPriorityForUnTrustedApps(), NO_CLEANUP);
  2540 	HEAP_TEST_LS_SESSION(iLs, 0, DONT_CHECK, TestDataPriorityForUnTrustedApps(), NO_CLEANUP);
  2548 	HEAP_TEST_LS_SESSION(iLs, 0, 0, TestDataPriorityForUnTrustedAppsRegFile(), NO_CLEANUP);
  2541 	HEAP_TEST_LS_SESSION(iLs, 0, 0, TestDataPriorityForUnTrustedAppsRegFile(), NO_CLEANUP);
  2549 	TestIconLoaderAndIconArrayMemoryLeaksL();
  2542 	TestIconLoaderAndIconArrayMemoryLeaksL();
  2550 	}
  2543 	}
  2551 
  2544 
  2552 /**
  2545 /**
  2584    @return - TVerdict code
  2577    @return - TVerdict code
  2585    Override of base class virtual
  2578    Override of base class virtual
  2586  */
  2579  */
  2587 TVerdict CT_RApaLsSessionTestStep::doTestStepPreambleL()
  2580 TVerdict CT_RApaLsSessionTestStep::doTestStepPreambleL()
  2588 	{
  2581 	{
       
  2582     CSisFileInstaller sisFIleInstaller;
       
  2583     INFO_PRINTF2(_L("Installing sis file from -> %S"), &KApparcTestAppSisFile);
       
  2584     sisFIleInstaller.InstallSisL(KApparcTestAppSisFile);
       
  2585     INFO_PRINTF2(_L("Installing sis file from -> %S"), &KGroupNameTestAppSisFile);
       
  2586     sisFIleInstaller.InstallSisL(KGroupNameTestAppSisFile);
       
  2587     INFO_PRINTF2(_L("Installing sis file from -> %S"), &KAppNotEmbeddableSisFile);
       
  2588     sisFIleInstaller.InstallSisL(KAppNotEmbeddableSisFile);
       
  2589     INFO_PRINTF2(_L("Installing sis file from -> %S"), &KAppEmbeddableOnlySisFile);
       
  2590     sisFIleInstaller.InstallSisL(KAppEmbeddableOnlySisFile);
       
  2591     INFO_PRINTF2(_L("Installing sis file from -> %S"), &KAppEmbeddableStandaloneSisFile);
       
  2592     sisFIleInstaller.InstallSisL(KAppEmbeddableStandaloneSisFile);
       
  2593     INFO_PRINTF2(_L("Installing sis file from -> %S"), &KAppEmbeddableEmbeddedSisFile);
       
  2594     sisFIleInstaller.InstallSisL(KAppEmbeddableEmbeddedSisFile);
       
  2595     INFO_PRINTF2(_L("Installing sis file from -> %S"), &KAppEmbeddableUiNotStandAloneSisFile);
       
  2596     sisFIleInstaller.InstallSisL(KAppEmbeddableUiNotStandAloneSisFile);
       
  2597     INFO_PRINTF2(_L("Installing sis file from -> %S"), &KAppEmbeddableUiOrStandAloneEmbeddedSisFile);
       
  2598     sisFIleInstaller.InstallSisL(KAppEmbeddableUiOrStandAloneEmbeddedSisFile);
       
  2599     INFO_PRINTF2(_L("Installing sis file from -> %S"), &KSimpleAppSisFile);
       
  2600     sisFIleInstaller.InstallSisL(KSimpleAppSisFile);   
       
  2601     INFO_PRINTF2(_L("Installing sis file from -> %S"), &KWinChainAppSisFile);
       
  2602     sisFIleInstaller.InstallSisL(KWinChainAppSisFile); 
       
  2603     INFO_PRINTF2(_L("Installing sis file from -> %S"), &KServerApp7SisFile);
       
  2604     sisFIleInstaller.InstallSisL(KServerApp7SisFile);
       
  2605     INFO_PRINTF2(_L("Installing sis file from -> %S"), &KTestTrustedPriorityApp1SisFile);
       
  2606     sisFIleInstaller.InstallSisL(KTestTrustedPriorityApp1SisFile);    
       
  2607     INFO_PRINTF2(_L("Installing sis file from -> %S"), &KTestUnTrustedPriorityApp1SisFile);
       
  2608     sisFIleInstaller.InstallSisL(KTestUnTrustedPriorityApp1SisFile);   
       
  2609     INFO_PRINTF2(_L("Installing sis file from -> %S"), &KTestTrustedPriorityApp2SisFile);
       
  2610     sisFIleInstaller.InstallSisL(KTestTrustedPriorityApp2SisFile);       
       
  2611     INFO_PRINTF2(_L("Installing sis file from -> %S"), &KAppEmbeddableUiOrStandAloneStandaloneSisFile);
       
  2612     sisFIleInstaller.InstallSisAndWaitForAppListUpdateL(KAppEmbeddableUiOrStandAloneStandaloneSisFile);
       
  2613        
  2589 	SetTestStepResult(EPass);
  2614 	SetTestStepResult(EPass);
  2590 	return TestStepResult();
  2615 	return TestStepResult();
  2591 	}
  2616 	}
  2592 
  2617 
       
  2618 
  2593 /**
  2619 /**
  2594    @return - TVerdict code
  2620    @return - TVerdict code
  2595    Override of base class virtual
  2621    Override of base class virtual
  2596  */
  2622  */
  2597 TVerdict CT_RApaLsSessionTestStep::doTestStepPostambleL()
  2623 TVerdict CT_RApaLsSessionTestStep::doTestStepPostambleL()
  2598 	{
  2624 	{
       
  2625     CSisFileInstaller sisFIleInstaller;
       
  2626     sisFIleInstaller.UninstallSisL(KApparcTestAppComponent);
       
  2627     sisFIleInstaller.UninstallSisL(KGroupNameTestAppComponent); 
       
  2628     sisFIleInstaller.UninstallSisL(KAppNotEmbeddableComponent);
       
  2629     sisFIleInstaller.UninstallSisL(KAppEmbeddableOnlyComponent);
       
  2630     sisFIleInstaller.UninstallSisL(KAppEmbeddableStandaloneComponent);    
       
  2631     sisFIleInstaller.UninstallSisL(KAppEmbeddableEmbeddedComponent);
       
  2632     sisFIleInstaller.UninstallSisL(KAppEmbeddableUiNotStandAloneComponent);
       
  2633     sisFIleInstaller.UninstallSisL(KAppEmbeddableUiOrStandAloneEmbeddedComponent);
       
  2634     sisFIleInstaller.UninstallSisL(KAppEmbeddableUiOrStandAloneStandaloneComponent);
       
  2635     sisFIleInstaller.UninstallSisL(KSimpleAppComponent);
       
  2636     sisFIleInstaller.UninstallSisL(KWinChainAppComponent);    
       
  2637     sisFIleInstaller.UninstallSisL(KServerApp7Component); 
       
  2638     sisFIleInstaller.UninstallSisL(KTestTrustedPriorityApp1Component);       
       
  2639     sisFIleInstaller.UninstallSisL(KTestUnTrustedPriorityApp1Component);   
       
  2640     sisFIleInstaller.UninstallSisL(KTestTrustedPriorityApp2Component);    
  2599 	return TestStepResult();
  2641 	return TestStepResult();
  2600 	}
  2642 	}
  2601 
  2643 
  2602 
  2644 
  2603 TVerdict CT_RApaLsSessionTestStep::doTestStepL()
  2645 TVerdict CT_RApaLsSessionTestStep::doTestStepL()
  2604 	{
  2646 	{
  2605 	INFO_PRINTF1(_L("Testing Apparc...T_RApaLsSession Test Cases Running..."));
  2647 	INFO_PRINTF1(_L("Testing Apparc...T_RApaLsSession Test Cases Running..."));
  2606 
  2648 	
       
  2649 	TApaAppInfo info;
       
  2650 	TUid uid = {0xABCD0000};
       
  2651 	TInt err = iLs.GetAppInfo(info, uid);
       
  2652 	if(err == KErrNone)
       
  2653 	{       
       
  2654 	CSisFileInstaller sisFileInstaller;
       
  2655 	sisFileInstaller.UninstallSisL(KZeroSizeIconAppComponent);
       
  2656 	}
  2607 	TRAPD(ret,RunTestCasesL())
  2657 	TRAPD(ret,RunTestCasesL())
  2608 	TEST(ret==KErrNone);
  2658 	TEST(ret==KErrNone);
  2609 	
  2659 	
  2610 	INFO_PRINTF1(_L("...T_RApaLsSession Test Cases Completed."));
  2660 	INFO_PRINTF1(_L("...T_RApaLsSession Test Cases Completed."));
  2611 
  2661