localisation/apparchitecture/tef/T_RApaLsSessionStep.cpp
branchSymbian2
changeset 1 8758140453c0
child 6 c108117318cb
equal deleted inserted replaced
0:e8c1ea2c6496 1:8758140453c0
       
     1 // Copyright (c) 2007-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 the License "Symbian Foundation License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 
       
    17 
       
    18 /**
       
    19  @file
       
    20  @test
       
    21  @internalComponent - Internal Symbian test code 
       
    22 */
       
    23 
       
    24 #include <f32file.h>
       
    25 #include <fbs.h>
       
    26 #include <s32std.h> 
       
    27 #include <s32stor.h> 
       
    28 #include <s32file.h> 
       
    29 
       
    30 #include <coecntrl.h>
       
    31 #include <coeccntx.h>
       
    32 #include <coemain.h>
       
    33 #include <coeview.h>
       
    34 #include <eikdialg.h>
       
    35 #include <eikdoc.h>
       
    36 #include <eikapp.h>
       
    37 #include <eiksrvc.h>
       
    38 #include <eikconso.h>
       
    39 
       
    40 #include <apaid.h>
       
    41 #include "..\apparc\apadll.h"
       
    42 #include <apgaplst.h>
       
    43 #include <apgicnfl.h>
       
    44 #include <apgdoor.h>
       
    45 #include <apfrec.h>
       
    46 #include <apfctlf.h>
       
    47 #include <apgctl.h>
       
    48 #include <apgaplst.h>
       
    49 #include <apaflrec.h>
       
    50 #include <apgcli.h>
       
    51 #include <apacmdln.h>
       
    52 #include <apsserv.h>
       
    53 #include <barsread.h>
       
    54 #include "tstapp.h"
       
    55 #include <appfwk_test.h>
       
    56 
       
    57 #include "T_RApaLsSessionStep.h"
       
    58 #include "appfwk_test_AppUi.h"
       
    59 #include "TRApaLsSessionStartAppTest.h"
       
    60 #include "TIconLoaderAndIconArrayForLeaks.h"  
       
    61 
       
    62 #if !defined(__E32TEST_H__)
       
    63 #include <e32test.h>
       
    64 #endif
       
    65 
       
    66 // Literals & Constants
       
    67 _LIT(KCompleted, "Completed.");
       
    68 const TUint KBytesToRead=100;
       
    69 
       
    70 
       
    71 /****************************************
       
    72  Auxiliary functions used by test cases
       
    73 *****************************************/
       
    74 void CT_RApaLsSessionTestStep::setup()
       
    75 	{
       
    76 #if defined(__EPOC32__)
       
    77 	
       
    78 	TFullName filePath=_L("c:\\docs\\tstapp.doc");
       
    79 	TFullName tempPath=_L("c:\\system\\temp\\");
       
    80 	// if we're on the rack create the directories we need
       
    81 	TParse parser;
       
    82 	parser.Set(filePath,NULL,NULL);
       
    83 	iFs.MkDirAll(parser.DriveAndPath());
       
    84 	parser.Set(tempPath,NULL,NULL);
       
    85 	iFs.MkDirAll(parser.DriveAndPath());
       
    86 #endif
       
    87 	}
       
    88 
       
    89 
       
    90 ////////////////////////////
       
    91 // Might actually be tests......
       
    92 /////////////////////////////
       
    93 
       
    94 void CT_RApaLsSessionTestStep::TestAppListInfoDataInterrogationSetupL()
       
    95 	{
       
    96 	//
       
    97 	INFO_PRINTF1(_L("Initialising App List Cache using GetAllApps....."));
       
    98 	TInt ret = iLs.GetAllApps();
       
    99 	TEST(ret==KErrNone);
       
   100 	INFO_PRINTF1(KCompleted);
       
   101 
       
   102 // get the full app count
       
   103 	INFO_PRINTF1(_L("Getting AppCount....."));
       
   104 	TInt count=0;
       
   105 	ret = iLs.AppCount(count);
       
   106 	TEST(ret==KErrNone);
       
   107 	TEST(count>=1);
       
   108 	INFO_PRINTF1(KCompleted);
       
   109 
       
   110 // prepare to get a list of embeddable apps
       
   111 	INFO_PRINTF1(_L("Initialising embeddable app list cache using GetEmbeddableApps....."));
       
   112 	ret = iLs.GetEmbeddableApps();
       
   113 	TEST(ret==KErrNone);
       
   114 	INFO_PRINTF1(KCompleted);
       
   115 
       
   116 // get the embedded app count
       
   117 	INFO_PRINTF1(_L("Initialising embeddable app list cache using EmbeddableAppCount....."));
       
   118 	count=0;
       
   119 	ret = iLs.EmbeddableAppCount(count);
       
   120 	TEST(ret==KErrNone);
       
   121 	TEST(count>=1);
       
   122 	INFO_PRINTF1(KCompleted);
       
   123 	}	
       
   124 
       
   125 /**
       
   126    @SYMTestCaseID T-RApaLsSessionTestStep-TestAppInfo1
       
   127   
       
   128    @SYMPREQ
       
   129   
       
   130    @SYMTestCaseDesc Test RApaLsSession::GetNextApp() 
       
   131    
       
   132    @SYMTestPriority High 
       
   133   
       
   134    @SYMTestStatus Implemented
       
   135    
       
   136    @SYMTestActions Call RApaLsSession::GetAllApps() to initialize the process of
       
   137    getting all applications in the cached list. Traverse the application list
       
   138    by calling RApaLsSession::GetNextApp() to search for application tstapp.
       
   139    Test the application info obtained from GetNextApp() to ensure the application
       
   140    info obtained is of tstapp. Complete traversal of the list to ensure that at
       
   141    the end of the list, the enum ENoMoreAppInList is returned by GetNextApp().\n
       
   142    API Calls:\n	
       
   143    RApaLsSession::GetAllApps() const\n
       
   144    RApaLsSession::GetNextApp(TApaAppInfo& aInfo) const\n
       
   145    
       
   146    @SYMTestExpectedResults The test compares the results obtained with expected values.
       
   147     
       
   148  */
       
   149 void CT_RApaLsSessionTestStep::TestAppInfo1()
       
   150 	{
       
   151 	
       
   152 	INFO_PRINTF1(_L("Testing RApaLsSession::ENoMoreAppsInList....attempt to get an app"));
       
   153     //Go to end of Applist for next test... 
       
   154 	TApaAppInfo info;
       
   155 	TInt ret = iLs.GetAllApps();
       
   156 	TEST(ret==KErrNone);
       
   157 
       
   158 	do
       
   159 		{
       
   160  		ret=iLs.GetNextApp(info);
       
   161  		}
       
   162  	while (ret != RApaLsSession::ENoMoreAppsInList);
       
   163 
       
   164 	//try to get another app (there arn't any more)
       
   165 	ret = iLs.GetNextApp(info);
       
   166 	TEST(ret==RApaLsSession::ENoMoreAppsInList);
       
   167 	
       
   168 	INFO_PRINTF1(KCompleted);
       
   169 	}
       
   170 
       
   171 /**
       
   172    @SYMTestCaseID T-RApaLsSessionTestStep-TestAppInfo2
       
   173   
       
   174    @SYMPREQ
       
   175   
       
   176    @SYMTestCaseDesc Test RApaLsSession::GetNextApp() 
       
   177    
       
   178    @SYMTestPriority High 
       
   179   
       
   180    @SYMTestStatus Implemented
       
   181    
       
   182    @SYMTestActions Call RApaLsSession::GetAllApps() to initialize the process of
       
   183    getting all applications in the cached list. Traverse the application list
       
   184    by calling RApaLsSession::GetNextApp() to search for application tstapp.
       
   185    Test the application information obtained from GetNextApp() to ensure that
       
   186    information retrieved is of tstapp.\n
       
   187    API Calls:\n	
       
   188    RApaLsSession::GetAllApps() const\n
       
   189    RApaLsSession::GetNextApp(TApaAppInfo& aInfo) const\n
       
   190    
       
   191    @SYMTestExpectedResults The test compares the results obtained with expected values.
       
   192     
       
   193  */
       
   194 void CT_RApaLsSessionTestStep::TestAppInfo2()
       
   195 	{
       
   196 	INFO_PRINTF1(_L("Testing RApaLsSession::GetNextApps() return info...."));
       
   197 	_LIT(KLitAppPath,"z:\\sys\\bin\\tstapp.exe");
       
   198 	TFullName appPath(KLitAppPath);
       
   199 
       
   200 	TApaAppInfo info;
       
   201 	TInt ret = iLs.GetAllApps();
       
   202 	TEST(ret==KErrNone);
       
   203 
       
   204 	do
       
   205 	{
       
   206 		iLs.GetNextApp(info);
       
   207 	}
       
   208 	while (ret==KErrNone && info.iUid!=KUidTestApp);
       
   209 		
       
   210 	TEST(ret==KErrNone);
       
   211 	TEST(info.iUid==KUidTestApp);
       
   212 	info.iFullName.LowerCase();	
       
   213 	TEST(info.iFullName.Compare(appPath) == 0);
       
   214 	INFO_PRINTF1(KCompleted);
       
   215 	}
       
   216 
       
   217 /**
       
   218    @SYMTestCaseID T-RApaLsSessionTestStep-TestAppInfo3
       
   219   
       
   220    @SYMPREQ
       
   221   
       
   222    @SYMTestCaseDesc Test RApaLsSession::GetAppInfo(). 
       
   223    
       
   224    @SYMTestPriority High 
       
   225   
       
   226    @SYMTestStatus Implemented
       
   227    
       
   228    @SYMTestActions Call RApaLsSession::GetAppInfo() by passing the Uid of test
       
   229    application tstapp and test the application info obtained from GetAppInfo()
       
   230    to ensure the obtained information is of test application tstapp.\n
       
   231    API Calls:\n	
       
   232    RApaLsSession::GetAppInfo(TApaAppInfo& aInfo,TUid aAppUid) const\n
       
   233    
       
   234    @SYMTestExpectedResults The test confirms that RApaLsSession::GetAppInfo()
       
   235    returns the expected application info.
       
   236     
       
   237  */
       
   238 void CT_RApaLsSessionTestStep::TestAppInfo3()
       
   239 	{
       
   240 	INFO_PRINTF1(_L("Testing RApaLsSession::GetAppInfo()...."));
       
   241 	_LIT(KLitAppPath,"z:\\sys\\bin\\tstapp.exe");
       
   242 	TFullName appPath(KLitAppPath);
       
   243 	// Get info for an app that exists
       
   244 	TApaAppInfo info;
       
   245 	TInt ret = iLs.GetAppInfo(info,KUidTestApp);
       
   246 	TEST(ret==KErrNone);
       
   247 	TEST(info.iUid==KUidTestApp);
       
   248 	info.iFullName.LowerCase();	
       
   249 	TEST(info.iFullName.Compare(appPath) == 0);
       
   250 	INFO_PRINTF1(KCompleted);
       
   251 	}
       
   252 
       
   253 /**
       
   254    @SYMTestCaseID T-RApaLsSessionTestStep-TestAppInfo4
       
   255   
       
   256    @SYMPREQ
       
   257   
       
   258    @SYMTestCaseDesc Test if RApaLsSession::GetAppInfo() return KErrNotFound. 
       
   259    
       
   260    @SYMTestPriority High 
       
   261   
       
   262    @SYMTestStatus Implemented
       
   263    
       
   264    @SYMTestActions The method calls RApaLsSession::GetAppInfo() by passing the null Uid
       
   265    KNullUid. Observe whether KErrNotFound is returned when Uid that doesn't match
       
   266    is passed to GetAppInfo().\n
       
   267    API Calls:\n	
       
   268    RApaLsSession::GetAppInfo(TApaAppInfo& aInfo,TUid aAppUid) const\n
       
   269    
       
   270    @SYMTestExpectedResults The test confirms RApaLsSession::GetAppInfo() returns
       
   271    KErrNotFound when no match is found for the Uid passed.\n
       
   272     
       
   273  */
       
   274 void CT_RApaLsSessionTestStep::TestAppInfo4()
       
   275 	{
       
   276 	INFO_PRINTF1(_L("Testing RApaLsSession::GetAppInfo()....non-existent app"));
       
   277 
       
   278 	TApaAppInfo info;
       
   279 	TInt ret = iLs.GetAppInfo(info,KNullUid);
       
   280 	TEST(ret==KErrNotFound);
       
   281 	INFO_PRINTF1(KCompleted);
       
   282 	}
       
   283 
       
   284 /**
       
   285    @SYMTestCaseID T-RApaLsSessionTestStep-TestServerIconSizeCountL
       
   286   
       
   287    @SYMPREQ
       
   288   
       
   289    @SYMTestCaseDesc Test Get the number of icon sizes for testapp app. 
       
   290    
       
   291    @SYMTestPriority High 
       
   292   
       
   293    @SYMTestStatus Implemented
       
   294    
       
   295    @SYMTestActions Allocate a flat dynamic buffer which would hold available icon
       
   296    sizes for tstapp. Call RApaLsSession::GetAppIconSizes() to store the sizes
       
   297    of icons available for the app tstapp to the allocated flat dynamic buffer.
       
   298    Check that it is non zero, i.e. that a number of icon sizes has been retreived
       
   299    for testapp.\n
       
   300    API Calls:\n	
       
   301    RApaLsSession::GetAppIconSizes(TUid aAppUid, CArrayFixFlat<TSize>& aArrayToFill) const\n
       
   302    
       
   303    @SYMTestExpectedResults aTestIconSizeArray->Count() is greater than 0.
       
   304     
       
   305  */
       
   306 void CT_RApaLsSessionTestStep::TestServerIconSizeCountL(CArrayFixFlat<TSize>& aTestIconSizeArray)
       
   307 	{
       
   308 	INFO_PRINTF1(_L("Test RApaLsSession::GetAppIconSizes..."));
       
   309 
       
   310 	TInt ret=iLs.GetAppIconSizes(KUidTestApp,aTestIconSizeArray);
       
   311 	if(ret==KErrNoMemory)
       
   312 		User::Leave(KErrNoMemory);
       
   313 	TEST(ret==KErrNone);
       
   314 	TEST(aTestIconSizeArray.Count()!=0);
       
   315 	
       
   316 	INFO_PRINTF1(KCompleted);
       
   317 	}
       
   318 
       
   319 
       
   320 
       
   321 /**
       
   322    @SYMTestCaseID T-RApaLsSessionTestStep-TestServerIconLoadingBySize1L
       
   323   
       
   324    @SYMPREQ
       
   325   
       
   326    @SYMTestCaseDesc Test loading of Icon by size. 
       
   327    
       
   328    @SYMTestPriority High 
       
   329   
       
   330    @SYMTestStatus Implemented
       
   331    
       
   332    @SYMTestActions Allocate a flat dynamic buffer which would hold available icon
       
   333    sizes for tstapp. Call RApaLsSession::GetAppIconSizes() to store the sizes
       
   334    of icons available for the app tstapp to the allocated flat dynamic buffer.
       
   335    Call RApaLsSession::GetAppIcon() by passing each of the icon sizes stored.
       
   336    Verify whether icon is retrieved each time by GetAppIcon().\n
       
   337    API Calls:\n	
       
   338    RApaLsSession::GetAppIcon(TUid aAppUid, TSize aSize, CApaMaskedBitmap& aAppBitmap) const\n
       
   339    
       
   340    @SYMTestExpectedResults The results obtained are compared with the expected values to verify
       
   341    functionality of RApaLsSession::GetAppIcon().
       
   342     
       
   343  */
       
   344 void CT_RApaLsSessionTestStep::TestServerIconLoadingBySize1L(CArrayFixFlat<TSize>& aTestIconSizeArray)
       
   345 	{
       
   346 	INFO_PRINTF1(_L("Test RApaLsSession::GetAppIcon....Compare icon sizes"));
       
   347 
       
   348 	for(TInt i=0;i<aTestIconSizeArray.Count();i++)
       
   349 		{
       
   350 		CApaMaskedBitmap* iconBySize=CApaMaskedBitmap::NewLC();
       
   351 		TInt ret=iLs.GetAppIcon(KUidTestApp,aTestIconSizeArray[i],*iconBySize); //by Size
       
   352 		if(ret==KErrNoMemory)
       
   353 			User::Leave(KErrNoMemory);
       
   354 		TEST(ret==KErrNone);
       
   355 		TEST(iconBySize->SizeInPixels()==aTestIconSizeArray[i]);
       
   356 		CleanupStack::PopAndDestroy(iconBySize);
       
   357 		}
       
   358 	INFO_PRINTF1(KCompleted);
       
   359 	}
       
   360 
       
   361 /**
       
   362    @SYMTestCaseID T-RApaLsSessionTestStep-TestServerIconLoadingBySize2L
       
   363   
       
   364    @SYMPREQ
       
   365   
       
   366    @SYMTestCaseDesc Test loading of Icon by size. 
       
   367    
       
   368    @SYMTestPriority High 
       
   369   
       
   370    @SYMTestStatus Implemented
       
   371    
       
   372    @SYMTestActions Allocate a flat dynamic buffer which would hold available icon
       
   373    sizes for tstapp. Call RApaLsSession::GetAppIconSizes() to store the sizes
       
   374    of icons available for the app tstapp to the allocated flat dynamic buffer.
       
   375    Call RApaLsSession::GetAppIcon() by passing each of the icon sizes stored.
       
   376    Test calling RApaLsSession::GetAppIcon() by specifying reduced size than
       
   377    the actual icon size. Since no match would be found, KErrNotFound should be
       
   378    returned.\n
       
   379    API Calls:\n	
       
   380    RApaLsSession::GetAppIcon(TUid aAppUid, TSize aSize, CApaMaskedBitmap& aAppBitmap) const\n
       
   381    
       
   382    @SYMTestExpectedResults The results obtained are compared with the expected values to verify
       
   383    functionality of RApaLsSession::GetAppIcon().
       
   384     
       
   385  */
       
   386 void CT_RApaLsSessionTestStep::TestServerIconLoadingBySize2L(CArrayFixFlat<TSize>& aTestIconSizeArray)
       
   387 	{
       
   388 	INFO_PRINTF1(_L("Test RApaLsSession::GetAppIcon....Compare icon sizes that don't match"));
       
   389 
       
   390 	// now try non exact sizes
       
   391 	CApaMaskedBitmap* iconBySize=CApaMaskedBitmap::NewLC();
       
   392 	TInt ret=iLs.GetAppIcon(KUidTestApp,(aTestIconSizeArray[0])+TSize(-5,-5),*iconBySize); //by Size
       
   393 	if(ret==KErrNoMemory)
       
   394 		User::Leave(KErrNoMemory);
       
   395 	TEST(ret==KErrNotFound);
       
   396 	CleanupStack::PopAndDestroy(iconBySize);
       
   397 	INFO_PRINTF1(KCompleted);
       
   398 	}
       
   399 
       
   400 /**
       
   401    @SYMTestCaseID T-RApaLsSessionTestStep-TestServerIconLoadingBySize3L
       
   402   
       
   403    @SYMPREQ
       
   404   
       
   405    @SYMTestCaseDesc Test loading of Icon by size. 
       
   406    
       
   407    @SYMTestPriority High 
       
   408   
       
   409    @SYMTestStatus Implemented
       
   410    
       
   411    @SYMTestActions Allocate a flat dynamic buffer which would hold available icon
       
   412    sizes for tstapp. Call RApaLsSession::GetAppIconSizes() to store the sizes
       
   413    of icons available for the app tstapp to the allocated flat dynamic buffer.
       
   414    Call RApaLsSession::GetAppIcon() by passing each of the icon sizes stored.
       
   415    Test GetAppIcon() again by specifying an increased size than the
       
   416    actual icon size. Observe whether the GetAppIcon() in this case gets the
       
   417    closest icon available.\n
       
   418    API Calls:\n	
       
   419    RApaLsSession::GetAppIcon(TUid aAppUid, TSize aSize, CApaMaskedBitmap& aAppBitmap) const\n
       
   420    
       
   421    @SYMTestExpectedResults The results obtained are compared with the expected values to verify
       
   422    functionality of RApaLsSession::GetAppIcon().
       
   423     
       
   424  */
       
   425 void CT_RApaLsSessionTestStep::TestServerIconLoadingBySize3L(CArrayFixFlat<TSize>& aTestIconSizeArray)
       
   426 	{
       
   427 	INFO_PRINTF1(_L("Test RApaLsSession::GetAppIcon....Compare icon sizes that don't match."));
       
   428 	for(TInt ii=0;ii<aTestIconSizeArray.Count();ii++)
       
   429 		{
       
   430 		CApaMaskedBitmap* iconBySize=CApaMaskedBitmap::NewLC();
       
   431 		TInt ret=iLs.GetAppIcon(KUidTestApp,(aTestIconSizeArray[ii])+TSize(5,5),*iconBySize); //by Size
       
   432 		if(ret==KErrNoMemory)
       
   433 			User::Leave(KErrNoMemory);
       
   434 		TEST(ret==KErrNone);
       
   435 		TEST(iconBySize->SizeInPixels()==aTestIconSizeArray[ii]); // should get size below always!!!
       
   436 		CleanupStack::PopAndDestroy(iconBySize);
       
   437 		}
       
   438 	INFO_PRINTF1(KCompleted);
       
   439 	}
       
   440 
       
   441 
       
   442 /**
       
   443    @SYMTestCaseID T-RApaLsSessionTestStep-TestAppListInvalidL()
       
   444   
       
   445    @SYMPREQ
       
   446   
       
   447    @SYMTestCaseDesc Test .
       
   448    
       
   449    @SYMTestPriority High 
       
   450   
       
   451    @SYMTestStatus Implemented
       
   452    
       
   453    @SYMTestActions Test RApaLsSession::AppForDocument() to recognize data type &
       
   454    applications that can handle the data type of data stored in the specified
       
   455    file. The test is performed on files of one byte and zero byte sizes.
       
   456    Observe that on both occasions the API returns Uid of an application that
       
   457    can handle text \ plain data type.\n
       
   458    Test RApaLsSession::AppForDataType() to recognize Uid of an application
       
   459    that can handle a specified data type. To do this the test calls
       
   460    RApaLsSession::RecognizeData() which gets the data type for data taken
       
   461    from a specified file. The test is performed on files of one byte and zero
       
   462    byte sizes. The test ensures that RApaLsSession::AppForDataType() doesn't
       
   463    return KNullUid for both sizes of the file.\n
       
   464    API Calls:\n	
       
   465    RApaLsSession::AppForDocument(const TDesC& aFileName, TUid& aUid, TDataType& aDataType) const\n
       
   466    RApaLsSession::RecognizeData(const TDesC& aName, const TDesC8& aBuffer, TDataRecognitionResult& aDataType) const\n
       
   467    RApaLsSession::AppForDataType(const TDataType& aDataType, TUid& aAppUid) const\n
       
   468    
       
   469    @SYMTestExpectedResults Test ensures that the data recognition functions identify the data type of
       
   470    data in a file and the application capable of handling the specified
       
   471    data type.
       
   472    
       
   473  */
       
   474 void CT_RApaLsSessionTestStep::TestAppListInvalidL()
       
   475 	{
       
   476 	__UHEAP_MARK;
       
   477 	TestAppListInvalidSetupL();
       
   478 	__UHEAP_MARKEND;
       
   479 	
       
   480 	INFO_PRINTF1(_L("Test RApaLsSession::GetNextApp() never returns RApaLsSession::EAppListInvalid."));
       
   481 
       
   482 	TApaAppInfo info;
       
   483 	TInt ret=0;
       
   484 	while(ret==KErrNone)
       
   485 		{
       
   486 		ret=iLs.GetNextApp(info);
       
   487 		}
       
   488 
       
   489 	//tests GetNextApp() never returns RApaLsSession::EAppListInvalid
       
   490 	TEST(ret!=RApaLsSession::EAppListInvalid);
       
   491 	TEST(ret==RApaLsSession::ENoMoreAppsInList);
       
   492 	INFO_PRINTF1(KCompleted);
       
   493 	}
       
   494 
       
   495 
       
   496 void CT_RApaLsSessionTestStep::TestAppListInvalidSetupL()
       
   497 	{
       
   498 	INFO_PRINTF1(_L("Setting up Applist invalid test."));
       
   499 	
       
   500 	_LIT(KTempAppDir, "C:\\private\\10003a3f\\import\\apps\\");
       
   501 	_LIT(KTempRegPath, "C:\\private\\10003a3f\\import\\apps\\tstapp_reg.rsc");
       
   502 	TFullName regPath=_L("z:\\private\\10003a3f\\import\\apps\\tstapp_reg.rsc");
       
   503 	
       
   504 	CFileMan* iAppListInvalidTestFileMan = CFileMan::NewL (iFs);
       
   505 	CleanupStack::PushL(iAppListInvalidTestFileMan);
       
   506 	
       
   507 	INFO_PRINTF1(_L("Copy tstapp files to C: drive......."));
       
   508 	TInt rtn=iFs.MkDir(KTempAppDir);
       
   509 	TEST(rtn==KErrNone||rtn==KErrAlreadyExists); 
       
   510 	TEST(iAppListInvalidTestFileMan->Copy(regPath, KTempRegPath)==KErrNone);	//Just to start the idle update.
       
   511 
       
   512 	INFO_PRINTF1(_L("Get app list......."));
       
   513 	TInt ret = iLs.GetAllApps();
       
   514 	TEST(ret==KErrNone);
       
   515 
       
   516 	INFO_PRINTF1(_L("Remove temp files from C: drive......."));
       
   517 	TRequestStatus status;
       
   518 	TTime tempTime(0); // added tempTime to avoid asynch CFileMan::Attribs request completing with KErrArgument
       
   519 	TEST(iAppListInvalidTestFileMan->Attribs(KTempAppDir,0,KEntryAttReadOnly, tempTime, CFileMan::ERecurse, status)==KErrNone);
       
   520 	
       
   521 	User::WaitForRequest(status);
       
   522 	TEST(status.Int() == KErrNone);
       
   523 	INFO_PRINTF1(_L("Deleting Reg file......."));
       
   524 	TEST(iAppListInvalidTestFileMan->Delete(KTempRegPath)==KErrNone);	//Just to start the idle update.
       
   525 	INFO_PRINTF1(_L("Removing App dir......."));
       
   526 	TEST(iAppListInvalidTestFileMan->RmDir(KTempAppDir)==KErrNone);
       
   527 	CleanupStack::PopAndDestroy(iAppListInvalidTestFileMan);
       
   528 
       
   529 	INFO_PRINTF1(KCompleted);
       
   530 	}
       
   531 
       
   532 
       
   533 
       
   534 /**
       
   535    @SYMTestCaseID T-RApaLsSessionTestStep-TestAppListRecognizeDataL
       
   536   
       
   537    @SYMPREQ
       
   538   
       
   539    @SYMTestCaseDesc Test data recognition functions of RApaLsSession.
       
   540    
       
   541    @SYMTestPriority High 
       
   542   
       
   543    @SYMTestStatus Implemented
       
   544    
       
   545    @SYMTestActions Test RApaLsSession::AppForDocument() to recognize data type &
       
   546    applications that can handle the data type of data stored in the specified
       
   547    file. The test is performed on files of one byte and zero byte sizes.
       
   548    Observe that on both occasions the API returns Uid of an application that
       
   549    can handle text \ plain data type.\n
       
   550    Test RApaLsSession::AppForDataType() to recognize Uid of an application
       
   551    that can handle a specified data type. To do this the test calls
       
   552    RApaLsSession::RecognizeData() which gets the data type for data taken
       
   553    from a specified file. The test is performed on files of one byte and zero
       
   554    byte sizes. The test ensures that RApaLsSession::AppForDataType() doesn't
       
   555    return KNullUid for both sizes of the file.\n
       
   556    API Calls:\n	
       
   557    RApaLsSession::AppForDocument(const TDesC& aFileName, TUid& aUid, TDataType& aDataType) const\n
       
   558    RApaLsSession::RecognizeData(const TDesC& aName, const TDesC8& aBuffer, TDataRecognitionResult& aDataType) const\n
       
   559    RApaLsSession::AppForDataType(const TDataType& aDataType, TUid& aAppUid) const\n
       
   560    
       
   561    @SYMTestExpectedResults Test ensures that the data recognition functions identify the data type of
       
   562    data in a file and the application capable of handling the specified
       
   563    data type.
       
   564     
       
   565  */
       
   566 void CT_RApaLsSessionTestStep::TestAppListRecognizeDataL()
       
   567 	{
       
   568 	// The following tests will only succeed if the text recogniser and an app which likes text files are both installed
       
   569 	// The tests check that file recognisers work for zero and non zero length files.
       
   570 	INFO_PRINTF1(_L("Testing AppForDocument(), RecognizeData() and AppForDataType()"));
       
   571 	TInt ret;
       
   572 	TUid appUid=KNullUid;
       
   573     TDataType dataType;
       
   574 	INFO_PRINTF1(_L("Testing 1 byte text file recognition"));
       
   575     ret = iLs.AppForDocument(_L("z:\\system\\data\\one_byte.txt"), appUid,dataType);
       
   576 	TEST(ret==KErrNone);
       
   577 	TEST(appUid!=KNullUid);
       
   578 	INFO_PRINTF1(KCompleted);
       
   579 	
       
   580 	appUid=KNullUid;
       
   581 	INFO_PRINTF1(_L("Testing zero byte text file recognition"));
       
   582     ret = iLs.AppForDocument(_L("z:\\system\\data\\zero_len.txt"), appUid,dataType);
       
   583 	TEST(ret==KErrNone);
       
   584 	TEST(appUid!=KNullUid);
       
   585 	INFO_PRINTF1(KCompleted);
       
   586 	
       
   587 	// this following exihibits a defect which was fixed for Release 6 is fixed.
       
   588 	// KNullUid was recognized for zero length text files using this method before the fix.
       
   589 	appUid=KNullUid;
       
   590 	TBuf8<255> buffer;
       
   591     buffer.FillZ(255);
       
   592     buffer[0] = 'a';	// We used to fill it entirely with zeroes but an ICL recognizer know interferes 
       
   593     					// with this, so we added an 'a'
       
   594 	TDataRecognitionResult recogResult;
       
   595 
       
   596 	appUid=KNullUid;
       
   597 	INFO_PRINTF1(_L("Testing 1 byte text file recognition - lengthy method"));
       
   598     ret = iLs.RecognizeData(_L("z:\\system\\data\\one_byte.txt"),buffer,recogResult);
       
   599 	TEST(ret==KErrNone);
       
   600     ret = iLs.AppForDataType(recogResult.iDataType,appUid);
       
   601 	TEST(ret==KErrNone);
       
   602 	TEST(appUid!=KNullUid);
       
   603 	INFO_PRINTF1(KCompleted);
       
   604 
       
   605 	appUid=KNullUid;
       
   606 	INFO_PRINTF1(_L("Testing zero byte text file recognition -lengthy method"));
       
   607 	ret = iLs.RecognizeData(_L("z:\\system\\data\\zero_len.txt"),buffer,recogResult);
       
   608 	TEST(ret==KErrNone);
       
   609     ret = iLs.AppForDataType(recogResult.iDataType,appUid);
       
   610 	TEST(ret==KErrNone);
       
   611 	TEST(appUid!=KNullUid);
       
   612 	INFO_PRINTF1(KCompleted);
       
   613 	
       
   614 	// the following attempts to open a file of an unknown mime type with extension .UnrecognisableExtention
       
   615 	
       
   616 	INFO_PRINTF1(_L("Testing RecognizeData() with unrecognizable file type..."));
       
   617 	buffer.FillZ(255);
       
   618 	_LIT8(KLitUnRecog,"");
       
   619 	iLs.FlushRecognitionCache();
       
   620 	recogResult.Reset();
       
   621 	//First call to RecognizeData() does not utilize the cache
       
   622 	User::LeaveIfError(iLs.RecognizeData(_L("z:\\system\\data\\FileWithUnknownMimeType.UnrecognisableExtention"),buffer,recogResult));
       
   623 	TEST(recogResult.iDataType.Des8().CompareF(KLitUnRecog)==0);
       
   624 	recogResult.Reset();
       
   625 	//Second call to RecognizeData() utilizes the cache
       
   626 	User::LeaveIfError(iLs.RecognizeData(_L("z:\\system\\data\\FileWithUnknownMimeType.UnrecognisableExtention"),buffer,recogResult));
       
   627 	TEST(recogResult.iDataType.Des8().CompareF(KLitUnRecog)==0);
       
   628 	INFO_PRINTF1(_L("Completed Testing unrecognizable file type..."));
       
   629 	
       
   630    	}
       
   631    	
       
   632 /**
       
   633    @SYMTestCaseID T-RApaLsSessionTestStep-TestAppListRecognizeDataBufferOnlyL
       
   634   
       
   635    @SYMPREQ INC064138
       
   636   
       
   637    @SYMTestCaseDesc Test data recognition functions of RApaLsSession without a filename.
       
   638    
       
   639    @SYMTestPriority High 
       
   640   
       
   641    @SYMTestStatus Implemented
       
   642    
       
   643    @SYMTestActions 
       
   644    
       
   645    @SYMTestExpectedResults Test ensures that the data recognition functions identify the data type of
       
   646    data in a file.
       
   647  */
       
   648 void CT_RApaLsSessionTestStep::TestAppListRecognizeDataBufferOnlyL()
       
   649 	{
       
   650 	INFO_PRINTF1(_L("Testing recognition without filename"));
       
   651 	
       
   652 	TDataRecognitionResult rr;
       
   653     _LIT8(KTestBuffer, "Text_TestRecognizer");
       
   654     rr.Reset();
       
   655     TInt error = iLs.RecognizeData(KNullDesC, KTestBuffer, rr);
       
   656     if (rr.iConfidence != CApaDataRecognizerType::ECertain)
       
   657         {
       
   658         INFO_PRINTF1(_L("Error: confidence should be ECertain"));
       
   659         TEST(EFalse);
       
   660         }
       
   661     
       
   662     _LIT8(KAnotherBuffer, "AnotherText");
       
   663     rr.Reset();
       
   664     error = iLs.RecognizeData(KNullDesC, KAnotherBuffer, rr);
       
   665     if (rr.iConfidence != CApaDataRecognizerType::EProbable)
       
   666         {
       
   667         INFO_PRINTF1(_L("Error: confidence should be EProbable"));        
       
   668         TEST(EFalse);
       
   669         }  
       
   670    
       
   671   	INFO_PRINTF1(KCompleted);
       
   672 	}
       
   673    	
       
   674 /**
       
   675    @SYMTestCaseID T-Serv2Step-DoEnquiryTestsL
       
   676   
       
   677    @SYMPREQ
       
   678   
       
   679    @SYMTestCaseDesc Tests querying of data (MIME) type information. 
       
   680    
       
   681    @SYMTestPriority High 
       
   682   
       
   683    @SYMTestStatus Implemented
       
   684    
       
   685    @SYMTestActions Test setting and getting the confidence threshold for
       
   686    successful data recognition by calling RApaLsSession::SetAcceptedConfidence()
       
   687    and RApaLsSession::GetAcceptedConfidence().\n
       
   688    Test setting and getting maximum size of the data that can be read
       
   689    from a file for the purpose of recognizing the data type by calling
       
   690    RApaLsSession::SetMaxDataBufSize() and RApaLsSession::GetMaxDataBufSize().
       
   691    Finally test retrieval of all supported data (MIME) types.\n
       
   692    API Calls:\n	
       
   693    RApaLsSession::SetAcceptedConfidence(TInt aConfidence)\n
       
   694    RApaLsSession::GetAcceptedConfidence(TInt& aConfidence) const\n
       
   695    RApaLsSession::SetMaxDataBufSize(TInt aBufSize)\n
       
   696    RApaLsSession::GetMaxDataBufSize(TInt& aBufSize) const\n
       
   697    RApaLsSession::GetSupportedDataTypesL(CDataTypeArray& aDataTypes) const\n
       
   698    
       
   699    @SYMTestExpectedResults Test results against expected values.
       
   700     
       
   701  */
       
   702 void CT_RApaLsSessionTestStep::TestSetGetAcceptedConfidenceL()
       
   703 	{
       
   704 	INFO_PRINTF1(_L("Test SetAcceptedConfidence...."));
       
   705 	
       
   706 	TInt temp=1234;
       
   707 	TInt ret=iLs.SetAcceptedConfidence(temp);
       
   708 	TSecurityInfo info;
       
   709 	info.Set(RProcess());
       
   710 	
       
   711 	info.iCaps.HasCapability(ECapabilityWriteDeviceData) ? TEST(ret==KErrNone) :  TEST(ret==KErrPermissionDenied);
       
   712 	INFO_PRINTF1(KCompleted);
       
   713 	
       
   714 	INFO_PRINTF1(_L("Test GetAcceptedConfidence...."));
       
   715 	temp=0;
       
   716 	ret=iLs.GetAcceptedConfidence(temp);
       
   717 	TEST(ret==KErrNone);
       
   718 	TEST(temp==1234);
       
   719 	INFO_PRINTF1(KCompleted);
       
   720 	}
       
   721 
       
   722 void CT_RApaLsSessionTestStep::TestSetGetMaxDataBufSizeL()
       
   723 	{
       
   724 	INFO_PRINTF1(_L("Test SetMaxDataBufSize...."));
       
   725 
       
   726 	TInt temp=1234;
       
   727 	TInt ret=iLs.SetMaxDataBufSize(temp);
       
   728 	TEST(ret==KErrNone);
       
   729 	INFO_PRINTF1(KCompleted);
       
   730 	
       
   731 	INFO_PRINTF1(_L("Test GetMaxDataBufSize...."));
       
   732 	temp=0;
       
   733 	ret=iLs.GetMaxDataBufSize(temp);
       
   734 	TEST(ret==KErrNone);
       
   735 	TEST(temp==1234);
       
   736 	INFO_PRINTF1(KCompleted);
       
   737 	}
       
   738 
       
   739 void CT_RApaLsSessionTestStep::TestGetSupportedDataTypesL()
       
   740 {
       
   741 	INFO_PRINTF1(_L("Test GetSupportedDataTypes...."));
       
   742 
       
   743 	CDataTypeArray* dataTypes=new(ELeave) CDataTypeArray(5);
       
   744 	CleanupStack::PushL(dataTypes);
       
   745 	
       
   746 	TInt ret=iLs.GetSupportedDataTypesL(*dataTypes);
       
   747 	TEST(ret==KErrNone);
       
   748 	TEST(dataTypes->Count()>=4);
       
   749 	CleanupStack::PopAndDestroy(); // dataTypes
       
   750 
       
   751 	INFO_PRINTF1(KCompleted);
       
   752 	}
       
   753 
       
   754 
       
   755 /**
       
   756    @SYMTestCaseID T-RApaLsSessionTestStep-DoGetAllApps
       
   757   
       
   758    @SYMPREQ PHAR-5Q4FX8
       
   759   
       
   760    @SYMTestCaseDesc
       
   761    Check that RApaLsSession::GetAllApps() hasn't been
       
   762    affected by the new code to filter the app list
       
   763    based on embeddability (implemented for CR PHAR-5Q4FX8)
       
   764   
       
   765    @SYMTestPriority High
       
   766   
       
   767    @SYMTestStatus Implemented
       
   768   
       
   769    @SYMTestActions
       
   770    Call GetAllApps() once, followed by repeated calls
       
   771    to GetNextApp until something other than KErrNone is returned
       
   772   
       
   773    @SYMTestExpectedResults
       
   774    GetNextApp should return app info for the following test apps:
       
   775    TAppNotEmbeddable.exe
       
   776    TAppEmbeddable.dll
       
   777    TAppEmbeddableOnly.dll
       
   778    TAppEmbeddableUiOrStandAlone.dll
       
   779    TAppEmbeddableUiNotStandAlone.dll
       
   780    The last call to GetNextApp should return RApaLsSession::ENoMoreAppsInList
       
   781   
       
   782  */
       
   783 void CT_RApaLsSessionTestStep::DoGetAllApps()
       
   784 	{
       
   785 	INFO_PRINTF1(_L("DoGetAllApps"));
       
   786 
       
   787 	TInt ret = iLs.GetAllApps();
       
   788 	TEST(ret==KErrNone);
       
   789 
       
   790 	TApaAppInfo appInfo;
       
   791 	TUint bitFlags = 0;
       
   792 	while ((ret = iLs.GetNextApp(appInfo)) == KErrNone)
       
   793 		{
       
   794 		if (appInfo.iUid == KUidAppNotEmbeddable)
       
   795 			bitFlags |= 0x01;
       
   796 		else if (appInfo.iUid == KUidAppEmbeddable)
       
   797 			bitFlags |= 0x02;
       
   798 		else if (appInfo.iUid == KUidAppEmbeddableOnly)
       
   799 			bitFlags |= 0x04;
       
   800 		else if (appInfo.iUid == KUidAppEmbeddableUiOrStandAlone)
       
   801 			bitFlags |= 0x08;
       
   802 		else if (appInfo.iUid == KUidAppEmbeddableUiNotStandAlone)
       
   803 			bitFlags |= 0x10;
       
   804 		};
       
   805 	TEST(ret==RApaLsSession::ENoMoreAppsInList);
       
   806 	TEST(bitFlags == 0x1F);
       
   807 	INFO_PRINTF1(KCompleted);
       
   808 	}
       
   809 
       
   810 /**
       
   811    @SYMTestCaseID T-RApaLsSessionTestStep-DoGetEmbeddableApps
       
   812   
       
   813    @SYMPREQ PHAR-5Q4FX8
       
   814   
       
   815    @SYMTestCaseDesc
       
   816    Check that RApaLsSession::GetEmbeddableApps() hasn't been
       
   817    affected by the new code to filter the app list
       
   818    based on embeddability (implemented for CR PHAR-5Q4FX8)
       
   819   
       
   820    @SYMTestPriority High
       
   821   
       
   822    @SYMTestStatus Implemented
       
   823   
       
   824    @SYMTestActions
       
   825    Call GetEmbeddableApps() once, followed by repeated calls
       
   826    to GetNextApp until something other than KErrNone is returned
       
   827   
       
   828    @SYMTestExpectedResults
       
   829    GetNextApp should return app info for the following test apps:
       
   830    TAppEmbeddable.dll
       
   831    TAppEmbeddableOnly.dll
       
   832    and should not return app info for:
       
   833    TAppNotEmbeddable.exe
       
   834    TAppEmbeddableUiOrStandAlone.dll
       
   835    TAppEmbeddableUiNotStandAlone.dll
       
   836    The last call to GetNextApp should return RApaLsSession::ENoMoreAppsInList
       
   837   
       
   838  */
       
   839 void CT_RApaLsSessionTestStep::DoGetEmbeddableApps()
       
   840 	{
       
   841 	INFO_PRINTF1(_L("DoGetEmbeddableApps"));
       
   842 
       
   843 	TInt ret = iLs.GetEmbeddableApps();
       
   844 	TEST(ret==KErrNone);
       
   845 
       
   846 	TApaAppInfo appInfo;
       
   847 	TUint bitFlags = 0;
       
   848 	while ((ret = iLs.GetNextApp(appInfo)) == KErrNone)
       
   849 		{
       
   850 		if (appInfo.iUid == KUidAppNotEmbeddable)
       
   851 			bitFlags |= 0x01;
       
   852 		else if (appInfo.iUid == KUidAppEmbeddable)
       
   853 			bitFlags |= 0x02;
       
   854 		else if (appInfo.iUid == KUidAppEmbeddableOnly)
       
   855 			bitFlags |= 0x04;
       
   856 		else if (appInfo.iUid == KUidAppEmbeddableUiOrStandAlone)
       
   857 			bitFlags |= 0x08;
       
   858 		else if (appInfo.iUid == KUidAppEmbeddableUiNotStandAlone)
       
   859 			bitFlags |= 0x10;
       
   860 		};
       
   861 	TEST(ret==RApaLsSession::ENoMoreAppsInList);
       
   862 	TEST(bitFlags == 0x06);
       
   863 	INFO_PRINTF1(KCompleted);
       
   864 	}
       
   865 
       
   866 /**
       
   867    @SYMTestCaseID T-RApaLsSessionTestStep-DoEmbeddableAppCount
       
   868   
       
   869    @SYMPREQ PHAR-5Q4FX8
       
   870   
       
   871    @SYMTestCaseDesc
       
   872    The number of apps returned by GetEmbeddableApps should be the
       
   873    same as EmbeddableAppCount returns.
       
   874   
       
   875    @SYMTestPriority High
       
   876   
       
   877    @SYMTestStatus Implemented
       
   878   
       
   879    @SYMTestActions
       
   880    Count the number of apps returned by calling GetEmbeddableApps
       
   881    followed by repeated calls to GetNextApp.
       
   882    Count the number of apps returned by EmbeddableAppCount.
       
   883   
       
   884    @SYMTestExpectedResults
       
   885    The counts should be equal.
       
   886    The last call to GetNextApp should return RApaLsSession::ENoMoreAppsInList
       
   887   
       
   888  */
       
   889 void CT_RApaLsSessionTestStep::DoEmbeddableAppCount()
       
   890 	{
       
   891 	INFO_PRINTF1(_L("DoEmbeddableAppCount"));
       
   892 
       
   893 	TInt ret = iLs.GetEmbeddableApps();
       
   894 	TEST(ret==KErrNone);
       
   895 
       
   896 	TApaAppInfo appInfo;
       
   897 	TInt count1 = 0;
       
   898 	while ((ret = iLs.GetNextApp(appInfo)) == KErrNone)
       
   899 		{
       
   900 		count1 ++;
       
   901 		};
       
   902 	TEST(ret==RApaLsSession::ENoMoreAppsInList);
       
   903 	
       
   904 	TInt count2 = 0;
       
   905 	ret = iLs.EmbeddableAppCount(count2);
       
   906 	TEST(ret==KErrNone);
       
   907 	TEST(count1 == count2);
       
   908 	INFO_PRINTF1(KCompleted);
       
   909 	}
       
   910 
       
   911 /**
       
   912    @SYMTestCaseID T-RApaLsSessionTestStep-DoGetAppCapability
       
   913   
       
   914    @SYMPREQ PHAR-5Q4FX8
       
   915   
       
   916    @SYMTestCaseDesc
       
   917    Confirm that the application embeddability value that a specific app
       
   918    defines in it's AIF file, matches the value returned by
       
   919    RApaLsSession::GetAppCapability.
       
   920    Check that this is true for all supported embeddability values
       
   921   
       
   922    @SYMTestPriority High
       
   923   
       
   924    @SYMTestStatus Implemented
       
   925   
       
   926    @SYMTestActions
       
   927    Call GetAppCapability for each of the following test apps:
       
   928    TAppNotEmbeddable.exe
       
   929    TAppEmbeddable.dll
       
   930    TAppEmbeddableOnly.dll
       
   931    TAppEmbeddableUiOrStandAlone.dll
       
   932    TAppEmbeddableUiNotStandAlone.dll
       
   933   
       
   934    @SYMTestExpectedResults
       
   935    For each app, GetAppCapability should return the embeddability value
       
   936    defined in the application's AIF file.
       
   937   
       
   938  */
       
   939 void CT_RApaLsSessionTestStep::DoGetAppCapability()
       
   940 	{
       
   941 	INFO_PRINTF1(_L("DoGetAppCapability"));
       
   942 
       
   943 	const TInt numberOfCapabilities = 5;
       
   944 	TUid uidArray[numberOfCapabilities];
       
   945 	uidArray[0] = KUidAppNotEmbeddable;
       
   946 	uidArray[1] = KUidAppEmbeddable;
       
   947 	uidArray[2] = KUidAppEmbeddableOnly;
       
   948 	uidArray[3] = KUidAppEmbeddableUiOrStandAlone;
       
   949 	uidArray[4] = KUidAppEmbeddableUiNotStandAlone;
       
   950 
       
   951 	const TApaAppCapability::TEmbeddability embeddabilityArray[numberOfCapabilities]
       
   952 		= { TApaAppCapability::ENotEmbeddable,
       
   953 			TApaAppCapability::EEmbeddable, 
       
   954 			TApaAppCapability::EEmbeddableOnly, 
       
   955 			TApaAppCapability::EEmbeddableUiOrStandAlone, 
       
   956 			TApaAppCapability::EEmbeddableUiNotStandAlone };
       
   957 
       
   958 	for (TInt ii = 0; ii < numberOfCapabilities; ii++)
       
   959 		{
       
   960 		INFO_PRINTF2(_L("Testing embeddability value, %d"), uidArray[ii]);
       
   961 		TApaAppCapabilityBuf capabilityBuf;
       
   962 		TInt ret = iLs.GetAppCapability(capabilityBuf, uidArray[ii]);
       
   963 		TEST(ret==KErrNone);
       
   964 		TEST(capabilityBuf().iEmbeddability == embeddabilityArray[ii]);
       
   965 		}
       
   966 	INFO_PRINTF1(KCompleted);
       
   967 	}
       
   968 
       
   969 /**
       
   970    @SYMTestCaseID T-RApaLsSessionTestStep-DoGetFilteredApps1
       
   971   
       
   972    @SYMPREQ PHAR-5Q4FX8
       
   973   
       
   974    @SYMTestCaseDesc
       
   975    Passing an empty filter to RApaLsSession::GetFilteredApps
       
   976    should cause no apps to be returned by subsequent calls
       
   977    to RApaLsSession::GetNextApp
       
   978   
       
   979    @SYMTestPriority High
       
   980   
       
   981    @SYMTestStatus Implemented
       
   982   
       
   983    @SYMTestActions
       
   984    Call GetFilteredApps passing a default constructed filter,
       
   985    followed by a single call to GetNextApp
       
   986   
       
   987    @SYMTestExpectedResults
       
   988    GetNextApp should return RApaLsSession::ENoMoreAppsInList
       
   989   
       
   990  */
       
   991 void CT_RApaLsSessionTestStep::DoGetFilteredApps1()
       
   992 	{
       
   993 	INFO_PRINTF1(_L("DoGetFilteredApps1"));
       
   994 
       
   995 	TApaEmbeddabilityFilter filter;
       
   996 	TInt ret = iLs.GetFilteredApps(filter);
       
   997 	TEST(ret==KErrNone);
       
   998 
       
   999 	TApaAppInfo appInfo;
       
  1000 	TEST(iLs.GetNextApp(appInfo) == RApaLsSession::ENoMoreAppsInList);
       
  1001 	INFO_PRINTF1(KCompleted);
       
  1002 	}
       
  1003 
       
  1004 /**
       
  1005    @SYMTestCaseID T-RApaLsSessionTestStep-DoGetFilteredApps2
       
  1006   
       
  1007    @SYMPREQ PHAR-5Q4FX8
       
  1008   
       
  1009    @SYMTestCaseDesc
       
  1010    Passing a filter specifying only ENotEmbeddable
       
  1011    to RApaLsSession::GetFilteredApps should cause subsequent
       
  1012    calls to RApaLsSession::GetNextApp to return only
       
  1013    applications which cannot be embedded
       
  1014   
       
  1015    @SYMTestPriority High
       
  1016   
       
  1017    @SYMTestStatus Implemented
       
  1018   
       
  1019    @SYMTestActions
       
  1020    Call GetFilteredApps passing a filter containing ENotEmbeddable,
       
  1021    followed by repeated calls to GetNextApp until something other than
       
  1022    KErrNone is returned
       
  1023   
       
  1024    @SYMTestExpectedResults
       
  1025    GetNextApp should return app info for only the following test app:
       
  1026    TAppNotEmbeddable.exe
       
  1027    and should not return app info for:
       
  1028    TAppEmbeddable.dll
       
  1029    TAppEmbeddableOnly.dll
       
  1030    TAppEmbeddableUiOrStandAlone.dll
       
  1031    TAppEmbeddableUiNotStandAlone.dll
       
  1032    The last call to GetNextApp should return RApaLsSession::ENoMoreAppsInList
       
  1033  
       
  1034  */
       
  1035 void CT_RApaLsSessionTestStep::DoGetFilteredApps2()
       
  1036 	{
       
  1037 	INFO_PRINTF1(_L("DoGetFilteredApps2"));
       
  1038 
       
  1039 	TApaEmbeddabilityFilter filter;
       
  1040 	filter.AddEmbeddability(TApaAppCapability::ENotEmbeddable);
       
  1041 	TInt ret = iLs.GetFilteredApps(filter);
       
  1042 	TEST(ret==KErrNone);
       
  1043 
       
  1044 	TApaAppInfo appInfo;
       
  1045 	TUint bitFlags = 0;
       
  1046 	while ((ret = iLs.GetNextApp(appInfo)) == KErrNone)
       
  1047 		{
       
  1048 		if (appInfo.iUid == KUidAppNotEmbeddable)
       
  1049 			bitFlags |= 0x01;
       
  1050 		else if (appInfo.iUid == KUidAppEmbeddable)
       
  1051 			bitFlags |= 0x02;
       
  1052 		else if (appInfo.iUid == KUidAppEmbeddableOnly)
       
  1053 			bitFlags |= 0x04;
       
  1054 		else if (appInfo.iUid == KUidAppEmbeddableUiOrStandAlone)
       
  1055 			bitFlags |= 0x08;
       
  1056 		else if (appInfo.iUid == KUidAppEmbeddableUiNotStandAlone)
       
  1057 			bitFlags |= 0x10;
       
  1058 		}
       
  1059 	TEST(ret==RApaLsSession::ENoMoreAppsInList);
       
  1060 	TEST(bitFlags == 0x01);
       
  1061 	INFO_PRINTF1(KCompleted);
       
  1062 	}
       
  1063 
       
  1064 /**
       
  1065    @SYMTestCaseID T-RApaLsSessionTestStep-DoGetFilteredApps3
       
  1066   
       
  1067    @SYMPREQ PHAR-5Q4FX8
       
  1068   
       
  1069    @SYMTestCaseDesc
       
  1070    EEmbeddableUiOrStandAlone (value 5) shares a bit flag (bit 1)
       
  1071    with EEmbeddable (value 1).
       
  1072    Confirm that a filter of EEmbeddableUiOrStandAlone only returns
       
  1073    apps that define EEmbeddableUiOrStandAlone
       
  1074   
       
  1075    @SYMTestPriority High
       
  1076   
       
  1077    @SYMTestStatus Implemented
       
  1078   
       
  1079    @SYMTestActions
       
  1080    Call GetFilteredApps passing a filter containing EEmbeddableUiOrStandAlone,
       
  1081    followed by repeated calls to GetNextApp until something other than
       
  1082    KErrNone is returned
       
  1083   
       
  1084    @SYMTestExpectedResults
       
  1085    GetNextApp should return app info for only the following test app:
       
  1086    TAppEmbeddableUiOrStandAlone.dll
       
  1087    and should not return app info for:
       
  1088    TAppEmbeddable.dll
       
  1089    The last call to GetNextApp should return RApaLsSession::ENoMoreAppsInList
       
  1090    
       
  1091  */
       
  1092 void CT_RApaLsSessionTestStep::DoGetFilteredApps3()
       
  1093 	{
       
  1094 	INFO_PRINTF1(_L("DoGetFilteredApps3"));
       
  1095 
       
  1096 	TApaEmbeddabilityFilter filter;
       
  1097 	filter.AddEmbeddability(TApaAppCapability::EEmbeddableUiOrStandAlone);
       
  1098 	TInt ret = iLs.GetFilteredApps(filter);
       
  1099 	TEST(ret==KErrNone);
       
  1100 
       
  1101 	TApaAppInfo appInfo;
       
  1102 	TUint bitFlags = 0;
       
  1103 	while ((ret = iLs.GetNextApp(appInfo)) == KErrNone)
       
  1104 		{
       
  1105 		if (appInfo.iUid == KUidAppEmbeddable)
       
  1106 			bitFlags |= 0x02;
       
  1107 		else if (appInfo.iUid == KUidAppEmbeddableUiOrStandAlone)
       
  1108 			bitFlags |= 0x08;
       
  1109 		}
       
  1110 	TEST(ret==RApaLsSession::ENoMoreAppsInList);
       
  1111 	TEST(bitFlags == 0x08);
       
  1112 	INFO_PRINTF1(KCompleted);
       
  1113 	}
       
  1114 
       
  1115 /**
       
  1116    @SYMTestCaseID T-RApaLsSessionTestStep-DoGetFilteredApps4
       
  1117   
       
  1118    @SYMPREQ PHAR-5Q4FX8
       
  1119   
       
  1120    @SYMTestCaseDesc
       
  1121    A filter specifying two embeddability values should
       
  1122    include apps of either embeddability
       
  1123   
       
  1124    @SYMTestPriority High
       
  1125   
       
  1126    @SYMTestStatus Implemented
       
  1127   
       
  1128    @SYMTestActions
       
  1129    Call GetFilteredApps passing a filter containing EEmbeddableUiOrStandAlone
       
  1130    and EEmbeddableUiNotStandAlone followed by repeated calls to GetNextApp
       
  1131    until something other than KErrNone is returned
       
  1132   
       
  1133    @SYMTestExpectedResults
       
  1134    GetNextApp should return app info for only the following test apps:
       
  1135    TAppEmbeddableUiOrStandAlone.dll
       
  1136    TAppEmbeddableUiNotStandAlone.dll
       
  1137    and should not return app info for:
       
  1138    TAppNotEmbeddable.exe
       
  1139    TAppEmbeddable.dll
       
  1140    TAppEmbeddableOnly.dll
       
  1141    The last call to GetNextApp should return RApaLsSession::ENoMoreAppsInList
       
  1142   
       
  1143  */
       
  1144 void CT_RApaLsSessionTestStep::DoGetFilteredApps4()
       
  1145 	{
       
  1146 	INFO_PRINTF1(_L("DoGetFilteredApps4"));
       
  1147 
       
  1148 	TApaEmbeddabilityFilter filter;
       
  1149 	filter.AddEmbeddability(TApaAppCapability::EEmbeddableUiOrStandAlone);
       
  1150 	filter.AddEmbeddability(TApaAppCapability::EEmbeddableUiNotStandAlone);
       
  1151 	TInt ret = iLs.GetFilteredApps(filter);
       
  1152 	TEST(ret==KErrNone);
       
  1153 
       
  1154 	TApaAppInfo appInfo;
       
  1155 	TUint bitFlags = 0;
       
  1156 	while ((ret = iLs.GetNextApp(appInfo)) == KErrNone)
       
  1157 		{
       
  1158 		if (appInfo.iUid == KUidAppNotEmbeddable)
       
  1159 			bitFlags |= 0x01;
       
  1160 		else if (appInfo.iUid == KUidAppEmbeddable)
       
  1161 			bitFlags |= 0x02;
       
  1162 		else if (appInfo.iUid == KUidAppEmbeddableOnly)
       
  1163 			bitFlags |= 0x04;
       
  1164 		else if (appInfo.iUid == KUidAppEmbeddableUiOrStandAlone)
       
  1165 			bitFlags |= 0x08;
       
  1166 		else if (appInfo.iUid == KUidAppEmbeddableUiNotStandAlone)
       
  1167 			bitFlags |= 0x10;
       
  1168 		}
       
  1169 	TEST(ret==RApaLsSession::ENoMoreAppsInList);
       
  1170 	TEST(bitFlags == 0x18);
       
  1171 	INFO_PRINTF1(KCompleted);
       
  1172 	}
       
  1173 
       
  1174 /**
       
  1175    @SYMTestCaseID T-RApaLsSessionTestStep-DoGetFilteredApps5
       
  1176   
       
  1177    @SYMPREQ PHAR-5Q4FX8
       
  1178   
       
  1179    @SYMTestCaseDesc
       
  1180    Getting apps using a filter specifying all embeddability values
       
  1181    should return the same number of apps as RApaLsSession::GetAllApps()
       
  1182   
       
  1183    @SYMTestPriority High
       
  1184   
       
  1185    @SYMTestStatus Implemented
       
  1186   
       
  1187    @SYMTestActions
       
  1188    Call GetFilteredApps passing a filter containing all embeddability values,
       
  1189    and count the number of calls to GetNextApp until something other than
       
  1190    KErrNone is returned.
       
  1191    Then call GetAllApps and count the number of calls to GetNextApp until
       
  1192    something other than KErrNone is returned.
       
  1193   
       
  1194    @SYMTestExpectedResults
       
  1195    The two counts should be equal.
       
  1196    The last call in each sequence of calls to GetNextApp should return
       
  1197    RApaLsSession::ENoMoreAppsInList
       
  1198   
       
  1199  */
       
  1200 void CT_RApaLsSessionTestStep::DoGetFilteredApps5()
       
  1201 	{
       
  1202 	INFO_PRINTF1(_L("DoGetFilteredApps5"));
       
  1203 
       
  1204 	TApaEmbeddabilityFilter filter;
       
  1205 	filter.AddEmbeddability(TApaAppCapability::ENotEmbeddable);
       
  1206 	filter.AddEmbeddability(TApaAppCapability::EEmbeddable);
       
  1207 	filter.AddEmbeddability(TApaAppCapability::EEmbeddableOnly);
       
  1208 	filter.AddEmbeddability(TApaAppCapability::EEmbeddableUiOrStandAlone);
       
  1209 	filter.AddEmbeddability(TApaAppCapability::EEmbeddableUiNotStandAlone);
       
  1210 	TInt ret = iLs.GetFilteredApps(filter);
       
  1211 	TEST(ret==KErrNone);
       
  1212 
       
  1213 	TApaAppInfo appInfo;
       
  1214 	TInt filteredCount = 0;
       
  1215 	while ((ret = iLs.GetNextApp(appInfo)) == KErrNone)
       
  1216 		{
       
  1217 		filteredCount++;
       
  1218 		}
       
  1219 	TEST(ret==RApaLsSession::ENoMoreAppsInList);
       
  1220 
       
  1221 	ret = iLs.GetAllApps();
       
  1222 	TEST(ret==KErrNone);
       
  1223 
       
  1224 	TInt allAppsCount = 0;
       
  1225 	while ((ret = iLs.GetNextApp(appInfo)) == KErrNone)
       
  1226 		{
       
  1227 		allAppsCount++;
       
  1228 		}
       
  1229 	TEST(ret==RApaLsSession::ENoMoreAppsInList);
       
  1230 
       
  1231 	TEST(filteredCount == allAppsCount);
       
  1232 	INFO_PRINTF1(KCompleted);
       
  1233 	}
       
  1234 
       
  1235 /**
       
  1236    @SYMTestCaseID T-RApaLsSessionTestStep-DoGetFilteredApps6
       
  1237   
       
  1238    @SYMPREQ PHAR-5Q4FX8
       
  1239   
       
  1240    @SYMTestCaseDesc
       
  1241    None of the following embeddability test apps support
       
  1242    screen mode 1, so none of them should be returned even
       
  1243    if the filter specifies all embeddability types.
       
  1244    TAppNotEmbeddable.exe
       
  1245    TAppEmbeddable.dll
       
  1246    TAppEmbeddableOnly.dll
       
  1247    TAppEmbeddableUiOrStandAlone.dll
       
  1248    TAppEmbeddableUiNotStandAlone.dll
       
  1249   
       
  1250    @SYMTestPriority High
       
  1251   
       
  1252    @SYMTestStatus Implemented
       
  1253   
       
  1254    @SYMTestActions
       
  1255    Call GetFilteredApps passing a filter containing all embeddability values
       
  1256    and screen mode 1, followed by repeated calls to GetNextApp until something
       
  1257    other than KErrNone is returned
       
  1258   
       
  1259    @SYMTestExpectedResults
       
  1260    GetNextApp should not return app info for any of the following test apps:
       
  1261    TAppNotEmbeddable.exe
       
  1262    TAppEmbeddable.dll
       
  1263    TAppEmbeddableOnly.dll
       
  1264    TAppEmbeddableUiOrStandAlone.dll
       
  1265    TAppEmbeddableUiNotStandAlone.dll
       
  1266    The last call to GetNextApp should return RApaLsSession::ENoMoreAppsInList
       
  1267   
       
  1268  */
       
  1269 void CT_RApaLsSessionTestStep::DoGetFilteredApps6(/*RApaLsSession& iLs*/)
       
  1270 	{
       
  1271 	INFO_PRINTF1(_L("DoGetFilteredApps6"));
       
  1272 
       
  1273 	TApaEmbeddabilityFilter filter;
       
  1274 	filter.AddEmbeddability(TApaAppCapability::ENotEmbeddable);
       
  1275 	filter.AddEmbeddability(TApaAppCapability::EEmbeddable);
       
  1276 	filter.AddEmbeddability(TApaAppCapability::EEmbeddableOnly);
       
  1277 	filter.AddEmbeddability(TApaAppCapability::EEmbeddableUiOrStandAlone);
       
  1278 	filter.AddEmbeddability(TApaAppCapability::EEmbeddableUiNotStandAlone);
       
  1279 	const TInt screenMode1 = 1;
       
  1280 	TInt ret = iLs.GetFilteredApps(filter, screenMode1);
       
  1281 	TEST(ret==KErrNone);
       
  1282 
       
  1283 	TApaAppInfo appInfo;
       
  1284 	TUint bitFlags = 0;
       
  1285 	while ((ret = iLs.GetNextApp(appInfo)) == KErrNone)
       
  1286 		{
       
  1287 		if (appInfo.iUid == KUidAppNotEmbeddable)
       
  1288 			bitFlags |= 0x01;
       
  1289 		else if (appInfo.iUid == KUidAppEmbeddable)
       
  1290 			bitFlags |= 0x02;
       
  1291 		else if (appInfo.iUid == KUidAppEmbeddableOnly)
       
  1292 			bitFlags |= 0x04;
       
  1293 		else if (appInfo.iUid == KUidAppEmbeddableUiOrStandAlone)
       
  1294 			bitFlags |= 0x08;
       
  1295 		else if (appInfo.iUid == KUidAppEmbeddableUiNotStandAlone)
       
  1296 			bitFlags |= 0x10;
       
  1297 		}
       
  1298 	TEST(ret==RApaLsSession::ENoMoreAppsInList);
       
  1299 	TEST(bitFlags == 0);
       
  1300 	INFO_PRINTF1(KCompleted);
       
  1301 	}
       
  1302 	
       
  1303 /**
       
  1304    @SYMTestCaseID T-RApaLsSessionTestStep-DoTestEmbeddabilityFilter1
       
  1305   
       
  1306    @SYMPREQ PHAR-5Q4FX8
       
  1307   
       
  1308    @SYMTestCaseDesc
       
  1309    Ensure default constructed TApaEmbeddabilityFilter object is
       
  1310    initialized correctly.
       
  1311  
       
  1312    @SYMTestPriority High
       
  1313  
       
  1314    @SYMTestStatus Implemented
       
  1315   
       
  1316    @SYMTestActions
       
  1317    Construct a TApaEmbeddabilityFilter object and call
       
  1318    MatchesEmbeddability using each of the following embeddability values:
       
  1319    TApaAppCapability::ENotEmbeddable
       
  1320    TApaAppCapability::EEmbeddable
       
  1321    TApaAppCapability::EEmbeddableOnly
       
  1322    TApaAppCapability::EEmbeddableUiOrStandAlone
       
  1323    TApaAppCapability::EEmbeddableUiNotStandAlone
       
  1324   
       
  1325    @SYMTestExpectedResults
       
  1326    All calls to MatchesEmbeddability should return fiLse.
       
  1327   
       
  1328  */
       
  1329 void CT_RApaLsSessionTestStep::DoTestEmbeddabilityFilter1()
       
  1330 	{
       
  1331 	INFO_PRINTF1(_L("DoTestEmbeddabilityFilter1"));
       
  1332 
       
  1333 	TApaEmbeddabilityFilter filter;
       
  1334 	TEST(!filter.MatchesEmbeddability(TApaAppCapability::ENotEmbeddable));
       
  1335 	TEST(!filter.MatchesEmbeddability(TApaAppCapability::EEmbeddable));
       
  1336 	TEST(!filter.MatchesEmbeddability(TApaAppCapability::EEmbeddableOnly));
       
  1337 	TEST(!filter.MatchesEmbeddability(TApaAppCapability::EEmbeddableUiOrStandAlone));
       
  1338 	TEST(!filter.MatchesEmbeddability(TApaAppCapability::EEmbeddableUiNotStandAlone));
       
  1339 	INFO_PRINTF1(KCompleted);
       
  1340 	}
       
  1341 
       
  1342 /**
       
  1343    @SYMTestCaseID T-RApaLsSessionTestStep-DoTestEmbeddabilityFilter2
       
  1344   
       
  1345    @SYMPREQ PHAR-5Q4FX8
       
  1346   
       
  1347    @SYMTestCaseDesc
       
  1348    Bit 2 is used by both EEmbeddableUiNotStandAlone and EEmbeddableOnly.
       
  1349    Make sure that setting the filter to only EEmbeddableUiNotStandAlone
       
  1350    doesn't match EEmbeddableOnly.
       
  1351   
       
  1352    @SYMTestPriority High
       
  1353   
       
  1354    @SYMTestStatus Implemented
       
  1355   
       
  1356    @SYMTestActions
       
  1357    Construct a TApaEmbeddabilityFilter object,
       
  1358    set the filter to only EEmbeddableUiNotStandAloneand
       
  1359    and call MatchesEmbeddability passing EEmbeddableOnly
       
  1360   
       
  1361    @SYMTestExpectedResults
       
  1362    MatchesEmbeddability should return fiLse.
       
  1363   
       
  1364  */
       
  1365 void CT_RApaLsSessionTestStep::DoTestEmbeddabilityFilter2()
       
  1366 	{
       
  1367 	INFO_PRINTF1(_L("DoTestEmbeddabilityFilter2"));
       
  1368 
       
  1369 	TApaEmbeddabilityFilter filter;
       
  1370 	filter.AddEmbeddability(TApaAppCapability::EEmbeddableUiNotStandAlone);
       
  1371 	TEST(!filter.MatchesEmbeddability(TApaAppCapability::EEmbeddableOnly));
       
  1372 	INFO_PRINTF1(KCompleted);
       
  1373 	}
       
  1374 
       
  1375 /**
       
  1376    @SYMTestCaseID T-RApaLsSessionTestStep-DoTestEmbeddabilityFilter3
       
  1377   
       
  1378    @SYMPREQ PHAR-5Q4FX8
       
  1379   
       
  1380    @SYMTestCaseDesc
       
  1381    Bit 2 is used by both EEmbeddableUiNotStandAlone and EEmbeddableOnly.
       
  1382    Make sure that setting the filter to only EEmbeddableOnly
       
  1383    doesn't match EEmbeddableUiNotStandAlone.
       
  1384   
       
  1385    @SYMTestPriority High
       
  1386   
       
  1387    @SYMTestStatus Implemented
       
  1388   
       
  1389    @SYMTestActions
       
  1390    Construct a TApaEmbeddabilityFilter object,
       
  1391    set the filter to only EEmbeddableOnly
       
  1392    and call MatchesEmbeddability passing EEmbeddableUiNotStandAlone
       
  1393   
       
  1394    @SYMTestExpectedResults
       
  1395    MatchesEmbeddability should return fiLse.
       
  1396   
       
  1397  */
       
  1398 void CT_RApaLsSessionTestStep::DoTestEmbeddabilityFilter3()
       
  1399 	{
       
  1400 	INFO_PRINTF1(_L("DoTestEmbeddabilityFilter3"));
       
  1401 
       
  1402 	TApaEmbeddabilityFilter filter;
       
  1403 	filter.AddEmbeddability(TApaAppCapability::EEmbeddableOnly);
       
  1404 	TEST(!filter.MatchesEmbeddability(TApaAppCapability::EEmbeddableUiNotStandAlone));
       
  1405 	INFO_PRINTF1(KCompleted);
       
  1406 	}
       
  1407 
       
  1408 /**
       
  1409    @SYMTestCaseID T-RApaLsSessionTestStep-DoTestEmbeddabilityFilter4
       
  1410   
       
  1411    @SYMPREQ PHAR-5Q4FX8
       
  1412   
       
  1413    @SYMTestCaseDesc
       
  1414    Ensure MatchesEmbeddability returns true when the filter only contains
       
  1415    the embeddability being matched.
       
  1416   
       
  1417    @SYMTestPriority High
       
  1418   
       
  1419    @SYMTestStatus Implemented
       
  1420   
       
  1421    @SYMTestActions
       
  1422    Construct a TApaEmbeddabilityFilter object,
       
  1423    set the filter to only EEmbeddable
       
  1424    and call MatchesEmbeddability passing EEmbeddable
       
  1425   
       
  1426    @SYMTestExpectedResults
       
  1427    MatchesEmbeddability should return true.
       
  1428   
       
  1429  */
       
  1430 void CT_RApaLsSessionTestStep::DoTestEmbeddabilityFilter4()
       
  1431 	{
       
  1432 	INFO_PRINTF1(_L("DoTestEmbeddabilityFilter4"));
       
  1433 
       
  1434 	TApaEmbeddabilityFilter filter;
       
  1435 	filter.AddEmbeddability(TApaAppCapability::EEmbeddable);
       
  1436 	TEST(filter.MatchesEmbeddability(TApaAppCapability::EEmbeddable));
       
  1437 	INFO_PRINTF1(KCompleted);
       
  1438 	}
       
  1439 
       
  1440 /**
       
  1441    @SYMTestCaseID T-RApaLsSessionTestStep-DoTestEmbeddabilityFilter5
       
  1442   
       
  1443    @SYMPREQ PHAR-5Q4FX8
       
  1444   
       
  1445    @SYMTestCaseDesc
       
  1446    Ensure MatchesEmbeddability returns true when the filter contains
       
  1447    a superset of the embeddability being matched.
       
  1448   
       
  1449    @SYMTestPriority High
       
  1450   
       
  1451    @SYMTestStatus Implemented
       
  1452   
       
  1453    @SYMTestActions
       
  1454    Construct a TApaEmbeddabilityFilter object,
       
  1455    set the filter to both ENotEmbeddable and EEmbeddable
       
  1456    and call MatchesEmbeddability passing EEmbeddable
       
  1457   
       
  1458    @SYMTestExpectedResults
       
  1459    MatchesEmbeddability should return true.
       
  1460   
       
  1461  */
       
  1462 void CT_RApaLsSessionTestStep::DoTestEmbeddabilityFilter5()
       
  1463 	{
       
  1464 	INFO_PRINTF1(_L("DoTestEmbeddabilityFilter5"));
       
  1465 
       
  1466 	TApaEmbeddabilityFilter filter;
       
  1467 	filter.AddEmbeddability(TApaAppCapability::ENotEmbeddable);
       
  1468 	filter.AddEmbeddability(TApaAppCapability::EEmbeddable);
       
  1469 	TEST(filter.MatchesEmbeddability(TApaAppCapability::EEmbeddable));
       
  1470 	INFO_PRINTF1(KCompleted);
       
  1471 	}
       
  1472 
       
  1473  /**
       
  1474    @SYMTestCaseID T-RApaLsSessionTestStep-TestGetAppCapabilityL
       
  1475   
       
  1476    @SYMPREQ
       
  1477   
       
  1478    @SYMTestCaseDesc Test interrogates the Application Architecture Server. 
       
  1479    
       
  1480    @SYMTestPriority High 
       
  1481   
       
  1482    @SYMTestStatus Implemented
       
  1483   
       
  1484    RApaLsSession::GetAppCapability(TDes8& aCapabilityBuf,TUid aAppUid) const\n
       
  1485    RApaLsSession::RecognizeSpecificData(const TDesC& aName, const TDesC8& aBuffer, const TDataType& aDataType, TBool& aResult) const\n
       
  1486    RApaLsSession::RecognizeData(const TDesC& aName, const TDesC8& aBuffer, TDataRecognitionResult& aDataType) const\n
       
  1487    RApaLsSession::GetAppIcon(TUid aAppUid, TInt aSize, CApaMaskedBitmap& aAppBitmap) const\n
       
  1488    
       
  1489    @SYMTestExpectedResults All tests compare the results obtained with the desired result.
       
  1490     
       
  1491  */
       
  1492 void CT_RApaLsSessionTestStep::TestGetAppCapabilityL()
       
  1493 	{
       
  1494 	TApaAppCapabilityBuf buf;
       
  1495 	INFO_PRINTF1(_L("Checking GetAppCapability from Test App Uid..."));
       
  1496 	TInt ret = iLs.GetAppCapability(buf,KUidTestApp);
       
  1497 	TEST(ret==KErrNone);
       
  1498 	TApaAppCapability cap=buf();
       
  1499 	TEST(cap.iEmbeddability==TApaAppCapability::EEmbeddable);
       
  1500 	TEST(!cap.iSupportsNewFile);
       
  1501 	TEST(!cap.iAppIsHidden);
       
  1502 	INFO_PRINTF1(KCompleted);
       
  1503 
       
  1504 	INFO_PRINTF1(_L("Checking GetAppCapability Null Id returns KErrNotFound..."));
       
  1505 	ret = iLs.GetAppCapability(buf,KNullUid);
       
  1506 	TEST(ret==KErrNotFound);
       
  1507 	INFO_PRINTF1(KCompleted);
       
  1508 	}
       
  1509 
       
  1510 /**
       
  1511    @SYMTestCaseID T_RApaLsSessionTestStep_TestRecognizeSpecificData
       
  1512   
       
  1513    @SYMPREQ
       
  1514   
       
  1515    @SYMTestCaseDesc Test interrogates the Application Architecture Server. 
       
  1516    
       
  1517    @SYMTestPriority High 
       
  1518   
       
  1519    @SYMTestStatus Implemented
       
  1520   
       
  1521    RApaLsSession::RecognizeSpecificData(const TDesC& aName, const TDesC8& aBuffer, const TDataType& aDataType, TBool& aResult) const\n
       
  1522    RApaLsSession::RecognizeData(const TDesC& aName, const TDesC8& aBuffer, TDataRecognitionResult& aDataType) const\n
       
  1523    RApaLsSession::GetAppIcon(TUid aAppUid, TInt aSize, CApaMaskedBitmap& aAppBitmap) const\n
       
  1524    
       
  1525    @SYMTestExpectedResults All tests compare the results obtained with the desired result.
       
  1526     
       
  1527  */
       
  1528 void CT_RApaLsSessionTestStep::TestRecognizeSpecificData()
       
  1529 {
       
  1530 	INFO_PRINTF1(_L("Checking data type information"));
       
  1531 	INFO_PRINTF1(_L("Checking RecognizeSpecificData..."));
       
  1532 	TBool isText=EFalse;
       
  1533 	TInt ret=iLs.RecognizeSpecificData(_L("a file name.txt"),_L8("Some plain text"),TDataType(_L8("text/plain")),isText);
       
  1534 	TEST(ret==KErrNone);
       
  1535 	TEST(isText);
       
  1536 
       
  1537 	INFO_PRINTF1(_L("Checking RecognizeData..."));
       
  1538 	TDataRecognitionResult result;
       
  1539 	ret=iLs.RecognizeData(_L("a file name.txt"),_L8("Some plain text"),result);
       
  1540 	TEST(ret==KErrNone);
       
  1541 	TEST(result.iDataType==TDataType(_L8("text/plain")));
       
  1542 	TEST(result.iConfidence==CApaDataRecognizerType::EProbable);
       
  1543 		
       
  1544 	isText=EFalse;
       
  1545 	INFO_PRINTF1(_L("Checking RecognizeSpecificData...unknown data type..."));
       
  1546 	ret=iLs.RecognizeSpecificData(_L("a file name.txt"),_L8("Some plain text"),TDataType(_L8("foo/bar")),isText);
       
  1547 	TEST(!isText);
       
  1548 	INFO_PRINTF1(KCompleted);
       
  1549 }
       
  1550 
       
  1551 /**
       
  1552    @SYMTestCaseID T-RApaLsSessionTestStep-TestGetAppIconL
       
  1553   
       
  1554    @SYMPREQ
       
  1555   
       
  1556    @SYMTestCaseDesc Test interrogates the Application Architecture Server. 
       
  1557    
       
  1558    @SYMTestPriority High 
       
  1559   
       
  1560    @SYMTestStatus Implemented   
       
  1561    
       
  1562    @SYMTestExpectedResults All tests compare the results obtained with the desired result.
       
  1563     
       
  1564  */
       
  1565 void CT_RApaLsSessionTestStep::TestGetAppIconL()
       
  1566 	{
       
  1567 	INFO_PRINTF1(_L("Checking icon loading by index"));
       
  1568 	CApaMaskedBitmap* icon=CApaMaskedBitmap::NewLC();
       
  1569 	TSize lastSize(0,0);
       
  1570 
       
  1571 	INFO_PRINTF1(_L("Checking index 0"));
       
  1572 	TInt ret=iLs.GetAppIcon(KUidTestApp,0,*icon);
       
  1573 	TEST(ret==KErrNone);
       
  1574 	TEST(icon->SizeInPixels().iWidth*icon->SizeInPixels().iHeight > lastSize.iWidth*lastSize.iHeight);
       
  1575 	lastSize=icon->SizeInPixels();
       
  1576 
       
  1577 	INFO_PRINTF1(_L("Checking icon index 1"));	
       
  1578 	ret=iLs.GetAppIcon(KUidTestApp,1,*icon);
       
  1579 	TEST(ret==KErrNone);
       
  1580 	TEST(icon->SizeInPixels().iWidth*icon->SizeInPixels().iHeight == lastSize.iWidth*lastSize.iHeight);
       
  1581 	lastSize=icon->SizeInPixels();
       
  1582 
       
  1583 	INFO_PRINTF1(_L("Checking icon index 2"));
       
  1584 	ret=iLs.GetAppIcon(KUidTestApp,2,*icon);
       
  1585 	TEST(ret==KErrNone);		
       
  1586 	TEST((icon->SizeInPixels().iWidth*icon->SizeInPixels().iHeight) > (lastSize.iWidth*lastSize.iHeight));
       
  1587 	lastSize=icon->SizeInPixels();
       
  1588 
       
  1589 	INFO_PRINTF1(_L("Checking icon loading unknown Uid...."));
       
  1590 	TUid uid={9999};
       
  1591 	ret=iLs.GetAppIcon(uid,0,*icon);
       
  1592 	TEST(ret==KErrNotFound);
       
  1593 	CleanupStack::PopAndDestroy(icon);
       
  1594 	INFO_PRINTF1(KCompleted);
       
  1595 	}
       
  1596 /**
       
  1597     @SYMTestCaseID APPFWK-APPARC-0085
       
  1598    
       
  1599     @SYMDEF PDEF113054: Apparc fails to detect the presence of localized MBM files  
       
  1600 	
       
  1601 	@SYMTestCaseDesc 
       
  1602 	Negative Test: Test an icon file with an extension which is not supported.
       
  1603 	
       
  1604     
       
  1605     @SYMTestPriority High 
       
  1606    
       
  1607     @SYMTestStatus Implemented
       
  1608     
       
  1609     Call GetAppViewIcon API on an App which has a localized MBM icon file associated with it with an invalid extension.
       
  1610 	GetAppViewIcon returns KErrNotSupported 
       
  1611     
       
  1612     @SYMTestExpectedResults RApaLsSession::GetAppViewIcon should return KErrNotSupported when 
       
  1613     the view icon file is an invalid icon file
       
  1614     */
       
  1615 void CT_RApaLsSessionTestStep::TestGetAppIcon2L()
       
  1616 	{
       
  1617 	CApaAppViewArray* appViews = new(ELeave) CApaAppViewArray(4);
       
  1618 	CleanupStack::PushL(appViews);
       
  1619 	TInt ret = iLs.GetAppViews(*appViews, KUidTestApp);
       
  1620 	TEST(ret==KErrNone);
       
  1621 	 	
       
  1622 	INFO_PRINTF1(_L("Negative test- checking for file extension which is not supported"));
       
  1623 	//the third view icon is not a valid mbm file
       
  1624 	const TApaAppViewInfo& viewInfo=(*appViews)[2];
       
  1625 	TEST(viewInfo.iUid != KNullUid);
       
  1626 	TEST(viewInfo.iViewCaption.Length() > 0);
       
  1627 	TEST(viewInfo.iScreenMode == 0x00);
       
  1628 	CApaMaskedBitmap* viewBitmap = CApaMaskedBitmap::NewLC();
       
  1629 	ret = iLs.GetAppViewIcon(KUidTestApp, viewInfo.iUid, TSize(50,50), *viewBitmap);
       
  1630 	TEST(ret==KErrNotSupported);
       
  1631 	INFO_PRINTF2(_L("The View icon's UID is - %d"), viewInfo.iUid);
       
  1632 		
       
  1633 	HBufC* fullIconFileName = NULL;
       
  1634 	ret = iLs.GetAppViewIcon(KUidTestApp, viewInfo.iUid, fullIconFileName);
       
  1635 	TEST(ret == KErrNone);
       
  1636 	TEST(fullIconFileName != NULL);
       
  1637 	if (fullIconFileName != NULL)
       
  1638 		{
       
  1639 		TEST(fullIconFileName->Length() > 0);
       
  1640 		INFO_PRINTF2(_L("Invalid View's icon file name is - %S"), fullIconFileName);
       
  1641 		}
       
  1642 	delete fullIconFileName;		
       
  1643 	fullIconFileName = NULL;
       
  1644 	 	
       
  1645 	CleanupStack::PopAndDestroy(viewBitmap);
       
  1646 	CleanupStack::PopAndDestroy(appViews);
       
  1647 	 	
       
  1648 	INFO_PRINTF1(KCompleted);
       
  1649 	}	
       
  1650 
       
  1651 /**
       
  1652    @SYMTestCaseID APPFWK-APPARC-0073
       
  1653   
       
  1654    @SYMDEF INC098717: support for scalable midlet icons is missing  
       
  1655   
       
  1656    @SYMTestCaseDesc Test interrogates the Application Architecture Server's GetAppIcon API . 
       
  1657    
       
  1658    @SYMTestPriority High 
       
  1659   
       
  1660    @SYMTestStatus Implemented
       
  1661    
       
  1662    @SYMTestActions Call GetAppIcon API on an app which has an icon file associated with it.
       
  1663    Again Call GetAppIcon API on an app which does not have an icon file associated with it.
       
  1664    Again Call GetAppIcon with an invalid app uid. Do it for SVG and MBM icon file.
       
  1665    
       
  1666    @SYMTestExpectedResults RApaLsSession::GetAppIcon should return KErrNotFound when 
       
  1667    an invalid app uid is passed, KErrNotFound when application does not have an icon 
       
  1668    file, KErrNone and an open file handle to the application's icon file if application 
       
  1669    has an icon file.
       
  1670  */
       
  1671 void CT_RApaLsSessionTestStep::TestGetAppIcon1L()
       
  1672 	{
       
  1673 	TestGetAppIconForMBMIconsL();
       
  1674 	TestGetAppIconForSVGIconsL();
       
  1675 	
       
  1676 	//Generic tests for both MBM and SVG icon files
       
  1677 	RFile iconFile;
       
  1678 	CleanupClosePushL(iconFile);
       
  1679 	//Testing GetAppIcon for native app without an icon file.
       
  1680 	INFO_PRINTF1(_L("Testing GetAppIcon API for an app that does not have an icon file"));
       
  1681 	const TUint KGroupNameApp = 0x10208185; //T_groupNametest app, does not have an icon file.
       
  1682 	TInt err = iLs.GetAppIcon(TUid::Uid(KGroupNameApp), iconFile);
       
  1683 	TEST(err == KErrNotFound);
       
  1684 
       
  1685 	//Checking the iconfile name when the icon file is not a physical file on the file system.
       
  1686 	CApaAppViewArray* appViews = new(ELeave) CApaAppViewArray(4);
       
  1687 	CleanupStack::PushL(appViews);
       
  1688 	TInt ret = iLs.GetAppViews(*appViews, TUid::Uid(KGroupNameApp));
       
  1689 	TEST(ret==KErrNone);
       
  1690 	TEST(appViews->Count() > 0);
       
  1691 	 	
       
  1692 	const TApaAppViewInfo& viewInfo=(*appViews)[0];
       
  1693 	TEST(viewInfo.iUid != KNullUid);
       
  1694 
       
  1695 	HBufC* fullIconFileName = NULL;
       
  1696 	ret = iLs.GetAppViewIcon(TUid::Uid(KGroupNameApp), viewInfo.iUid, fullIconFileName);
       
  1697 	TEST(ret == KErrNone);
       
  1698 	TEST(fullIconFileName != NULL);
       
  1699 	INFO_PRINTF2(_L("The View icon's UID is - %X"), viewInfo.iUid);
       
  1700 	TEST(!fullIconFileName->Compare(_L("file:///c/resource/apps/tcheckiconapp.xyz")));
       
  1701 	INFO_PRINTF2(_L("View's icon file name is - %S"), fullIconFileName);
       
  1702 	
       
  1703 	delete fullIconFileName;		
       
  1704 	CleanupStack::PopAndDestroy(appViews);
       
  1705 	
       
  1706 	//Testing GetAppIcon with an invalid app UID.
       
  1707 	INFO_PRINTF1(_L("Testing GetAppIcon API with unknown app uid"));
       
  1708 	TUid invalidAppUid = {9999};
       
  1709 	err = iLs.GetAppIcon(invalidAppUid, iconFile);
       
  1710 	TEST(err == KErrNotFound);
       
  1711 	
       
  1712 	//Close icon file
       
  1713 	CleanupStack::PopAndDestroy(&iconFile);	
       
  1714 	
       
  1715 	INFO_PRINTF1(KCompleted);
       
  1716 	}
       
  1717 
       
  1718 void CT_RApaLsSessionTestStep::TestGetAppIconForMBMIconsL()
       
  1719 	{
       
  1720 	//Testing GetAppIcon for native app with MBM icon file.
       
  1721 	INFO_PRINTF1(_L("Testing GetAppIcon API for an app to retrieve an open file handle to an MBM icon file"));
       
  1722 	const TUint KTestApp = 10; //Tstapp app, has MBM icon file	
       
  1723 	
       
  1724 	RFile mbmIconFile;
       
  1725 	CleanupClosePushL(mbmIconFile);
       
  1726 	
       
  1727 	TInt err = iLs.GetAppIcon(TUid::Uid(KTestApp), mbmIconFile);
       
  1728 	TEST(err == KErrNone);
       
  1729 	
       
  1730 	_LIT(KMBMIconFileName, "z:\\resource\\apps\\tstapp.mbm");
       
  1731 	//Get the name of the icon file 
       
  1732 	TBuf<KMaxFileName> mbmIconFileName;	
       
  1733 	mbmIconFile.FullName(mbmIconFileName);
       
  1734 	TEST(mbmIconFileName.Length() != 0);
       
  1735 	if (mbmIconFileName.Length() != 0)
       
  1736 		{
       
  1737 		mbmIconFileName.LowerCase();
       
  1738 		TEST(mbmIconFileName.Compare(KMBMIconFileName) == 0);
       
  1739 		}
       
  1740 		
       
  1741 	//Try to write into the MBM icon file whose handle was returned.
       
  1742 	INFO_PRINTF1(_L("..writing into the MBM icon file whose handle was returned."));
       
  1743 	_LIT8(KSomeText, "It would not be written into the file");
       
  1744 	err = mbmIconFile.Write(KSomeText);
       
  1745 	TEST(err == KErrAccessDenied);
       
  1746 	
       
  1747 	//Try to read from the MBM icon file whose handle was returned.
       
  1748 	INFO_PRINTF1(_L("..reading from the MBM icon file whose handle was returned."));
       
  1749 	TBuf8<KBytesToRead> buffer; //buffer to read first KBytesToRead bytes of the mbm icon file.
       
  1750 	err = mbmIconFile.Read(buffer);
       
  1751 	TEST(err == KErrNone);
       
  1752 	
       
  1753 	//Close icon files.
       
  1754 	CleanupStack::PopAndDestroy(&mbmIconFile);
       
  1755 	
       
  1756 	//First KBytesToRead bytes of the icon file, this should be same as in mbm file.
       
  1757 	RFile tempFile;
       
  1758 	CleanupClosePushL(tempFile);
       
  1759 	err = tempFile.Open(iFs, KMBMIconFileName, EFileShareReadersOnly);
       
  1760 	TEST(err == KErrNone);
       
  1761 	TBuf8<KBytesToRead> buffer1;
       
  1762 	err = tempFile.Read(buffer1);
       
  1763 	TEST(err == KErrNone);	
       
  1764 	TEST(buffer == buffer1);
       
  1765 	CleanupStack::PopAndDestroy(&tempFile);
       
  1766 	}
       
  1767 	
       
  1768 void CT_RApaLsSessionTestStep::TestGetAppIconForSVGIconsL()
       
  1769 	{
       
  1770 	//Testing GetAppIcon for native app with SVG icon file.		
       
  1771 	RFile svgIconFile;
       
  1772 	CleanupClosePushL(svgIconFile);
       
  1773 	INFO_PRINTF1(_L("Testing GetAppIcon API for an app to retrieve an open file handle to an SVG icon file"));
       
  1774 	const TUint KApparcTestApp = 0x100048F3; //Tstapp app, has SVG icon file
       
  1775 	TInt err = iLs.GetAppIcon(TUid::Uid(KApparcTestApp), svgIconFile);
       
  1776 	TEST(err == KErrNone);
       
  1777 	
       
  1778 	_LIT(KSVGIconFileName, "z:\\resource\\apps\\svg_icon.svg");
       
  1779 	//Get the name of the icon file 
       
  1780 	TBuf<KMaxFileName> svgIconFileName;	
       
  1781 	svgIconFile.FullName(svgIconFileName);
       
  1782 	TEST(svgIconFileName.Length() != 0);
       
  1783 	if (svgIconFileName.Length() != 0)
       
  1784 		{
       
  1785 		svgIconFileName.LowerCase();
       
  1786 		TEST(svgIconFileName.Compare(KSVGIconFileName) == 0);
       
  1787 		}
       
  1788 			
       
  1789 	//Try to write into the icon file whose handle was returned.
       
  1790 	INFO_PRINTF1(_L("..writing into the SVG icon file whose handle was returned."));
       
  1791 	_LIT8(KSomeText, "It would not be written into the file");
       
  1792 	err = svgIconFile.Write(KSomeText);
       
  1793 	TEST(err == KErrAccessDenied);
       
  1794 	
       
  1795 	//Try to read from the icon file whose handle was returned.
       
  1796 	INFO_PRINTF1(_L("..reading from the SVG icon file whose handle was returned."));
       
  1797 	TBuf8<KBytesToRead> svgBuffer; //buffer to read first KBytesToRead bytes of the icon file. 
       
  1798 	err = svgIconFile.Read(svgBuffer);
       
  1799 	TEST(err == KErrNone);
       
  1800 	
       
  1801 	//Close icon file
       
  1802 	CleanupStack::PopAndDestroy(&svgIconFile);
       
  1803 	
       
  1804 	//First KBytesToRead bytes of the icon file, this should be same as in mbm file.
       
  1805 	RFile tempFile;	
       
  1806 	CleanupClosePushL(tempFile);
       
  1807 	err = tempFile.Open(iFs, KSVGIconFileName, EFileRead);
       
  1808 	TEST(err == KErrNone);
       
  1809 	TBuf8<KBytesToRead> buffer1;
       
  1810 	err = tempFile.Read(buffer1);
       
  1811 	TEST(err == KErrNone);
       
  1812 	TEST(svgBuffer == buffer1);
       
  1813 	CleanupStack::PopAndDestroy(&tempFile);		
       
  1814 	}
       
  1815 	
       
  1816 /**
       
  1817    @SYMTestCaseID T-RApaLsSessionTestStep-TestAppListInstallationL
       
  1818   
       
  1819    @SYMPREQ
       
  1820   
       
  1821    @SYMTestCaseDesc Test updating of Application list on installation of a new application. 
       
  1822    
       
  1823    @SYMTestPriority High 
       
  1824   
       
  1825    @SYMTestStatus Implemented
       
  1826    
       
  1827    @SYMTestActions Test updating of application list on installation of a new application. 
       
  1828    Copy the tstapp from z: import\apps folder to c: import\apps folder. 
       
  1829    Call RApaLsSession::GetAppInfo() and test the application information obtained to 
       
  1830    verify whether the application architecture server updates the application to reside in c: drive.
       
  1831    Delete the copied application and call RApaLsSession::GetAppInfo().
       
  1832    Verify that the application list updates the tstapp application to reside
       
  1833    on z: drive.\n
       
  1834    API Calls:\n	
       
  1835    RApaLsSession::GetAppInfo(TApaAppInfo& aInfo,TUid aAppUid) const\n
       
  1836    
       
  1837    @SYMTestExpectedResults The test confirms that the application architecture
       
  1838    server updates the application list on installation of a new application. It also confirms that 
       
  1839    if UID of an application which is present on import\apps folder on any non-ROM drive, is same 
       
  1840    as UID of an existing application present on z: import\apps folder then the apparc server 
       
  1841    updates the applist and uses the application residing on non-ROM drive's import\apps folder.
       
  1842     
       
  1843  */
       
  1844 void CT_RApaLsSessionTestStep::TestAppListInstallationL()
       
  1845  	{ 
       
  1846  	_LIT(KTestAppDestDir, "C:\\private\\10003a3f\\import\\apps\\" );
       
  1847  	_LIT(KTestAppSource, "Z:\\private\\10003a3f\\import\\apps\\tstapp_reg.rsc" );
       
  1848  	_LIT(KTestAppDest, "C:\\private\\10003a3f\\import\\apps\\tstapp_reg.rsc" );
       
  1849 
       
  1850  	_LIT(KTestWaitingForApplistUpdate,"Waiting %d microseconds for applist to be updated");
       
  1851  	const TInt KApplistUpdateTime = 10000000;
       
  1852 
       
  1853  	// Copy App files around and delete them to check whether 
       
  1854 	// the app list updates and stores the cache correctly.
       
  1855  	RFs	theFS;
       
  1856  	theFS.Connect();
       
  1857  
       
  1858  	// Remove Test app from the file system
       
  1859  	CFileMan* fileManager = CFileMan::NewL (theFS);
       
  1860  
       
  1861  	INFO_PRINTF1(_L("Copying the app to C"));
       
  1862  	TEST(KErrNone == fileManager->Copy (KTestAppSource, KTestAppDest, CFileMan::ERecurse));
       
  1863  	
       
  1864  	INFO_PRINTF2(KTestWaitingForApplistUpdate, KApplistUpdateTime);
       
  1865  	User::After(KApplistUpdateTime);
       
  1866  
       
  1867  	TApaAppInfo aInfo;
       
  1868  	TEST(KErrNone == iLs.GetAppInfo (aInfo, KUidTestApp));
       
  1869 
       
  1870 	TParsePtrC parse (aInfo.iFullName);
       
  1871  	_LIT (KCdrive, "C:");
       
  1872 	INFO_PRINTF1(_L("Comparing App drive location is C:... "));
       
  1873 	TEST(parse.Drive ().CompareF (KCdrive) == 0);
       
  1874  
       
  1875  	INFO_PRINTF1(_L("Removing the app from C"));
       
  1876 	TRequestStatus status;
       
  1877 	TTime tempTime(0); // added tempTime to avoid asynch CFileMan::Attribs request completing with KErrArgument
       
  1878 	TEST(fileManager->Attribs(KTestAppDest,0,KEntryAttReadOnly, tempTime, CFileMan::ERecurse, status)==KErrNone);
       
  1879 	User::WaitForRequest(status);
       
  1880 	TEST(status.Int() == KErrNone);
       
  1881  	TEST(KErrNone == fileManager->Delete (KTestAppDest, CFileMan::ERecurse));
       
  1882 	INFO_PRINTF1(_L("Removing the app dir from C"));
       
  1883 	TEST(fileManager->RmDir(KTestAppDestDir)==KErrNone);
       
  1884  	
       
  1885 	INFO_PRINTF2(KTestWaitingForApplistUpdate, KApplistUpdateTime);
       
  1886 	User::After(KApplistUpdateTime);
       
  1887  
       
  1888  	// That should put the file in the right place
       
  1889  	TEST(KErrNone == iLs.GetAppInfo( aInfo, KUidTestApp));
       
  1890 
       
  1891  	TParsePtrC parse1 (aInfo.iFullName);
       
  1892  	_LIT (KZdrive, "Z:");
       
  1893 	INFO_PRINTF1(_L("Comparing App drive location is Z:... "));
       
  1894  	TEST((parse1.Drive().CompareF(KZdrive)) == 0);
       
  1895 
       
  1896  	delete fileManager;
       
  1897  	theFS.Close();
       
  1898 
       
  1899  	INFO_PRINTF1(_L("Test TestAppListInstallationL completed"));
       
  1900  	}
       
  1901  	
       
  1902 /**
       
  1903    @SYMTestCaseID T-RApaLsSessionTestStep-TestAppListInstallation1L
       
  1904   
       
  1905    @SYMDEF DEF055654: Platform-security loop-hole for "import-directory" applications
       
  1906   
       
  1907    @SYMTestCaseDesc Test updating of Application list on installation of a new application. 
       
  1908    
       
  1909    @SYMTestPriority High 
       
  1910   
       
  1911    @SYMTestStatus Implemented
       
  1912    
       
  1913    @SYMTestActions Test updating of application list on installation of a new application. 
       
  1914    Copy the SimpleApparcTestApp from z:\private\10003a3f\apps folder to c:\private\10003a3f\import\apps
       
  1915    folder. Call RApaLsSession::GetAppInfo() and test the application information obtained to
       
  1916    verify that apparc server does not update the application to reside in c: drive
       
  1917    but on z drive. Delete the copied application and call RApaLsSession::GetAppInfo().
       
  1918    Verify that the application list does not update app list again.\n
       
  1919    API Calls:\n	
       
  1920    RApaLsSession::GetAppInfo(TApaAppInfo& aInfo,TUid aAppUid) const\n
       
  1921    
       
  1922    @SYMTestExpectedResults The test confirms that the scanning order of apparc server 
       
  1923    for applications is 'apps' folder for all ROM drives and then 'import\apps' folder 
       
  1924    for all other drives. It also confirms that if UID of an application which is present in 
       
  1925    import\apps folder on any non-ROM drive, is same as UID of an existing application present 
       
  1926    on z: apps folder then the apparc server does not update app list and uses the application
       
  1927    residing on z drive.
       
  1928     
       
  1929  */
       
  1930 void CT_RApaLsSessionTestStep::TestAppListInstallation1L()
       
  1931  	{ 
       
  1932  	_LIT(KTestAppDestDir, "C:\\private\\10003a3f\\import\\apps\\" );
       
  1933  	_LIT(KTestAppSource, "Z:\\private\\10003a3f\\apps\\SimpleApparcTestApp_reg.rsc" );
       
  1934  	_LIT(KTestAppDest, "C:\\private\\10003a3f\\import\\apps\\SimpleApparcTestApp_reg.rsc" );
       
  1935 
       
  1936  	_LIT(KTestWaitingForApplistUpdate,"Waiting %d microseconds for applist to be updated");
       
  1937  	const TInt KApplistUpdateTime=10000000;
       
  1938 
       
  1939  	// Copy reg files around and delete them to check the app list does not update. 
       
  1940  	RFs	theFS;
       
  1941  	User::LeaveIfError(theFS.Connect());
       
  1942  	CleanupClosePushL(theFS);
       
  1943  	
       
  1944  	// Remove simple app from the file system
       
  1945  	CFileMan* fileManager=CFileMan::NewL(theFS);
       
  1946  	CleanupStack::PushL(fileManager);
       
  1947  
       
  1948  	INFO_PRINTF1(_L("Copying the app to C \\import\\apps folder"));
       
  1949  	TEST(KErrNone==fileManager->Copy(KTestAppSource,KTestAppDest,CFileMan::ERecurse));
       
  1950  	
       
  1951  	INFO_PRINTF2(KTestWaitingForApplistUpdate,KApplistUpdateTime);
       
  1952  	User::After(KApplistUpdateTime);
       
  1953  
       
  1954  	TApaAppInfo appInfo;
       
  1955  	const TUid KUidSimpleApparcTestApp={0x12008ACE};
       
  1956  	TEST(KErrNone==iLs.GetAppInfo(appInfo,KUidSimpleApparcTestApp));
       
  1957 
       
  1958 	TParsePtrC parse(appInfo.iFullName);
       
  1959  	_LIT (KZdrive,"Z:");
       
  1960  	INFO_PRINTF1(_L("After copying app to C:, there should not be any update in app list:... "));
       
  1961  	INFO_PRINTF1(_L("Comparing App drive location is Z:... "));
       
  1962 	TEST(parse.Drive().CompareF(KZdrive)==0);
       
  1963  
       
  1964  	INFO_PRINTF1(_L("Removing the app from C"));
       
  1965 	TRequestStatus status;
       
  1966 	TTime tempTime(0); // added tempTime to avoid asynch CFileMan::Attribs request completing with KErrArgument
       
  1967 	TEST(fileManager->Attribs(KTestAppDest,0,KEntryAttReadOnly,tempTime,CFileMan::ERecurse,status)==KErrNone);
       
  1968 	User::WaitForRequest(status);
       
  1969 	TEST(status.Int()==KErrNone);
       
  1970  	TEST(KErrNone==fileManager->Delete(KTestAppDest, CFileMan::ERecurse));
       
  1971 
       
  1972 	INFO_PRINTF1(_L("Removing the app dir from C"));
       
  1973 	TEST(fileManager->RmDir(KTestAppDestDir)==KErrNone);
       
  1974 
       
  1975  	
       
  1976 	INFO_PRINTF2(KTestWaitingForApplistUpdate,KApplistUpdateTime);
       
  1977 	User::After(KApplistUpdateTime);
       
  1978  
       
  1979  	TEST(KErrNone==iLs.GetAppInfo(appInfo,KUidSimpleApparcTestApp));
       
  1980 
       
  1981  	TParsePtrC parse1(appInfo.iFullName);
       
  1982  	INFO_PRINTF1(_L("After removing app from C:, there should not be any update in app list:... "));
       
  1983  	INFO_PRINTF1(_L("Comparing App drive location is Z:... "));
       
  1984  	TEST((parse1.Drive().CompareF(KZdrive))==0);
       
  1985  	
       
  1986  	CleanupStack::PopAndDestroy(2, &theFS);
       
  1987 
       
  1988  	INFO_PRINTF1(_L("Test TestAppListInstallation1L completed"));
       
  1989  	} 	
       
  1990 
       
  1991 /**
       
  1992    @SYMTestCaseID T-RApaLsSessionTestStep-TestAppFolderNonRomDrivesL
       
  1993   
       
  1994    @SYMDEF DEF055654: Platform-security loop-hole for "import-directory" applications
       
  1995   
       
  1996    @SYMTestCaseDesc Test scanning of app folder for non-ROM drives. 
       
  1997   
       
  1998    @SYMTestPriority High 
       
  1999   
       
  2000    @SYMTestStatus Implemented
       
  2001    
       
  2002    @SYMTestActions Test scanning of app folder for non-ROM drives. 
       
  2003    Copy a new application AAA_reg from z:\Apparctest folder to c:\private\10003a3f\apps folder. 
       
  2004    Call RApaLsSession::GetAppInfo() and test application architecture server does not 
       
  2005    populate the new application in app list. Delete the copied application.\n
       
  2006    API Calls:\n	
       
  2007    RApaLsSession::GetAppInfo(TApaAppInfo& aInfo,TUid aAppUid) const\n
       
  2008    
       
  2009    @SYMTestExpectedResults The test confirms that the application architecture server does not 
       
  2010    scans applications residing in 'apps' folder for all non-ROM drives.    
       
  2011  */
       
  2012 void CT_RApaLsSessionTestStep::TestAppFolderNonRomDrivesL()
       
  2013  	{ 
       
  2014  	_LIT(KTestAppDestDir, "C:\\private\\10003a3f\\apps\\" );
       
  2015  	_LIT(KTestAppSource, "Z:\\Apparctest\\AAA_reg.rsc" );
       
  2016  	_LIT(KTestAppDest, "C:\\private\\10003a3f\\apps\\AAA_reg.rsc" );
       
  2017 
       
  2018  	_LIT(KTestWaitingForApplistUpdate,"Waiting %d microseconds for applist to be updated");
       
  2019  	const TInt KApplistUpdateTime=10000000;
       
  2020 
       
  2021 	INFO_PRINTF1(_L("Test scanning of app folder for non-ROM drives"));
       
  2022  	// Copy reg files around and delete them to check 
       
  2023 	// the app list does not update. 
       
  2024  	RFs	theFS;
       
  2025  	User::LeaveIfError(theFS.Connect());
       
  2026  	CleanupClosePushL(theFS);
       
  2027  
       
  2028  	// Remove simple app from the file system
       
  2029  	CFileMan* fileManager=CFileMan::NewL(theFS);
       
  2030  	CleanupStack::PushL(fileManager);
       
  2031  
       
  2032  	INFO_PRINTF1(_L("Copying AAA app to C apps folder"));
       
  2033  	TEST(KErrNone==fileManager->Copy(KTestAppSource,KTestAppDest,CFileMan::ERecurse));
       
  2034  	
       
  2035  	INFO_PRINTF2(KTestWaitingForApplistUpdate,KApplistUpdateTime);
       
  2036  	User::After(KApplistUpdateTime);
       
  2037  
       
  2038  	TApaAppInfo appInfo;
       
  2039  	// UID of AAA app is 0x10207f74
       
  2040  	const TUid KUidSimpleApp={0x10207f74};
       
  2041  	INFO_PRINTF1(_L("Finding AAA app in app list... "));
       
  2042  	TEST(KErrNotFound==iLs.GetAppInfo(appInfo,KUidSimpleApp));
       
  2043 
       
  2044 	INFO_PRINTF1(_L("Removing AAA app from C apps folder"));
       
  2045 	TRequestStatus status;
       
  2046 	TTime tempTime(0); // added tempTime to avoid asynch CFileMan::Attribs request completing with KErrArgument
       
  2047 	TEST(fileManager->Attribs(KTestAppDest,0,KEntryAttReadOnly,tempTime,CFileMan::ERecurse,status)==KErrNone);
       
  2048 	User::WaitForRequest(status);
       
  2049 	TEST(status.Int()==KErrNone);
       
  2050  	TEST(KErrNone==fileManager->Delete(KTestAppDest,CFileMan::ERecurse));
       
  2051 
       
  2052 	INFO_PRINTF1(_L("Removing the app dir from C"));
       
  2053 	TEST(fileManager->RmDir(KTestAppDestDir)==KErrNone);
       
  2054 
       
  2055  	
       
  2056 	INFO_PRINTF2(KTestWaitingForApplistUpdate,KApplistUpdateTime);
       
  2057 	User::After(KApplistUpdateTime);
       
  2058  	
       
  2059  	INFO_PRINTF1(_L("Finding AAA app in app list... "));
       
  2060  	TEST(KErrNotFound==iLs.GetAppInfo(appInfo,KUidSimpleApp));
       
  2061  	
       
  2062  	CleanupStack::PopAndDestroy(2, &theFS);
       
  2063 
       
  2064  	INFO_PRINTF1(_L("Test scanning of app folder for non-ROM drives completed"));
       
  2065  	}
       
  2066  	
       
  2067 /**
       
  2068    @SYMTestCaseID T-RApaLsSessionTestStep-DoNumDefIconsTestL
       
  2069   
       
  2070    @SYMDEF DEF037571 - Provide a better alternative to CApaAppInfoFileReader::NumberOfBitmaps'
       
  2071   
       
  2072    @SYMTestCaseDesc  
       
  2073    
       
  2074    @SYMTestPriority High 
       
  2075   
       
  2076    @SYMTestStatus Implemented
       
  2077    
       
  2078    @SYMTestActions 
       
  2079    API Calls:\n	
       
  2080    RApaLsSession::GetAppIconSizes() \n
       
  2081    RApaLsSession::NumberOfOwnDefinedIcons(appUid, iconCount)
       
  2082    @SYMTestExpectedResults
       
  2083     
       
  2084  */
       
  2085 void CT_RApaLsSessionTestStep::DoNumDefIconsTestL()
       
  2086 	{
       
  2087 	INFO_PRINTF1(_L("Testing RApaLsSession::NumberOfOwnDefinedIcons"));
       
  2088 
       
  2089 	CArrayFixFlat<TSize>* array = new(ELeave) CArrayFixFlat<TSize>(4);
       
  2090 	CleanupStack::PushL(array);
       
  2091 
       
  2092 	// Test the GetAppIconSizes function, check 3 icons are returned (default icons)
       
  2093 	INFO_PRINTF1(_L("Testing GetAppIconSizes"));
       
  2094 	TUid appUid;
       
  2095 	appUid.iUid = 0x12008ACE;	// SimpleApparcTestApp UID
       
  2096 	TInt err = iLs.GetAppIconSizes(appUid, *array);
       
  2097 	TEST(err == KErrNone);
       
  2098 	TEST(array->Count() == 3);
       
  2099 
       
  2100 	// Test the NumberOfOwnDefinedIcons function, check count is zero (no own defined icons)
       
  2101 	INFO_PRINTF1(_L("Testing NumberOfOwnDefinedIcons (SimpleApparcTestApp)"));
       
  2102 	TInt iconCount = -1;
       
  2103 	err = iLs.NumberOfOwnDefinedIcons(appUid, iconCount);
       
  2104 	TEST(err == KErrNone);
       
  2105 	TEST(iconCount == 0);
       
  2106 
       
  2107 	// Test NumberOfOwnDefinedIcons again, this time with Agenda app UID (icons defined)
       
  2108 	INFO_PRINTF1(_L("Testing NumberOfOwnDefinedIcons (Paint app)"));
       
  2109 	iconCount = -1;
       
  2110 	appUid.iUid = 0x10003A5C;//agenda  app UID
       
  2111 	err = iLs.NumberOfOwnDefinedIcons(appUid, iconCount);
       
  2112 	TEST(err == KErrNone);
       
  2113 	TEST(iconCount == 3);
       
  2114 
       
  2115 	CleanupStack::PopAndDestroy(array);
       
  2116 
       
  2117 	INFO_PRINTF1(_L("NumberOfOwnDefinedIcons test complete"));
       
  2118 	}
       
  2119 
       
  2120 
       
  2121 void CT_RApaLsSessionTestStep::TestMatchesSecurityPolicy()
       
  2122 	{
       
  2123 	TUid appUid;
       
  2124 	appUid.iUid=0X10009f9a;
       
  2125     TBool matches;
       
  2126    
       
  2127     //Testing with valid TSecurityPolicy
       
  2128     INFO_PRINTF1(_L("Testing MatchesSecurityPolicy with valid TSecurityPolicy"));
       
  2129     iLs.MatchesSecurityPolicy(matches, appUid, TSecurityPolicy(TVendorId(0x70000001)));
       
  2130     TEST(matches);
       
  2131     INFO_PRINTF1(KCompleted);
       
  2132     
       
  2133     //Testing with invalid TSecurityPolicy
       
  2134     INFO_PRINTF1(_L("Testing MatchesSecurityPolicy with invalid TSecurityPolicy"));
       
  2135     APPFWK_NEGATIVE_PLATSEC_START;
       
  2136     iLs.MatchesSecurityPolicy(matches, appUid, TSecurityPolicy(TVendorId(0x70000002)));
       
  2137     APPFWK_NEGATIVE_PLATSEC_FINISH;
       
  2138     TEST(!matches);
       
  2139     INFO_PRINTF1(KCompleted);
       
  2140 	}
       
  2141 
       
  2142 void CT_RApaLsSessionTestStep::TestGetAppViewsL()
       
  2143 	{
       
  2144 	INFO_PRINTF1(_L("Testing RApaLsSession::GetAppViews() with a valid app uid"));
       
  2145 
       
  2146 	CApaAppViewArray* appViews = new(ELeave) CApaAppViewArray(4);
       
  2147 	CleanupStack::PushL(appViews);
       
  2148 
       
  2149 	TInt ret = iLs.GetAppViews(*appViews, KUidTestApp);
       
  2150 	TEST(ret==KErrNone);
       
  2151 	
       
  2152 	// check appviews contain entries
       
  2153 	const TInt count=appViews->Count();
       
  2154 	TEST(count > 0);
       
  2155 	TInt testNumberOfIcons = count-1;
       
  2156 	//the last view is invalid. Hence it checks till count-1 
       
  2157 	for (TInt ii=0; ii<testNumberOfIcons; ii++)
       
  2158 		{
       
  2159 		const TApaAppViewInfo& viewInfo=(*appViews)[ii];
       
  2160 		TEST(viewInfo.iUid != KNullUid);
       
  2161 		TEST(viewInfo.iViewCaption.Length() > 0);
       
  2162 		TEST(viewInfo.iScreenMode == 0x00);
       
  2163 
       
  2164 		// check icons in the views
       
  2165 		CApaMaskedBitmap* viewBitmap = CApaMaskedBitmap::NewLC();
       
  2166 		ret = iLs.GetAppViewIcon(KUidTestApp, viewInfo.iUid, TSize(50,50), *viewBitmap);
       
  2167 		TEST(ret==KErrNone);
       
  2168 		CleanupStack::PopAndDestroy(viewBitmap);
       
  2169 		
       
  2170 		HBufC* fullFileName = NULL;
       
  2171 		ret = iLs.GetAppViewIcon(KUidTestApp, viewInfo.iUid, fullFileName);
       
  2172 		TEST(ret == KErrNone);
       
  2173 		TEST(fullFileName != NULL);
       
  2174 		if (fullFileName != NULL)
       
  2175 			{
       
  2176 			TEST(fullFileName->Length() > 0);
       
  2177 			}
       
  2178 		delete fullFileName;		
       
  2179 		fullFileName = NULL;		
       
  2180 		}
       
  2181 
       
  2182 	CleanupStack::PopAndDestroy(appViews);
       
  2183     INFO_PRINTF1(KCompleted);
       
  2184 	}
       
  2185 
       
  2186 void CT_RApaLsSessionTestStep::TestGetAppViewsFailureL()
       
  2187 	{
       
  2188 	INFO_PRINTF1(_L("Testing RApaLsSession::GetAppViews() with an invalid app uid"));
       
  2189 
       
  2190 	const TUid appUid={10000}; // invalid uid
       
  2191 	CApaAppViewArray* appViews = new(ELeave) CApaAppViewArray(2);
       
  2192 	CleanupStack::PushL(appViews);
       
  2193 	
       
  2194 	//Create App View array
       
  2195 	TInt ret = iLs.GetAppViews(*appViews, appUid);
       
  2196 	TEST(ret=KErrNotFound);
       
  2197 	
       
  2198 	CleanupStack::PopAndDestroy(appViews);
       
  2199     INFO_PRINTF1(KCompleted);
       
  2200 	}
       
  2201 
       
  2202 void CT_RApaLsSessionTestStep::IconLoadingTestCasesL()
       
  2203 	{
       
  2204 	CArrayFixFlat<TSize>* testIconSizeArray;
       
  2205 	testIconSizeArray=new(ELeave) CArrayFixFlat<TSize>(3);
       
  2206 	CleanupStack::PushL(testIconSizeArray);
       
  2207 	TestServerIconSizeCountL(*testIconSizeArray);
       
  2208 	TestServerIconLoadingBySize1L(*testIconSizeArray);
       
  2209 	TestServerIconLoadingBySize2L(*testIconSizeArray);
       
  2210 	TestServerIconLoadingBySize3L(*testIconSizeArray);
       
  2211 	CleanupStack::PopAndDestroy(testIconSizeArray);
       
  2212 	}
       
  2213 
       
  2214 void CT_RApaLsSessionTestStep::AppInfoTestCasesL()
       
  2215 	{
       
  2216 	TestAppListInfoDataInterrogationSetupL();
       
  2217 					
       
  2218 	TestAppInfo1();
       
  2219 	TestAppInfo2();
       
  2220 	TestAppInfo3();
       
  2221 	TestAppInfo4();
       
  2222 	
       
  2223 	TestGetAppCapabilityL();
       
  2224 	TestRecognizeSpecificData();
       
  2225 
       
  2226 	TestSetGetAcceptedConfidenceL();
       
  2227 	TestSetGetMaxDataBufSizeL();
       
  2228 			
       
  2229 	TestGetSupportedDataTypesL();
       
  2230 	TestGetAppIconL();
       
  2231 	TestGetAppIcon1L();
       
  2232 	TestGetAppIcon2L();
       
  2233 
       
  2234 	TestGetAppViewsL();
       
  2235 	TestGetAppViewsFailureL();
       
  2236 	}
       
  2237 
       
  2238 void CT_RApaLsSessionTestStep::EmbeddedAppsTestCases()
       
  2239 	{
       
  2240 	DoGetAllApps();
       
  2241 	DoGetEmbeddableApps();
       
  2242 	DoEmbeddableAppCount();
       
  2243 	DoGetAppCapability();
       
  2244 	DoGetFilteredApps1();
       
  2245 	DoGetFilteredApps2();
       
  2246 	DoGetFilteredApps3();
       
  2247 	DoGetFilteredApps4();
       
  2248 	DoGetFilteredApps5();
       
  2249 	DoGetFilteredApps6();
       
  2250 	DoTestEmbeddabilityFilter1();
       
  2251 	DoTestEmbeddabilityFilter2();
       
  2252 	DoTestEmbeddabilityFilter3();
       
  2253 	DoTestEmbeddabilityFilter4();
       
  2254 	DoTestEmbeddabilityFilter5();
       
  2255 	}
       
  2256 	
       
  2257 void CT_RApaLsSessionTestStep::TestNotifyOnDataMappingChangeL()
       
  2258 	{
       
  2259 	INFO_PRINTF1(_L("Test RApaLsSession::TestNotifyOnDataMappingChangeL()"));
       
  2260 	RApaLsSession lsMappingChange;
       
  2261 	lsMappingChange.Connect();
       
  2262 	CleanupClosePushL(lsMappingChange);
       
  2263 	TRequestStatus status;
       
  2264 	lsMappingChange.NotifyOnDataMappingChange(status);
       
  2265 	//Test for TestCancelNotifyOnDataMappingChange
       
  2266 	lsMappingChange.CancelNotifyOnDataMappingChange();
       
  2267 	User::WaitForRequest(status);
       
  2268 	TEST( status ==KErrCancel);
       
  2269 	//Test for TestNotifyOnDataMappingChangeL
       
  2270 	lsMappingChange.NotifyOnDataMappingChange(status);
       
  2271 	const TUid KTestUidValue1={10101010};
       
  2272 	const TDataType dataType(_L8("sonew/else"));
       
  2273 	iLs.InsertDataMapping(dataType,KDataTypePriorityHigh,KTestUidValue1);
       
  2274 	User::WaitForRequest(status);
       
  2275 	TEST(status==KErrNone);
       
  2276 	TEST(KErrNone == iLs.DeleteDataMapping(dataType));
       
  2277 	CleanupStack::PopAndDestroy(&lsMappingChange);
       
  2278 	INFO_PRINTF1(KCompleted);
       
  2279 	}
       
  2280 
       
  2281 /**
       
  2282    @SYMTestCaseID T_RApaLsSessionTestStep_TestDataPriorityForUnTrustedApps
       
  2283   
       
  2284    @SYMDEF	DEF063982
       
  2285   
       
  2286    @SYMTestCaseDesc Tests the Un-Trusted Apps Datatypepriority assigned through 
       
  2287 	RApaLsSession::InsertDataMapping(const TDataType& aDataType, TDataTypePriority aPriority, TUid aUid)\n
       
  2288    
       
  2289    @SYMTestPriority High 
       
  2290   
       
  2291    @SYMTestStatus Implemented
       
  2292 
       
  2293    @SYMTestExpectedResults All tests compare the results obtained with the desired result.
       
  2294 */
       
  2295 void CT_RApaLsSessionTestStep::TestDataPriorityForUnTrustedApps()
       
  2296 	{
       
  2297 	INFO_PRINTF1(_L("TestDataPriorityForUnTrustedApps about to start..."));
       
  2298 	const TUid KUidUnTrustedApp = {0x10207f8C};
       
  2299 	const TUid KUidTrustedApp = {0x10207f8D};
       
  2300 	TInt ret;
       
  2301 	TBool insertVal = EFalse;
       
  2302 	//There is no restriction for the Trusted Apps datapriority
       
  2303 	TDataTypePriority KTrustedAppPriority = {KDataTypeUnTrustedPriorityThreshold+1};
       
  2304 	//The data priority for UnTrusted Apps is greater than the Threshold
       
  2305 	TDataTypePriority KUnTrustedAppPriority = {KDataTypeUnTrustedPriorityThreshold+10};
       
  2306 	_LIT8(KLitMimeTypeTestData,"test/data");
       
  2307 	ret = iLs.InsertDataMapping(TDataType(KLitMimeTypeTestData),KTrustedAppPriority,KUidTrustedApp);
       
  2308 	//UnTrusted Apps data priority will be reduced to Security Threshold if it is greater than it.
       
  2309 	ret = iLs.InsertDataMappingIfHigher(TDataType(KLitMimeTypeTestData),KUnTrustedAppPriority,KUidUnTrustedApp,insertVal);
       
  2310 	TUid testUid;
       
  2311 	ret = iLs.AppForDataType(TDataType(KLitMimeTypeTestData),testUid);
       
  2312 	TEST(ret == KErrNone);
       
  2313 	TEST(testUid == KUidTrustedApp);
       
  2314 	INFO_PRINTF1(_L("Completed"));
       
  2315 	}
       
  2316 
       
  2317 /**
       
  2318    @SYMTestCaseID T_RApaLsSessionTestStep_TestDataPriorityForUnTrustedAppsRegFile
       
  2319   
       
  2320    @SYMDEF	DEF063982
       
  2321   
       
  2322    @SYMTestCaseDesc Tests the UnTrusted Apps Datatypepriority assigned through the registration files
       
  2323    
       
  2324    @SYMTestPriority High 
       
  2325   
       
  2326    @SYMTestStatus Implemented
       
  2327    
       
  2328    @SYMTestExpectedResults All tests compare the results obtained with the desired result.
       
  2329  */
       
  2330 void CT_RApaLsSessionTestStep::TestDataPriorityForUnTrustedAppsRegFile()
       
  2331 	{
       
  2332 	INFO_PRINTF1(_L("TestDataPriorityForUnTrustedAppsRegFile about to start..."));
       
  2333 	const TUid KUidRegTrustedApp = {0x10207f8F};
       
  2334 	_LIT8(KLitMimeTypeTestData,"text/html");
       
  2335 	TUid testUid;
       
  2336 	TInt ret;
       
  2337 	//The datatype priority of UnTrusted Apps is reduced to Threshold.  
       
  2338 	ret = iLs.AppForDataType(TDataType(KLitMimeTypeTestData),testUid);
       
  2339 	TEST(ret == KErrNone);
       
  2340 	TEST(testUid == KUidRegTrustedApp);
       
  2341 	INFO_PRINTF1(_L("Completed"));
       
  2342 	}
       
  2343 	
       
  2344 /**
       
  2345    @SYMTestCaseID T_RApaLsSessionTestStep_TestIconLoaderAndIconArrayMemoryLeaksL
       
  2346   
       
  2347    @SYMDEF	PDEF104113
       
  2348   
       
  2349    @SYMTestCaseDesc Checks there's no memory leaks when a CApaAppIconArray oject 
       
  2350    is created and deleted
       
  2351    
       
  2352    @SYMTestPriority High 
       
  2353   
       
  2354    @SYMTestStatus Implemented
       
  2355    
       
  2356    @SYMTestActions It creates an object of CApaAppIconArray class and deletes it. 
       
  2357    Then test there is no memory leak from the creation to destory the object.
       
  2358    
       
  2359    @SYMTestExpectedResults There should be no memory leak checked by __UHEAP_MARK 
       
  2360    and __UHEAP_MARKEND.
       
  2361  */
       
  2362 void CT_RApaLsSessionTestStep::TestIconLoaderAndIconArrayMemoryLeaksL()
       
  2363 	{
       
  2364 	INFO_PRINTF1(_L("Test TestIconLoaderAndIconArrayMemoryLeaksL"));
       
  2365 	__UHEAP_MARK;
       
  2366 	TIconLoaderAndIconArrayForLeaks::TestIconLoaderAndIconArrayL();
       
  2367 	__UHEAP_MARKEND;
       
  2368 	INFO_PRINTF1(_L("Completed"));
       
  2369 	}
       
  2370 
       
  2371 void CT_RApaLsSessionTestStep::RunTestCasesL()
       
  2372 	{
       
  2373 	//make sure the RFbsSession doesn't have to allocate buffer since it would change the heap
       
  2374 	CFbsBitmap* bufferAllocator = new(ELeave) CFbsBitmap;
       
  2375 	CleanupStack::PushL(bufferAllocator);
       
  2376 	bufferAllocator->Create(TSize(200,1), EColor16M);
       
  2377 	CleanupStack::PopAndDestroy(bufferAllocator);
       
  2378 
       
  2379 	
       
  2380 	HEAP_TEST_LS_SESSION(iLs, 0, 0, TestAppListInvalidL(), iLs.ClearAppInfoArray() );
       
  2381 	//DONT_CHECK due to file system changes
       
  2382 	HEAP_TEST_LS_SESSION(iLs, 0, DONT_CHECK, TestAppListInstallationL(), NO_CLEANUP);
       
  2383 	HEAP_TEST_LS_SESSION(iLs, 0, DONT_CHECK, TestAppListInstallation1L(), NO_CLEANUP);
       
  2384 	HEAP_TEST_LS_SESSION(iLs, 0, DONT_CHECK, TestAppFolderNonRomDrivesL(), NO_CLEANUP);
       
  2385 	HEAP_TEST_LS_SESSION(iLs, 0, 0, IconLoadingTestCasesL(), NO_CLEANUP);
       
  2386 	HEAP_TEST_LS_SESSION(iLs, 0, 0, AppInfoTestCasesL(), iLs.ClearAppInfoArray(); NO_CLEANUP);
       
  2387 	HEAP_TEST_LS_SESSION(iLs, 0, 0, EmbeddedAppsTestCases(), iLs.ClearAppInfoArray() );
       
  2388 	HEAP_TEST_LS_SESSION(iLs, 0, DONT_CHECK, DoNumDefIconsTestL(), NO_CLEANUP);
       
  2389 	HEAP_TEST_LS_SESSION(iLs, 0, 0, TestMatchesSecurityPolicy(), NO_CLEANUP);
       
  2390 	//DONT_CHECK since there's a new typestore
       
  2391 	HEAP_TEST_LS_SESSION(iLs, 0, DONT_CHECK, TestNotifyOnDataMappingChangeL(), NO_CLEANUP);
       
  2392 	HEAP_TEST_LS_SESSION(iLs, 0, 0, TestAppListRecognizeDataBufferOnlyL(), iLs.FlushRecognitionCache() );
       
  2393 	HEAP_TEST_LS_SESSION(iLs, 0, 0, TestAppListRecognizeDataL(), iLs.FlushRecognitionCache() );
       
  2394 	HEAP_TEST_LS_SESSION(iLs, 0, 0, TestDataPriorityForUnTrustedApps(), NO_CLEANUP);
       
  2395 	HEAP_TEST_LS_SESSION(iLs, 0, 0, TestDataPriorityForUnTrustedAppsRegFile(), NO_CLEANUP);
       
  2396 	TestIconLoaderAndIconArrayMemoryLeaksL();
       
  2397 	}
       
  2398 
       
  2399 /**
       
  2400    Destructor
       
  2401  */
       
  2402 CT_RApaLsSessionTestStep::~CT_RApaLsSessionTestStep()
       
  2403 	{
       
  2404 	RFbsSession::Disconnect();
       
  2405 	iFs.Close();
       
  2406 	iLs.Close();
       
  2407 	}
       
  2408 
       
  2409 /**
       
  2410    Constructor
       
  2411  */
       
  2412 CT_RApaLsSessionTestStep::CT_RApaLsSessionTestStep()
       
  2413 	{
       
  2414 	FbsStartup();
       
  2415 	TInt ret=RFbsSession::Connect();
       
  2416 	TEST(ret==KErrNone);
       
  2417 
       
  2418 	ret=iFs.Connect();
       
  2419 	TEST(ret==KErrNone);
       
  2420 	
       
  2421 	setup();
       
  2422 
       
  2423 	ret = iLs.Connect();
       
  2424 	TEST(ret==KErrNone);
       
  2425 	
       
  2426 	// Call base class method to set up the human readable name for logging
       
  2427 	SetTestStepName(KT_RApaLsSessionStep);
       
  2428 	}
       
  2429 
       
  2430 /**
       
  2431    @return - TVerdict code
       
  2432    Override of base class virtual
       
  2433  */
       
  2434 TVerdict CT_RApaLsSessionTestStep::doTestStepPreambleL()
       
  2435 	{
       
  2436 	SetTestStepResult(EPass);
       
  2437 	return TestStepResult();
       
  2438 	}
       
  2439 
       
  2440 /**
       
  2441    @return - TVerdict code
       
  2442    Override of base class virtual
       
  2443  */
       
  2444 TVerdict CT_RApaLsSessionTestStep::doTestStepPostambleL()
       
  2445 	{
       
  2446 	return TestStepResult();
       
  2447 	}
       
  2448 
       
  2449 
       
  2450 TVerdict CT_RApaLsSessionTestStep::doTestStepL()
       
  2451 	{
       
  2452 	INFO_PRINTF1(_L("Testing Apparc...T_RApaLsSession Test Cases Running..."));
       
  2453 
       
  2454 	TRAPD(ret,RunTestCasesL())
       
  2455 	TEST(ret==KErrNone);
       
  2456 	
       
  2457 	INFO_PRINTF1(_L("...T_RApaLsSession Test Cases Completed."));
       
  2458 
       
  2459 	return TestStepResult();
       
  2460 	}
       
  2461