os/kernelhwsrv/kerneltest/e32test/earlyextension/t_testearlyextension.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 // Copyright (c) 2007-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 the License "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 // e32test\earlyextension\t_testextension.cpp
    15 // 
    16 //
    17 
    18 #include <e32test.h>
    19 #include <hal.h>
    20 #include "d_testearlyextension.h"
    21 
    22 RLddEarlyExtensionTest lddChan;
    23 GLDEF_D RTest test(_L("LDD tests"));
    24 _LIT(KLddFileName, "D_TESTEARLYEXTENSION.LDD");
    25 
    26 GLDEF_C TInt E32Main()
    27     {
    28 	test.Title();
    29 	test.Start(_L("Testing early extension...\n"));
    30 	//Load logical device
    31 	TInt r = User::LoadLogicalDevice(KLddFileName);
    32 	test((r == KErrNone) || (r == KErrAlreadyExists));
    33 	//Open the channel
    34 	r = lddChan.Open();
    35     test(r==KErrNone || r==KErrAlreadyExists);
    36 	Int64 earlyExtTime = 0, extTime = 0;
    37 	//Get system time stamps 
    38 	r = lddChan.Test_getSystemTimeStamps(earlyExtTime, extTime);
    39     test(r == KErrNone);
    40 	//Compare the time stamps for correctness. 
    41 	//Time stamps got in early extension should be less than (valuewise) the one got in normal extension entry point.
    42 	if(earlyExtTime > extTime)
    43 		{
    44 		test.Printf(_L("Early Extension time stamp %ld is greater than extension time stamp %ld\n"), earlyExtTime, extTime);
    45 		test(0);
    46 		}
    47 	test.Printf(_L("Time stamps are as expected!!!\n"));
    48 	test.Printf(_L("Closing the channel\n"));
    49 	lddChan.Close();
    50 
    51 	test.Printf(_L("Freeing logical device\n"));
    52 	r = User::FreeLogicalDevice(KLddFileName);
    53 	test(r==KErrNone);
    54 	User::After(100000);
    55 	test.End();
    56 	test.Close();
    57 	return r;
    58 	}