fontservices/fontstore/tfs/TFntStoreServer.cpp
changeset 0 1fb32624e06b
child 1 e96e8a131979
equal deleted inserted replaced
-1:000000000000 0:1fb32624e06b
       
     1 /*
       
     2 * Copyright (c) 2006-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 
       
    19 /**
       
    20  @file
       
    21  @test
       
    22  @internalComponent Internal Symbian test code
       
    23 */
       
    24 
       
    25 #include "TFntStoreServer.h"
       
    26 #include "T_FNTMEM.H"
       
    27 #include "T_FSOPEN.H"
       
    28 #include "T_FontBitmap.H"
       
    29 #include "T_MatchFonts.h"
       
    30 #include "T_GlyphTreeDel.h"
       
    31 #include "T_OpenFontTypes.h"
       
    32 #include "T_FontMetrics.h"
       
    33 #include "T_GetNearestFont.h"
       
    34 #include "T_GetNearestFontCapability.h"
       
    35 #include "T_SetDefaultTypefaceName.h"
       
    36 #include "t_corruptfonts.h"
       
    37 #include "T_FNT.H" 
       
    38 #include "T_SHAPERCACHE.H"
       
    39 #include "T_LinkedFonts.h"
       
    40 #include "t_cachedeletion.h"
       
    41 #include "T_LinkedFonts2.h"
       
    42 #include "t_linkedfontsmemory.h"
       
    43 #include "t_linkedfontscomparison.h"
       
    44 #include "t_linkedfontscapability.h"
       
    45 #include "T_LinkedFontUpdateTests.h"
       
    46 #include "T_CACHE.H" 
       
    47 
       
    48 CTFntStoreServer* CTFntStoreServer::NewL()
       
    49 /**
       
    50    @return - Instance of the test server
       
    51    Same code for Secure and non-secure variants
       
    52    Called inside the MainL() function to create and start the
       
    53    CTestServer derived server.
       
    54  */
       
    55 	{
       
    56 	CTFntStoreServer * server = new (ELeave) CTFntStoreServer();
       
    57 	CleanupStack::PushL(server);
       
    58 	
       
    59 	// Get server name from process so we can use SetCap to change the capabilites and use this server with a different filename
       
    60 	RProcess handle = RProcess();
       
    61 	TParsePtrC serverName(handle.FileName());
       
    62 	
       
    63 	// CServer base class call
       
    64 	server->StartL(serverName.Name());
       
    65 		
       
    66 	CleanupStack::Pop(server);
       
    67 	return server;
       
    68 	}
       
    69 
       
    70 
       
    71 LOCAL_C void MainL()
       
    72 //
       
    73 // Secure variant
       
    74 // Much simpler, uses the new Rendezvous() call to sync with the client
       
    75 //
       
    76 	{
       
    77  	RProcess().DataCaging(RProcess::EDataCagingOn);
       
    78 	RProcess().SecureApi(RProcess::ESecureApiOn);
       
    79 	CActiveScheduler* sched=NULL;
       
    80 	sched=new(ELeave) CActiveScheduler;
       
    81 	CActiveScheduler::Install(sched);
       
    82 	CTFntStoreServer* server = NULL;
       
    83 	// Create the CTestServer derived server
       
    84 	TRAPD(err,server = CTFntStoreServer::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 /** @return - Standard Epoc error code on process exit
       
    96     Secure variant only
       
    97     Process entry point. Called by client using RProcess API
       
    98 */
       
    99 GLDEF_C TInt E32Main()
       
   100 	{
       
   101 	__UHEAP_MARK;
       
   102 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
   103 	if(cleanup == NULL)
       
   104 		{
       
   105 		return KErrNoMemory;
       
   106 		}
       
   107 	TRAPD(err,MainL());
       
   108 	if (err)
       
   109 	    {
       
   110 		RDebug::Print(_L("CTFntStoreServer::MainL - Error: %d"), err);
       
   111 	   	User::Panic(_L("CTFntStoreServer"),err);
       
   112 	    }
       
   113 	delete cleanup;
       
   114 	__UHEAP_MARKEND;
       
   115 	return KErrNone;
       
   116     }
       
   117 
       
   118 CTestStep* CTFntStoreServer::CreateTestStep(const TDesC& aStepName)
       
   119 /**
       
   120    @return - A CTestStep derived instance
       
   121    Secure and non-secure variants
       
   122    Implementation of CTestServer pure virtual
       
   123  */
       
   124 	{
       
   125 	if(aStepName == KTFntStep)
       
   126 		{
       
   127 		return new CTFntStep();
       
   128 		}
       
   129 	else if(aStepName == KTCacheStep)
       
   130 	    	{
       
   131 	    	return new CTCacheStep();
       
   132 	    	}
       
   133 	else if(aStepName == KTFntMemStep)
       
   134 		{
       
   135 		return new CTFntMemStep();
       
   136 		}
       
   137 	else if(aStepName == KTFsOpenStep)
       
   138 		{
       
   139 		return new CTFsOpenStep();
       
   140 		}
       
   141 	else if(aStepName == KTFontBitmapStep)
       
   142 		{
       
   143 		return new CTFontBitmapStep();
       
   144 		}
       
   145 	else if(aStepName == KTMatchFontsStep)
       
   146 		{
       
   147 		return new CTMatchFontsStep();
       
   148 		}
       
   149 	else if(aStepName == KTGlyphTreeDelStep)
       
   150 		{
       
   151 		return new CTGlyphTreeDelStep();
       
   152 		}
       
   153 	else if(aStepName == KTOpenFontTypesStep)
       
   154 		{
       
   155 		return new CTOpenFontTypesStep();
       
   156 		}
       
   157 	else if(aStepName == KTFontMetricsStep)
       
   158 		{
       
   159 		return new CTFontMetricsStep();
       
   160 		}
       
   161 	else if(aStepName == KTGetNearestFontStep)
       
   162 		{
       
   163 		return new CTGetNearestFontStep();
       
   164 		}
       
   165 	else if(aStepName == KTGetNearestFontCapabilityStep)	// These tests have no capabilities and are expected to cause panics i.e. they will show up pass in the log files
       
   166 		{
       
   167 		return new CTGetNearestFontCapabilityStep();
       
   168 		}
       
   169 	else if(aStepName == KTSetDefaultTypefaceNameStep)	// These tests have no capabilities and are expected to cause panics i.e. they will show up pass in the log files
       
   170 		{
       
   171 		return new CTSetDefaultTypefaceNameStep();
       
   172 		}
       
   173 	else if(aStepName == KTCorruptFontRejectionStep)
       
   174 		{
       
   175 		return new CTCorruptFontRejectionStep();
       
   176 		}
       
   177 	else if(aStepName == KTShaperCacheStep)
       
   178 		{
       
   179 		return new CTShaperCacheStep();
       
   180 		}
       
   181 	else if (aStepName == KTCacheDeletionStep)	
       
   182 		{
       
   183 		return new CTCacheDeletionStep();
       
   184 		}
       
   185 	else if (aStepName == KTLinkedFonts2Step)
       
   186 		{
       
   187 		return new CTLinkedFonts2Step();
       
   188 		}
       
   189 	else if (aStepName == KTLinkedFontsMemoryStep)
       
   190 		{
       
   191 		return new CTLinkedFontsMemoryStep();
       
   192 		}
       
   193 	else if (aStepName == KTLinkedFontsComparisonStep)
       
   194 		{
       
   195 		return new CTLinkedFontsComparisonStep();
       
   196 		}
       
   197 	else if (aStepName == KTLinkedFontsCapabilityStep)
       
   198 		{
       
   199 		return new CTLinkedFontsCapabilityStep();
       
   200 		}
       
   201 		else if (aStepName == KTLinkedFontsUpdateStage1Step)
       
   202 		{
       
   203 		return new CTLinkedFontsUpdateStage1Step();
       
   204 		}
       
   205 		else if (aStepName == KTLinkedFontsUpdateStage2Step)
       
   206 		{
       
   207 		return new CTLinkedFontsUpdateStage2Step();
       
   208 		}
       
   209 	RDebug::Printf("Test Step is either mis-spelt or doesn't exist - see CTFntStoreServer::CreateTestStep");
       
   210 	return NULL;
       
   211 	}
       
   212