installationservices/swcomponentregistry/test/tscrdatalayer/source/tscrdatalayer.cpp
branchRCL_3
changeset 25 7333d7932ef7
equal deleted inserted replaced
24:5cc91383ab1e 25:7333d7932ef7
       
     1 /*
       
     2 * Copyright (c) 2008-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 * Implements the test server of the Software Component Registry test harness
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #include "tscrdatalayerserver.h" 			// TEF Test Server
       
    21 #include "datalayersteps.h"
       
    22 
       
    23 CScrDataLayerTestServer* CScrDataLayerTestServer::NewL()
       
    24 /**
       
    25 	Called inside the MainL() function to create and start the CTestServer derived server.
       
    26 	@return Instance of the test server
       
    27  */
       
    28 	{	
       
    29 	CScrDataLayerTestServer* server = new (ELeave) CScrDataLayerTestServer();
       
    30 	CleanupStack::PushL(server);
       
    31 	server->ConstructL(KScrDataLayerTestServerName);
       
    32 	CleanupStack::Pop(server);
       
    33 	return server;
       
    34 	}
       
    35 	
       
    36 	
       
    37 CScrDataLayerTestServer::~CScrDataLayerTestServer()
       
    38 	{	
       
    39 	}
       
    40 
       
    41 
       
    42 LOCAL_C void MainL()
       
    43 	{	
       
    44 	CActiveScheduler *scheduler = new(ELeave) CActiveScheduler;
       
    45 	CActiveScheduler::Install(scheduler);
       
    46 
       
    47 	CScrDataLayerTestServer* server = NULL;
       
    48 	
       
    49 	// Create the CTestServer derived server
       
    50 	TRAPD(err,server = CScrDataLayerTestServer::NewL());
       
    51 	if(!err)
       
    52 		{
       
    53 		// Sync with the client and enter the active scheduler
       
    54 		RProcess::Rendezvous(KErrNone);
       
    55 		scheduler->Start();
       
    56 		}
       
    57 		
       
    58 	delete server;
       
    59 	delete scheduler;
       
    60 	}
       
    61 
       
    62 
       
    63 GLDEF_C TInt E32Main()
       
    64 /**
       
    65  * @return - Standard Epoc error code on process exit
       
    66  * Process entry point. Called by client using RProcess API
       
    67  */
       
    68 	{
       
    69 	__UHEAP_MARK;
       
    70 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
    71 	if(cleanup == NULL)
       
    72 		{
       
    73 		return KErrNoMemory;
       
    74 		}
       
    75 	TRAPD(err,MainL());
       
    76 	delete cleanup;
       
    77 	__UHEAP_MARKEND;
       
    78 	return err;
       
    79     }
       
    80 
       
    81 CTestStep* CScrDataLayerTestServer::CreateTestStep(const TDesC& aStepName)
       
    82 /**
       
    83 	Creates a new test step.
       
    84 	@param aStepName The name of the requested test step.
       
    85 	@return A pointer to the object of the requested test step.
       
    86  */
       
    87 	{
       
    88 	// Initialise test step object to NULL if no TEF steps are assigned
       
    89 	CTestStep* testStep = NULL;
       
    90 	
       
    91 	if(aStepName == KScrDataLayerStep)
       
    92 		testStep = new CScrTestDataLayer(*this);
       
    93 
       
    94 	return testStep;
       
    95 	}