kerneltest/e32test/active/t_ctimer.cpp
changeset 247 d8d70de2bd36
parent 0 a41df078684a
child 257 3e88ff8f41d5
--- a/kerneltest/e32test/active/t_ctimer.cpp	Tue Jul 06 15:50:07 2010 +0300
+++ b/kerneltest/e32test/active/t_ctimer.cpp	Wed Aug 18 11:08:29 2010 +0300
@@ -28,6 +28,7 @@
 // and check for panic.
 // - Call absolute timer's At function without adding it to the active scheduler and 
 // check for panic.
+// - Call 1s inactivity timer
 // - Check if heap has been corrupted by the tests.
 // Platforms/Drives/Compatibility:
 // All.
@@ -77,6 +78,15 @@
 	static TInt iTotalCount;
 	};
 
+// for inactivity test
+class myInactTimer : public CTimer
+	{
+public:
+	myInactTimer(const TInt aPriority):CTimer(aPriority){;}
+	void RunL(void);	
+	void Start(void);
+	};
+
 TInt myTimer::iTotalCount;
 TInt myTimer::iNum;
 
@@ -108,6 +118,23 @@
 	CActiveScheduler::Add(this);
 	}
 
+void myInactTimer::RunL(void)
+//
+// Timer has completed
+//
+	{
+	CActiveScheduler::Stop();
+	}
+
+void myInactTimer::Start(void)
+//
+// Start a timer going.
+//
+	{
+	ConstructL();
+	CActiveScheduler::Add(this);
+	}
+
 LOCAL_D TInt ThreadEntry(TAny* aDirective)
 //
 // Test thread
@@ -197,12 +224,22 @@
 	CActiveScheduler::Start();
 	test(A[0]==ID1 && pTimer1->iStatus==KErrNone);
 //
-
+	test.Next(_L("Inactivity 1s"));
+	User::ResetInactivityTime();
+	myInactTimer* pInactTimer=new myInactTimer(0);
+	pInactTimer->Start();
+	test.Printf(_L("inactivity..."));
+	pInactTimer->Inactivity(1);
+	CActiveScheduler::Start();
+	test.Printf(_L("...back"));
+	test(pInactTimer->iStatus==KErrNone);
+//
 	test.Next(_L("Destroy objects"));
 	delete pTimer1;
 	delete pTimer2;
 	delete pTimer3;
 	delete pRepeater;
+	delete pInactTimer;
 //
 	test.End();
 	}