applayerprotocols/httptransportfw/Test/TestScriptTest/TestScriptTestServer.cpp
changeset 0 b16258d2340f
equal deleted inserted replaced
-1:000000000000 0:b16258d2340f
       
     1 // Copyright (c) 2006-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 // System Include
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @internalTechnology 
       
    21 */
       
    22 
       
    23 // User Includes
       
    24 // Test Server
       
    25 #include "TestScriptTestServer.h"
       
    26 
       
    27 // Test steps
       
    28 #include "TestScriptTestStep.h"
       
    29 
       
    30 #if defined(HTTPIOP)
       
    31 	_LIT(KServerName, "HTTPIOPTest");
       
    32 #else	
       
    33 	_LIT(KServerName, "HTTPPipeliningTest");
       
    34 #endif
       
    35 
       
    36 /**
       
    37 Static factory constructor. Creates and returns instance of the test server
       
    38 @internalTechnology
       
    39 @test
       
    40 @return		A pointer to the newly created CTestScriptTestServer object
       
    41 */
       
    42 CTestScriptTestServer*  CTestScriptTestServer::NewL()
       
    43 	{
       
    44 	// Construct the server
       
    45 	CTestScriptTestServer* server = new(ELeave) CTestScriptTestServer();
       
    46 	CleanupStack::PushL(server);
       
    47 
       
    48 	// CServer base class call
       
    49 	// Name the server using the system-wide unique string
       
    50 	// Clients use this to create server sessions.
       
    51 	server->StartL(KServerName);
       
    52 
       
    53 	CleanupStack::Pop(server);
       
    54 	return server;
       
    55 	}
       
    56 
       
    57 /**
       
    58 Destructor. Closes the arrays.
       
    59 @internalTechnology
       
    60 @test
       
    61 */
       
    62 CTestScriptTestServer::~CTestScriptTestServer()
       
    63 	{
       
    64 	
       
    65 	}
       
    66 
       
    67 
       
    68 LOCAL_C void MainL()
       
    69 	{
       
    70 	// For platform security
       
    71 #if (defined __DATA_CAGING__)
       
    72 	RProcess().DataCaging(RProcess::EDataCagingOn);
       
    73 	RProcess().SecureApi(RProcess::ESecureApiOn);
       
    74 #endif
       
    75 	CActiveScheduler* sched = NULL;
       
    76 	sched = new(ELeave) CActiveScheduler;
       
    77 	CActiveScheduler::Install(sched);
       
    78 	CTestScriptTestServer* server = NULL;
       
    79 
       
    80 	// Create the test-server
       
    81 	TRAPD(err, server = CTestScriptTestServer::NewL());
       
    82 
       
    83 	if(!err)
       
    84 		{
       
    85 		// Sync with the client and enter the active scheduler
       
    86 		RProcess::Rendezvous(KErrNone);
       
    87 		sched->Start();
       
    88 		}
       
    89 	delete server;
       
    90 	delete sched;
       
    91 	}
       
    92 
       
    93 GLDEF_C TInt E32Main()
       
    94 	{
       
    95 	__UHEAP_MARK;
       
    96 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
    97 	if (cleanup == NULL)
       
    98 		{
       
    99 		return KErrNoMemory;
       
   100 		}
       
   101 	TInt err = KErrNone;
       
   102 	TRAP(err, MainL());
       
   103 	delete cleanup;
       
   104 	__UHEAP_MARKEND;
       
   105 	return KErrNone;
       
   106 	}
       
   107 
       
   108 CTestStep* CTestScriptTestServer::CreateTestStep(const TDesC& aStepName)
       
   109 	{
       
   110 	CTestStep* testStep = NULL;
       
   111 
       
   112 	if (aStepName == KTestScriptTestStep)
       
   113 		{
       
   114 		testStep = new CTestScriptTestStep;
       
   115 		}
       
   116 	
       
   117 	return testStep;
       
   118 	}