1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/textandloc/fontservices/fontstore/tfs/TFntStoreServer.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,217 @@
1.4 +/*
1.5 +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +*
1.19 +*/
1.20 +
1.21 +
1.22 +/**
1.23 + @file
1.24 + @test
1.25 + @internalComponent Internal Symbian test code
1.26 +*/
1.27 +
1.28 +#include "TFntStoreServer.h"
1.29 +#include "T_FNTMEM.H"
1.30 +#include "T_FSOPEN.H"
1.31 +#include "T_FontBitmap.H"
1.32 +#include "T_MatchFonts.h"
1.33 +#include "T_GlyphTreeDel.h"
1.34 +#include "T_OpenFontTypes.h"
1.35 +#include "T_FontMetrics.h"
1.36 +#include "T_GetNearestFont.h"
1.37 +#include "T_GetNearestFontCapability.h"
1.38 +#include "T_SetDefaultTypefaceName.h"
1.39 +#include "t_corruptfonts.h"
1.40 +#include "T_FNT.H"
1.41 +#include "T_SHAPERCACHE.H"
1.42 +#include "T_LinkedFonts.h"
1.43 +#include "t_cachedeletion.h"
1.44 +#include "T_LinkedFonts2.h"
1.45 +#include "t_linkedfontsmemory.h"
1.46 +#include "t_linkedfontscomparison.h"
1.47 +#include "t_linkedfontscapability.h"
1.48 +#include "T_LinkedFontUpdateTests.h"
1.49 +#include "T_CACHE.H"
1.50 +#include "T_FontSessionCache.h"
1.51 +
1.52 +CTFntStoreServer* CTFntStoreServer::NewL()
1.53 +/**
1.54 + @return - Instance of the test server
1.55 + Same code for Secure and non-secure variants
1.56 + Called inside the MainL() function to create and start the
1.57 + CTestServer derived server.
1.58 + */
1.59 + {
1.60 + CTFntStoreServer * server = new (ELeave) CTFntStoreServer();
1.61 + CleanupStack::PushL(server);
1.62 +
1.63 + // Get server name from process so we can use SetCap to change the capabilites and use this server with a different filename
1.64 + RProcess handle = RProcess();
1.65 + TParsePtrC serverName(handle.FileName());
1.66 +
1.67 + // CServer base class call
1.68 + server->StartL(serverName.Name());
1.69 +
1.70 + CleanupStack::Pop(server);
1.71 + return server;
1.72 + }
1.73 +
1.74 +
1.75 +LOCAL_C void MainL()
1.76 +//
1.77 +// Secure variant
1.78 +// Much simpler, uses the new Rendezvous() call to sync with the client
1.79 +//
1.80 + {
1.81 + RProcess().DataCaging(RProcess::EDataCagingOn);
1.82 + RProcess().SecureApi(RProcess::ESecureApiOn);
1.83 + CActiveScheduler* sched=NULL;
1.84 + sched=new(ELeave) CActiveScheduler;
1.85 + CActiveScheduler::Install(sched);
1.86 + CTFntStoreServer* server = NULL;
1.87 + // Create the CTestServer derived server
1.88 + TRAPD(err,server = CTFntStoreServer::NewL());
1.89 + if(!err)
1.90 + {
1.91 + // Sync with the client and enter the active scheduler
1.92 + RProcess::Rendezvous(KErrNone);
1.93 + sched->Start();
1.94 + }
1.95 + delete server;
1.96 + delete sched;
1.97 + }
1.98 +
1.99 +/** @return - Standard Epoc error code on process exit
1.100 + Secure variant only
1.101 + Process entry point. Called by client using RProcess API
1.102 +*/
1.103 +GLDEF_C TInt E32Main()
1.104 + {
1.105 + __UHEAP_MARK;
1.106 + CTrapCleanup* cleanup = CTrapCleanup::New();
1.107 + if(cleanup == NULL)
1.108 + {
1.109 + return KErrNoMemory;
1.110 + }
1.111 + TRAPD(err,MainL());
1.112 + if (err)
1.113 + {
1.114 + RDebug::Print(_L("CTFntStoreServer::MainL - Error: %d"), err);
1.115 + User::Panic(_L("CTFntStoreServer"),err);
1.116 + }
1.117 + delete cleanup;
1.118 + __UHEAP_MARKEND;
1.119 + return KErrNone;
1.120 + }
1.121 +
1.122 +CTestStep* CTFntStoreServer::CreateTestStep(const TDesC& aStepName)
1.123 +/**
1.124 + @return - A CTestStep derived instance
1.125 + Secure and non-secure variants
1.126 + Implementation of CTestServer pure virtual
1.127 + */
1.128 + {
1.129 + if (aStepName == KTFntStep)
1.130 + {
1.131 + return new CTFntStep();
1.132 + }
1.133 + else if(aStepName == KTFntMemStep)
1.134 + {
1.135 + return new CTFntMemStep();
1.136 + }
1.137 + else if(aStepName == KTFsOpenStep)
1.138 + {
1.139 + return new CTFsOpenStep();
1.140 + }
1.141 + else if(aStepName == KTFontBitmapStep)
1.142 + {
1.143 + return new CTFontBitmapStep();
1.144 + }
1.145 + else if(aStepName == KTMatchFontsStep)
1.146 + {
1.147 + return new CTMatchFontsStep();
1.148 + }
1.149 + else if(aStepName == KTGlyphTreeDelStep)
1.150 + {
1.151 + return new CTGlyphTreeDelStep();
1.152 + }
1.153 + else if(aStepName == KTOpenFontTypesStep)
1.154 + {
1.155 + return new CTOpenFontTypesStep();
1.156 + }
1.157 + else if(aStepName == KTFontMetricsStep)
1.158 + {
1.159 + return new CTFontMetricsStep();
1.160 + }
1.161 + else if(aStepName == KTGetNearestFontStep)
1.162 + {
1.163 + return new CTGetNearestFontStep();
1.164 + }
1.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
1.166 + {
1.167 + return new CTGetNearestFontCapabilityStep();
1.168 + }
1.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
1.170 + {
1.171 + return new CTSetDefaultTypefaceNameStep();
1.172 + }
1.173 + else if(aStepName == KTCorruptFontRejectionStep)
1.174 + {
1.175 + return new CTCorruptFontRejectionStep();
1.176 + }
1.177 + else if(aStepName == KTShaperCacheStep)
1.178 + {
1.179 + return new CTShaperCacheStep();
1.180 + }
1.181 + else if (aStepName == KTCacheDeletionStep)
1.182 + {
1.183 + return new CTCacheDeletionStep();
1.184 + }
1.185 + else if (aStepName == KTLinkedFonts2Step)
1.186 + {
1.187 + return new CTLinkedFonts2Step();
1.188 + }
1.189 + else if (aStepName == KTLinkedFontsMemoryStep)
1.190 + {
1.191 + return new CTLinkedFontsMemoryStep();
1.192 + }
1.193 + else if (aStepName == KTLinkedFontsComparisonStep)
1.194 + {
1.195 + return new CTLinkedFontsComparisonStep();
1.196 + }
1.197 + else if (aStepName == KTLinkedFontsCapabilityStep)
1.198 + {
1.199 + return new CTLinkedFontsCapabilityStep();
1.200 + }
1.201 + else if (aStepName == KTLinkedFontsUpdateStage1Step)
1.202 + {
1.203 + return new CTLinkedFontsUpdateStage1Step();
1.204 + }
1.205 + else if (aStepName == KTLinkedFontsUpdateStage2Step)
1.206 + {
1.207 + return new CTLinkedFontsUpdateStage2Step();
1.208 + }
1.209 + else if (aStepName == KTCacheStep)
1.210 + {
1.211 + return new CTCacheStep();
1.212 + }
1.213 + else if (aStepName == KTFontSessionCacheStep)
1.214 + {
1.215 + return new CTFontSessionCacheStep();
1.216 + }
1.217 + RDebug::Printf("Test Step is either mis-spelt or doesn't exist - see CTFntStoreServer::CreateTestStep");
1.218 + return NULL;
1.219 + }
1.220 +