common/tools/ats/smoketest/localisation/apparchitecture/tef/apparctestserver.cpp
changeset 793 0c32c669a39d
child 872 17498133d9ad
equal deleted inserted replaced
792:893b85cda81b 793:0c32c669a39d
       
     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 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 <basched.h>
       
    25 #include <eikenv.h>
       
    26 #include <eikappui.h>
       
    27 #include <eikon.hrh>
       
    28 #include <eikapp.h>
       
    29 #include <eikdoc.h>
       
    30 #include <eiklabel.h>
       
    31 #include <eikfctry.h>
       
    32 #include <coecntrl.h>
       
    33 #include <barsread.h>
       
    34 #include <eiktbar.h>
       
    35 #include <eikmenub.h>
       
    36 
       
    37 #include "appfwk_test_AppUi.h"
       
    38 #include "ApparcTestServer.h"
       
    39 #include "t_foreground.h"
       
    40 #include "T_ProStep.h"
       
    41 #include "T_OOMStep.h"
       
    42 #include "T_File1Step.h"
       
    43 #include "T_File2Step.h"
       
    44 #include "T_File3Step.h"
       
    45 #include "T_BackupStep.h"
       
    46 #include "T_MdrStep.h"
       
    47 #include "T_Serv2Step.h"
       
    48 #include "T_Serv3Step.h"
       
    49 #include "T_MruStep.h"
       
    50 #include "T_CmdlnStep.h"
       
    51 #include "T_WgnamStep.h"
       
    52 #include "T_ExeStep.h"
       
    53 #include "T_NotifStep.h"
       
    54 #include "T_CaptionStep.h"
       
    55 #include "T_LocaleStep.h"
       
    56 #include "T_RApaLsSessionStep.h"
       
    57 #include "T_ServicesStep.h"
       
    58 #include "T_ServiceRegistryStep.h"
       
    59 #include "T_StartAppStep.h"
       
    60 #include "T_StartDocStep.h"
       
    61 #include "T_AutoMMCReaderOpen.h"
       
    62 #include "T_ControlPanelTest.h"
       
    63 #include "T_RuleBasedLaunchingStep.h"
       
    64 #include "T_Capability1.h"
       
    65 #include "T_Capability2.h"
       
    66 #include "T_DataTypeMappingWithSid1.h"
       
    67 #include "T_groupNametest.h"
       
    68 #include "T_groupNametest_ver1.h"
       
    69 #include "T_groupNametest_ver2.h"
       
    70 #include "T_WindowChainingStep.h"
       
    71 #include "T_AppList.h"
       
    72 #include "T_SysStartApparcStep.h"
       
    73 #include "T_ProcStep.h"
       
    74 #include "T_DataMappingPersistenceA.h"
       
    75 #include "T_DataMappingPersistenceB.h"
       
    76 #include "T_DataMappingPersistenceC.h"
       
    77 #include "T_NonNativeAppsStep.h"
       
    78 #include "T_IntegritySupportStep.h"
       
    79 #include "T_IntegritySupportRebootStep.h"
       
    80 #include "T_ApsScan.h"
       
    81 #include "T_EndTaskStep.h"
       
    82 #include "T_RecUpgrade.h"
       
    83 #ifdef SYMBIAN_APPARC_APPINFO_CACHE
       
    84 #include "T_AppListFileBootStep.h"
       
    85 #include "T_AppListFileUpdateStep.h"
       
    86 #endif //SYMBIAN_APPARC_APPINFO_CACHE
       
    87 #include "t_largestackstep.h"
       
    88 #include "t_drivenotification.h"
       
    89 #include "t_mimecontentpolicystep.h"
       
    90 #include "t_servicebasestep.h"
       
    91 
       
    92 CApparctestServer* CApparctestServer::NewL()
       
    93 /**
       
    94    @return - Instance of the test server
       
    95    Same code for Secure and non-secure variants
       
    96    Called inside the MainL() function to create and start the
       
    97    CTestServer derived server.
       
    98  */
       
    99 	{
       
   100 	CApparctestServer * server = new (ELeave) CApparctestServer();
       
   101 	CleanupStack::PushL(server);
       
   102 	// CServer base class call
       
   103 	TParsePtrC serverName(RProcess().FileName());	
       
   104 	server->StartL(serverName.Name());
       
   105 	CleanupStack::Pop(server);
       
   106 	return server;
       
   107 	}
       
   108 
       
   109 
       
   110 
       
   111 CTestStep* CApparctestServer::CreateTestStep(const TDesC& aStepName)
       
   112 /**
       
   113    @return - A CTestStep derived instance
       
   114    Secure and non-secure variants
       
   115    Implementation of CTestServer pure virtual
       
   116  */
       
   117 	{
       
   118 	CTestStep* testStep = NULL;
       
   119 	// User::After(TTimeIntervalMicroSeconds32(5000000));
       
   120 	// This server creates just one step but create as many as you want
       
   121 	// They are created "just in time" when the worker thread is created 
       
   122 	if(aStepName == KTestAppListStep)
       
   123 		{
       
   124 		testStep = new CTestAppListStep();
       
   125 		}
       
   126 	else if(aStepName == KTestForegroundStep)
       
   127 		{
       
   128 		testStep = new CTestForegroundStep();
       
   129 		}
       
   130 	else if(aStepName == KT_ProStep)
       
   131 		{
       
   132 		testStep = new CT_ProStep();
       
   133 		}
       
   134 	else if(aStepName == KT_OOMStep)
       
   135 		{
       
   136 		testStep = new CT_OOMStep();
       
   137 		}	
       
   138 	else if(aStepName == KT_File1Step)
       
   139 		{
       
   140 		testStep = new CT_File1Step();
       
   141 		}
       
   142 	else if(aStepName == KT_File2Step)
       
   143 		{
       
   144 		testStep = new CT_File2Step();
       
   145 		}
       
   146 	else if(aStepName == KT_File3Step)
       
   147 		{
       
   148 		testStep = new CT_File3Step();
       
   149 		}
       
   150 	else if(aStepName == KT_BackupStep)
       
   151 		{
       
   152 		testStep = new CT_BackupStep();
       
   153 		}
       
   154 	else if(aStepName == KT_MdrStep)
       
   155 		{
       
   156 		testStep = new CT_MdrStep();
       
   157 		}
       
   158 	else if(aStepName == KT_Serv2Step)
       
   159 		{
       
   160 		testStep = new CT_Serv2Step();
       
   161 		}
       
   162 	else if(aStepName == KT_Serv3Step)
       
   163 		{
       
   164 		testStep = new CT_Serv3Step();
       
   165 		}
       
   166 	else if(aStepName == KT_MruStep)
       
   167 		{
       
   168 		testStep = new CT_MruStep();
       
   169 		}
       
   170 	else if(aStepName == KT_CmdlnStep)
       
   171 		{
       
   172 		testStep = new CT_CmdlnStep();
       
   173 		}
       
   174 	else if(aStepName == KT_RApaLsSessionStep)
       
   175 		{
       
   176 		testStep = new CT_RApaLsSessionTestStep();
       
   177 		}
       
   178 	else if(aStepName == KT_NotifStep)
       
   179 		{
       
   180 		testStep = new CT_NotifStep();
       
   181 		}
       
   182 	else if(aStepName == KT_WgnamStep)
       
   183 		{
       
   184 		testStep = new CT_WgnamStep();
       
   185 		}
       
   186 	else if(aStepName == KT_ExeStep)
       
   187 		{
       
   188 		testStep = new CT_ExeStep();
       
   189 		}
       
   190 	else if(aStepName == KT_CaptionStep)
       
   191 		{
       
   192 		testStep = new CT_CaptionStep();
       
   193 		}
       
   194 	else if(aStepName == KT_LocaleStep)
       
   195 		{
       
   196 		testStep = new CT_LocaleStep();
       
   197 		}
       
   198 	else if(aStepName == KT_ServicesStep)
       
   199 		{
       
   200 		testStep = new CT_ServicesTestStep();
       
   201 		}
       
   202 	else if(aStepName == KT_StartAppStep)
       
   203 		{
       
   204 		testStep = new CT_StartAppTestStep();
       
   205 		}
       
   206 	else if(aStepName == KT_ServiceRegistryStep)
       
   207 		{
       
   208 		testStep = new CT_ServiceRegistryTestStep();
       
   209 		}
       
   210 	else if(aStepName == KT_StartDocStep)
       
   211 		{
       
   212 		testStep = new CT_StartDocStep();
       
   213 		}
       
   214 	else if(aStepName == KTestAutoMMCReaderOpenStep)
       
   215 		{
       
   216 		testStep = new CTestAutoMMCReaderStep();
       
   217 		}
       
   218 	else if(aStepName == KT_ControlPanelTest)
       
   219 		{
       
   220 		testStep = new CT_ControlPanelTestStep();
       
   221 		}
       
   222 	else if(aStepName == KT_RuleBasedLaunchingStep)
       
   223 		{
       
   224 		testStep = new CTRuleBasedLaunchingStep();
       
   225 		}
       
   226 	else if(aStepName == KT_GroupNameStep)
       
   227 		{
       
   228 		testStep = new CT_GroupNameStep();
       
   229 		}
       
   230 	else if(aStepName == KT_GroupNameStep_ver1)
       
   231 		{
       
   232 		testStep = new CT_GroupNameStep_ver1();
       
   233 		}
       
   234 	else if(aStepName == KT_GroupNameStep_ver2)
       
   235 		{
       
   236 		testStep = new CT_GroupNameStep_ver2();
       
   237 		}
       
   238 	else if(aStepName == KT_Capability1)
       
   239 		{
       
   240 		testStep = new CT_Capability1();
       
   241 		}
       
   242 	else if(aStepName == KT_Capability2)
       
   243 		{
       
   244 		testStep = new CT_Capability2();
       
   245 		}
       
   246     else if(aStepName == KT_DataTypeMappingWithSid1)
       
   247         {
       
   248         testStep = new CT_DataTypeMappingWithSid1();
       
   249         }
       
   250 	else if (aStepName == KT_WindowChainingStep)
       
   251 		{
       
   252 		testStep = new CT_WindowChainingStep();
       
   253 		}
       
   254 	else if( (aStepName == KT_SysStartApparcStep) ||
       
   255              (aStepName == KApparcStartupT_TestStartApp1L) ||
       
   256              (aStepName == KApparcStartupT_TestStartApp2L) ||
       
   257              (aStepName == KApparcStartupT_TestStartApp3L) ||
       
   258              (aStepName == KApparcStartupT_TestStartApp4L) ||
       
   259              (aStepName == KApparcStartupT_TestStartApp5L) ||
       
   260              (aStepName == KApparcStartupT_TestStartApp6L) ||
       
   261              (aStepName == KApparcStartupT_TestGetAllApps) ||
       
   262              (aStepName == KApparcStartupT_TestInsertDataTypeL) ||
       
   263              (aStepName == KApparcStartupT_TestAppForDataTypeL) ||
       
   264              (aStepName == KApparcStartupT_TestDeleteDataTypeL) ||
       
   265              (aStepName == KApparcStartupT_TestServiceDiscovery) ||
       
   266              (aStepName == KApparcStartupT_TestGetAppInfo) ||
       
   267              (aStepName == KApparcStartupT_TestAppCount) ||
       
   268              (aStepName == KApparcStartupT_TestCreateDoc) ||
       
   269              (aStepName == KApparcStartupT_TestLocalisedCaptionL) )
       
   270 		{
       
   271 		testStep = new CT_SysStartApparcStep();
       
   272 		}
       
   273 	else if (aStepName == KT_ProcStep)
       
   274 		{
       
   275 		testStep = new CT_ProcStep();
       
   276 		}
       
   277 	else if (aStepName == KT_DataMappingPersistenceAStep)
       
   278 		{
       
   279 		testStep = new CT_DataMappingPersistenceATestStep();
       
   280 		}
       
   281 	else if (aStepName == KT_DataMappingPersistenceBStep)
       
   282 		{
       
   283 		testStep = new CT_DataMappingPersistenceBTestStep();
       
   284 		}
       
   285 	else if (aStepName == _L("T_DataMappingPersistenceC"))
       
   286 		{
       
   287 		testStep = new CT_DataMappingPersistenceCTestStep();
       
   288 		}
       
   289 	else if (aStepName == _L("T_NonNativeApps"))
       
   290 		{
       
   291 		testStep = new CT_NonNativeAppsStep();
       
   292 		}
       
   293 	else if (aStepName == KT_IntegritySupportStep)
       
   294 		{
       
   295 		testStep = new CT_IntegritySupportTestStep();
       
   296 		}
       
   297 	else if (aStepName == KT_IntegritySupportReboot1Step)
       
   298 		{
       
   299 		testStep = new CT_IntegritySupportReboot1TestStep();
       
   300 		}
       
   301 	else if (aStepName == KT_IntegritySupportReboot2Step)
       
   302 		{
       
   303 		testStep = new CT_IntegritySupportReboot2TestStep();
       
   304 		}
       
   305 	else if (aStepName == KT_ApsScanStep)
       
   306 		{
       
   307 		testStep = new CT_ApsScanStep();
       
   308 		}
       
   309 	else if (aStepName == KT_EndTaskStep)
       
   310 		{
       
   311 		testStep = new CTEndTaskStep();
       
   312 		}	
       
   313 	#ifdef SYMBIAN_APPARC_APPINFO_CACHE
       
   314 	else if (aStepName == KT_AppListFileUpdate)
       
   315 		{
       
   316 		testStep = new CT_AppListFileUpdateStep();
       
   317 		}
       
   318 	else if (aStepName == KT_AppListFile_Boot1)
       
   319 		{ 		
       
   320 		testStep = new CT_AppListFileBootStep(1);
       
   321 		}
       
   322 	else if (aStepName == KT_AppListFile_Boot2)
       
   323 		{
       
   324 		testStep = new CT_AppListFileBootStep(2);
       
   325 		}
       
   326 	else if (aStepName == KT_AppListFile_Boot3)
       
   327 		{
       
   328 		testStep = new CT_AppListFileBootStep(3);
       
   329 		}
       
   330 	#endif //SYMBIAN_APPARC_APPINFO_CACHE
       
   331 	else if (aStepName == KT_LargeStackStep)
       
   332 		{
       
   333 		testStep = new CT_LargeStackStep();
       
   334 		}
       
   335 	else if (aStepName == KT_DriveNotificationStep)
       
   336 		{
       
   337 		testStep = new CT_DriveNotificationStep();
       
   338 		}
       
   339 	else if (aStepName == KT_MimeContentPolicyStep)
       
   340 		{
       
   341 		testStep = new CT_MimeContentPolicyStep();
       
   342 		}
       
   343 	else if (aStepName == KT_ServiceBaseStep)
       
   344 		{
       
   345 		testStep = new CT_ServiceBaseStep();
       
   346 		}
       
   347 	else if (aStepName == KT_RecUpgradeStep)
       
   348 		{
       
   349 		testStep = new CT_RecUpgradeStep();
       
   350 		}
       
   351 	
       
   352 	return testStep;
       
   353 	}
       
   354 
       
   355 
       
   356 LOCAL_C void MainL()
       
   357 	{
       
   358 	// Leave the hooks in for platform security
       
   359 	RProcess().DataCaging(RProcess::EDataCagingOn);
       
   360 	RProcess().SecureApi(RProcess::ESecureApiOn);
       
   361 
       
   362 	CActiveScheduler* sched=NULL;
       
   363 	sched=new(ELeave) CActiveScheduler;
       
   364 	CActiveScheduler::Install(sched);
       
   365 	CApparctestServer* server = NULL;
       
   366 	// Create the CTestServer derived server
       
   367 	TRAPD(err,server = CApparctestServer::NewL());;
       
   368 	
       
   369 	if(!err)
       
   370 		{
       
   371 		// Sync with the client and enter the active scheduler
       
   372 		RProcess::Rendezvous(KErrNone);
       
   373 		sched->Start();
       
   374 		}
       
   375 	delete server;
       
   376 	delete sched;
       
   377 	}
       
   378 
       
   379 
       
   380 GLDEF_C TInt E32Main()
       
   381 	{
       
   382 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
   383 	if(cleanup == NULL)
       
   384 		{
       
   385 		return KErrNoMemory;
       
   386 		}
       
   387 	TRAP_IGNORE(MainL());
       
   388 	delete cleanup;
       
   389 	return KErrNone;
       
   390     }