sl@0: /* sl@0: * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * sl@0: */ sl@0: sl@0: sl@0: /** sl@0: @file sl@0: @test sl@0: @internalComponent Internal Symbian test code sl@0: */ sl@0: sl@0: #include "TFntStoreServer.h" sl@0: #include "T_FNTMEM.H" sl@0: #include "T_FSOPEN.H" sl@0: #include "T_FontBitmap.H" sl@0: #include "T_MatchFonts.h" sl@0: #include "T_GlyphTreeDel.h" sl@0: #include "T_OpenFontTypes.h" sl@0: #include "T_FontMetrics.h" sl@0: #include "T_GetNearestFont.h" sl@0: #include "T_GetNearestFontCapability.h" sl@0: #include "T_SetDefaultTypefaceName.h" sl@0: #include "t_corruptfonts.h" sl@0: #include "T_FNT.H" sl@0: #include "T_SHAPERCACHE.H" sl@0: #include "T_LinkedFonts.h" sl@0: #include "t_cachedeletion.h" sl@0: #include "T_LinkedFonts2.h" sl@0: #include "t_linkedfontsmemory.h" sl@0: #include "t_linkedfontscomparison.h" sl@0: #include "t_linkedfontscapability.h" sl@0: #include "T_LinkedFontUpdateTests.h" sl@0: #include "T_CACHE.H" sl@0: #include "T_FontSessionCache.h" sl@0: sl@0: CTFntStoreServer* CTFntStoreServer::NewL() sl@0: /** sl@0: @return - Instance of the test server sl@0: Same code for Secure and non-secure variants sl@0: Called inside the MainL() function to create and start the sl@0: CTestServer derived server. sl@0: */ sl@0: { sl@0: CTFntStoreServer * server = new (ELeave) CTFntStoreServer(); sl@0: CleanupStack::PushL(server); sl@0: sl@0: // Get server name from process so we can use SetCap to change the capabilites and use this server with a different filename sl@0: RProcess handle = RProcess(); sl@0: TParsePtrC serverName(handle.FileName()); sl@0: sl@0: // CServer base class call sl@0: server->StartL(serverName.Name()); sl@0: sl@0: CleanupStack::Pop(server); sl@0: return server; sl@0: } sl@0: sl@0: sl@0: LOCAL_C void MainL() sl@0: // sl@0: // Secure variant sl@0: // Much simpler, uses the new Rendezvous() call to sync with the client sl@0: // sl@0: { sl@0: RProcess().DataCaging(RProcess::EDataCagingOn); sl@0: RProcess().SecureApi(RProcess::ESecureApiOn); sl@0: CActiveScheduler* sched=NULL; sl@0: sched=new(ELeave) CActiveScheduler; sl@0: CActiveScheduler::Install(sched); sl@0: CTFntStoreServer* server = NULL; sl@0: // Create the CTestServer derived server sl@0: TRAPD(err,server = CTFntStoreServer::NewL()); sl@0: if(!err) sl@0: { sl@0: // Sync with the client and enter the active scheduler sl@0: RProcess::Rendezvous(KErrNone); sl@0: sched->Start(); sl@0: } sl@0: delete server; sl@0: delete sched; sl@0: } sl@0: sl@0: /** @return - Standard Epoc error code on process exit sl@0: Secure variant only sl@0: Process entry point. Called by client using RProcess API sl@0: */ sl@0: GLDEF_C TInt E32Main() sl@0: { sl@0: __UHEAP_MARK; sl@0: CTrapCleanup* cleanup = CTrapCleanup::New(); sl@0: if(cleanup == NULL) sl@0: { sl@0: return KErrNoMemory; sl@0: } sl@0: TRAPD(err,MainL()); sl@0: if (err) sl@0: { sl@0: RDebug::Print(_L("CTFntStoreServer::MainL - Error: %d"), err); sl@0: User::Panic(_L("CTFntStoreServer"),err); sl@0: } sl@0: delete cleanup; sl@0: __UHEAP_MARKEND; sl@0: return KErrNone; sl@0: } sl@0: sl@0: CTestStep* CTFntStoreServer::CreateTestStep(const TDesC& aStepName) sl@0: /** sl@0: @return - A CTestStep derived instance sl@0: Secure and non-secure variants sl@0: Implementation of CTestServer pure virtual sl@0: */ sl@0: { sl@0: if (aStepName == KTFntStep) sl@0: { sl@0: return new CTFntStep(); sl@0: } sl@0: else if(aStepName == KTFntMemStep) sl@0: { sl@0: return new CTFntMemStep(); sl@0: } sl@0: else if(aStepName == KTFsOpenStep) sl@0: { sl@0: return new CTFsOpenStep(); sl@0: } sl@0: else if(aStepName == KTFontBitmapStep) sl@0: { sl@0: return new CTFontBitmapStep(); sl@0: } sl@0: else if(aStepName == KTMatchFontsStep) sl@0: { sl@0: return new CTMatchFontsStep(); sl@0: } sl@0: else if(aStepName == KTGlyphTreeDelStep) sl@0: { sl@0: return new CTGlyphTreeDelStep(); sl@0: } sl@0: else if(aStepName == KTOpenFontTypesStep) sl@0: { sl@0: return new CTOpenFontTypesStep(); sl@0: } sl@0: else if(aStepName == KTFontMetricsStep) sl@0: { sl@0: return new CTFontMetricsStep(); sl@0: } sl@0: else if(aStepName == KTGetNearestFontStep) sl@0: { sl@0: return new CTGetNearestFontStep(); sl@0: } sl@0: 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 sl@0: { sl@0: return new CTGetNearestFontCapabilityStep(); sl@0: } sl@0: 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 sl@0: { sl@0: return new CTSetDefaultTypefaceNameStep(); sl@0: } sl@0: else if(aStepName == KTCorruptFontRejectionStep) sl@0: { sl@0: return new CTCorruptFontRejectionStep(); sl@0: } sl@0: else if(aStepName == KTShaperCacheStep) sl@0: { sl@0: return new CTShaperCacheStep(); sl@0: } sl@0: else if (aStepName == KTCacheDeletionStep) sl@0: { sl@0: return new CTCacheDeletionStep(); sl@0: } sl@0: else if (aStepName == KTLinkedFonts2Step) sl@0: { sl@0: return new CTLinkedFonts2Step(); sl@0: } sl@0: else if (aStepName == KTLinkedFontsMemoryStep) sl@0: { sl@0: return new CTLinkedFontsMemoryStep(); sl@0: } sl@0: else if (aStepName == KTLinkedFontsComparisonStep) sl@0: { sl@0: return new CTLinkedFontsComparisonStep(); sl@0: } sl@0: else if (aStepName == KTLinkedFontsCapabilityStep) sl@0: { sl@0: return new CTLinkedFontsCapabilityStep(); sl@0: } sl@0: else if (aStepName == KTLinkedFontsUpdateStage1Step) sl@0: { sl@0: return new CTLinkedFontsUpdateStage1Step(); sl@0: } sl@0: else if (aStepName == KTLinkedFontsUpdateStage2Step) sl@0: { sl@0: return new CTLinkedFontsUpdateStage2Step(); sl@0: } sl@0: else if (aStepName == KTCacheStep) sl@0: { sl@0: return new CTCacheStep(); sl@0: } sl@0: else if (aStepName == KTFontSessionCacheStep) sl@0: { sl@0: return new CTFontSessionCacheStep(); sl@0: } sl@0: RDebug::Printf("Test Step is either mis-spelt or doesn't exist - see CTFntStoreServer::CreateTestStep"); sl@0: return NULL; sl@0: } sl@0: