installationservices/swi/test/tsisregistrytest_legacy/tsisregistrytest.cpp
changeset 0 ba25891c3a9e
child 5 3eebb1e54d3a
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     1 /*
       
     2 * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 /**
       
    20  @file 
       
    21  @test
       
    22  @internalTechnology
       
    23 */
       
    24 #include "tsisregistrytest.h"
       
    25 #include "tsisregistryteststep.h"
       
    26 #include "sessionstep.h"
       
    27 #include "writablesessionstep.h"
       
    28 
       
    29 _LIT(KServerName,"tSisRegistryTest");
       
    30 CTestSisRegistry* CTestSisRegistry::NewL()
       
    31 /**
       
    32  * @return - Instance of the test server
       
    33  * Called inside the MainL() function to create and start the
       
    34  * CTestServer derived server.
       
    35  */
       
    36 	{
       
    37 	CTestSisRegistry * server = new (ELeave) CTestSisRegistry();
       
    38 	CleanupStack::PushL(server);
       
    39 	// CServer base class call
       
    40 	server->StartL(KServerName);
       
    41 	CleanupStack::Pop(server);
       
    42 	return server;
       
    43 	}
       
    44 
       
    45 LOCAL_C void MainL()
       
    46 /**
       
    47  * Much simpler, uses the new Rendezvous() call to sync with the client
       
    48  */
       
    49 	{
       
    50 	// Leave the hooks in for platform security
       
    51 #if (defined __DATA_CAGING__)
       
    52 	RProcess().DataCaging(RProcess::EDataCagingOn);
       
    53 	RProcess().SecureApi(RProcess::ESecureApiOn);
       
    54 #endif
       
    55 	CActiveScheduler* sched=NULL;
       
    56 	sched=new(ELeave) CActiveScheduler;
       
    57 	CActiveScheduler::Install(sched);
       
    58 	// __EDIT_ME__ Your server name
       
    59 	CTestSisRegistry* server = NULL;
       
    60 	// Create the CTestServer derived server
       
    61 	// __EDIT_ME__ Your server name
       
    62 	TRAPD(err,server = CTestSisRegistry::NewL());
       
    63 	if(!err)
       
    64 		{
       
    65 		// Sync with the client and enter the active scheduler
       
    66 		RProcess::Rendezvous(KErrNone);
       
    67 		sched->Start();
       
    68 		}
       
    69 	delete server;
       
    70 	delete sched;
       
    71 	}
       
    72 
       
    73 GLDEF_C TInt E32Main()
       
    74 /**
       
    75  * @return - Standard Epoc error code on exit
       
    76  */
       
    77 	{
       
    78 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
    79 	if(cleanup == NULL)
       
    80 		{
       
    81 		return KErrNoMemory;
       
    82 		}
       
    83 	TRAP_IGNORE(MainL());
       
    84 	delete cleanup;
       
    85 	return KErrNone;
       
    86     }
       
    87 
       
    88 CTestStep* CTestSisRegistry::CreateTestStep(const TDesC& aStepName)
       
    89 /**
       
    90  * @return - A CTestStep derived instance
       
    91  * Implementation of CTestServer pure virtual
       
    92  */
       
    93 	{
       
    94 	CTestStep* name = NULL;
       
    95 	if (aStepName == KInstalledUids)
       
    96 		{
       
    97 		name = new CInstalledUidsStep;
       
    98 		}
       
    99 	if (aStepName == KInstalledPackages)
       
   100 		{
       
   101 		name = new CInstalledPackagesStep;
       
   102 		}
       
   103 	if (aStepName == KRemovablePackages)
       
   104 		{
       
   105 		name = new CRemovablePackagesStep;
       
   106 		}	
       
   107 	if (aStepName == KInRomNonRemovablePackages)
       
   108 		{
       
   109 		name = new CInRomNonRemovablePackage;
       
   110 		}
       
   111 	if (aStepName == KInstalledDrives)
       
   112 		{
       
   113 		name = new CInstalledDrives;
       
   114 		}		
       
   115 	else if (aStepName == KIsUidInstalled)
       
   116 		{
       
   117 		name = new CIsUidInstalledStep;	
       
   118 		}
       
   119 	else if (aStepName == KIsPackageInstalled)
       
   120 		{
       
   121 		name = new CIsPackageInstalledStep;
       
   122 		}
       
   123 	if (aStepName == KGetControllers)
       
   124 		{
       
   125 		name = new CGetControllersStep;	
       
   126 		}
       
   127 	if (aStepName == KIsControllerInstalled)
       
   128 		{
       
   129 		name = new CIsControllerInstalledStep;	
       
   130 		}
       
   131 	else if (aStepName == KEntryUidOpenClose)
       
   132 		{
       
   133 		name = new CEntryUidOpenCloseStep;
       
   134 		}
       
   135 	else if (aStepName == KEntryPackageOpenClose)
       
   136 		{
       
   137 		name = new CEntryPackageOpenCloseStep;
       
   138 		}
       
   139 	else if (aStepName == KEntryNameOpenClose)
       
   140 		{
       
   141 		name = new CEntryNameOpenCloseStep;
       
   142 		}	
       
   143 	else if (aStepName == KEntrySids)
       
   144 		{
       
   145 		name = new CEntrySidsStep;
       
   146 		}
       
   147 	else if (aStepName == KEntryMethods)
       
   148 		{
       
   149 		name = new CEntryMethodsStep;
       
   150 		}
       
   151 	else if (aStepName == KWritableEntryMethods)
       
   152 		{
       
   153 		name = new CWritableEntryMethodsStep;
       
   154 		}
       
   155 	else if (aStepName == KPoliceSids)
       
   156 		{
       
   157 		name = new CPoliceSidsStep;
       
   158 		}		
       
   159 	else if (aStepName == KEntryDelete)
       
   160 		{
       
   161 		name = new CEntryDeleteStep;
       
   162 		}
       
   163 	else if (aStepName == KBackupRegistry)
       
   164 		{
       
   165 		name = new CBackupRegistryStep;
       
   166 		}
       
   167 	else if (aStepName == KCreateTestRegistry)
       
   168 		{
       
   169 		name = new CCreateTestRegistryStep;
       
   170 		}
       
   171 	else if (aStepName == KDeleteRegistry)
       
   172 		{
       
   173 		name = new CDeleteRegistryStep;
       
   174 		}
       
   175 	else if (aStepName == KRestoreRegistry)
       
   176 		{
       
   177 		name = new CRestoreRegistryStep;
       
   178 		}
       
   179 	else if (aStepName == KSidFileName)
       
   180 		{
       
   181 		name = new CSidFileStep;
       
   182 		}
       
   183  	else if (aStepName == KModifiableFile)
       
   184  		{
       
   185  		name = new CModifiableFileStep;
       
   186  		}
       
   187  	else if (aStepName == KFileHash)
       
   188  		{
       
   189  		name = new CFileHashStep;
       
   190  		}		
       
   191  	else if (aStepName == KSaveGeneratedRegistry)
       
   192  		{
       
   193  		name = new CSaveRegistryStep;
       
   194  		}
       
   195  	else if (aStepName == KIsSidPresentStep)
       
   196  		{
       
   197  		name = new CIsSidPresentStep;
       
   198  		}
       
   199  	else if (aStepName == KIsPackagePresentStep)
       
   200  		{
       
   201  		name = new CIsPackagePresentStep;
       
   202  		}
       
   203  	else if (aStepName == KIntegrityCheckStep)
       
   204  		{
       
   205  		name = new CIntegrityCheckStep;
       
   206  		}	
       
   207  	else if (aStepName == KLoggingFileInfo)
       
   208   		{
       
   209   		name = new CLoggingFileInfoStep;
       
   210    		}
       
   211  	else if (aStepName == KRomStubPerformanceStep)
       
   212  		{
       
   213  		name = new CRomStubPerformanceStep;
       
   214  		}	
       
   215  	else if (aStepName == KCorruptCacheStep)
       
   216  		{
       
   217  		name = new CCorruptCacheStep;
       
   218  		}
       
   219   	else if (aStepName == KCorruptCacheRecoverStep)
       
   220  		{
       
   221  		name = new CCorruptCacheRecoverStep;
       
   222  		}
       
   223 	else if (aStepName == KDateAndTimeIntegrityCheckStep)
       
   224 		{
       
   225 		name = new CIntegrityDateAndTimeCheckStep;
       
   226 		}
       
   227 	else if (aStepName == KEmbeddingPackageStep)
       
   228 		{
       
   229 		name = new CEmbeddingPackageStep;		
       
   230 		}
       
   231 	else if (aStepName == KChangeLocale)
       
   232 		{
       
   233 		name = new CChangeLocaleStep;
       
   234 		}
       
   235    	return name;
       
   236 	}