installationservices/swi/test/tintegrityservices/tintegrityservices.cpp
changeset 0 ba25891c3a9e
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 "tintegrityservices.h"
       
    25 #include "tintegrityservicesstep.h"
       
    26 
       
    27 using namespace Swi;
       
    28 using namespace Swi::Test;
       
    29 
       
    30 _LIT(KServerName,"tIntegrityServices");
       
    31 CTestIntegrityServices* CTestIntegrityServices::NewL()
       
    32 /**
       
    33  * @return - Instance of the test server
       
    34  * Called inside the MainL() function to create and start the
       
    35  * CTestServer derived server.
       
    36  */
       
    37 	{
       
    38 	CTestIntegrityServices * server = new (ELeave) CTestIntegrityServices();
       
    39 	CleanupStack::PushL(server);
       
    40 	// CServer base class call
       
    41 	server->StartL(KServerName);
       
    42 	CleanupStack::Pop(server);
       
    43 	return server;
       
    44 	}
       
    45 
       
    46 LOCAL_C void MainL()
       
    47 /**
       
    48  * Much simpler, uses the new Rendezvous() call to sync with the client
       
    49  */
       
    50 	{
       
    51 	// Leave the hooks in for platform security
       
    52 #if (defined __DATA_CAGING__)
       
    53 	RProcess().DataCaging(RProcess::EDataCagingOn);
       
    54 	RProcess().SecureApi(RProcess::ESecureApiOn);
       
    55 #endif
       
    56 	CActiveScheduler* sched=NULL;
       
    57 	sched=new(ELeave) CActiveScheduler;
       
    58 	CActiveScheduler::Install(sched);
       
    59 	// __EDIT_ME__ Your server name
       
    60 	CTestIntegrityServices* server = NULL;
       
    61 	// Create the CTestServer derived server
       
    62 	// __EDIT_ME__ Your server name
       
    63 	TRAPD(err,server = CTestIntegrityServices::NewL());
       
    64 	if(!err)
       
    65 		{
       
    66 		// Sync with the client and enter the active scheduler
       
    67 		RProcess::Rendezvous(KErrNone);
       
    68 		sched->Start();
       
    69 		}
       
    70 	delete server;
       
    71 	delete sched;
       
    72 	}
       
    73 
       
    74 GLDEF_C TInt E32Main()
       
    75 /**
       
    76  * @return - Standard Epoc error code on exit
       
    77  */
       
    78 	{
       
    79 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
    80 	if(cleanup == NULL)
       
    81 		{
       
    82 		return KErrNoMemory;
       
    83 		}
       
    84 	TRAP_IGNORE(MainL());
       
    85 	delete cleanup;
       
    86 	return KErrNone;
       
    87     }
       
    88 
       
    89 CTestStep* CTestIntegrityServices::CreateTestStep(const TDesC& aStepName)
       
    90 /**
       
    91  * @return - A CTestStep derived instance
       
    92  * Implementation of CTestServer pure virtual
       
    93  */
       
    94 	{
       
    95 	CTestStep* name = NULL;
       
    96 	if (aStepName == KInstall)
       
    97 		{
       
    98 		name = new CInstallStep;
       
    99 		}
       
   100 	else if (aStepName == KRecover)
       
   101 		{
       
   102 		name = new CRecoverStep;
       
   103 		}
       
   104 	else if (aStepName == KCleanup)
       
   105 		{
       
   106 		name = new CCleanupStep;
       
   107 		}
       
   108 	else if (aStepName == KOOM)
       
   109 		{
       
   110 		name = new COOMStep;
       
   111 		}
       
   112 	else if (aStepName == KCheck)
       
   113 		{
       
   114 		name = new CCheckStep;
       
   115 		}
       
   116 		
       
   117 	return name;
       
   118 	}
       
   119