sl@0
|
1 |
// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// e32test\mmu\t_chunk3.cpp
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
|
sl@0
|
18 |
#include <e32test.h>
|
sl@0
|
19 |
#include "u32std.h"
|
sl@0
|
20 |
#include "../misc/prbs.h"
|
sl@0
|
21 |
|
sl@0
|
22 |
RTest test(_L("T_CHUNK3"));
|
sl@0
|
23 |
const TInt KHeapSize=4096;
|
sl@0
|
24 |
|
sl@0
|
25 |
GLDEF_C TInt E32Main()
|
sl@0
|
26 |
{
|
sl@0
|
27 |
TUint seed[2];
|
sl@0
|
28 |
seed[0]=0xddb3d743;
|
sl@0
|
29 |
seed[1]=0;
|
sl@0
|
30 |
|
sl@0
|
31 |
test.Title();
|
sl@0
|
32 |
test.Start(_L("Testing chunk resizing"));
|
sl@0
|
33 |
|
sl@0
|
34 |
RChunk c1;
|
sl@0
|
35 |
RChunk c2;
|
sl@0
|
36 |
TInt r=c1.CreateLocal(0,0x01000000); // initial 0 max 16Mb
|
sl@0
|
37 |
test(r==KErrNone);
|
sl@0
|
38 |
r=c2.CreateLocal(0,0x01000000); // initial 0 max 16Mb
|
sl@0
|
39 |
test(r==KErrNone);
|
sl@0
|
40 |
|
sl@0
|
41 |
FOREVER
|
sl@0
|
42 |
{
|
sl@0
|
43 |
r=c1.Adjust(0x400000); // adjust first chunk to 4Mb
|
sl@0
|
44 |
test(r==KErrNone);
|
sl@0
|
45 |
r=c1.Adjust(0); // now adjust back to 0
|
sl@0
|
46 |
test(r==KErrNone);
|
sl@0
|
47 |
r=c1.Adjust(0x100000); // adjust first chunk to 1Mb
|
sl@0
|
48 |
test(r==KErrNone);
|
sl@0
|
49 |
r=c2.Adjust(0x200000); // now adjust second chunk to 2Mb
|
sl@0
|
50 |
test(r==KErrNone);
|
sl@0
|
51 |
|
sl@0
|
52 |
TUint wait=Random(seed);
|
sl@0
|
53 |
wait &= 16383; // delay in us between 0 and 16383
|
sl@0
|
54 |
User::AfterHighRes(wait); // wait for a bit
|
sl@0
|
55 |
|
sl@0
|
56 |
r=c2.Adjust(0); // then back to zero
|
sl@0
|
57 |
test(r==KErrNone);
|
sl@0
|
58 |
r=c1.Adjust(0); // both chunks back to zero
|
sl@0
|
59 |
test(r==KErrNone);
|
sl@0
|
60 |
}
|
sl@0
|
61 |
|
sl@0
|
62 |
// test.End();
|
sl@0
|
63 |
}
|