egl/egltest/endpointtestsuite/automated/src/remotetestbase.cpp
changeset 136 62bb7c97884c
parent 98 bf7481649c98
equal deleted inserted replaced
121:d72fc2aace31 136:62bb7c97884c
    32 #include "remotetestbase.h"
    32 #include "remotetestbase.h"
    33 #include <e32debug.h>
    33 #include <e32debug.h>
    34 #include <e32math.h>
    34 #include <e32math.h>
    35 
    35 
    36 
    36 
    37 // Timout for remote test steps. This MUST be smaller
    37 // Default timout for remote test steps. This MUST be smaller
    38 // than any timeout passed to TEF for the local test step
    38 // than any timeout passed to TEF for the local test step
    39 // in the script file.
    39 // in the script file. Remote test steps can override this 
       
    40 // value by implementing the Timeout() function in their 
       
    41 // derrived class.
    40 const TInt KRemoteTestStepTimeout = 10 * 1000000;
    42 const TInt KRemoteTestStepTimeout = 10 * 1000000;
    41 
    43 
    42 
    44 
    43 //Active object used to generate a timeout if worker thread takes too long. ------
    45 //Active object used to generate a timeout if worker thread takes too long. ------
    44 
    46 
    66     }
    68     }
    67 
    69 
    68 
    70 
    69 CTimeoutTimer::~CTimeoutTimer()
    71 CTimeoutTimer::~CTimeoutTimer()
    70     {
    72     {
       
    73     Cancel();
    71     }
    74     }
    72 
    75 
    73 
    76 
    74 void CTimeoutTimer::RunL()
    77 void CTimeoutTimer::RunL()
    75     {
    78     {
   313             return;
   316             return;
   314             }
   317             }
   315         }
   318         }
   316 
   319 
   317     //Activate the TimoutTimer, TestCaseListener and WorkerListener.
   320     //Activate the TimoutTimer, TestCaseListener and WorkerListener.
   318     iTimeoutTimer->After(KRemoteTestStepTimeout);
   321     iTimeoutTimer->After(iCurTestStep->Timeout());
   319     iTestCaseListener->Listen();
   322     iTestCaseListener->Listen();
   320     iWorkerListener->Listen(iCurWorker);
   323     iWorkerListener->Listen(iCurWorker);
   321 
   324 
   322     //Signal the worker thread to start a test case.
   325     //Signal the worker thread to start a test case.
   323     TRequestStatus* notifyRunTestCase = &iNotifyRunTestCase;
   326     TRequestStatus* notifyRunTestCase = &iNotifyRunTestCase;
   462 // on the heap for the egl implementation - or the equivalent if the
   465 // on the heap for the egl implementation - or the equivalent if the
   463 // heap is not a typical Symbian heap.
   466 // heap is not a typical Symbian heap.
   464 void CRemoteTestEnv::DoEglHeapMark()
   467 void CRemoteTestEnv::DoEglHeapMark()
   465     {
   468     {
   466 #if USE_EGLHEAP_CHECKING
   469 #if USE_EGLHEAP_CHECKING
   467     typedef void (*TEglDebugHeapMarkStartPtr)(void);
   470     typedef void (*TEglDebugHeapMarkStartPtr)();
   468 
   471 
   469     TEglDebugHeapMarkStartPtr  heapMarkStart = reinterpret_cast<TEglDebugHeapMarkStartPtr>(eglGetProcAddress("egliDebugHeapMarkStart"));
   472     TEglDebugHeapMarkStartPtr  heapMarkStart = reinterpret_cast<TEglDebugHeapMarkStartPtr>(eglGetProcAddress("egliDebugHeapMarkStart"));
   470     if (heapMarkStart)
   473     if (heapMarkStart)
   471         {
   474         {
   472         heapMarkStart();
   475         heapMarkStart();
   560 
   563 
   561 
   564 
   562 TInt CRemoteTestEnv::TestThreadEntryPoint(TAny* aSelf)
   565 TInt CRemoteTestEnv::TestThreadEntryPoint(TAny* aSelf)
   563     {
   566     {
   564     CRemoteTestEnv* self = static_cast<CRemoteTestEnv*>(aSelf);
   567     CRemoteTestEnv* self = static_cast<CRemoteTestEnv*>(aSelf);
       
   568     
       
   569     //Create cleanup stack.
   565     CTrapCleanup* cleanup = CTrapCleanup::New();
   570     CTrapCleanup* cleanup = CTrapCleanup::New();
   566 
   571     ASSERT(cleanup);
   567     TRAPD(err,
   572     
   568         //Create active scheduler.
   573     //Create active scheduler.
   569         CActiveScheduler* scheduler = new (ELeave) CActiveScheduler();
   574     CActiveScheduler* scheduler = new CActiveScheduler();
   570         CleanupStack::PushL(scheduler);
   575     ASSERT(scheduler);
   571         CActiveScheduler::Install(scheduler);
   576     CActiveScheduler::Install(scheduler);
   572 
   577     
   573         //Run the current test step.
   578     TRAPD(err, self->RunCurrentTestStepL());
   574         self->RunCurrentTestStepL();
       
   575 
       
   576         //Clean up.
       
   577         CleanupStack::PopAndDestroy(scheduler);
       
   578         );
       
   579 
       
   580     __ASSERT_ALWAYS(err == KErrNone, User::Invariant());
   579     __ASSERT_ALWAYS(err == KErrNone, User::Invariant());
   581 
   580 
       
   581     //Clean up.
       
   582     delete scheduler;
   582     delete cleanup;
   583     delete cleanup;
   583     return KErrNone;
   584     return KErrNone;
   584     }
   585     }
   585 
   586 
   586 
   587 
   632 
   633 
   633 TRemoteTestVerdict CRemoteTestStepBase::DoEndRemoteTestStepL(const TRemoteTestParams& /*aMessageIn*/)
   634 TRemoteTestVerdict CRemoteTestStepBase::DoEndRemoteTestStepL(const TRemoteTestParams& /*aMessageIn*/)
   634     {
   635     {
   635     //Default implementation does nothing.
   636     //Default implementation does nothing.
   636     return ERtvPass;
   637     return ERtvPass;
       
   638     }
       
   639 
       
   640 
       
   641 TInt CRemoteTestStepBase::Timeout() const
       
   642     {
       
   643     return KRemoteTestStepTimeout;
   637     }
   644     }
   638 
   645 
   639 
   646 
   640 class TOverflowTruncate : public TDesOverflow
   647 class TOverflowTruncate : public TDesOverflow
   641     {
   648     {