kerneltest/e32test/mmu/t_chunk3.cpp
changeset 0 a41df078684a
child 109 b3a1d9898418
equal deleted inserted replaced
-1:000000000000 0:a41df078684a
       
     1 // Copyright (c) 1995-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\mmu\t_chunk3.cpp
       
    15 // 
       
    16 //
       
    17 
       
    18 #include <e32test.h>
       
    19 #include "u32std.h"
       
    20 #include "../misc/prbs.h"
       
    21 
       
    22 RTest test(_L("T_CHUNK3"));
       
    23 const TInt KHeapSize=4096;
       
    24 
       
    25 GLDEF_C TInt E32Main()
       
    26 	{
       
    27 	TUint seed[2];
       
    28 	seed[0]=0xddb3d743;
       
    29 	seed[1]=0;
       
    30 
       
    31 	test.Title();
       
    32 	test.Start(_L("Testing chunk resizing"));
       
    33 
       
    34 	RChunk c1;
       
    35 	RChunk c2;
       
    36 	TInt r=c1.CreateLocal(0,0x01000000);	// initial 0 max 16Mb
       
    37 	test(r==KErrNone);
       
    38 	r=c2.CreateLocal(0,0x01000000);			// initial 0 max 16Mb
       
    39 	test(r==KErrNone);
       
    40 
       
    41 	FOREVER
       
    42 		{
       
    43 		r=c1.Adjust(0x400000);				// adjust first chunk to 4Mb
       
    44 		test(r==KErrNone);
       
    45 		r=c1.Adjust(0);						// now adjust back to 0
       
    46 		test(r==KErrNone);
       
    47 		r=c1.Adjust(0x100000);				// adjust first chunk to 1Mb
       
    48 		test(r==KErrNone);
       
    49 		r=c2.Adjust(0x200000);				// now adjust second chunk to 2Mb
       
    50 		test(r==KErrNone);
       
    51 
       
    52 		TUint wait=Random(seed);
       
    53 		wait &= 16383;						// delay in us between 0 and 16383
       
    54 		User::AfterHighRes(wait);			// wait for a bit
       
    55 
       
    56 		r=c2.Adjust(0);						// then back to zero
       
    57 		test(r==KErrNone);
       
    58 		r=c1.Adjust(0);						// both chunks back to zero
       
    59 		test(r==KErrNone);
       
    60 		}
       
    61 
       
    62 //	test.End();
       
    63 	}