datacommsserver/esockserver/test/te_mecunittest/src/mecunittestserver.cpp
changeset 0 dfb7c4ff071f
child 73 5ebd530e523b
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     1 // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 // mecunittestserver.cpp
       
    16 //
       
    17 
       
    18 
       
    19 /**
       
    20 @file 
       
    21 @internalTechnology
       
    22 
       
    23 Meta Extension Container Unit Test Server
       
    24 */
       
    25 
       
    26 #include <e32base.h>
       
    27 
       
    28 #include "mecunittestserver.h"
       
    29 
       
    30 #include "mectest001step.h"
       
    31 #include "mectest002step.h"
       
    32 #include "mectest003step.h"
       
    33 #include "mectest004step.h"
       
    34 #include "mectest005step.h"
       
    35 #include "mectest006step.h"
       
    36 #include "mectest007step.h"
       
    37 #include "mectest008step.h"
       
    38 #include "mectest009step.h"
       
    39 #include "mectest010step.h"
       
    40 #include "mectest011step.h"
       
    41 #include "mectest012step.h"
       
    42 
       
    43 #include "mectest030step.h"
       
    44 #include "mectest031step.h"
       
    45 #include "mectest032step.h"
       
    46 #include "mectest033step.h"
       
    47 
       
    48 #include "mectest050step.h"
       
    49 #include "mectest051step.h"
       
    50 #include "mectest052step.h"
       
    51 #include "mectest053step.h"
       
    52 #include "mectest054step.h"
       
    53 #include "mectest055step.h"
       
    54 
       
    55 
       
    56 //#include "mectestpanic1step.h"
       
    57 #include "mectestpanic2step.h"
       
    58 #include "mectestpanic3step.h"
       
    59 #include "mectestpanic4step.h"
       
    60 #include "mectestpanic5step.h"
       
    61 #include "mectestpanic6step.h"
       
    62 #include "mectestpanic7step.h"
       
    63 #include "mectestpanic8step.h"
       
    64 #include "mectestpanic9step.h"
       
    65 #include "mectestpanic10step.h"
       
    66 #include "mectestpanic11step.h"
       
    67 #include "mectestpanic12step.h"
       
    68 #include "mectestpanic13step.h"
       
    69 #include "mectestpanic14step.h"
       
    70 #include "mectestpanic15step.h"
       
    71 #include "mectestpanic16step.h"
       
    72 #include "mectestpanic17step.h"
       
    73 
       
    74 
       
    75 /**
       
    76 */
       
    77 LOCAL_C void MainL()
       
    78 	{
       
    79 	CActiveScheduler* sched = NULL;
       
    80 	sched = new(ELeave)CActiveScheduler();
       
    81 	CActiveScheduler::Install(sched);
       
    82 	
       
    83 	CMecUnitTestServer* server = NULL;
       
    84 	// Create the CTestServer derived server
       
    85 	TRAPD(err, server = CMecUnitTestServer::NewL());
       
    86 	if (!err)
       
    87 		{
       
    88 		// Sync with the client and enter the active scheduler
       
    89 		RProcess::Rendezvous(KErrNone);
       
    90 		sched->Start();
       
    91 		}
       
    92 	delete server;
       
    93 	delete sched;
       
    94 	}
       
    95 
       
    96 
       
    97 /**
       
    98 Process entry point. Called by client using RProcess API
       
    99 @return - Standard Epoc error code on process exit
       
   100 */
       
   101 GLDEF_C TInt E32Main()
       
   102 	{
       
   103 	__UHEAP_MARK;
       
   104 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
   105 	if(cleanup == NULL)
       
   106 		{
       
   107 		return KErrNoMemory;
       
   108 		}
       
   109 	TRAPD(err,MainL());
       
   110 	delete cleanup;
       
   111 	__UHEAP_MARKEND;
       
   112 	return err;
       
   113     }
       
   114 
       
   115 
       
   116 
       
   117 // ------------------------
       
   118 // CMecUnitTestServer
       
   119 // ------------------------
       
   120 CMecUnitTestServer* CMecUnitTestServer::NewL()
       
   121 	{
       
   122 	CMecUnitTestServer* self = new(ELeave)CMecUnitTestServer();
       
   123 	CleanupStack::PushL(self);
       
   124 	self->StartL(self->ServerName());
       
   125 	CleanupStack::Pop(self);
       
   126 	return self;
       
   127 	}
       
   128 
       
   129 
       
   130 CMecUnitTestServer::CMecUnitTestServer()
       
   131 	: CTestServer()
       
   132 	{
       
   133 	}
       
   134 
       
   135 
       
   136 CMecUnitTestServer::~CMecUnitTestServer()
       
   137 	{
       
   138 	}
       
   139 
       
   140 
       
   141 
       
   142 #define BEGIN_TEST_STEP_LIST()  \
       
   143 	CTestStep* testStep = NULL; \
       
   144 	if (EFalse) { }
       
   145 
       
   146 #define TEST_STEP(testStepTag)  \
       
   147     else if (aStepName.CompareF(K##testStepTag##Step) == 0) \
       
   148         { testStep = new C##testStepTag##Step(); }
       
   149 
       
   150 #define END_TEST_STEP_LIST()    \
       
   151     return testStep;
       
   152     
       
   153 
       
   154 /**
       
   155 Implementation of CTestServer pure virtual
       
   156 @return     A CTestStep derived instance
       
   157 */
       
   158 CTestStep* CMecUnitTestServer::CreateTestStep(const TDesC& aStepName)
       
   159 	{
       
   160     BEGIN_TEST_STEP_LIST()
       
   161         TEST_STEP(MecTest001)
       
   162         TEST_STEP(MecTest002)        
       
   163         TEST_STEP(MecTest003)        
       
   164         TEST_STEP(MecTest004)        
       
   165         TEST_STEP(MecTest005)
       
   166         TEST_STEP(MecTest006)
       
   167 		TEST_STEP(MecTest007)
       
   168 		TEST_STEP(MecTest008)        
       
   169         TEST_STEP(MecTest009)
       
   170         TEST_STEP(MecTest010)
       
   171 		TEST_STEP(MecTest011)
       
   172 		TEST_STEP(MecTest012)
       
   173         
       
   174 		TEST_STEP(MecTest030)
       
   175 		TEST_STEP(MecTest031)
       
   176 		TEST_STEP(MecTest032)
       
   177 		TEST_STEP(MecTest033)
       
   178 
       
   179 		TEST_STEP(MecTest050)
       
   180 		TEST_STEP(MecTest051)
       
   181 		TEST_STEP(MecTest052)
       
   182 		TEST_STEP(MecTest053)
       
   183 		TEST_STEP(MecTest054)
       
   184 		TEST_STEP(MecTest055)
       
   185 
       
   186 //		TEST_STEP(MecTestPanic1) 
       
   187         TEST_STEP(MecTestPanic2) 
       
   188         TEST_STEP(MecTestPanic3) 
       
   189         TEST_STEP(MecTestPanic4) 
       
   190         TEST_STEP(MecTestPanic5)
       
   191         TEST_STEP(MecTestPanic6) 
       
   192 		TEST_STEP(MecTestPanic7) 
       
   193 		TEST_STEP(MecTestPanic8) 
       
   194 		TEST_STEP(MecTestPanic9) 
       
   195 		TEST_STEP(MecTestPanic10) 
       
   196 		TEST_STEP(MecTestPanic11)
       
   197 		TEST_STEP(MecTestPanic12) 
       
   198 		TEST_STEP(MecTestPanic13) 
       
   199 		TEST_STEP(MecTestPanic14) 
       
   200 		TEST_STEP(MecTestPanic15)
       
   201 		TEST_STEP(MecTestPanic16)
       
   202 		TEST_STEP(MecTestPanic17) 
       
   203 
       
   204 	END_TEST_STEP_LIST()
       
   205 	}
       
   206 
       
   207 
       
   208 
       
   209 const TPtrC CMecUnitTestServer::ServerName() const
       
   210 	{
       
   211 
       
   212 	// On EKA2, test server runs in its own process.
       
   213 	// So we arrive at the server name using the exe from which it is loaded.
       
   214 	TParsePtrC serverName(RProcess().FileName());
       
   215 	return serverName.Name();
       
   216 	}
       
   217