charconvfw/charconv_fw/test/t_charconvfwserver.cpp
changeset 64 f66674566702
equal deleted inserted replaced
59:7d891bb52a7d 64:f66674566702
       
     1 /*
       
     2 * Copyright (c) 1997-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 #include "t_charconvfwserver.h"
       
    19 #include "t_memory.h"
       
    20 #include "t_simple7.h"
       
    21 #include "t_simple8.h"
       
    22 #include "t_rfc1642.h"
       
    23 #include "t_comp7.h"
       
    24 #include "t_comp8.h"
       
    25 #include "t_realut8.h"
       
    26 #include "t_realuni.h"
       
    27 #include "t_error.h"
       
    28 #include "t_newlin7.h"
       
    29 #include "t_java.h"
       
    30 #include "t_partial.h"
       
    31 #include "t_imap.h"
       
    32 
       
    33 
       
    34 /* Path to the script
       
    35 
       
    36 c:\z:\t_TEF\t_TEF_All.script
       
    37 
       
    38 */
       
    39 
       
    40 _LIT(KServerName,"T_CharConvFWServer");
       
    41 
       
    42 CT_CharConvFwServer *CT_CharConvFwServer::NewL()
       
    43 /**
       
    44    @return - Instance of the test server
       
    45    Same code for Secure and non-secure variants
       
    46    Called inside the MainL() function to create and start the
       
    47    CTestServer derived server.
       
    48  */
       
    49     {
       
    50     CT_CharConvFwServer * server = new (ELeave) CT_CharConvFwServer();
       
    51     CleanupStack::PushL(server);
       
    52     // CServer base class call
       
    53     server->StartL(KServerName);
       
    54     CleanupStack::Pop(server);
       
    55     return server;
       
    56     }
       
    57 
       
    58 
       
    59 LOCAL_C void MainL()
       
    60 //
       
    61 // Secure variant
       
    62 // Much simpler, uses the new Rendezvous() call to sync with the client
       
    63 //
       
    64     {
       
    65 #if (defined __DATA_CAGING__)
       
    66     RProcess().DataCaging(RProcess::EDataCagingOn);
       
    67     RProcess().SecureApi(RProcess::ESecureApiOn);
       
    68 #endif
       
    69     CActiveScheduler* sched=NULL;
       
    70     sched=new(ELeave) CActiveScheduler;
       
    71     CActiveScheduler::Install(sched);
       
    72     CT_CharConvFwServer *server = NULL;
       
    73     // Create the CTestServer derived server
       
    74     TRAPD(err,server = CT_CharConvFwServer::NewL());
       
    75     if(!err)
       
    76         {
       
    77         // Sync with the client and enter the active scheduler
       
    78         RProcess::Rendezvous(KErrNone);
       
    79         sched->Start();
       
    80         }
       
    81     delete server;
       
    82     delete sched;
       
    83     }
       
    84 
       
    85 /** @return - Standard Epoc error code on process exit
       
    86     Secure variant only
       
    87     Process entry point. Called by client using RProcess API
       
    88 */
       
    89 GLDEF_C TInt E32Main()
       
    90     {
       
    91     __UHEAP_MARK;
       
    92     CTrapCleanup* cleanup = CTrapCleanup::New();
       
    93     if(cleanup == NULL)
       
    94         {
       
    95         return KErrNoMemory;
       
    96         }
       
    97     TRAPD(err,MainL());
       
    98     // This if statement is here just to shut up RVCT, which would otherwise warn
       
    99     // that err was set but never used
       
   100     if (err)
       
   101         {
       
   102         err = KErrNone;
       
   103         }
       
   104     delete cleanup;
       
   105     __UHEAP_MARKEND;
       
   106     return KErrNone;
       
   107     }
       
   108 
       
   109 CTestStep *CT_CharConvFwServer::CreateTestStep(const TDesC& aStepName)
       
   110 /**
       
   111    @return - A CTestStep derived instance
       
   112    Secure and non-secure variants
       
   113    Implementation of CTestServer pure virtual
       
   114  */
       
   115     {
       
   116     if(aStepName == KTestStep_T_MEMORY)
       
   117         {
       
   118         return new CT_MEMORY();
       
   119         }
       
   120     else if(aStepName == KTestStep_T_SIMPLE7)
       
   121         {
       
   122         return new CT_SIMPLE7();
       
   123         }
       
   124     else if(aStepName == KTestStep_T_SIMPLE8)
       
   125         {
       
   126         return new CT_SIMPLE8();
       
   127         }
       
   128     else if(aStepName == KTestStep_T_RFC1642)
       
   129         {
       
   130         return new CT_RFC1642();
       
   131         }
       
   132     else if(aStepName == KTestStep_T_COMP7)
       
   133         {
       
   134         return new CT_COMP7();
       
   135         }
       
   136     else if(aStepName == KTestStep_T_COMP8)
       
   137         {
       
   138         return new CT_COMP8();
       
   139         }
       
   140     else if(aStepName == KTestStep_T_REALUT8)
       
   141         {
       
   142         return new CT_REALUT8();
       
   143         }
       
   144     else if(aStepName == KTestStep_T_REALUNI)
       
   145         {
       
   146         return new CT_REALUNI();
       
   147         }
       
   148     else if(aStepName == KTestStep_T_ERROR)
       
   149         {
       
   150         return new CT_ERROR();
       
   151         }
       
   152     else if(aStepName == KTestStep_T_NEWLIN7)
       
   153         {
       
   154         return new CT_NEWLIN7();
       
   155         }
       
   156     else if(aStepName == KTestStep_T_JAVA)
       
   157         {
       
   158         return new CT_JAVA();
       
   159         }
       
   160     else if(aStepName == KTestStep_T_PARTIAL)
       
   161         {
       
   162         return new CT_PARTIAL();
       
   163         }
       
   164     else if(aStepName == KTestStep_T_IMAP)
       
   165         {
       
   166         return new CT_IMAP();
       
   167         }
       
   168     
       
   169     return NULL;
       
   170     }
       
   171