datacommsserver/esockserver/test/TE_Protocol/src/TestSuiteProtocol.cpp
changeset 0 dfb7c4ff071f
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     1 // Copyright (c) 2004-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 // Test cases for the socket class
       
    15 // for (WINS && !EKA2) versions will be xxxServer.Dll and require a thread to be started
       
    16 // in the process of the client. The client initialises the server by calling the
       
    17 // one and only ordinal.
       
    18 // 
       
    19 //
       
    20 
       
    21 /**
       
    22  @file 	@file TestSuiteProtocol.cpp
       
    23 */
       
    24 
       
    25 #include "TestSuiteProtocol.h"
       
    26 #include "ProtocolTestSection.h"
       
    27 
       
    28 _LIT(KServerName,"TE_Protocol");
       
    29 
       
    30 CTestServerProtocol* CTestServerProtocol::NewL()
       
    31 /**
       
    32 @return - Instance of the test server
       
    33 Called inside the MainL() function to create and start the
       
    34 CTestServer derived server.
       
    35 */
       
    36 	{
       
    37 	CTestServerProtocol * server = new (ELeave) CTestServerProtocol();
       
    38 	CleanupStack::PushL(server);
       
    39 	
       
    40 	// Either use a StartL or ConstructL, the latter will permit
       
    41 	// Server Logging.
       
    42 	
       
    43 	//server->StartL(KServerName); 
       
    44 	server-> ConstructL(KServerName);
       
    45 	CleanupStack::Pop(server);
       
    46 	return server;
       
    47 	}
       
    48 
       
    49 
       
    50 // EKA2 much simpler
       
    51 // Just an E32Main and a MainL()
       
    52 LOCAL_C void MainL()
       
    53 /**
       
    54 Much simpler, uses the new Rendezvous() call to sync with the client
       
    55 */
       
    56 	{
       
    57 	// Leave the hooks in for platform security
       
    58 
       
    59 	RProcess().DataCaging(RProcess::EDataCagingOn);
       
    60 	RProcess().SecureApi(RProcess::ESecureApiOn);
       
    61 
       
    62 	CActiveScheduler* sched=NULL;
       
    63 	sched=new(ELeave) CActiveScheduler;
       
    64 	CActiveScheduler::Install(sched);
       
    65 	
       
    66 	CTestServerProtocol* server = NULL;
       
    67 	// Create the CTestServer derived server
       
    68 	
       
    69 	TRAPD(err,server = CTestServerProtocol::NewL());
       
    70 	if(!err)
       
    71 		{
       
    72 		// Sync with the client and enter the active scheduler
       
    73 		RProcess::Rendezvous(KErrNone);
       
    74 		sched->Start();
       
    75 		}
       
    76 	delete server;
       
    77 	delete sched;
       
    78 	}
       
    79 
       
    80 GLDEF_C TInt E32Main()
       
    81 /**
       
    82 @return - Standard Epoc error code on exit
       
    83 */
       
    84 	{
       
    85 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
    86 	if(cleanup == NULL)
       
    87 		{
       
    88 		return KErrNoMemory;
       
    89 		}
       
    90 	TRAP_IGNORE(MainL());
       
    91 	delete cleanup;
       
    92 	return KErrNone;
       
    93     }
       
    94 
       
    95 CTestServerProtocol::CTestServerProtocol()
       
    96 	{
       
    97 	}
       
    98 
       
    99 CTestServerProtocol::~CTestServerProtocol()
       
   100 	{
       
   101 	}
       
   102 
       
   103 
       
   104 CTestStep* CTestServerProtocol::CreateTestStep(const TDesC& aStepName)
       
   105 /**
       
   106 @return - A CTestStep derived instance
       
   107 Implementation of CTestServer pure virtual
       
   108 */
       
   109 	{
       
   110 	START_TEST_STEP_LIST
       
   111 		ADD_TEST_STEP(CProtocolTest1)
       
   112 		ADD_TEST_STEP(CProtocolTest2)
       
   113 		ADD_TEST_STEP(CProtocolTest3)
       
   114 		ADD_TEST_STEP(CProtocolTest4)
       
   115 		ADD_TEST_STEP(CProtocolTest5)
       
   116 		ADD_TEST_STEP(CProtocolTest6)
       
   117 		ADD_TEST_STEP(CProtocolTest7)
       
   118 		ADD_TEST_STEP(CProtocolTest8)
       
   119 		ADD_TEST_STEP(CProtocolTest9)
       
   120 		ADD_TEST_STEP(CProtocolTest10)
       
   121 		ADD_TEST_STEP(CProtocolTest11)
       
   122 		ADD_TEST_STEP(CProtocolTest12)
       
   123 		ADD_TEST_STEP(CProtocolTest13)	
       
   124 	END_TEST_STEP_LIST
       
   125 	}
       
   126 
       
   127 
       
   128