messagingfw/msgtest/targetautomation/Delay/T_delay.cpp
changeset 22 bde600d88860
parent 0 8e480a14352b
equal deleted inserted replaced
21:08008ce8a6df 22:bde600d88860
       
     1 // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include <e32std.h>
       
    17 #include <bacline.h>
       
    18 #include <e32test.h>
       
    19 #include <kernel\u32std.h>
       
    20 #include <e32svr.h>
       
    21 
       
    22 RTest test(_L("T_DELAY"));
       
    23 
       
    24 const TInt KMsgDefaultBatchFileDelay=20000000;	// 20 seconds
       
    25 //const TInt KMsgDefaultBatchFileDelay=5000000;	// 5 seconds
       
    26 
       
    27 LOCAL_C void doDelayL()
       
    28 	{
       
    29 //	HAL::SetAutoSwitchOffBehavior(ESwitchOffDisabled);	// Can't do this anymore :<
       
    30 	User::ResetInactivityTime();
       
    31 
       
    32 	// Get command line.
       
    33 	CCommandLineArguments* parsed=CCommandLineArguments::NewLC();
       
    34 	// Check for numerical arguments.
       
    35 	TInt theDelay=KMsgDefaultBatchFileDelay;
       
    36 	if (parsed->Count()==2)
       
    37 		{
       
    38 		TLex convArg(parsed->Arg(1));
       
    39 		TInt parsedDelay;
       
    40 		if (convArg.Val(parsedDelay)==KErrNone)
       
    41 			theDelay=parsedDelay*1000000;
       
    42 		}
       
    43 	// Delay.
       
    44 	User::After(theDelay);
       
    45 
       
    46 	User::ResetInactivityTime();
       
    47 
       
    48 	CleanupStack::PopAndDestroy(parsed);
       
    49 	}
       
    50 
       
    51 GLDEF_C TInt E32Main()
       
    52 	{	
       
    53 	__UHEAP_MARK;
       
    54 	test.Title();
       
    55 	CTrapCleanup* theCleanup=CTrapCleanup::New();
       
    56 
       
    57 	TInt totalRamSize;
       
    58 	TInt freeRamSize;
       
    59 	TMemoryInfoV1 info;
       
    60 	TPckg<TMemoryInfoV1> infoPckg(info);
       
    61 	TInt r=UserSvr::HalGet(EMemoryInfo, (TAny*)&infoPckg);
       
    62 	if (r==KErrNone)
       
    63 		{
       
    64 		totalRamSize=info.iTotalRamInBytes;
       
    65 		freeRamSize=info.iFreeRamInBytes;
       
    66 		test.Printf(_L("TotalRam: 0x%8x\n"),totalRamSize);
       
    67 		test.Printf(_L("FreeRam:  0x%8x\n"),freeRamSize);
       
    68 		}
       
    69 
       
    70 	
       
    71 	TRAPD(ret,doDelayL());          
       
    72 	delete theCleanup;      
       
    73 	test.Close();
       
    74 	__UHEAP_MARKEND;
       
    75 	return(KErrNone);
       
    76 	}
       
    77