kerneltest/e32test/usbho/t_otgdi/src/testcasewd.cpp
changeset 253 d37db4dcc88d
parent 0 a41df078684a
child 257 3e88ff8f41d5
equal deleted inserted replaced
252:0a40b8675b23 253:d37db4dcc88d
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Eclipse Public License v1.0"
     4 // under the terms of the License "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    24 #include <e32base_private.h>
    24 #include <e32base_private.h>
    25 #include <e32cons.h>
    25 #include <e32cons.h>
    26 #include <e32Test.h>	// RTest headder
    26 #include <e32Test.h>	// RTest headder
    27 #include "testcaseroot.h"
    27 #include "testcaseroot.h"
    28 #include "TestCasewd.h"
    28 #include "TestCasewd.h"
       
    29 #include "OstTraceDefinitions.h"
       
    30 #ifdef OST_TRACE_COMPILER_IN_USE
       
    31 #include "testcasewdTraces.h"
       
    32 #endif
    29 
    33 
    30 
    34 
    31 
    35 
    32 
    36 
    33 const TInt KMagicNumberWDogValid	= 0xF143F00D;
    37 const TInt KMagicNumberWDogValid	= 0xF143F00D;
    69     
    73     
    70 
    74 
    71 void CTestCaseWatchdog::RunL()
    75 void CTestCaseWatchdog::RunL()
    72 // Timer request has completed, so notify the timer's owner that we timed out
    76 // Timer request has completed, so notify the timer's owner that we timed out
    73     {
    77     {
    74 	LOG_FUNC
    78 	if(gVerboseOutput)
       
    79 	    {
       
    80 	    OstTraceFunctionEntry0(CTESTCASEWATCHDOG_RUNL);
       
    81 	    }
    75 	__ASSERT_ALWAYS(iCancelFriendFunc, User::Panic(KMsgWatchdogPanicd, EPanicWatchdogError));
    82 	__ASSERT_ALWAYS(iCancelFriendFunc, User::Panic(KMsgWatchdogPanicd, EPanicWatchdogError));
    76 	__ASSERT_ALWAYS(iThisPointer, User::Panic(KMsgWatchdogPanicd, EPanicWatchdogError));
    83 	__ASSERT_ALWAYS(iThisPointer, User::Panic(KMsgWatchdogPanicd, EPanicWatchdogError));
    77 	(*iCancelFriendFunc)(iThisPointer);
    84 	(*iCancelFriendFunc)(iThisPointer);
    78 	iCancelFriendFunc = NULL;
    85 	iCancelFriendFunc = NULL;
    79 	}
    86 	}
    83 void CTestCaseWatchdog::IssueRequest(TInt aWatchdogIntervalMS, 
    90 void CTestCaseWatchdog::IssueRequest(TInt aWatchdogIntervalMS, 
    84 		CTestCaseRoot* pRoot, 
    91 		CTestCaseRoot* pRoot, 
    85 		WDCancellerMethod cancelMethod)
    92 		WDCancellerMethod cancelMethod)
    86 	{
    93 	{
    87 	LOG_VERBOSE2(_L("Watchdogging this step for %d ms\n"), aWatchdogIntervalMS);
    94 	LOG_VERBOSE2(_L("Watchdogging this step for %d ms\n"), aWatchdogIntervalMS);
       
    95 	if(gVerboseOutput)
       
    96 	    {
       
    97 	    OstTrace1(TRACE_VERBOSE, CTESTCASEWATCHDOG_ISSUEREQUEST, "Watchdogging this step for %d ms\n", aWatchdogIntervalMS);
       
    98 	    }
    88 	if (IsValid())
    99 	if (IsValid())
    89 		{
   100 		{
    90 		Cancel();
   101 		Cancel();
    91 		
   102 		
    92 		iThisPointer = pRoot;				// save caller instance data
   103 		iThisPointer = pRoot;				// save caller instance data
   106 	// This is test code, or else we would ifdef this out
   117 	// This is test code, or else we would ifdef this out
   107 	if (KMagicNumberWDogValid!= iValidConstr)
   118 	if (KMagicNumberWDogValid!= iValidConstr)
   108 		{
   119 		{
   109 		
   120 		
   110 		test.Printf(_L("CTestCaseWatchdog obj not properly constructed!\n"));
   121 		test.Printf(_L("CTestCaseWatchdog obj not properly constructed!\n"));
       
   122 		OstTrace0(TRACE_NORMAL, CTESTCASEWATCHDOG_ISVALID, "CTestCaseWatchdog obj not properly constructed!\n");
   111 		return(EFalse);
   123 		return(EFalse);
   112 		}
   124 		}
   113 	return(ETrue);	
   125 	return(ETrue);	
   114 	}
   126 	}
   115 
   127