1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/kerneltest/e32test/mmu/t_chunk3.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,63 @@
1.4 +// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of the License "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// e32test\mmu\t_chunk3.cpp
1.18 +//
1.19 +//
1.20 +
1.21 +#include <e32test.h>
1.22 +#include "u32std.h"
1.23 +#include "../misc/prbs.h"
1.24 +
1.25 +RTest test(_L("T_CHUNK3"));
1.26 +const TInt KHeapSize=4096;
1.27 +
1.28 +GLDEF_C TInt E32Main()
1.29 + {
1.30 + TUint seed[2];
1.31 + seed[0]=0xddb3d743;
1.32 + seed[1]=0;
1.33 +
1.34 + test.Title();
1.35 + test.Start(_L("Testing chunk resizing"));
1.36 +
1.37 + RChunk c1;
1.38 + RChunk c2;
1.39 + TInt r=c1.CreateLocal(0,0x01000000); // initial 0 max 16Mb
1.40 + test(r==KErrNone);
1.41 + r=c2.CreateLocal(0,0x01000000); // initial 0 max 16Mb
1.42 + test(r==KErrNone);
1.43 +
1.44 + FOREVER
1.45 + {
1.46 + r=c1.Adjust(0x400000); // adjust first chunk to 4Mb
1.47 + test(r==KErrNone);
1.48 + r=c1.Adjust(0); // now adjust back to 0
1.49 + test(r==KErrNone);
1.50 + r=c1.Adjust(0x100000); // adjust first chunk to 1Mb
1.51 + test(r==KErrNone);
1.52 + r=c2.Adjust(0x200000); // now adjust second chunk to 2Mb
1.53 + test(r==KErrNone);
1.54 +
1.55 + TUint wait=Random(seed);
1.56 + wait &= 16383; // delay in us between 0 and 16383
1.57 + User::AfterHighRes(wait); // wait for a bit
1.58 +
1.59 + r=c2.Adjust(0); // then back to zero
1.60 + test(r==KErrNone);
1.61 + r=c1.Adjust(0); // both chunks back to zero
1.62 + test(r==KErrNone);
1.63 + }
1.64 +
1.65 +// test.End();
1.66 + }