os/graphics/egl/egltest/endpointtestsuite/automated/src/renderstage.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/graphics/egl/egltest/endpointtestsuite/automated/src/renderstage.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,118 @@
     1.4 +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +
    1.16 +
    1.17 +/**
    1.18 + @file
    1.19 + @test
    1.20 + @internalComponent - Internal Symbian test code
    1.21 +*/
    1.22 +
    1.23 +
    1.24 +//This render stage sets up a test thread within window server that waits on
    1.25 +//an asynchonous message queue for test commands that are sent from the TEF driver app.
    1.26 +//All render stage calls are simply forwarded to the next stage in the chain. The
    1.27 +//renderstage is a NULL renderstage.
    1.28 +
    1.29 +
    1.30 +#include "renderstage.h"
    1.31 +#include "remotetestbase.h"
    1.32 +#include <e32math.h>
    1.33 +
    1.34 +
    1.35 +CRenderStage* CRenderStage::NewL(MWsGraphicDrawerEnvironment* /*aEnv*/, MWsScreen* /*aScreen*/, MWsScreenRedraw* /*aScreenRedraw*/, CWsRenderStage* aNextStage)
    1.36 +    {
    1.37 +    CRenderStage* stage = new(ELeave) CRenderStage();
    1.38 +    CleanupStack::PushL(stage);
    1.39 +    stage->ConstructL(aNextStage);
    1.40 +    CleanupStack::Pop(stage);
    1.41 +    return stage;
    1.42 +    }
    1.43 +
    1.44 +
    1.45 +CRenderStage::CRenderStage()
    1.46 +    {
    1.47 +    }
    1.48 +
    1.49 +
    1.50 +void CRenderStage::ConstructL(CWsRenderStage* aNextStage)
    1.51 +    {
    1.52 +    ENDPOINT_ASSERT_DEBUG(aNextStage, User::Invariant());
    1.53 +    BaseConstructL();
    1.54 +    SetNext(aNextStage);
    1.55 +
    1.56 +    //Stack and heap sizes.
    1.57 +    static const TInt KStackSize =   0x2000;      //  8KB
    1.58 +    static const TInt KHeapMinSize = 0x1000;      //  4KB
    1.59 +    static const TInt KHeapMaxSize = 0x1000000;   // 16MB
    1.60 +
    1.61 +    //Create test environment thread.
    1.62 +    TUint32 random = Math::Random();
    1.63 +    TName threadName;
    1.64 +    _LIT(KThreadNameFormat, "%S-%u");
    1.65 +    _LIT(KEnvName, "EpTestRemoteEnv");
    1.66 +    threadName.Format(KThreadNameFormat, &KEnvName, random);
    1.67 +    User::LeaveIfError(iTestEnvThread.Create(threadName, TestEnvThreadEntryPoint, KStackSize, KHeapMinSize, KHeapMaxSize, this));
    1.68 +    iTestEnvThread.Resume();
    1.69 +    }
    1.70 +
    1.71 +
    1.72 +CRenderStage::~CRenderStage()
    1.73 +    {
    1.74 +    iTestEnvThread.Kill(KErrNone);
    1.75 +    }
    1.76 +
    1.77 +
    1.78 +TAny* CRenderStage::ResolveObjectInterface(TUint aTypeId)
    1.79 +    {
    1.80 +    return Next()->ResolveObjectInterface(aTypeId);
    1.81 +    }
    1.82 +
    1.83 +
    1.84 +void CRenderStage::Begin(const TRegion* aRegion)
    1.85 +    {
    1.86 +    Next()->Begin(aRegion);
    1.87 +    }
    1.88 +
    1.89 +
    1.90 +void CRenderStage::End(TRequestStatus* aCompositorReady)
    1.91 +    {
    1.92 +    Next()->End(aCompositorReady);
    1.93 +    }
    1.94 +
    1.95 +
    1.96 +TInt CRenderStage::TestEnvThreadEntryPoint(TAny* /*aSelf*/)
    1.97 +    {
    1.98 +    RDebug::Printf("CRenderStage: Entering Test Environment Thread...");
    1.99 +    
   1.100 +    //Create cleanup stack.
   1.101 +    CTrapCleanup* cleanup = CTrapCleanup::New();
   1.102 +    ASSERT(cleanup);
   1.103 +    
   1.104 +    //Create active scheduler.
   1.105 +    CActiveScheduler* scheduler = new CActiveScheduler();
   1.106 +    ASSERT(scheduler);
   1.107 +    CActiveScheduler::Install(scheduler);
   1.108 +    
   1.109 +    //Create a CRemoteTestEnv.
   1.110 +    CRemoteTestEnv* testEnv = NULL;
   1.111 +    TRAPD(err, testEnv = CRemoteTestEnv::NewL());
   1.112 +    __ASSERT_ALWAYS(err == KErrNone, User::Invariant());
   1.113 +    testEnv->StartReceivingCmds();
   1.114 +
   1.115 +    //Clean up.
   1.116 +    delete scheduler;
   1.117 +    delete cleanup;
   1.118 +    RDebug::Printf("CRenderStage: Leaving Test Environment Thread...");
   1.119 +    return KErrNone;
   1.120 +    }
   1.121 +