pimappservices/calendar/tsrc/Integration/TestCalApiPolicing/generated/CSuite.cpp
changeset 0 f979ecb2b13e
equal deleted inserted replaced
-1:000000000000 0:f979ecb2b13e
       
     1 // Copyright (c) 2006-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 "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 // for (WINS && !EKA2) versions will be xxxServer.Dll and require a thread to be started
       
    17 // in the process of the client. The client initialises the server by calling the
       
    18 // one and only ordinal.
       
    19 //
       
    20 
       
    21 #include <e32base.h>
       
    22 #include <e32cmn.h> 
       
    23 
       
    24 #if (!defined TS_TestCalApiPolicing_SERVER_H_)
       
    25 	#include "CSuite.h"
       
    26 #endif
       
    27 
       
    28 #include "EOpenAgenda1_CStep.h"
       
    29 #include "ECloseAgenda1_CStep.h"
       
    30 #include "ETransmitBuffer1_CStep.h"
       
    31 #include "EGetInstanceExtractor1_CStep.h"
       
    32 #include "EPreviousDayWithInstance1_CStep.h"
       
    33 #include "ENextDayWithInstance1_CStep.h"
       
    34 #include "ECreateEntryIterator1_CStep.h"
       
    35 #include "EEntryIteratorNext1_CStep.h"
       
    36 #include "EEntryIteratorPosition1_CStep.h"
       
    37 #include "ECreateDateIterator1_CStep.h"
       
    38 #include "EDateIteratorPrevious1_CStep.h"
       
    39 #include "EDateIteratorNext1_CStep.h"
       
    40 #include "EDateIteratorAtStart1_CStep.h"
       
    41 #include "EDateIteratorAtEnd1_CStep.h"
       
    42 #include "EDateIteratorCurrentKey1_CStep.h"
       
    43 #include "EDateIteratorGoto1_CStep.h"
       
    44 #include "EDateIteratorGotoLessOrEqual1_CStep.h"
       
    45 #include "ECompactFile1_CStep.h"
       
    46 #include "ECompactionStatus1_CStep.h"
       
    47 #include "EGetEntryUidsSinceDate1_CStep.h"
       
    48 #include "EGetFileId1_CStep.h"
       
    49 #include "EGetCategoryListCount1_CStep.h"
       
    50 #include "ECategoryFilter1_CStep.h"
       
    51 #include "EStartBuildIndex1_CStep.h"
       
    52 #include "EGetListFileNames1_CStep.h"
       
    53 #include "ECancelTask1_CStep.h"
       
    54 #include "EAgnResourceCount1_CStep.h"
       
    55 #include "EAgnSetHeapFailure1_CStep.h"
       
    56 #include "EAgendaFileExists1_CStep.h"
       
    57 #include "EDisableChangeBroadcast1_CStep.h"
       
    58 #include "EEnableChangeBroadcast1_CStep.h"
       
    59 #include "ERequestChangeNotificationParameters21_CStep.h"
       
    60 #include "ERequestChangeNotification21_CStep.h"
       
    61 #include "ECancelChangeNotification21_CStep.h"
       
    62 #include "ERequestProgress1_CStep.h"
       
    63 #include "ESetUpdateAlarm1_CStep.h"
       
    64 #include "ESetEnablePubSubNotification1_CStep.h"
       
    65 #include "ERestoreAlarmAction1_CStep.h"
       
    66 #include "EFetchEntry1_CStep.h"
       
    67 #include "EFetchSimpleEntry1_CStep.h"
       
    68 #include "EDateIteratorCurrentElement1_CStep.h"
       
    69 #include "EFetchEntryByUID1_CStep.h"
       
    70 #include "ERestoreText1_CStep.h"
       
    71 #include "EGetCategoryListItem1_CStep.h"
       
    72 #include "EGetRelatedGuid1_CStep.h"
       
    73 #include "EGetChangesSinceLastNotification1_CStep.h"
       
    74 #include "EFindInstances1_CStep.h"
       
    75 #include "EUpdateEntry1_CStep.h"
       
    76 #include "EAddEntry1_CStep.h"
       
    77 #include "EDeleteEntry1_CStep.h"
       
    78 #include "EAddEntrySizes1_CStep.h"
       
    79 #include "EAddCategoryToList1_CStep.h"
       
    80 #include "EDeleteAgendaFile1_CStep.h"
       
    81 #include "ETidyByDateReadParams1_CStep.h"
       
    82 #include "ETidyByDateStart1_CStep.h"
       
    83 #include "ECategoryStart1_CStep.h"
       
    84 #include "ECategoryStartAsyn1_CStep.h"
       
    85 #include "ECreateAgendaFile1_CStep.h"
       
    86 #include "EFetchEntryByGuid1_CStep.h"
       
    87 #include "EDeleteEntriesByLocalUid1_CStep.h"
       
    88 #include "EDeleteEntryByGuid1_CStep.h"
       
    89 #include "ECommit1_CStep.h"
       
    90 #include "ERollback1_CStep.h"
       
    91 
       
    92 // __EDIT_ME__ - Substitute the name of your test server 
       
    93 _LIT(KServerName,"Cap_TestCalApiPolicing_sc");
       
    94 // __EDIT_ME__ - Use your own server class name
       
    95 
       
    96 CTestTestCalApiPolicingServer* CTestTestCalApiPolicingServer::NewL()
       
    97 /**
       
    98  * @return - Instance of the test server
       
    99  * Same code for Secure and non-secure variants
       
   100  * Called inside the MainL() function to create and start the
       
   101  * CTestServer derived server.
       
   102  */
       
   103 	{
       
   104 // __EDIT_ME__ - Use your own server class name
       
   105 	CTestTestCalApiPolicingServer * server = new (ELeave) CTestTestCalApiPolicingServer();
       
   106 	CleanupStack::PushL(server);
       
   107 	// CServer base class call
       
   108 	server->StartL(KServerName);
       
   109 	CleanupStack::Pop(server);
       
   110 	return server;
       
   111 	}
       
   112 
       
   113 CTestStep* CTestTestCalApiPolicingServer::CreateTestStep(const TDesC& aStepName)
       
   114 /**
       
   115  * @return - A CTestStep derived instance
       
   116  * Secure and non-secure variants
       
   117  * Implementation of CTestServer pure virtual
       
   118  */
       
   119 	{
       
   120 	 CTestStep* testStep = NULL;
       
   121 	// add test steps
       
   122 		if (aStepName == _L("CEOpenAgenda1Step"))
       
   123 			{
       
   124 			testStep =  new(ELeave) CEOpenAgenda1Step  ;
       
   125 			return testStep;
       
   126 			 }
       
   127 			 
       
   128 		if (aStepName == _L("CECloseAgenda1Step"))
       
   129 			{
       
   130 			testStep =  new(ELeave) CECloseAgenda1Step  ;
       
   131 			return testStep;
       
   132 			 }
       
   133 			 
       
   134 		if (aStepName == _L("CETransmitBuffer1Step"))
       
   135 			{
       
   136 			testStep =  new(ELeave) CETransmitBuffer1Step  ;
       
   137 			return testStep;
       
   138 			 }
       
   139 			 
       
   140 		if (aStepName == _L("CEGetInstanceExtractor1Step"))
       
   141 			{
       
   142 			testStep =  new(ELeave) CEGetInstanceExtractor1Step  ;
       
   143 			return testStep;
       
   144 			 }
       
   145 			 
       
   146 		if (aStepName == _L("CEPreviousDayWithInstance1Step"))
       
   147 			{
       
   148 			testStep =  new(ELeave) CEPreviousDayWithInstance1Step  ;
       
   149 			return testStep;
       
   150 			 }
       
   151 			 
       
   152 		if (aStepName == _L("CENextDayWithInstance1Step"))
       
   153 			{
       
   154 			testStep =  new(ELeave) CENextDayWithInstance1Step  ;
       
   155 			return testStep;
       
   156 			 }
       
   157 			 
       
   158 		if (aStepName == _L("CECreateEntryIterator1Step"))
       
   159 			{
       
   160 			testStep =  new(ELeave) CECreateEntryIterator1Step  ;
       
   161 			return testStep;
       
   162 			 }
       
   163 			 
       
   164 		if (aStepName == _L("CEEntryIteratorNext1Step"))
       
   165 			{
       
   166 			testStep =  new(ELeave) CEEntryIteratorNext1Step  ;
       
   167 			return testStep;
       
   168 			 }
       
   169 			 
       
   170 		if (aStepName == _L("CEEntryIteratorPosition1Step"))
       
   171 			{
       
   172 			testStep =  new(ELeave) CEEntryIteratorPosition1Step  ;
       
   173 			return testStep;
       
   174 			 }
       
   175 			 
       
   176 		if (aStepName == _L("CECreateDateIterator1Step"))
       
   177 			{
       
   178 			testStep =  new(ELeave) CECreateDateIterator1Step  ;
       
   179 			return testStep;
       
   180 			 }
       
   181 			 
       
   182 		if (aStepName == _L("CEDateIteratorPrevious1Step"))
       
   183 			{
       
   184 			testStep =  new(ELeave) CEDateIteratorPrevious1Step  ;
       
   185 			return testStep;
       
   186 			 }
       
   187 			 
       
   188 		if (aStepName == _L("CEDateIteratorNext1Step"))
       
   189 			{
       
   190 			testStep =  new(ELeave) CEDateIteratorNext1Step  ;
       
   191 			return testStep;
       
   192 			 }
       
   193 			 
       
   194 		if (aStepName == _L("CEDateIteratorAtStart1Step"))
       
   195 			{
       
   196 			testStep =  new(ELeave) CEDateIteratorAtStart1Step  ;
       
   197 			return testStep;
       
   198 			 }
       
   199 			 
       
   200 		if (aStepName == _L("CEDateIteratorAtEnd1Step"))
       
   201 			{
       
   202 			testStep =  new(ELeave) CEDateIteratorAtEnd1Step  ;
       
   203 			return testStep;
       
   204 			 }
       
   205 			 
       
   206 		if (aStepName == _L("CEDateIteratorCurrentKey1Step"))
       
   207 			{
       
   208 			testStep =  new(ELeave) CEDateIteratorCurrentKey1Step  ;
       
   209 			return testStep;
       
   210 			 }
       
   211 			 
       
   212 		if (aStepName == _L("CEDateIteratorGoto1Step"))
       
   213 			{
       
   214 			testStep =  new(ELeave) CEDateIteratorGoto1Step  ;
       
   215 			return testStep;
       
   216 			 }
       
   217 			 
       
   218 		if (aStepName == _L("CEDateIteratorGotoLessOrEqual1Step"))
       
   219 			{
       
   220 			testStep =  new(ELeave) CEDateIteratorGotoLessOrEqual1Step  ;
       
   221 			return testStep;
       
   222 			 }
       
   223 			 
       
   224 		if (aStepName == _L("CECompactFile1Step"))
       
   225 			{
       
   226 			testStep =  new(ELeave) CECompactFile1Step  ;
       
   227 			return testStep;
       
   228 			 }
       
   229 			 
       
   230 		if (aStepName == _L("CECompactionStatus1Step"))
       
   231 			{
       
   232 			testStep =  new(ELeave) CECompactionStatus1Step  ;
       
   233 			return testStep;
       
   234 			 }
       
   235 			 
       
   236 		if (aStepName == _L("CEGetEntryUidsSinceDate1Step"))
       
   237 			{
       
   238 			testStep =  new(ELeave) CEGetEntryUidsSinceDate1Step  ;
       
   239 			return testStep;
       
   240 			 }
       
   241 			 
       
   242 		if (aStepName == _L("CEGetFileId1Step"))
       
   243 			{
       
   244 			testStep =  new(ELeave) CEGetFileId1Step  ;
       
   245 			return testStep;
       
   246 			 }
       
   247 			 
       
   248 		if (aStepName == _L("CEGetCategoryListCount1Step"))
       
   249 			{
       
   250 			testStep =  new(ELeave) CEGetCategoryListCount1Step  ;
       
   251 			return testStep;
       
   252 			 }
       
   253 			 
       
   254 		if (aStepName == _L("CECategoryFilter1Step"))
       
   255 			{
       
   256 			testStep =  new(ELeave) CECategoryFilter1Step  ;
       
   257 			return testStep;
       
   258 			 }
       
   259 			 
       
   260 		if (aStepName == _L("CEStartBuildIndex1Step"))
       
   261 			{
       
   262 			testStep =  new(ELeave) CEStartBuildIndex1Step  ;
       
   263 			return testStep;
       
   264 			 }
       
   265 			 
       
   266 		if (aStepName == _L("CEGetListFileNames1Step"))
       
   267 			{
       
   268 			testStep =  new(ELeave) CEGetListFileNames1Step  ;
       
   269 			return testStep;
       
   270 			 }
       
   271 			 
       
   272 		if (aStepName == _L("CECancelTask1Step"))
       
   273 			{
       
   274 			testStep =  new(ELeave) CECancelTask1Step  ;
       
   275 			return testStep;
       
   276 			 }
       
   277 			 
       
   278 		if (aStepName == _L("CEAgnResourceCount1Step"))
       
   279 			{
       
   280 			testStep =  new(ELeave) CEAgnResourceCount1Step  ;
       
   281 			return testStep;
       
   282 			 }
       
   283 			 
       
   284 		if (aStepName == _L("CEAgnSetHeapFailure1Step"))
       
   285 			{
       
   286 			testStep =  new(ELeave) CEAgnSetHeapFailure1Step  ;
       
   287 			return testStep;
       
   288 			 }
       
   289 			 
       
   290 		if (aStepName == _L("CEAgendaFileExists1Step"))
       
   291 			{
       
   292 			testStep =  new(ELeave) CEAgendaFileExists1Step  ;
       
   293 			return testStep;
       
   294 			 }
       
   295 			 
       
   296 		if (aStepName == _L("CEDisableChangeBroadcast1Step"))
       
   297 			{
       
   298 			testStep =  new(ELeave) CEDisableChangeBroadcast1Step  ;
       
   299 			return testStep;
       
   300 			 }
       
   301 			 
       
   302 		if (aStepName == _L("CEEnableChangeBroadcast1Step"))
       
   303 			{
       
   304 			testStep =  new(ELeave) CEEnableChangeBroadcast1Step  ;
       
   305 			return testStep;
       
   306 			 }
       
   307 			 
       
   308 		if (aStepName == _L("CERequestChangeNotificationParameters21Step"))
       
   309 			{
       
   310 			testStep =  new(ELeave) CERequestChangeNotificationParameters21Step  ;
       
   311 			return testStep;
       
   312 			 }
       
   313 			 
       
   314 		if (aStepName == _L("CERequestChangeNotification21Step"))
       
   315 			{
       
   316 			testStep =  new(ELeave) CERequestChangeNotification21Step  ;
       
   317 			return testStep;
       
   318 			 }
       
   319 			 
       
   320 		if (aStepName == _L("CECancelChangeNotification21Step"))
       
   321 			{
       
   322 			testStep =  new(ELeave) CECancelChangeNotification21Step  ;
       
   323 			return testStep;
       
   324 			 }
       
   325 			 
       
   326 		if (aStepName == _L("CERequestProgress1Step"))
       
   327 			{
       
   328 			testStep =  new(ELeave) CERequestProgress1Step  ;
       
   329 			return testStep;
       
   330 			 }
       
   331 			 
       
   332 		if (aStepName == _L("CESetUpdateAlarm1Step"))
       
   333 			{
       
   334 			testStep =  new(ELeave) CESetUpdateAlarm1Step  ;
       
   335 			return testStep;
       
   336 			 }
       
   337 			 
       
   338 		if (aStepName == _L("CESetEnablePubSubNotification1Step"))
       
   339 			{
       
   340 			testStep =  new(ELeave) CESetEnablePubSubNotification1Step  ;
       
   341 			return testStep;
       
   342 			 }
       
   343 			 
       
   344 		if (aStepName == _L("CERestoreAlarmAction1Step"))
       
   345 			{
       
   346 			testStep =  new(ELeave) CERestoreAlarmAction1Step  ;
       
   347 			return testStep;
       
   348 			 }
       
   349 			 
       
   350 		if (aStepName == _L("CEFetchEntry1Step"))
       
   351 			{
       
   352 			testStep =  new(ELeave) CEFetchEntry1Step  ;
       
   353 			return testStep;
       
   354 			 }
       
   355 			 
       
   356 		if (aStepName == _L("CEFetchSimpleEntry1Step"))
       
   357 			{
       
   358 			testStep =  new(ELeave) CEFetchSimpleEntry1Step  ;
       
   359 			return testStep;
       
   360 			 }
       
   361 			 
       
   362 		if (aStepName == _L("CEDateIteratorCurrentElement1Step"))
       
   363 			{
       
   364 			testStep =  new(ELeave) CEDateIteratorCurrentElement1Step  ;
       
   365 			return testStep;
       
   366 			 }
       
   367 			 
       
   368 		if (aStepName == _L("CEFetchEntryByUID1Step"))
       
   369 			{
       
   370 			testStep =  new(ELeave) CEFetchEntryByUID1Step  ;
       
   371 			return testStep;
       
   372 			 }
       
   373 			 
       
   374 		if (aStepName == _L("CERestoreText1Step"))
       
   375 			{
       
   376 			testStep =  new(ELeave) CERestoreText1Step  ;
       
   377 			return testStep;
       
   378 			 }
       
   379 			 
       
   380 		if (aStepName == _L("CEGetCategoryListItem1Step"))
       
   381 			{
       
   382 			testStep =  new(ELeave) CEGetCategoryListItem1Step  ;
       
   383 			return testStep;
       
   384 			 }
       
   385 			 
       
   386 		if (aStepName == _L("CEGetRelatedGuid1Step"))
       
   387 			{
       
   388 			testStep =  new(ELeave) CEGetRelatedGuid1Step  ;
       
   389 			return testStep;
       
   390 			 }
       
   391 			 
       
   392 		if (aStepName == _L("CEGetChangesSinceLastNotification1Step"))
       
   393 			{
       
   394 			testStep =  new(ELeave) CEGetChangesSinceLastNotification1Step  ;
       
   395 			return testStep;
       
   396 			 }
       
   397 			 
       
   398 		if (aStepName == _L("CEFindInstances1Step"))
       
   399 			{
       
   400 			testStep =  new(ELeave) CEFindInstances1Step  ;
       
   401 			return testStep;
       
   402 			 }
       
   403 			 
       
   404 		if (aStepName == _L("CEUpdateEntry1Step"))
       
   405 			{
       
   406 			testStep =  new(ELeave) CEUpdateEntry1Step  ;
       
   407 			return testStep;
       
   408 			 }
       
   409 			 
       
   410 		if (aStepName == _L("CEAddEntry1Step"))
       
   411 			{
       
   412 			testStep =  new(ELeave) CEAddEntry1Step  ;
       
   413 			return testStep;
       
   414 			 }
       
   415 			 
       
   416 		if (aStepName == _L("CEDeleteEntry1Step"))
       
   417 			{
       
   418 			testStep =  new(ELeave) CEDeleteEntry1Step  ;
       
   419 			return testStep;
       
   420 			 }
       
   421 			 
       
   422 		if (aStepName == _L("CEAddEntrySizes1Step"))
       
   423 			{
       
   424 			testStep =  new(ELeave) CEAddEntrySizes1Step  ;
       
   425 			return testStep;
       
   426 			 }
       
   427 			 
       
   428 		if (aStepName == _L("CEAddCategoryToList1Step"))
       
   429 			{
       
   430 			testStep =  new(ELeave) CEAddCategoryToList1Step  ;
       
   431 			return testStep;
       
   432 			 }
       
   433 			 
       
   434 		if (aStepName == _L("CEDeleteAgendaFile1Step"))
       
   435 			{
       
   436 			testStep =  new(ELeave) CEDeleteAgendaFile1Step  ;
       
   437 			return testStep;
       
   438 			 }
       
   439 			 
       
   440 		if (aStepName == _L("CETidyByDateReadParams1Step"))
       
   441 			{
       
   442 			testStep =  new(ELeave) CETidyByDateReadParams1Step  ;
       
   443 			return testStep;
       
   444 			 }
       
   445 			 
       
   446 		if (aStepName == _L("CETidyByDateStart1Step"))
       
   447 			{
       
   448 			testStep =  new(ELeave) CETidyByDateStart1Step  ;
       
   449 			return testStep;
       
   450 			 }
       
   451 			 
       
   452 		if (aStepName == _L("CECategoryStart1Step"))
       
   453 			{
       
   454 			testStep =  new(ELeave) CECategoryStart1Step  ;
       
   455 			return testStep;
       
   456 			 }
       
   457 			 
       
   458 		if (aStepName == _L("CECategoryStartAsyn1Step"))
       
   459 			{
       
   460 			testStep =  new(ELeave) CECategoryStartAsyn1Step  ;
       
   461 			return testStep;
       
   462 			 }
       
   463 			 
       
   464 		if (aStepName == _L("CECreateAgendaFile1Step"))
       
   465 			{
       
   466 			testStep =  new(ELeave) CECreateAgendaFile1Step  ;
       
   467 			return testStep;
       
   468 			 }
       
   469 			 
       
   470 		if (aStepName == _L("CEFetchEntryByGuid1Step"))
       
   471 			{
       
   472 			testStep =  new(ELeave) CEFetchEntryByGuid1Step  ;
       
   473 			return testStep;
       
   474 			 }
       
   475 			 
       
   476 		if (aStepName == _L("CEDeleteEntriesByLocalUid1Step"))
       
   477 			{
       
   478 			testStep =  new(ELeave) CEDeleteEntriesByLocalUid1Step  ;
       
   479 			return testStep;
       
   480 			 }
       
   481 			 
       
   482 		if (aStepName == _L("CEDeleteEntryByGuid1Step"))
       
   483 			{
       
   484 			testStep =  new(ELeave) CEDeleteEntryByGuid1Step  ;
       
   485 			return testStep;
       
   486 			 }
       
   487 			 
       
   488 		if (aStepName == _L("CECommit1Step"))
       
   489 			{
       
   490 			testStep =  new(ELeave) CECommit1Step  ;
       
   491 			return testStep;
       
   492 			 }
       
   493 			 
       
   494 		if (aStepName == _L("CERollback1Step"))
       
   495 			{
       
   496 			testStep =  new(ELeave) CERollback1Step  ;
       
   497 			return testStep;
       
   498 			 }
       
   499 			 
       
   500 		return testStep;
       
   501 	 }
       
   502 
       
   503 	
       
   504 
       
   505 // Secure variants much simpler
       
   506 // Just an E32Main and a MainL()
       
   507 LOCAL_C void MainL()
       
   508 /**
       
   509  * Secure variant
       
   510  * Much simpler, uses the new Rendezvous() call to sync with the client
       
   511  */
       
   512 	{
       
   513 #if (defined __DATA_CAGING__)
       
   514 	RProcess().DataCaging(RProcess::EDataCagingOn);
       
   515 	RProcess().DataCaging(RProcess::ESecureApiOn);
       
   516 #endif
       
   517 	CActiveScheduler* sched=NULL;
       
   518 	sched=new(ELeave) CActiveScheduler;
       
   519 	CActiveScheduler::Install(sched);
       
   520 // __EDIT_ME__ - Use your own server class name
       
   521 	CTestTestCalApiPolicingServer* server = NULL;
       
   522 	// Create the CTestServer derived server
       
   523 	TRAPD(err,server = CTestTestCalApiPolicingServer::NewL());
       
   524 	if(!err)
       
   525 		{
       
   526 		// Sync with the client and enter the active scheduler
       
   527 		RProcess::Rendezvous(KErrNone);
       
   528 		sched->Start();
       
   529 		}
       
   530 	delete server;
       
   531 	delete sched;
       
   532 	}
       
   533 
       
   534 
       
   535 GLDEF_C TInt E32Main()
       
   536 /**
       
   537  * @return - Standard Epoc error code on process exit
       
   538  * Secure variant only
       
   539  * Process entry point. Called by client using RProcess API
       
   540  */
       
   541 	{
       
   542 	__UHEAP_MARK;
       
   543 	TInt err = KErrNone;
       
   544 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
   545 	if(cleanup == NULL)
       
   546 		{
       
   547 		return KErrNoMemory;
       
   548 		}
       
   549 	TRAP(err,MainL());
       
   550 	delete cleanup;
       
   551 	__UHEAP_MARKEND;
       
   552 	return err;
       
   553     }
       
   554 
       
   555 
       
   556 TVerdict CCapabilityTestStep::doTestStepPreambleL( void )
       
   557 	{
       
   558 	//If Preamble is not required just pass a success value
       
   559 	TVerdict testResult = CTestStep::doTestStepPreambleL();
       
   560 	
       
   561 	
       
   562 	return TestStepResult();
       
   563 	
       
   564 	}
       
   565 TVerdict CCapabilityTestStep::doTestStepPostambleL( void )
       
   566 	{
       
   567 	//If Postamble is not required just pass a success value
       
   568 	TVerdict testResult = CTestStep::doTestStepPostambleL();
       
   569 
       
   570 	return TestStepResult();
       
   571 	
       
   572 	}
       
   573 
       
   574 
       
   575 // Moved from CStep.cpp
       
   576 
       
   577 enum TVerdict CCapabilityTestStep::doTestStepL()
       
   578 	{
       
   579 	//DEF! INFO_PRINTF2(_L("%S - Starting ..."), &iTestStepName);
       
   580 
       
   581 	//The MainThread()creates a separate thread that executes SendReceive
       
   582 	TVerdict vResult = MainThread();
       
   583 	
       
   584 	SetTestStepResult(vResult);
       
   585 	return TestStepResult();
       
   586 	}
       
   587 
       
   588 /*
       
   589 ThreadStartFn:
       
   590 Called by:	The Child thread
       
   591 Function:	Calls the Exec_SendReceive
       
   592 */
       
   593 static TInt ThreadStartFn( TAny * ptr )
       
   594 	{
       
   595 	return(((CCapabilityTestStep *)ptr)->Exec_SendReceive());
       
   596 	}
       
   597 
       
   598 /*
       
   599 TVerdict GetVerdict(TInt aAPIretValue)
       
   600 
       
   601 Called by: "MainThread" for returning verdict
       
   602 
       
   603 Parameters(TInt aRetValue) :	0 if API call gets thru without any rejection
       
   604 								1 if API call is rejected for capability error	
       
   605 */
       
   606 enum TVerdict CCapabilityTestStep::GetVerdict(TInt aAPIretValue)
       
   607 	{
       
   608 	TVerdict vVerdict[] = {EPass, EFail};
       
   609 
       
   610 	//please leave the following if/else block as the information printed by INFO_PRINTF1 is used bu CapTestSumm
       
   611 	if(iExpect_Rejection)//[Inverse Test] EPass for 1 while EFail for 0
       
   612 		{
       
   613 		INFO_PRINTF1(_L("Test Expected to Fail due to lack of capabilities"));
       
   614 		return vVerdict[(aAPIretValue)?0:1];
       
   615 		
       
   616 		}
       
   617 	else //[Direct Test] EPass for 0 while EFail for 1
       
   618 		{
       
   619 		INFO_PRINTF1(_L("Test Expected to Pass with correct capabilities"));
       
   620 		return vVerdict[(aAPIretValue)?1:0];
       
   621 		}
       
   622 	}
       
   623 
       
   624 
       
   625 /*
       
   626 TVerdict MainThread()
       
   627 
       
   628 Called by: "doTestStepL"
       
   629 
       
   630 Purpose:	Creates the child thread(which calls the respective function with regard
       
   631 			to the server and also implements the Message Call). Then this fn.waits for the
       
   632 			completion of the childthread( doesnt matter how the thread did die!)
       
   633 
       
   634 Return Value(Verdict of the TestStep):
       
   635 
       
   636 			A.Reporting PASS/FAIL
       
   637 				Direct Test:
       
   638 						When a message call gets thru. Please note that in such cases
       
   639 						actually the implementation of the message has started. As we
       
   640 						are passing "0" Parameters, server may panic, though our botheration
       
   641 						stops once the call gets thru.
       
   642 						NOTE:	The style is the same when CONNECTION capabilities
       
   643 								are tested, the only diff is you dont have to expect a 
       
   644 								panic from server
       
   645 				Inverse Test:
       
   646 						The call should be either failed or panicked with
       
   647 						"KErrPermissionDenied" flag. 
       
   648 
       
   649 				General Case:
       
   650 						If a thread creation failed or if the server couldnt be connected
       
   651 						apart from the above two cases, then a FAIL is reported
       
   652 			
       
   653 			B.Reporting INCONCLUSIVE
       
   654 						Any panic say from unexpected source (eg:KERN-EXEC) will be
       
   655 						reported INCONCLUSIVE														
       
   656 */
       
   657 TVerdict CCapabilityTestStep::MainThread()
       
   658 	{
       
   659 
       
   660 	TBuf<100>	tExitCategory;
       
   661 	TInt		tExitReason = 0;		
       
   662 	TBuf<100>	TestStyle;
       
   663 
       
   664 	iExpect_Rejection?TestStyle = _L("Inverse"):TestStyle = _L("Direct");
       
   665 	TCapabilitySet theCaps =  TSecurityInfo(RProcess()).iCaps ;
       
   666 	const TInt KMaxTestThreadHeapSize = 0x10000;
       
   667 
       
   668 	//Initialize return values
       
   669 	iResult_SR = iResult_Server = KErrNone;	
       
   670 		
       
   671 
       
   672 	// Create a child thread, with a new heap
       
   673 	TInt nRes_Thread =	tChildThread.Create(
       
   674 						ChildThread_SR,
       
   675 						ThreadStartFn,
       
   676 						KDefaultStackSize,
       
   677 						KMinHeapSize,
       
   678 						KMaxTestThreadHeapSize,
       
   679 						this,			
       
   680 						EOwnerProcess);
       
   681 
       
   682 
       
   683 	if(nRes_Thread == KErrNone)//Thread Created
       
   684 		{
       
   685 
       
   686 		//Let me know when the thread is killed
       
   687 		TRequestStatus ThreadStatus;
       
   688 		tChildThread.Logon(ThreadStatus);
       
   689 		tChildThread.Resume(); 
       
   690 		
       
   691 		User::WaitForRequest( ThreadStatus );
       
   692 		
       
   693 		
       
   694 		tExitCategory	=	tChildThread.ExitCategory();
       
   695 		tExitReason		=	tChildThread.ExitReason();
       
   696 		
       
   697 	=	
       
   698 		if(iSessionCreated && (SR_MESSAGE_ID >=0))//Flag set by Child thread when connected to Server
       
   699 		{
       
   700 			//DEF INFO_PRINTF5(_L("Connected to Server(%S) for %S Test [MessageID: %d,Req.Cap: 0x%x,Present.Cap: 0x%x]"),&SR_ServerName,&TestStyle,SR_MESSAGE_ID,iStepCap,TSecurityInfo(RProcess()));			
       
   701 		}
       
   702 		else if(SR_MESSAGE_ID < 0)
       
   703 		{
       
   704 			//DEF INFO_PRINTF5(_L("Testing Connection capabilities[%S Test] for Server(%S)  [Req.Cap: 0x%x,Present.Cap: 0x%x]"),&TestStyle,
       
   705 			//&SR_ServerName,TSecurityInfo(RProcess()));			
       
   706 		}
       
   707 		else if(!iSessionCreated)// NO Connection
       
   708 			{
       
   709 			INFO_PRINTF4(_L("Couldnt connect to the Server(%S) ErrorCode - ServerRet: %d C32ret: %d"),&SR_ServerName,iResult_Server,iResult_C32);
       
   710 			//INFO_PRINTF3(_L("Child Thread: ExitCategory : %S ExitReason : %d"),&tExitCategory,tExitReason);
       
   711   			return EFail;
       
   712  			}
       
   713 
       
   714 
       
   715 
       
   716 		switch(tChildThread.ExitType())
       
   717 			{			
       
   718 			case EExitPanic:
       
   719 				//1.A Panic from the connected Server 
       
   720 				//2.A CServer Panic normally for capability rejection
       
   721 				//3.A kernel Panic 
       
   722 				if((tExitReason == KErrPermissionDenied) ||
       
   723 					//DEF ? 	it's old version (tExitReason == CServer::EClientDoesntHaveRequiredCaps))//Rejected for Insufficient Cap.
       
   724 					// is it correct ?
       
   725 					(tExitReason == CServer2::EClientDoesntHaveRequiredCaps))//Rejected for Insufficient Cap.
       
   726 					{
       
   727 					INFO_PRINTF2(_L("Rejected for insufficient capabilities [Return Value : %d] "),tExitReason);
       
   728 					return(GetVerdict(API_RetValue_PermissionDenied));
       
   729 					}
       
   730 				else if(tExitCategory == iServer_Panic) //Panic from Server
       
   731 					{
       
   732 					INFO_PRINTF2(_L("Server(%S) Panic to child thread"),&tExitCategory);	
       
   733 					INFO_PRINTF3(_L("Child Thread: ExitCategory : %S ExitReason : %d"),&tExitCategory,tExitReason);			
       
   734 					return(GetVerdict(API_RetValue_ServerPanic));
       
   735 					}
       
   736 				else//A kernel Panic possibly
       
   737 					{
       
   738 					INFO_PRINTF3(_L("Child Thread: Panic from unexpected source (ExitCategory: %S ExitReason : %d)!"),&tExitCategory,tExitReason);
       
   739 					return EInconclusive;
       
   740 					}
       
   741 
       
   742 			case EExitKill:
       
   743 				if(iResult_SR != KErrPermissionDenied)
       
   744 					{
       
   745 					INFO_PRINTF2(_L("A Successfull call (Return Value : %d)"),((SR_MESSAGE_ID >=0)?iResult_SR:iResult_Server));
       
   746 					return(GetVerdict(API_RetValue_NoCapError));
       
   747 					}
       
   748 				else 
       
   749 					{
       
   750 					INFO_PRINTF2(_L("Rejected for insufficient capabilities [Return Value : %d] "),((SR_MESSAGE_ID >=0)?iResult_SR:iResult_Server));
       
   751 					return(GetVerdict(API_RetValue_PermissionDenied));			
       
   752 					}
       
   753 
       
   754 			default:					
       
   755 					break;
       
   756 			}
       
   757 		}			
       
   758 	else //thread couldnt start
       
   759 		{
       
   760 		INFO_PRINTF2(_L("ERROR: Failed to create Child thread,  ErrorCode:(%d)"),nRes_Thread);
       
   761 		return EFail;
       
   762 		}
       
   763 
       
   764 	return EInconclusive;
       
   765 	}
       
   766 
       
   767 TInt CCapabilityTestStep::StartServer()
       
   768 {
       
   769 	TInt err =  KErrNone ;
       
   770 	// EKA2 is simple No path required
       
   771 	TBuf<32> serverFile;
       
   772 	serverFile.Copy(_L("agsvexe"));
       
   773 	_LIT(KExe,".exe");
       
   774 	serverFile.Append(KExe);
       
   775 	RProcess server;
       
   776 	err = server.Create(serverFile,_L(""));
       
   777 	if(err != KErrNone)
       
   778 		return err;
       
   779 	// Synchronise with the server
       
   780 	TRequestStatus reqStatus;
       
   781 	server.Rendezvous(reqStatus);
       
   782 	server.Resume();
       
   783 	 //Server will call the reciprocal static synchronise call
       
   784 	User::WaitForRequest(reqStatus);
       
   785 	//server.Close();
       
   786 	if(reqStatus.Int() != KErrNone)
       
   787 		return reqStatus.Int();
       
   788 	return err;
       
   789 }	
       
   790 	
       
   791 TInt CCapabilityTestStep::TestDebugHeap(TInt* iDbgIPCNo)
       
   792  	{
       
   793  	
       
   794  	//TDbgFns  {MarkHeapStart, MarkHeapEnd, CheckHeap, FailNext, ResetFailNext};
       
   795  	TInt aFnToTest= iDbgIPCNo[5];
       
   796  			
       
   797  	
       
   798  	TInt iResult_SR [6] ={0};
       
   799  	TInt i = 1;
       
   800  	TInt testedFn = 0;
       
   801  
       
   802  	TInt dbgTestSequence[5][6]	=	{	{MarkHeapStart	,2,0,1,-1,-1}, 
       
   803  										{MarkHeapEnd	,2,0,1,-1,-1},
       
   804  										{CheckHeap		,3,0,2, 1,-1},
       
   805  										{FailNext		,4,0,3, 4, 1},
       
   806  										{ResetFailNext	,4,0,3, 4, 1}
       
   807  										
       
   808  									};
       
   809  
       
   810  	
       
   811  	TInt aCount = dbgTestSequence[aFnToTest][i];
       
   812  
       
   813  	while(aCount--  )
       
   814  		{
       
   815  		testedFn =  dbgTestSequence[aFnToTest][(++i)];
       
   816  		
       
   817 			iResult_SR[testedFn ]= SendReceive( iDbgIPCNo[testedFn],TIpcArgs(((iDbgIPCNo[testedFn]==3 )?4:0),0,0,0));
       
   818    		
       
   819  		
       
   820  		if( ((testedFn !=aFnToTest)?iResult_SR[testedFn]:KErrNone) == KErrPermissionDenied) 			
       
   821 			
       
   822 			User::Panic(_L("Failed at Initialization"),iResult_SR[testedFn]);		
       
   823 
       
   824 		}
       
   825 
       
   826 	return iResult_SR[aFnToTest];
       
   827 	}
       
   828 
       
   829 /**
       
   830 Waits for sometime and checks if the asynchronous call has been answered by the server/kernel
       
   831 If yes, we eat the signal. Else we assume that the call has been delivered to the ServiceL of the
       
   832 Server, but we are being put on hold for an event to occur. After all, we only want to know if there
       
   833 was a KErrPermissionDenied
       
   834 */
       
   835 TInt CCapabilityTestStep::WaitForSomeTimeAndDecide(TRequestStatus& aStatus)
       
   836 	{
       
   837 	TRequestStatus timerStatus;
       
   838 	RTimer timer;
       
   839 	timer.CreateLocal();
       
   840 	timer.After(timerStatus, 10000000);
       
   841 	User::WaitForRequest(aStatus, timerStatus);
       
   842 	
       
   843 	if(aStatus == KRequestPending)
       
   844 		{// timer expired and we still did not get any reply
       
   845 		return KErrNone;
       
   846 		}
       
   847 	else
       
   848 		{// Got some signal. Cancel the timer and read the signal
       
   849 		timer.Cancel();
       
   850 		return aStatus.Int();
       
   851 		}	
       
   852 	}
       
   853 
       
   854 /**
       
   855 Maintains a list of Async messages. And checks if the mesage passed as a parameter
       
   856 is an async message
       
   857 */
       
   858 TInt CCapabilityTestStep::GetSyncOrAsync(TInt aMessageNo)
       
   859 	{
       
   860 	const TInt size = 10;
       
   861 	
       
   862 	const TInt asyncMsgs[size] = {EStartBuildIndex, ETidyByDateStart, ERequestProgress, ECategoryStartAsyn, ERequestChangeNotification};
       
   863 	
       
   864 	for(TInt i = 0; i < size; ++i)
       
   865 		{
       
   866 		if (aMessageNo == asyncMsgs[i])
       
   867 			{
       
   868 			return KAsyncMessage;
       
   869 			}
       
   870 		}
       
   871 	return KSyncMessage;
       
   872 	}