examples/Base/IPC/AdvancedClientServerExample/test/te_ProcessClientServerTest/src/Te_ProcessClientServerTestSuiteServer.cpp

Go to the documentation of this file.
00001 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
00002 // All rights reserved.
00003 // This component and the accompanying materials are made available
00004 // under the terms of "Eclipse Public License v1.0"
00005 // which accompanies this distribution, and is available
00006 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
00007 //
00008 // Initial Contributors:
00009 // Nokia Corporation - initial contribution.
00010 //
00011 // Contributors:
00012 //
00013 // Description:
00014 //
00015 
00016 
00017 
00022 #include "Te_ProcessClientServerTestSuiteServer.h"
00023 #include "MainTestStep.h"
00024 
00025 _LIT(KServerName,"Te_ProcessClientServerTestSuite");
00026 
00033 CTe_ProcessClientServerTestSuite* CTe_ProcessClientServerTestSuite::NewL()
00034         {
00035         CTe_ProcessClientServerTestSuite * server = new (ELeave) CTe_ProcessClientServerTestSuite();
00036         CleanupStack::PushL(server);
00037 
00038         server->ConstructL();
00039         CleanupStack::Pop(server);
00040         return server;
00041         }
00048 void CTe_ProcessClientServerTestSuite::ConstructL()
00049         {
00050         CTestServer::ConstructL(KServerName);
00051         iScheduler = new(ELeave) CActiveScheduler();
00052         }
00056 CTe_ProcessClientServerTestSuite::~CTe_ProcessClientServerTestSuite()
00057         {
00058         delete iScheduler;
00059         // test step will need to clean up the handle to server
00060         // otherwise there will be a KERN::EXEC 0 panic
00061         }
00062 
00063 // Secure variants much simpler
00064 
00069 LOCAL_C void MainL()
00070         {
00071         
00072         CActiveScheduler* sched=NULL;
00073         sched=new(ELeave) CActiveScheduler;
00074         CActiveScheduler::Install(sched);
00075         CTe_ProcessClientServerTestSuite* server = NULL;
00076         // Create the CTestServer derived server
00077         TRAPD(err,server = CTe_ProcessClientServerTestSuite::NewL());
00078         if(!err)
00079                 {
00080                 // Sync with the client and enter the active scheduler
00081                 RProcess::Rendezvous(KErrNone);
00082                 sched->Start();
00083                 }
00084         delete server;
00085         delete sched;
00086         }
00092 GLDEF_C TInt E32Main()
00093         {
00094         __UHEAP_MARK;
00095         CTrapCleanup* cleanup = CTrapCleanup::New();
00096         if(cleanup == NULL)
00097                 {
00098                 return KErrNoMemory;
00099                 }
00100         TRAPD(err,MainL());
00101         delete cleanup;
00102         __UHEAP_MARKEND;
00103         return err;
00104     }
00110 CTestStep* CTe_ProcessClientServerTestSuite::CreateTestStep(const TDesC& aStepName)
00111         {
00112         CTestStep* testStep = NULL;
00113         if(aStepName == KMainTestStep)
00114          testStep = new CMainTestStep(*this);
00115         
00116         return testStep;
00117         }

Generated by  doxygen 1.6.2