localisation/apparchitecture/tef/tssaac/SysStartApparcTestCases.cpp
branchSymbian2
changeset 1 8758140453c0
child 6 c108117318cb
equal deleted inserted replaced
0:e8c1ea2c6496 1:8758140453c0
       
     1 // Copyright (c) 2005-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 // REQ3889 is essentially a change to the boot sequence and not a change to the functionality of apparc,
       
    15 // i.e. once the system has finished startup the functional behaviour should not have changed, which will
       
    16 // be proved with execution of the existing App-Framework test suite.
       
    17 // The test cases implemented below are executed during the Critical Static phase of startup to prove the
       
    18 // restricted functionality during this phase is correct. All calls to the API will panic except the call
       
    19 // to RApaLsSession::StartApp which has been modified not to panic.
       
    20 // Note that some of the tests cases used in this test are later executed during the normal
       
    21 // phone operation phase (non-critical phase) by other tests (see T_StartAppStep.cpp, T_RapaLsSession.cpp, ...)
       
    22 // As nearly all these test cases panic at the first client-server call and so execution of these test cases
       
    23 // will never reach the end of the function.
       
    24 // 
       
    25 //
       
    26 
       
    27 
       
    28 
       
    29 /**
       
    30  @file
       
    31  @test
       
    32  @internalComponent - Internal Symbian test code
       
    33 */
       
    34 
       
    35 #include <apacmdln.h>
       
    36 #include <s32file.h>
       
    37 
       
    38 #include "appfwk_test_AppUi.h"
       
    39 #include "T_SysStartApparcStep.h"
       
    40 #include "SysStartApparcTestCases.h"
       
    41 #include "TRApaLsSessionStartAppTest.h"
       
    42 #include "TRApaLsSessionTestUids.h"
       
    43 #include "tstapp.h"
       
    44 #include "tssaac.h"
       
    45 
       
    46 _LIT(KNonExistingFile, "z:\\system\\data\\not_here_thanks.foo");
       
    47 _LIT(KLitExePath, "\\sys\\bin\\texe.exe");
       
    48 
       
    49 
       
    50 /**
       
    51    Constructor
       
    52  */
       
    53 CSysStartApparcTestCase::CSysStartApparcTestCase()
       
    54 	{
       
    55 	}
       
    56 
       
    57 /**
       
    58    Destructor
       
    59  */
       
    60 CSysStartApparcTestCase::~CSysStartApparcTestCase()
       
    61 	{
       
    62 	iApaLsSession.Close();
       
    63 	}
       
    64 
       
    65 /**
       
    66 Connect to the Apparc server and call RunTestCasesL() inside a
       
    67 trap harness. Panic if an error is returned
       
    68 */
       
    69 void CSysStartApparcTestCase::doTestCasesL()
       
    70 	{
       
    71 	RDebug::Print(_L("CSysStartApparcTestCase: Test Cases Running..."));
       
    72 
       
    73 	TInt error = iApaLsSession.Connect();
       
    74 	if(error!=KErrNone)
       
    75 		{
       
    76 		RDebug::Print(_L("CSysStartApparcTestCase: Error connecting to RApaLsSession (err=%d)"), error);
       
    77 		}
       
    78 
       
    79 	TRAP(error,RunTestCasesL())
       
    80 	if(error!=KErrNone)
       
    81 		{
       
    82 		RDebug::Print(_L("CSysStartApparcTestCase: Error running test cases (err=%d)"), error);
       
    83 		}
       
    84 
       
    85 	RDebug::Print(_L("CSysStartApparcTestCase: Test Cases Completed!"));
       
    86 	}
       
    87 
       
    88 /**
       
    89 Call each test case inside a trap harness and panic if an error is returned.
       
    90 The Panic will be raised in doTestCasesL() function.
       
    91 The Use __UHEAP macros to test for memory leaks.
       
    92 Reads in the test case number from file TestCaseConfig.txt
       
    93 Each test case is assigned a unique number in the batch file sysstart_apparc_run.bat
       
    94 */
       
    95 void CSysStartApparcTestCase::RunTestCasesL()
       
    96 	{
       
    97 	__UHEAP_MARK;
       
    98 
       
    99 	TInt aTestCase=ReadConfigFileL();
       
   100 
       
   101 	switch(aTestCase)
       
   102 		{
       
   103 		case 1:
       
   104 			TestStartApp1L();
       
   105 			WriteResultFileL(); //Called if the test case does not panic
       
   106 			break;
       
   107 
       
   108 		case 2:
       
   109 			TestStartApp2L();
       
   110 			break;
       
   111 
       
   112 		case 3:
       
   113 			TestStartApp3L();
       
   114 			break;
       
   115 
       
   116 		case 4:
       
   117 			TestStartApp4L();
       
   118 			break;
       
   119 
       
   120 		case 5:
       
   121 			TestStartApp5L();
       
   122 			break;
       
   123 
       
   124 		case 6:
       
   125 			TestStartApp6L();
       
   126 			break;
       
   127 
       
   128 		case 7:
       
   129 			TestGetAllApps();
       
   130 			break;
       
   131 
       
   132 		case 8:
       
   133 			TestInsertDataTypeL();
       
   134 			break;
       
   135 
       
   136 		case 9:
       
   137 			TestAppForDataTypeL();
       
   138 			break;
       
   139 
       
   140 		case 10:
       
   141 			TestDeleteDataTypeL();
       
   142 			break;
       
   143 
       
   144 		case 11:
       
   145 			TestServiceDiscovery();
       
   146 			break;
       
   147 
       
   148 		case 12:
       
   149 			TestGetAppInfo();
       
   150 			break;
       
   151 
       
   152 		case 13:
       
   153 			TestAppCount();
       
   154 			break;
       
   155 
       
   156 		case 14:
       
   157 			TestCreateDoc();
       
   158 			break;
       
   159 
       
   160 		case 29:
       
   161 		case 0:
       
   162 		default:
       
   163 			RDebug::Print(_L("CSysStartApparcTestCase: Unknown Test Case Specified"));
       
   164 			break;
       
   165 		}
       
   166 
       
   167 	__UHEAP_MARKEND;
       
   168 	}
       
   169 
       
   170 
       
   171 /**
       
   172    @SYMTestCaseID          APPFWK-APPARC-I-0001
       
   173 
       
   174    @SYMPREQ                PREQ967
       
   175 
       
   176    @SYMREQ                 REQ3889
       
   177 
       
   178    @SYMTestCaseDesc        Test Launching of an application using command line information.
       
   179                            Test is run during SSA Critical Static phase,
       
   180 
       
   181    @SYMTestPriority        High
       
   182 
       
   183    @SYMTestStatus          Implemented
       
   184 
       
   185    @SYMTestActions         Call RApaLsSession::StartApp() to start an application defined by the command
       
   186    						   line information. Test the launching of application for following scenarios:
       
   187                            (1) When Application specified by command line exists.
       
   188                            (2) When Application specified by command line does not exist.
       
   189                            API Calls:\n
       
   190 						   RApaLsSession::StartApp(const CApaCommandLine& aCommandLine)
       
   191 
       
   192    @SYMTestExpectedResults (1) StartApp() returns KErrNone
       
   193                            (2) StartApp() returns KErrNotFound
       
   194 */
       
   195 void CSysStartApparcTestCase::TestStartApp1L()
       
   196 	{
       
   197 	RDebug::Print(_L("CSysStartApparcTestCase: Test RApaLsSession::StartApp using CApaCommandLine....."));
       
   198 
       
   199 	// Set filename location
       
   200 	TPtrC apparcTestFilename(KLitExePath);
       
   201 
       
   202 	// (1) start application texe.exe from the commandline
       
   203 	CApaCommandLine* cmdLn=CApaCommandLine::NewLC();
       
   204 	cmdLn->SetExecutableNameL(apparcTestFilename);
       
   205 	_LIT8(KLitDogfish,"dogfish");
       
   206 	cmdLn->SetTailEndL(KLitDogfish);
       
   207 	iStartApp1LRes1 = iApaLsSession.StartApp(*cmdLn); // explicit
       
   208 
       
   209 	if(iStartApp1LRes1 == KErrNone)
       
   210 		{
       
   211 		RDebug::Print(_L("CSysStartApparcTestCase: TestStartApp1L Launch of Command line app successful"));
       
   212 		}
       
   213 
       
   214 	// (2) start a non-existant app
       
   215 	_LIT(KLitWibble,"wibble");
       
   216 	cmdLn->SetExecutableNameL(KLitWibble);
       
   217 	iStartApp1LRes2 = iApaLsSession.StartApp(*cmdLn);
       
   218 	if(iStartApp1LRes2 == KErrNotFound)
       
   219 		{
       
   220 		RDebug::Print(_L("CSysStartApparcTestCase: TestStartApp1L Launch of non-existant app returns KErrNotFound"));
       
   221 		}
       
   222 
       
   223 	CleanupStack::PopAndDestroy(cmdLn); // cmdLn
       
   224 	}
       
   225 
       
   226 /**
       
   227    @SYMTestCaseID          APPFWK-APPARC-0002
       
   228 
       
   229    @SYMPREQ                PREQ967
       
   230 
       
   231    @SYMREQ                 REQ3889
       
   232 
       
   233    @SYMTestCaseDesc        Get the MIME type of the data in the specified document and return the UID of an
       
   234    						   application that can handle this type.
       
   235 
       
   236    @SYMTestPriority        High
       
   237 
       
   238    @SYMTestStatus          Implemented
       
   239 
       
   240    @SYMTestActions         Call RApaLsSession::AppForDocument() to return the UID of an application that can
       
   241    						   read/display the specified file. The Apparc server is not ready in CS phase, so the
       
   242    						   call has to fail.
       
   243                            API Calls:\n
       
   244 						   RApaLsSession::AppForDocument(const TDesC& aFileName, TUid& aAppUid, TDataType& aDataType) const
       
   245 
       
   246    @SYMTestExpectedResults AppForDocument() causes Main Panic KERN-EXEC 0
       
   247 */
       
   248 void CSysStartApparcTestCase::TestStartApp2L()
       
   249 	{
       
   250 	RDebug::Print(_L("CSysStartApparcTestCase: Test RApaLsSession::AppForDocument using filename and app uid...."));
       
   251 
       
   252 	TUid retUid = KNullUid;
       
   253 
       
   254 	TDataType data;
       
   255 
       
   256 	// Set filename location
       
   257 	TPtrC apparcTestFilename(KLitTRApaLsSessionStartAppTest);
       
   258 
       
   259 	// Main Panic KERN-EXEC 0
       
   260 	iApaLsSession.AppForDocument(apparcTestFilename, retUid, data);
       
   261 
       
   262 	}
       
   263 
       
   264 /**
       
   265    @SYMTestCaseID          APPFWK-APPARC-0003
       
   266 
       
   267    @SYMPREQ                PREQ967
       
   268 
       
   269    @SYMREQ                 REQ3889
       
   270 
       
   271    @SYMTestCaseDesc        Finds and launches an application to match the specified document.
       
   272 
       
   273    @SYMTestPriority        High
       
   274 
       
   275    @SYMTestStatus          Implemented
       
   276 
       
   277    @SYMTestActions         Call RApaLsSession::StartDocument() with a document name
       
   278                            API Calls:\n
       
   279 						   RApaLsSession::StartDocument(const TDesC& aFileName, TThreadId& aThreadId, TLaunchType aLaunchType)
       
   280 
       
   281    @SYMTestExpectedResults StartDocument() causes Main Panic KERN-EXEC 0
       
   282 */
       
   283 void CSysStartApparcTestCase::TestStartApp3L()
       
   284 	{
       
   285 	RDebug::Print(_L("CSysStartApparcTestCase: Test RApaLsSession::StartDocument....start the app from the recognized doc given."));
       
   286 
       
   287 	// Set filename location
       
   288 	TPtrC apparcTestFilename(KLitTRApaLsSessionStartAppTest);
       
   289 
       
   290 	//Call to tested function - for info, startAppThreadID is assigned to the app thread id
       
   291   	TThreadId startAppThreadID;
       
   292 
       
   293 	//Main Panic KERN-EXEC 0
       
   294 	iApaLsSession.StartDocument(apparcTestFilename, startAppThreadID);
       
   295 	}
       
   296 
       
   297 
       
   298 /**
       
   299    @SYMTestCaseID          APPFWK-APPARC-0004
       
   300 
       
   301    @SYMPREQ                PREQ967
       
   302 
       
   303    @SYMREQ                 REQ3889
       
   304 
       
   305    @SYMTestCaseDesc        Launches an application to suit the specified document by means of a specified MIME type
       
   306 
       
   307    @SYMTestPriority        High
       
   308 
       
   309    @SYMTestStatus          Implemented
       
   310 
       
   311    @SYMTestActions         Call RApaLsSession::StartDocument() with filename and MIME type.
       
   312                            API Calls:\n
       
   313 						   RApaLsSession::StartDocument(const TDesC& aFileName, const TDataType& aDataType, TThreadId& aThreadId, TLaunchType aLaunchType)
       
   314 
       
   315    @SYMTestExpectedResults StartDocument() causes Main Panic KERN-EXEC 0
       
   316 */
       
   317 void CSysStartApparcTestCase::TestStartApp4L()
       
   318 	{
       
   319 	RDebug::Print(_L("CSysStartApparcTestCase: Test RApaLsSession::StartDocument....known data type"));
       
   320 
       
   321 	// Set filename location
       
   322 	TPtrC apparcTestFilename(KLitTRApaLsSessionStartAppTest);
       
   323 
       
   324 	// KErrNotFound as a return value
       
   325 	TThreadId startAppThreadID;
       
   326 
       
   327 	//Main Panic KERN-EXEC 0
       
   328 	iApaLsSession.StartDocument(apparcTestFilename, TDataType(KLitMimeType_TRApaLsSessionStartAppTest), startAppThreadID);
       
   329 	}
       
   330 
       
   331 
       
   332 /**
       
   333    @SYMTestCaseID          APPFWK-APPARC-0005
       
   334 
       
   335    @SYMPREQ                PREQ967
       
   336 
       
   337    @SYMREQ                 REQ3889
       
   338 
       
   339    @SYMTestCaseDesc        Attempt to launch an application by means of an unknown MIME type
       
   340 
       
   341    @SYMTestPriority        High
       
   342 
       
   343    @SYMTestStatus          Implemented
       
   344 
       
   345    @SYMTestActions         Call RApaLsSession::StartDocument() with filename and unknown MIME type.
       
   346                            API Calls:\n
       
   347 						   RApaLsSession::StartDocument(const TDesC& aFileName, const TDataType& aDataType, TThreadId& aThreadId, TLaunchType aLaunchType)
       
   348 
       
   349    @SYMTestExpectedResults StartDocument() causes Main Panic KERN-EXEC 0
       
   350 */
       
   351 void CSysStartApparcTestCase::TestStartApp5L()
       
   352 	{
       
   353 	RDebug::Print(_L("CSysStartApparcTestCase: Test RApaLsSession::StartDocument....unknown data type"));
       
   354 
       
   355 	// Set filename location
       
   356 	TPtrC apparcTestFilename(KLitTRApaLsSessionStartAppTest);
       
   357 
       
   358 	// KErrNotFound as a return value
       
   359 	TThreadId startAppThreadID;
       
   360 
       
   361 	//Main Panic KERN-EXEC 0
       
   362 	iApaLsSession.StartDocument(apparcTestFilename, TDataType(_L8("text/plain/no thanks")), startAppThreadID);
       
   363 	}
       
   364 
       
   365 /**
       
   366    @SYMTestCaseID          APPFWK-APPARC-0006
       
   367 
       
   368    @SYMPREQ                PREQ967
       
   369 
       
   370    @SYMREQ                 REQ3889
       
   371 
       
   372    @SYMTestCaseDesc        Attempt to launch an application by specifying a non-existent file
       
   373 
       
   374    @SYMTestPriority        High
       
   375 
       
   376    @SYMTestStatus          Implemented
       
   377 
       
   378    @SYMTestActions         Call RApaLsSession::StartDocument() with a non-existent file
       
   379                            API Calls:\n
       
   380 						   RApaLsSession::StartDocument(const TDesC& aFileName, TThreadId& aThreadId, TLaunchType aLaunchType)
       
   381 
       
   382    @SYMTestExpectedResults StartDocument() causes Main Panic KERN-EXEC 0
       
   383 */
       
   384 void CSysStartApparcTestCase::TestStartApp6L()
       
   385 	{
       
   386 	RDebug::Print(_L("CSysStartApparcTestCase: Test RApaLsSession::StartDocument....non existent file."));
       
   387 
       
   388 	// Set filename location
       
   389 	TPtrC apparcTestFilename(KNonExistingFile);
       
   390 
       
   391 	// KErrNotFound as a return value
       
   392 	TThreadId startAppThreadID;
       
   393 
       
   394 	//Main Panic KERN-EXEC 0
       
   395 	iApaLsSession.StartDocument(apparcTestFilename, startAppThreadID);
       
   396 	}
       
   397 
       
   398 /**
       
   399    @SYMTestCaseID          APPFWK-APPARC-0007
       
   400 
       
   401    @SYMPREQ                PREQ967
       
   402 
       
   403    @SYMREQ                 REQ3889
       
   404 
       
   405    @SYMTestCaseDesc        Test the functionality of GetAllApps
       
   406 
       
   407    @SYMTestPriority        High
       
   408 
       
   409    @SYMTestStatus          Implemented
       
   410 
       
   411    @SYMTestActions         Call RApaLsSession::GetAllApps()
       
   412 
       
   413    @SYMTestExpectedResults GetAllApps() causes Main Panic KERN-EXEC 0
       
   414 
       
   415 */
       
   416 void CSysStartApparcTestCase::TestGetAllApps()
       
   417 	{
       
   418 	RDebug::Print(_L("CSysStartApparcTestCase: Test RApaLsSession::GetAllApps....check list of apps"));
       
   419 
       
   420 	// Main Panic KERN-EXEC 0
       
   421 	iApaLsSession.GetAllApps();
       
   422 
       
   423 	}
       
   424 
       
   425 /**
       
   426    @SYMTestCaseID          APPFWK-APPARC-0008
       
   427 
       
   428    @SYMPREQ                PREQ967
       
   429 
       
   430    @SYMREQ                 REQ3889
       
   431 
       
   432    @SYMTestCaseDesc        Tests InsertDataMapping() which links a datatype to the UID of an associated application
       
   433    						   for launching assigns adds a low priority.
       
   434                            Tests InsertDataMappingIfHigher() which remaps the datatype to the specified UID if the
       
   435                            specified priority is higher.
       
   436                            The "added" parameter indicates if the mapping was successful.
       
   437 
       
   438    @SYMTestPriority        High
       
   439 
       
   440    @SYMTestStatus          Implemented
       
   441 
       
   442    @SYMTestActions         Call RApaLsSession::InsertDataMapping() with datatype, application UID and low priority
       
   443                            API Calls:\n
       
   444 						   RApaLsSession::InsertDataMapping(const TDataType& aDataType, TDataTypePriority aPriority, TUid aUid)
       
   445 
       
   446    @SYMTestExpectedResults InsertDataMapping() causes Main Panic KERN-EXEC 0
       
   447 */
       
   448 void CSysStartApparcTestCase::TestInsertDataTypeL()
       
   449 	{
       
   450 	RDebug::Print(_L("CSysStartApparcTestCase: Test RApaLsSession::InsertDataMapping....Check data type mapping addition"));
       
   451 	const TDataTypePriority KPriLow = 1;
       
   452 
       
   453 	_LIT8(KLitPlainText,"text/plain");
       
   454 
       
   455 	TSecurityInfo info;
       
   456 	info.Set(RProcess());
       
   457 
       
   458 	//Main Panic KERN-EXEC 0
       
   459 	iApaLsSession.InsertDataMapping(TDataType(KLitPlainText), KPriLow, KUidTestApp);
       
   460 
       
   461 	}
       
   462 
       
   463 /**
       
   464    @SYMTestCaseID          APPFWK-APPARC-0009
       
   465 
       
   466    @SYMPREQ                PREQ967
       
   467 
       
   468    @SYMREQ                 REQ3889
       
   469 
       
   470    @SYMTestCaseDesc        Tests AppForDataType() which returns the UID of an application which can handle the specified datatype
       
   471 
       
   472    @SYMTestPriority        High
       
   473 
       
   474    @SYMTestStatus          Implemented
       
   475 
       
   476    @SYMTestActions         Call RApaLsSession::InsertDataMapping() with datatype and application UID (and priority)
       
   477                            API Calls:\n
       
   478 						   RApaLsSession::InsertDataMapping(const TDataType& aDataType, TDataTypePriority aPriority, TUid aUid)
       
   479 
       
   480    @SYMTestExpectedResults AppForDataType() causes Main Panic KERN-EXEC 0
       
   481 */
       
   482 void CSysStartApparcTestCase::TestAppForDataTypeL()
       
   483 	{
       
   484 	RDebug::Print(_L("CSysStartApparcTestCase: Test RApaLsSession::AppForDataType....Check an app binding"));
       
   485 
       
   486 	_LIT8(KLitPlainText,"text/plain");
       
   487 
       
   488 	TUid retUid = KNullUid;
       
   489 
       
   490 	//Main Panic KERN-EXEC 0
       
   491 	iApaLsSession.AppForDataType(TDataType(KLitPlainText), retUid);
       
   492 
       
   493 	}
       
   494 
       
   495 
       
   496 /**
       
   497    @SYMTestCaseID          APPFWK-APPARC-0010
       
   498 
       
   499    @SYMPREQ                PREQ967
       
   500 
       
   501    @SYMREQ                 REQ3889
       
   502 
       
   503    @SYMTestCaseDesc        Tests DeleteDataMapping() which removes the linking of a datatype to the UID of an associated application
       
   504 
       
   505    @SYMTestPriority        High
       
   506 
       
   507    @SYMTestStatus          Implemented
       
   508 
       
   509    @SYMTestActions         Call RApaLsSession::DeleteDataMapping() with datatype and service UID
       
   510                            API Calls:\n
       
   511 						   RApaLsSession::DeleteDataMapping(const TDataType& aDataType, TUid aServiceUid)
       
   512 
       
   513    @SYMTestExpectedResults DeleteDataMapping() causes Main Panic KERN-EXEC 0
       
   514 */
       
   515 void CSysStartApparcTestCase::TestDeleteDataTypeL()
       
   516 	{
       
   517 	RDebug::Print(_L("CSysStartApparcTestCase: Test RApaLsSession::DeleteDataMapping....Check data type mapping deletion"));
       
   518 
       
   519 	_LIT8(KLitPlainText,"text/plain");
       
   520 
       
   521 	TSecurityInfo info;
       
   522 	info.Set(RProcess());
       
   523 
       
   524 	//Main Panic KERN-EXEC 0
       
   525 	iApaLsSession.DeleteDataMapping(TDataType(KLitPlainText));
       
   526  	}
       
   527 
       
   528 
       
   529 /**
       
   530    @SYMTestCaseID          APPFWK-APPARC-0011
       
   531 
       
   532    @SYMPREQ                PREQ967
       
   533 
       
   534    @SYMREQ                 REQ3889
       
   535 
       
   536    @SYMTestCaseDesc        Test the functionality of GetServerApps with the service uid as parameter.
       
   537 
       
   538    @SYMTestPriority        High
       
   539 
       
   540    @SYMTestStatus          Implemented
       
   541 
       
   542    @SYMTestActions         Call RApaLsSession::GetServerApps() with a service uid that
       
   543    						   is not provided by any application
       
   544                            API Calls:\n
       
   545 						   RApaLsSession::GetServerApps(TUid aServiceUid) const
       
   546 
       
   547    @SYMTestExpectedResults GetServerApps() causes Main Panic KERN-EXEC 0
       
   548 
       
   549 */
       
   550 void CSysStartApparcTestCase::TestServiceDiscovery()
       
   551 	{
       
   552 	RDebug::Print(_L("CSysStartApparcTestCase: Test RApaLsSession::GetServerApps....check the service uid"));
       
   553 
       
   554 	TApaAppInfo appInfo;
       
   555 
       
   556 	// Uid is not provided by any application
       
   557 	const TUid KUidNonProvidedService = {0x01020300}; // service Uid
       
   558 
       
   559 	//Main Panic KERN-EXEC 0
       
   560 	iApaLsSession.GetServerApps(KUidNonProvidedService);
       
   561 
       
   562 	}
       
   563 
       
   564 
       
   565 /**
       
   566    @SYMTestCaseID          APPFWK-APPARC-0012
       
   567 
       
   568    @SYMPREQ                PREQ967
       
   569 
       
   570    @SYMREQ                 REQ3889
       
   571 
       
   572    @SYMTestCaseDesc        Test the functionality of GetAppInfo with a Uid as a parameter
       
   573 
       
   574    @SYMTestPriority        High
       
   575 
       
   576    @SYMTestStatus          Implemented
       
   577 
       
   578    @SYMTestActions         Call RApaLsSession::GetAppInfo() with a Uid that
       
   579    						   represents a non-existing app
       
   580 
       
   581                            API Calls:\n
       
   582 						   RApaLsSession::GetAppInfo(TApaAppInfo& aInfo,TUid aAppUid) const
       
   583 
       
   584    @SYMTestExpectedResults GetAppInfo() causes Main Panic KERN-EXEC 0
       
   585 
       
   586 */
       
   587 void CSysStartApparcTestCase::TestGetAppInfo()
       
   588 	{
       
   589 	RDebug::Print(_L("CSysStartApparcTestCase: Test RApaLsSession::GetAppInfo....check the app uid"));
       
   590 
       
   591 	TApaAppInfo info;
       
   592 
       
   593 	// non-existing app  causes Main Panic KERN-EXEC 0
       
   594 	iApaLsSession.GetAppInfo(info, KNullUid);
       
   595 
       
   596 	}
       
   597 
       
   598 
       
   599 /**
       
   600    @SYMTestCaseID          APPFWK-APPARC-0013
       
   601 
       
   602    @SYMPREQ                PREQ967
       
   603 
       
   604    @SYMREQ                 REQ3889
       
   605 
       
   606    @SYMTestCaseDesc        Test the functionality of AppCount
       
   607 
       
   608    @SYMTestPriority        High
       
   609 
       
   610    @SYMTestStatus          Implemented
       
   611 
       
   612    @SYMTestActions         Call RApaLsSession::AppCount()
       
   613 
       
   614 
       
   615    @SYMTestExpectedResults AppCount() causes Main Panic KERN-EXEC 0
       
   616 
       
   617 */
       
   618 void CSysStartApparcTestCase::TestAppCount()
       
   619 	{
       
   620 	RDebug::Print(_L("CSysStartApparcTestCase: Test RApaLsSession::AppCount()....check list of apps"));
       
   621 
       
   622 	TInt dummyArg;
       
   623 
       
   624 	// Main Panic KERN-EXEC 0
       
   625 	iApaLsSession.AppCount(dummyArg);
       
   626 
       
   627 	}
       
   628 
       
   629 
       
   630 /**
       
   631    @SYMTestCaseID           APPFWK-APPARC-0014
       
   632 
       
   633    @SYMPREQ                 PREQ967
       
   634 
       
   635    @SYMREQ                  REQ3889
       
   636 
       
   637    @SYMTestCaseDesc         Test the functionality of CreateDocument with a Uid as a parameter
       
   638 
       
   639    @SYMTestPriority         High
       
   640 
       
   641    @SYMTestStatus           Implemented
       
   642 
       
   643    @SYMTestActions          Call RApaLsSession::CreateDocument() with a Uid of an application
       
   644    						    When Application specified exists.
       
   645 
       
   646                             API Calls:\n
       
   647 						    RApaLsSession::CreateDocument(const TDesC& aFileName, TUid aAppUid, TThreadId& aThreadId, TLaunchType aLaunchType)
       
   648 
       
   649    @SYMTestExpectedResults (1) GetAppInfo() causes Main Panic KERN-EXEC 0
       
   650 
       
   651 */
       
   652 void CSysStartApparcTestCase::TestCreateDoc()
       
   653 	{
       
   654 	RDebug::Print(_L("CSysStartApparcTestCase: Test RApaLsSession::CreateDocument....check the app uid"));
       
   655 
       
   656 	// Set filename location
       
   657 	TPtrC apparcTestFilename(KLitTRApaLsSessionStartAppTest);
       
   658 
       
   659   	TThreadId startAppThreadID;
       
   660 
       
   661 	//Call to tested function with a existing uid (tstapp)  causes Main Panic KERN-EXEC 0
       
   662 	iApaLsSession.CreateDocument(apparcTestFilename, KUidTestApp, startAppThreadID);
       
   663 	}
       
   664 
       
   665 /**
       
   666 Reads the input config file created by sysstart_apparc_setup.bat and returns the
       
   667 test case number (Defined in sysstart_apparc_run.bat)
       
   668 @return TInt - the test case number
       
   669 */
       
   670 TInt CSysStartApparcTestCase::ReadConfigFileL()
       
   671 	{
       
   672 	RFs	fs;
       
   673  	User::LeaveIfError(fs.Connect());
       
   674  	CleanupClosePushL(fs);
       
   675 
       
   676  	RFileReadStream reader;
       
   677 	User::LeaveIfError(reader.Open(fs, KApparcConfigFile, EFileRead));
       
   678 	CleanupClosePushL(reader);
       
   679 
       
   680 	TChar delimChar('=');
       
   681 
       
   682 	TBuf8<255> aDes;
       
   683 	reader.ReadL(aDes, delimChar);
       
   684 
       
   685 	//Read in a two character representation of a number and convert to an integer
       
   686 	TChar result1(reader.ReadInt8L());
       
   687 	TChar result0(reader.ReadInt8L());
       
   688 	TInt aTestCase = result1.GetNumericValue()*10 + result0.GetNumericValue();
       
   689 
       
   690 	// clean-up
       
   691 	CleanupStack::PopAndDestroy(2, &fs);
       
   692 
       
   693 	return aTestCase;
       
   694 
       
   695 	}
       
   696 
       
   697 /**
       
   698   Write the results to the result file, to be later extracted by
       
   699   testexecute test case.
       
   700   These contain the results of the individual tests. The order in
       
   701   which these results are written in MUST match the order in which
       
   702   they are read and tested in CSysStartApparcTestStep::GetApparcResultsL()
       
   703   and the expected result tested in CSysStartApparcTestStep::Testxxx must
       
   704   match that in the test specification\n
       
   705 
       
   706   The format is:
       
   707   StartApp1LRes1 count=value1
       
   708   StartApp1LRes2 count=value2
       
   709 
       
   710   '=' is used as the deliminator.
       
   711 */
       
   712 void CSysStartApparcTestCase::WriteResultFileL()
       
   713 	{
       
   714 	RFs	fs;
       
   715  	User::LeaveIfError(fs.Connect());
       
   716  	CleanupClosePushL(fs);
       
   717 
       
   718 	RFileWriteStream writer;
       
   719 	User::LeaveIfError(writer.Replace(fs, KSsaacResultFile, EFileWrite));
       
   720 	CleanupClosePushL(writer);
       
   721 
       
   722 	// write data to file
       
   723 	writer << _L("StartApp1LRes1 count=");
       
   724 	writer.WriteInt16L(iStartApp1LRes1);
       
   725 	writer << _L("\n");
       
   726 	writer << _L("StartApp1LRes2 count=");
       
   727 	writer.WriteInt16L(iStartApp1LRes2);
       
   728 	writer << _L("\n");
       
   729 
       
   730 	writer.CommitL();
       
   731 	CleanupStack::PopAndDestroy(2, &fs);
       
   732 	}