commsconfig/commsdatabaseshim/TE_commdb/te_connpref/src/TE_ConnPrefServer.cpp
changeset 72 ae47d0499bee
equal deleted inserted replaced
68:5da8188e392b 72:ae47d0499bee
       
     1 //
       
     2 // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 // All rights reserved.
       
     4 // This component and the accompanying materials are made available
       
     5 // under the terms of "Eclipse Public License v1.0"
       
     6 // which accompanies this distribution, and is available
       
     7 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 //
       
     9 // Initial Contributors:
       
    10 // Nokia Corporation - initial contribution.
       
    11 //
       
    12 // Contributors:
       
    13 //
       
    14 // Description:
       
    15 //
       
    16 //
       
    17 
       
    18 // TE_ConnPrefServer.cpp
       
    19 //
       
    20 //
       
    21 // This main DLL entry point for the TE_ConServer.dll
       
    22 
       
    23 
       
    24 #include "TE_ConnPrefStep.h"
       
    25 #include "TE_ConnPrefHelperSteps.h"
       
    26 #include "TE_ConnPrefSteps.h"
       
    27 
       
    28 
       
    29 EXPORT_C CTE_ConnPrefServer* NewConnPrefServer( void ) 
       
    30 //
       
    31 // NewTestSuiteConnPrefL is exported at ordinal 1
       
    32 // this provides the interface to allow schedule test
       
    33 // to create instances of this test suite
       
    34 //
       
    35 	{
       
    36 
       
    37 	return new(ELeave) CTE_ConnPrefServer();
       
    38     }
       
    39 
       
    40 	
       
    41 	
       
    42 // __EDIT_ME__ - Substitute the name of your test server 
       
    43 _LIT(KServerName,"te_connpref");
       
    44 // __EDIT_ME__ - Use your own server class name
       
    45 CTE_ConnPrefServer* CTE_ConnPrefServer::NewL()
       
    46 /**
       
    47  * @return - Instance of the test server
       
    48  * Called inside the MainL() function to create and start the
       
    49  * CTestServer derived server.
       
    50  */
       
    51 	{
       
    52 	// __EDIT_ME__ new your server class here
       
    53 	CTE_ConnPrefServer * server = new (ELeave) CTE_ConnPrefServer();
       
    54 	CleanupStack::PushL(server);
       
    55 	
       
    56 	// Either use a StartL or ConstructL, the latter will permit
       
    57 	// Server Logging.
       
    58 
       
    59 	//server->StartL(KServerName); 
       
    60 	server-> ConstructL(KServerName);
       
    61 	CleanupStack::Pop(server);
       
    62 	return server;
       
    63 	}
       
    64 
       
    65 // EKA2 much simpler
       
    66 // Just an E32Main and a MainL()
       
    67 LOCAL_C void MainL()
       
    68 /**
       
    69  * Much simpler, uses the new Rendezvous() call to sync with the client
       
    70  */
       
    71 	{
       
    72 	// Leave the hooks in for platform security
       
    73 #if (defined __DATA_CAGING__)
       
    74 	RProcess().DataCaging(RProcess::EDataCagingOn);
       
    75 	RProcess().SecureApi(RProcess::ESecureApiOn);
       
    76 #endif
       
    77 	CActiveScheduler* sched=NULL;
       
    78 	sched=new(ELeave) CActiveScheduler;
       
    79 	CActiveScheduler::Install(sched);
       
    80 	// __EDIT_ME__ Your server name
       
    81 	CTE_ConnPrefServer* server = NULL;
       
    82 	// Create the CTestServer derived server
       
    83 	// __EDIT_ME__ Your server name
       
    84 	TRAPD(err,server = CTE_ConnPrefServer::NewL());
       
    85 	if(!err)
       
    86 		{
       
    87 		// Sync with the client and enter the active scheduler
       
    88 		RProcess::Rendezvous(KErrNone);
       
    89 		sched->Start();
       
    90 		}
       
    91 	delete server;
       
    92 	delete sched;
       
    93 	}
       
    94 
       
    95 // Only a DLL on emulator for typhoon and earlier
       
    96 
       
    97 GLDEF_C TInt E32Main()
       
    98 /**
       
    99  * @return - Standard Epoc error code on exit
       
   100  */
       
   101 	{
       
   102 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
   103 	if(cleanup == NULL)
       
   104 		{
       
   105 		return KErrNoMemory;
       
   106 		}
       
   107 	TRAP_IGNORE(MainL());
       
   108 	delete cleanup;
       
   109 	return KErrNone;
       
   110     }
       
   111 
       
   112 // Create a thread in the calling process
       
   113 // Emulator typhoon and earlier
       
   114 
       
   115 // __EDIT_ME__ - Use your own server class name
       
   116 CTestStep* CTE_ConnPrefServer::CreateTestStep(const TDesC& aStepName)
       
   117 /**
       
   118  * @return - A CTestStep derived instance
       
   119  * Implementation of CTestServer pure virtual
       
   120  */
       
   121 	{
       
   122 	
       
   123 	CTestStep* testStep = NULL;
       
   124 	// __EDIT_ME__ - Create your own test steps here
       
   125 	// This server creates just one step but create as many as you want
       
   126 	// They are created "just in time" when the worker thread is created
       
   127 	
       
   128 	
       
   129 	if(aStepName.Compare(_L("ForceCCoverWrite")) == 0 )
       
   130 		testStep = new(ELeave) CTE_ConnPrefForceCCoverWrite(_L("ForceCCoverWrite"));
       
   131 	else if(aStepName.Compare(_L("ConstructAndVersion")) == 0 )
       
   132 		testStep = new(ELeave) CTE_ConstructAndVersion();
       
   133 	else if(aStepName.Compare(_L("SetAndGetConnPrefs")) == 0 )
       
   134 		testStep = new(ELeave) CTE_SetAndGetConnPrefs();
       
   135 	else if(aStepName.Compare(_L("AssignAndCopyConstruct")) == 0 )
       
   136 		testStep = new(ELeave) CTE_AssignAndCopyConstruct();
       
   137 	else if(aStepName.Compare(_L("ComparePrefs")) == 0 )
       
   138 		testStep = new(ELeave) CTE_ComparePrefs();
       
   139 	else if(aStepName.Compare(_L("ExtensionIdAndCast")) == 0 )
       
   140 		testStep = new(ELeave) CTE_ExtensionIdAndCast();
       
   141 	else if(aStepName.Compare(_L("MultiConnPref")) == 0 )
       
   142 		testStep = new(ELeave) CTE_MultiConnPref();
       
   143 	else if(aStepName.Compare(_L("MultiConnPrefVersion")) == 0 )
       
   144 		testStep = new(ELeave) CTE_MultiConnPrefVersion();
       
   145 	else if(aStepName.Compare(_L("MultiConnectionAttempts")) == 0 )
       
   146 		testStep = new(ELeave) CTE_MultiConnectionAttempts();
       
   147 
       
   148 	
       
   149 	return testStep;
       
   150 	}
       
   151 
       
   152 
       
   153 
       
   154 // make a version string available for test system 
       
   155 TPtrC CTE_ConnPrefServer::GetVersion( void )
       
   156 	{
       
   157 
       
   158 #ifdef _DEBUG
       
   159 _LIT(KTxtVersion,"1.0 (udeb)");
       
   160 #else
       
   161 _LIT(KTxtVersion,"1.0");
       
   162 #endif
       
   163 
       
   164 	return KTxtVersion();
       
   165 	}
       
   166 
       
   167