lafagnosticuifoundation/animation/tef/AnimationTestServer.cpp
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 /**
       
    17  @file
       
    18  @test
       
    19  @internalComponent - Internal Symbian test code 
       
    20 */
       
    21 
       
    22 
       
    23 #include "AnimationTestServer.h"
       
    24 
       
    25 #include <ecom/ecom.h>
       
    26 
       
    27 #include "e32test.h"
       
    28 #include "TFrames.h"
       
    29 #include "TBasic.h"
       
    30 #include "TSynch.h"
       
    31 #include "TOomStep.h"
       
    32 #include "TCustomStep.h"
       
    33 #include "TMng.h"
       
    34 
       
    35 _LIT(KServerName, "AnimationTestServer");
       
    36 
       
    37 class CAnimationScheduler : public CActiveScheduler
       
    38 	{
       
    39 public:
       
    40 	void Error(TInt aError) const;
       
    41 	};
       
    42 	
       
    43 void CAnimationScheduler::Error(TInt /*aError*/) const
       
    44 	{
       
    45 	};
       
    46 
       
    47 //
       
    48 // TestServer implementation:
       
    49 //
       
    50 CAnimationTestServer* CAnimationTestServer::NewL()
       
    51 	{
       
    52 	CAnimationTestServer * self = new (ELeave) CAnimationTestServer();
       
    53 	CleanupStack::PushL(self);
       
    54 	self->ConstructL();
       
    55 	CleanupStack::Pop(self);
       
    56 	return self;
       
    57 	}
       
    58 	
       
    59 CTestStep* CAnimationTestServer::CreateTestStep(const TDesC& aStepName)
       
    60 	{
       
    61 	CTestStep* testStep = NULL;
       
    62 
       
    63 	if (aStepName == KBasicStep)
       
    64 		testStep = new CBasic;
       
    65 	else if (aStepName == KFramesStep)
       
    66 		testStep = new CFrames;
       
    67 	else if (aStepName == KSynchStep)
       
    68 		testStep = new CSynch;
       
    69 	else if (aStepName == KOomStep)
       
    70 		testStep = new COomStep;
       
    71 	else if (aStepName == KCustomStep)
       
    72 		testStep = new CCustomStep;
       
    73 	else if (aStepName == KMngStep)
       
    74 		testStep = new CMng;
       
    75 	
       
    76 	return testStep;
       
    77 	}
       
    78 
       
    79 CAnimationTestServer::CAnimationTestServer()
       
    80 	{
       
    81 	}
       
    82 	
       
    83 CAnimationTestServer::~CAnimationTestServer()
       
    84 	{
       
    85 	}
       
    86 	
       
    87 void CAnimationTestServer::ConstructL()
       
    88 	{
       
    89 	CTestServer::ConstructL(KServerName);
       
    90 	}
       
    91 
       
    92 //
       
    93 // Entry functions:
       
    94 //
       
    95 LOCAL_C void MainL()
       
    96 	{
       
    97 	// Active scheduler:
       
    98 	CAnimationScheduler* Scheduler = new (ELeave) CAnimationScheduler;
       
    99 	CleanupStack::PushL(Scheduler);
       
   100 	CActiveScheduler::Install(Scheduler);
       
   101 
       
   102 	// Create test server:
       
   103 	CAnimationTestServer* server = NULL;
       
   104 	TRAPD(err,server = CAnimationTestServer::NewL());
       
   105 	CleanupStack::PushL(server);
       
   106 	// Run tests:
       
   107 	if(!err)
       
   108 		{
       
   109 		RProcess::Rendezvous(KErrNone);
       
   110 		CActiveScheduler::Start();
       
   111 		}
       
   112 	
       
   113 	// Finish:
       
   114 	CleanupStack::PopAndDestroy(2, Scheduler);
       
   115 	}
       
   116 
       
   117 GLDEF_C TInt E32Main()
       
   118 	{
       
   119 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
   120 	if (!cleanup)
       
   121 		{
       
   122 		return KErrNoMemory;
       
   123 		}
       
   124 
       
   125 	TInt err = KErrNone;
       
   126 	TRAP_IGNORE(MainL());
       
   127 
       
   128 	delete cleanup;
       
   129     return err;
       
   130 	}