kerneltest/e32test/usbho/t_otgdi/src/testcasewd.cpp
branchRCL_3
changeset 257 3e88ff8f41d5
parent 256 c1f20ce4abcf
equal deleted inserted replaced
256:c1f20ce4abcf 257:3e88ff8f41d5
     1 // Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2007-2009 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
       
    33 
    29 
    34 
    30 
    35 
    31 
    36 
    32 
    37 const TInt KMagicNumberWDogValid	= 0xF143F00D;
    33 const TInt KMagicNumberWDogValid	= 0xF143F00D;
    73     
    69     
    74 
    70 
    75 void CTestCaseWatchdog::RunL()
    71 void CTestCaseWatchdog::RunL()
    76 // Timer request has completed, so notify the timer's owner that we timed out
    72 // Timer request has completed, so notify the timer's owner that we timed out
    77     {
    73     {
    78 	if(gVerboseOutput)
    74 	LOG_FUNC
    79 	    {
       
    80 	    OstTraceFunctionEntry0(CTESTCASEWATCHDOG_RUNL);
       
    81 	    }
       
    82 	__ASSERT_ALWAYS(iCancelFriendFunc, User::Panic(KMsgWatchdogPanicd, EPanicWatchdogError));
    75 	__ASSERT_ALWAYS(iCancelFriendFunc, User::Panic(KMsgWatchdogPanicd, EPanicWatchdogError));
    83 	__ASSERT_ALWAYS(iThisPointer, User::Panic(KMsgWatchdogPanicd, EPanicWatchdogError));
    76 	__ASSERT_ALWAYS(iThisPointer, User::Panic(KMsgWatchdogPanicd, EPanicWatchdogError));
    84 	(*iCancelFriendFunc)(iThisPointer);
    77 	(*iCancelFriendFunc)(iThisPointer);
    85 	iCancelFriendFunc = NULL;
    78 	iCancelFriendFunc = NULL;
    86 	}
    79 	}
    90 void CTestCaseWatchdog::IssueRequest(TInt aWatchdogIntervalMS, 
    83 void CTestCaseWatchdog::IssueRequest(TInt aWatchdogIntervalMS, 
    91 		CTestCaseRoot* pRoot, 
    84 		CTestCaseRoot* pRoot, 
    92 		WDCancellerMethod cancelMethod)
    85 		WDCancellerMethod cancelMethod)
    93 	{
    86 	{
    94 	LOG_VERBOSE2(_L("Watchdogging this step for %d ms\n"), aWatchdogIntervalMS);
    87 	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 	    }
       
    99 	if (IsValid())
    88 	if (IsValid())
   100 		{
    89 		{
   101 		Cancel();
    90 		Cancel();
   102 		
    91 		
   103 		iThisPointer = pRoot;				// save caller instance data
    92 		iThisPointer = pRoot;				// save caller instance data
   117 	// This is test code, or else we would ifdef this out
   106 	// This is test code, or else we would ifdef this out
   118 	if (KMagicNumberWDogValid!= iValidConstr)
   107 	if (KMagicNumberWDogValid!= iValidConstr)
   119 		{
   108 		{
   120 		
   109 		
   121 		test.Printf(_L("CTestCaseWatchdog obj not properly constructed!\n"));
   110 		test.Printf(_L("CTestCaseWatchdog obj not properly constructed!\n"));
   122 		OstTrace0(TRACE_NORMAL, CTESTCASEWATCHDOG_ISVALID, "CTestCaseWatchdog obj not properly constructed!\n");
       
   123 		return(EFalse);
   111 		return(EFalse);
   124 		}
   112 		}
   125 	return(ETrue);	
   113 	return(ETrue);	
   126 	}
   114 	}
   127 
   115