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_ThreadClientServerTestSuiteServer.h" 00023 #include "MainTestStep.h" 00024 00025 _LIT(KServerName,"Te_ThreadClientServerTestSuite"); 00026 00033 CTe_ThreadClientServerTestSuite* CTe_ThreadClientServerTestSuite::NewL() 00034 { 00035 CTe_ThreadClientServerTestSuite * server = new (ELeave) CTe_ThreadClientServerTestSuite(); 00036 CleanupStack::PushL(server); 00037 server->ConstructL(); 00038 CleanupStack::Pop(server); 00039 return server; 00040 } 00044 CTe_ThreadClientServerTestSuite::~CTe_ThreadClientServerTestSuite() 00045 { 00046 delete iScheduler; 00047 //NOTE: RThreadClient object must be cleaned up in test step thread 00048 } 00054 void CTe_ThreadClientServerTestSuite::ConstructL() 00055 { 00056 CTestServer::ConstructL(KServerName); 00057 iScheduler = new(ELeave) CActiveScheduler(); 00058 } 00059 00060 // Secure variants much simpler 00065 LOCAL_C void MainL() 00066 { 00067 00068 CActiveScheduler* sched=NULL; 00069 sched=new(ELeave) CActiveScheduler; 00070 CActiveScheduler::Install(sched); 00071 CTe_ThreadClientServerTestSuite* server = NULL; 00072 // Create the CTestServer derived server 00073 TRAPD(err,server = CTe_ThreadClientServerTestSuite::NewL()); 00074 if(!err) 00075 { 00076 // Sync with the client and enter the active scheduler 00077 RProcess::Rendezvous(KErrNone); 00078 sched->Start(); 00079 } 00080 delete server; 00081 delete sched; 00082 } 00088 GLDEF_C TInt E32Main() 00089 { 00090 __UHEAP_MARK; 00091 CTrapCleanup* cleanup = CTrapCleanup::New(); 00092 if(cleanup == NULL) 00093 { 00094 return KErrNoMemory; 00095 } 00096 TRAPD(err,MainL()); 00097 delete cleanup; 00098 __UHEAP_MARKEND; 00099 return err; 00100 } 00106 CTestStep* CTe_ThreadClientServerTestSuite::CreateTestStep(const TDesC& aStepName) 00107 { 00108 CTestStep* testStep = NULL; 00109 if(aStepName == KMainTestStep) 00110 testStep = new CMainTestStep(*this); 00111 00112 return testStep; 00113 }