sl@0: // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // e32test\demandpaging\t_chunkcreate.cpp sl@0: // sl@0: // sl@0: sl@0: // sl@0: #define __E32TEST_EXTENSION__ sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include "u32std.h" sl@0: sl@0: #include "t_dpcmn.h" sl@0: sl@0: _LIT(KGlobalChunkName, "TestChunk"); sl@0: sl@0: enum sl@0: { sl@0: ECreateNormal, sl@0: ECreateCode, sl@0: ECreateGlobal, sl@0: ECreateLocalDE, sl@0: ECreateGlobalDE, sl@0: ECreateLocalDC, sl@0: ECreateGlobalDC, sl@0: }; sl@0: sl@0: enum sl@0: { sl@0: EPagingUnspec, // Has to be first as can't clear back to unspecified. sl@0: EPagingOn, sl@0: EPagingOff, sl@0: EPagingNumberAttribs, sl@0: }; sl@0: sl@0: sl@0: void VerifyChunkPaged(RChunk& aChunk, TBool aPaged, TInt aR) sl@0: { sl@0: UpdatePaged(aPaged); sl@0: sl@0: test_KErrNone(aR); sl@0: test.Printf(_L("aPaged = %d, aChunk.IsPaged() = %d\n"), aPaged, aChunk.IsPaged()); sl@0: test_Equal(aPaged, aChunk.IsPaged()); sl@0: sl@0: // Uses same name for global chunks so needs to be fully closed before next call sl@0: CLOSE_AND_WAIT(aChunk); sl@0: } sl@0: sl@0: sl@0: void VerifyChunkPaged(TChunkCreateInfo& aCreateInfo) sl@0: { sl@0: TBool paged = EFalse; sl@0: for (TInt i = 0; i < EPagingNumberAttribs; i++) sl@0: { sl@0: switch(i) sl@0: { sl@0: case EPagingUnspec : sl@0: paged = gProcessPaged; // Should default to process's paged status. sl@0: test.Printf(_L("Should default to process's paged status\n")); sl@0: break; sl@0: case EPagingOn : sl@0: aCreateInfo.SetPaging(TChunkCreateInfo::EPaged); sl@0: paged = ETrue; sl@0: test.Printf(_L("Paging should be on\n")); sl@0: break; sl@0: case EPagingOff : sl@0: aCreateInfo.SetPaging(TChunkCreateInfo::EUnpaged); sl@0: paged = EFalse; sl@0: test.Printf(_L("Paging should be off\n")); sl@0: break; sl@0: } sl@0: RChunk chunk; sl@0: TInt r = chunk.Create(aCreateInfo); sl@0: VerifyChunkPaged(chunk, paged, r); sl@0: } sl@0: } sl@0: sl@0: sl@0: sl@0: TInt PanicChunkCreate(TAny* aCreateInfo) sl@0: { sl@0: TChunkCreateInfo createInfo((*(TChunkCreateInfo*) aCreateInfo)); sl@0: gChunk.Create(createInfo); sl@0: return KErrGeneral; // Should never reach here sl@0: } sl@0: sl@0: sl@0: void TestPanicChunkCreate1(TInt aType, TInt aSize, TInt aMaxSize, TInt aPanicCode) sl@0: { sl@0: TChunkCreateInfo createInfo; sl@0: switch (aType) sl@0: { sl@0: case ECreateNormal: sl@0: createInfo.SetNormal(aSize, aMaxSize); sl@0: break; sl@0: sl@0: case ECreateCode: sl@0: createInfo.SetCode(aSize, aMaxSize); sl@0: break; sl@0: sl@0: case ECreateGlobal: sl@0: createInfo.SetNormal(aSize, aMaxSize); sl@0: createInfo.SetGlobal(KGlobalChunkName); sl@0: break; sl@0: sl@0: } sl@0: sl@0: sl@0: RThread thread; sl@0: test_KErrNone(thread.Create(_L("Panic CreateChunk"), PanicChunkCreate, KDefaultStackSize, KMinHeapSize, sl@0: KMinHeapSize, (TAny*) &createInfo)); sl@0: sl@0: test_KErrNone(TestThreadExit(thread, EExitPanic, aPanicCode)); sl@0: } sl@0: sl@0: void TestPanicChunkCreate2(TInt aType, TInt aBottom, TInt aTop, TInt aMaxSize, TInt aPanicCode) sl@0: { sl@0: TChunkCreateInfo createInfo; sl@0: switch (aType) sl@0: { sl@0: case ECreateLocalDE: sl@0: createInfo.SetDoubleEnded(aBottom, aTop, aMaxSize); sl@0: break; sl@0: sl@0: case ECreateGlobalDE: sl@0: createInfo.SetDoubleEnded(aBottom, aTop, aMaxSize); sl@0: createInfo.SetGlobal(KGlobalChunkName); sl@0: break; sl@0: sl@0: case ECreateLocalDC: sl@0: createInfo.SetDisconnected(aBottom, aTop, aMaxSize); sl@0: break; sl@0: sl@0: case ECreateGlobalDC: sl@0: createInfo.SetDisconnected(aBottom, aTop, aMaxSize); sl@0: createInfo.SetGlobal(KGlobalChunkName); sl@0: break; sl@0: } sl@0: sl@0: sl@0: RThread thread; sl@0: test_KErrNone(thread.Create(_L("Panic CreateChunk"), PanicChunkCreate, KDefaultStackSize, KMinHeapSize, sl@0: KMinHeapSize, (TAny*) &createInfo)); sl@0: sl@0: test_KErrNone(TestThreadExit(thread, EExitPanic, aPanicCode)); sl@0: } sl@0: sl@0: // sl@0: // TestLocalChunk sl@0: // sl@0: //---------------------------------------------------------------------------------------------- sl@0: //! @SYMTestCaseID KBASE-T_CHUNKCREATE-xxxx sl@0: //! @SYMTestType UT sl@0: //! @SYMPREQ PREQ1954 sl@0: //! @SYMTestCaseDesc Verify the local chunk creation implementation. sl@0: //! @SYMTestActions sl@0: //! 1. Create a local chunk and specify the following paging options. sl@0: //! Following this, check the paging status of the chunk by calling IsPaged sl@0: //! a. Not specified sl@0: //! b. Paged sl@0: //! c. Unpaged sl@0: //! 2. Create a local chunk and specify aMaxSize to be negative sl@0: //! 3. Create a local chunk and specify aSize to be negative sl@0: //! 4. Create a local chunk and specify aMaxSize to be less than aSize. sl@0: //! sl@0: //! @SYMTestExpectedResults sl@0: //! 1. The following results are expected: sl@0: //! a. The chunk should take on the paging status of the process sl@0: //! b. ETrue sl@0: //! c. EFalse sl@0: //! 2. Panic USER99 sl@0: //! 3. Panic USER100 sl@0: //! 4. Panic USER101 sl@0: //! sl@0: //! @SYMTestPriority High sl@0: //! @SYMTestStatus Implemented sl@0: //---------------------------------------------------------------------------------------------- sl@0: void TestLocalChunk() sl@0: { sl@0: test.Start(_L("Test RChunk::CreateLocal - paging attributes")); sl@0: { sl@0: TChunkCreateInfo createInfo; sl@0: createInfo.SetNormal(gPageSize, gPageSize); sl@0: VerifyChunkPaged(createInfo); sl@0: // Test default create method sl@0: TInt r = gChunk.CreateLocal(gPageSize, gPageSize); sl@0: VerifyChunkPaged(gChunk, gProcessPaged, r); sl@0: } sl@0: sl@0: test.Next(_L("Test RChunk::CreateLocal - invalid max size")); sl@0: TestPanicChunkCreate1(ECreateNormal, gPageSize, -1, EChkCreateMaxSizeNegative); sl@0: sl@0: test.Next(_L("Test RChunk::CreateLocal - invalid size")); sl@0: TestPanicChunkCreate1(ECreateNormal, -1, gPageSize, EChkCreateSizeNotPositive); sl@0: sl@0: sl@0: test.Next(_L("Test RChunk::CreateLocal - aSize > aMaxSize")); sl@0: TestPanicChunkCreate1(ECreateNormal, gPageSize << 1, gPageSize, EChkCreateMaxLessThanMin); sl@0: test.End(); sl@0: } sl@0: sl@0: // sl@0: // TestCodeChunk sl@0: // sl@0: //---------------------------------------------------------------------------------------------- sl@0: //! @SYMTestCaseID KBASE-T_CHUNKCREATE-xxxx sl@0: //! @SYMTestType UT sl@0: //! @SYMPREQ PREQ1954 sl@0: //! @SYMTestCaseDesc Verify the user code chunk creation implementation sl@0: //! @SYMTestActions sl@0: //! 1. Create a user code chunk and specify the following paging options. sl@0: //! Following this check the paging status of the chunk by calling IsPaged(). sl@0: //! a. Not specified sl@0: //! b. Paged sl@0: //! c. Unpaged sl@0: //! 2. Create a user code chunk and specify aMaxSize to be negative sl@0: //! 3. Create a user code chunk and specify aSize to be negative sl@0: //! 4. Create a user code chunk and specify aMaxSize to be less than aSize. sl@0: //! sl@0: //! @SYMTestExpectedResults sl@0: //! 1. The following results are expected: sl@0: //! a. The chunk should take on the paging status of the process sl@0: //! b. ETrue sl@0: //! c. EFalse sl@0: //! 2. Panic USER99 sl@0: //! 3. Panic USER100 sl@0: //! 4. Panic USER101 sl@0: //! sl@0: //! @SYMTestPriority High sl@0: //! @SYMTestStatus Implemented sl@0: //---------------------------------------------------------------------------------------------- sl@0: void TestCodeChunk() sl@0: { sl@0: test.Start(_L("Test RChunk::CreateLocalCode - paging attributes")); sl@0: { sl@0: TChunkCreateInfo createInfo; sl@0: createInfo.SetCode(gPageSize, gPageSize); sl@0: VerifyChunkPaged(createInfo); sl@0: // Test default create method sl@0: TInt r = gChunk.CreateLocal(gPageSize, gPageSize); sl@0: VerifyChunkPaged(gChunk, gProcessPaged, r); sl@0: } sl@0: sl@0: test.Next(_L("Test RChunk::CreateLocalCode - invalid max size")); sl@0: TestPanicChunkCreate1(ECreateCode, gPageSize, -1, EChkCreateMaxSizeNegative); sl@0: sl@0: test.Next(_L("Test RChunk::CreateLocalCode - invalid size")); sl@0: TestPanicChunkCreate1(ECreateCode, -1, gPageSize, EChkCreateSizeNotPositive); sl@0: sl@0: sl@0: test.Next(_L("Test RChunk::CreateLocalCode - aSize > aMaxSize")); sl@0: TestPanicChunkCreate1(ECreateCode, gPageSize << 1, gPageSize, EChkCreateMaxLessThanMin); sl@0: sl@0: test.End(); sl@0: } sl@0: sl@0: // sl@0: // TestGlobalChunk sl@0: // sl@0: //---------------------------------------------------------------------------------------------- sl@0: //! @SYMTestCaseID KBASE-T_CHUNKCREATE-xxxx sl@0: //! @SYMTestType UT sl@0: //! @SYMPREQ PREQ1954 sl@0: //! @SYMTestCaseDesc Verify the global chunk creation implementation sl@0: //! @SYMTestActions sl@0: //! 1. Create a global chunk and specify the following paging options. sl@0: //! Following this check the paging status of the chunk by calling IsPaged(). sl@0: //! a. Not specified sl@0: //! b. Paged sl@0: //! c. Unpaged sl@0: //! 1. Create a global chunk and specify aMaxSize to be negative sl@0: //! 2. Create a global chunk and specify aSize to be negative sl@0: //! 3. Create a global chunk and specify aMaxSize to be less than aSize. sl@0: //! sl@0: //! @SYMTestExpectedResults sl@0: //! 1. The following results are expected: sl@0: //! a. The chunk should take on the paging status of the process sl@0: //! b. ETrue sl@0: //! c. EFalse sl@0: //! 2. Panic USER99 sl@0: //! 3. Panic USER100 sl@0: //! 4. Panic USER101 sl@0: //! sl@0: //! @SYMTestPriority High sl@0: //! @SYMTestStatus Implemented sl@0: //---------------------------------------------------------------------------------------------- sl@0: void TestGlobalChunk() sl@0: { sl@0: test.Start(_L("Test RChunk::CreateGlobal - paging attributes")); sl@0: { sl@0: TChunkCreateInfo createInfo; sl@0: createInfo.SetNormal(gPageSize, gPageSize); sl@0: createInfo.SetGlobal(KGlobalChunkName); sl@0: VerifyChunkPaged(createInfo); sl@0: // Test default create method sl@0: TInt r = gChunk.CreateLocal(gPageSize, gPageSize); sl@0: VerifyChunkPaged(gChunk, gProcessPaged, r); sl@0: } sl@0: sl@0: test.Next(_L("Test RChunk::CreateGlobal - invalid max size")); sl@0: TestPanicChunkCreate1(ECreateGlobal, gPageSize, -1, EChkCreateMaxSizeNegative); sl@0: sl@0: test.Next(_L("Test RChunk::CreateGlobal - invalid size")); sl@0: TestPanicChunkCreate1(ECreateGlobal, -1, gPageSize, EChkCreateSizeNotPositive); sl@0: sl@0: sl@0: test.Next(_L("Test RChunk::CreateGlobal - aSize > aMaxSize")); sl@0: TestPanicChunkCreate1(ECreateGlobal, gPageSize << 1, gPageSize, EChkCreateMaxLessThanMin); sl@0: sl@0: test.End(); sl@0: } sl@0: sl@0: // sl@0: // TestLocDEChunk sl@0: // sl@0: //---------------------------------------------------------------------------------------------- sl@0: //! @SYMTestCaseID KBASE-T_CHUNKCREATE-xxxx sl@0: //! @SYMTestType UT sl@0: //! @SYMPREQ PREQ1954 sl@0: //! @SYMTestCaseDesc Verify the local double ended chunk creation implementation sl@0: //! @SYMTestActions sl@0: //! 1. Create a local, double ended, chunk and specify the following paging options. sl@0: //! Following this check the paging status of the chunk by calling IsPaged(). sl@0: //! a. Not specified sl@0: //! b. Paged sl@0: //! c. Unpaged sl@0: //! 2. Create a local, double ended, chunk and specify aMaxSize to be negative sl@0: //! 3. Create a local, double ended, chunk and specify aInitialBottom to be negative sl@0: //! 4. Create a local, double ended, chunk and specify aInitialTop to be negative. sl@0: //! 5. Create a local, double ended, chunk and specify aInitialBottom to be greater than aInitialTop. sl@0: //! 6. Create a local, double ended, chunk and specify aInitialTop to be greater than aMaxSize. sl@0: //! sl@0: //! @SYMTestExpectedResults sl@0: //! 1. 1. The following results are expected: sl@0: //! a. The chunk should take on the paging status of the process sl@0: //! b. ETrue sl@0: //! c. EFalse sl@0: //! 2. Panic USER99 sl@0: //! 3. Panic USER120 sl@0: //! 4. Panic USER121 sl@0: //! 5. Panic USER122 sl@0: //! 6. Panic USER123 sl@0: //! sl@0: //! @SYMTestPriority High sl@0: //! @SYMTestStatus Implemented sl@0: //---------------------------------------------------------------------------------------------- sl@0: void TestLocDEChunk() sl@0: { sl@0: test.Start(_L("Test RChunk::CreateDoubleEndedLocal - paging attributes")); sl@0: { sl@0: TChunkCreateInfo createInfo; sl@0: createInfo.SetDoubleEnded(0, gPageSize, gPageSize); sl@0: VerifyChunkPaged(createInfo); sl@0: // Test default create method sl@0: TInt r = gChunk.CreateDoubleEndedLocal(0, gPageSize, gPageSize); sl@0: VerifyChunkPaged(gChunk, gProcessPaged, r); sl@0: } sl@0: sl@0: sl@0: test.Next(_L("Test RChunk::CreateDoubleEndedLocal - invalid max size")); sl@0: TestPanicChunkCreate2(ECreateLocalDE, 0, gPageSize, -1, EChkCreateMaxSizeNegative); sl@0: sl@0: test.Next(_L("Test RChunk::CreateDoubleEndedLocal - invalid bottom")); sl@0: TestPanicChunkCreate2(ECreateLocalDE, -1, gPageSize, gPageSize, EChkCreateBottomNegative); sl@0: sl@0: test.Next(_L("Test RChunk::CreateDoubleEndedLocal - invalid top")); sl@0: TestPanicChunkCreate2(ECreateLocalDE, 0, -1, gPageSize, EChkCreateTopNegative); sl@0: sl@0: test.Next(_L("Test RChunk::CreateDoubleEndedLocal - bottom > top")); sl@0: TestPanicChunkCreate2(ECreateLocalDE, gPageSize, 0, gPageSize, EChkCreateTopLessThanBottom); sl@0: sl@0: test.Next(_L("Test RChunk::CreateDoubleEndedLocal - top > max size")); sl@0: TestPanicChunkCreate2(ECreateLocalDE, 0, gPageSize << 1, gPageSize, EChkCreateTopBiggerThanMax); sl@0: sl@0: test.End(); sl@0: } sl@0: sl@0: sl@0: // sl@0: // TestGlobDEChunk sl@0: // sl@0: //---------------------------------------------------------------------------------------------- sl@0: //! @SYMTestCaseID KBASE-T_CHUNKCREATE-xxxx sl@0: //! @SYMTestType UT sl@0: //! @SYMPREQ PREQ1954 sl@0: //! @SYMTestCaseDesc Verify the global double ended chunk creation implementation sl@0: //! @SYMTestActions sl@0: //! 1. Create a global, double ended, chunk and specify the following paging options. sl@0: //! Following this check the paging status of the chunk by calling IsPaged(). sl@0: //! a. Not specified sl@0: //! b. Paged sl@0: //! c. Unpaged sl@0: //! 2. Create a global, double ended, chunk and specify aMaxSize to be negative sl@0: //! 3. Create a global, double ended, chunk and specify aInitialBottom to be negative sl@0: //! 4. Create a global, double ended, chunk and specify aInitialTop to be negative. sl@0: //! 5. Create a global, double ended, chunk and specify aInitialBottom to be greater than aInitialTop. sl@0: //! 6. Create a global, double ended, chunk and specify aInitialBottom to be greater than aMaxSize. sl@0: //! 7. Create a global, double ended, chunk and specify aInitialTop to be greater than aMaxSize. sl@0: //! sl@0: //! @SYMTestExpectedResults sl@0: //! 1. 1. The following results are expected: sl@0: //! a. The chunk should take on the paging status of the process sl@0: //! b. ETrue sl@0: //! c. EFalse sl@0: //! 2. Panic USER99 sl@0: //! 3. Panic USER120 sl@0: //! 4. Panic USER121 sl@0: //! 5. Panic USER122 sl@0: //! 6. Panic USER123 sl@0: //! 7. Panic USER123 sl@0: //! sl@0: //! @SYMTestPriority High sl@0: //! @SYMTestStatus Implemented sl@0: //---------------------------------------------------------------------------------------------- sl@0: void TestGlobDEChunk() sl@0: { sl@0: test.Start(_L("Test RChunk::CreateDoubleEndedGlobal - paging attributes")); sl@0: { sl@0: TChunkCreateInfo createInfo; sl@0: createInfo.SetDoubleEnded(0, gPageSize, gPageSize); sl@0: createInfo.SetGlobal(KGlobalChunkName); sl@0: VerifyChunkPaged(createInfo); sl@0: // Test default create method sl@0: TInt r = gChunk.CreateDoubleEndedLocal(0, gPageSize, gPageSize); sl@0: VerifyChunkPaged(gChunk, gProcessPaged, r); sl@0: } sl@0: sl@0: sl@0: test.Next(_L("Test RChunk::CreateDoubleEndedGlobal - invalid max size")); sl@0: TestPanicChunkCreate2(ECreateGlobalDE, 0, gPageSize, -1, EChkCreateMaxSizeNegative); sl@0: sl@0: test.Next(_L("Test RChunk::CreateDoubleEndedGlobal - invalid bottom")); sl@0: TestPanicChunkCreate2(ECreateGlobalDE, -1, gPageSize, gPageSize, EChkCreateBottomNegative); sl@0: sl@0: test.Next(_L("Test RChunk::CreateDoubleEndedGlobal - invalid top")); sl@0: TestPanicChunkCreate2(ECreateGlobalDE, 0, -1, gPageSize, EChkCreateTopNegative); sl@0: sl@0: test.Next(_L("Test RChunk::CreateDoubleEndedGlobal - bottom > top")); sl@0: TestPanicChunkCreate2(ECreateGlobalDE, gPageSize, 0, gPageSize, EChkCreateTopLessThanBottom); sl@0: sl@0: test.Next(_L("Test RChunk::CreateDoubleEndedGlobal - top > max size")); sl@0: TestPanicChunkCreate2(ECreateGlobalDE, 0, gPageSize << 1, gPageSize, EChkCreateTopBiggerThanMax); sl@0: test.End(); sl@0: } sl@0: sl@0: sl@0: // sl@0: // TestLocDiscChunk sl@0: // sl@0: //---------------------------------------------------------------------------------------------- sl@0: //! @SYMTestCaseID KBASE-T_CHUNKCREATE-xxxx sl@0: //! @SYMTestType UT sl@0: //! @SYMPREQ PREQ1954 sl@0: //! @SYMTestCaseDesc Verify the local disconnected chunk creation implementation sl@0: //! @SYMTestActions sl@0: //! 1. Create a local, disconnected chunk and specify the following paging options. sl@0: //! Following this check the paging status of the chunk by calling IsPaged(). sl@0: //! a. Not specified sl@0: //! b. Paged sl@0: //! c. Unpaged sl@0: //! 2. Create a local, disconnected chunk and specify aMaxSize to be negative sl@0: //! 3. Create a local, disconnected chunk and specify aInitialBottom to be negative sl@0: //! 4. Create a local, disconnected chunk and specify aInitialTop to be negative. sl@0: //! 5. Create a local, disconnected chunk and specify aInitialBottom to be greater than aInitialTop. sl@0: //! 6. Create a local, disconnected chunk and specify aInitialBottom to be greater than aMaxSize. sl@0: //! 7. Create local, disconnected chunk and specify aInitialTop to be greater than aMaxSize. sl@0: //! sl@0: //! @SYMTestExpectedResults sl@0: //! 1. 1. The following results are expected: sl@0: //! a. The chunk should take on the paging status of the process sl@0: //! b. ETrue sl@0: //! c. EFalse sl@0: //! 2. Panic USER99 sl@0: //! 3. Panic USER120 sl@0: //! 4. Panic USER121 sl@0: //! 5. Panic USER122 sl@0: //! 6. Panic USER123 sl@0: //! 7. Panic USER123 sl@0: //! sl@0: //! @SYMTestPriority High sl@0: //! @SYMTestStatus Implemented sl@0: //---------------------------------------------------------------------------------------------- sl@0: void TestLocDiscChunk() sl@0: { sl@0: test.Start(_L("Test RChunk::CreateDisconnectedLocal - paging attributes")); sl@0: { sl@0: TChunkCreateInfo createInfo; sl@0: createInfo.SetDisconnected(0, gPageSize, gPageSize); sl@0: VerifyChunkPaged(createInfo); sl@0: // Test default create method sl@0: TInt r = gChunk.CreateDoubleEndedLocal(0, gPageSize, gPageSize); sl@0: VerifyChunkPaged(gChunk, gProcessPaged, r); sl@0: } sl@0: sl@0: sl@0: test.Next(_L("Test RChunk::CreateDisconnectedLocal - invalid max size")); sl@0: TestPanicChunkCreate2(ECreateLocalDC, 0, gPageSize, -1, EChkCreateMaxSizeNegative); sl@0: sl@0: test.Next(_L("Test RChunk::CreateDisconnectedLocal - invalid bottom")); sl@0: TestPanicChunkCreate2(ECreateLocalDC, -1, gPageSize, gPageSize, EChkCreateBottomNegative); sl@0: sl@0: test.Next(_L("Test RChunk::CreateDisconnectedLocal - invalid top")); sl@0: TestPanicChunkCreate2(ECreateLocalDC, 0, -1, gPageSize, EChkCreateTopNegative); sl@0: sl@0: test.Next(_L("Test RChunk::CreateDisconnectedLocal - bottom > top")); sl@0: TestPanicChunkCreate2(ECreateLocalDC, gPageSize, 0, gPageSize, EChkCreateTopLessThanBottom); sl@0: sl@0: test.Next(_L("Test RChunk::CreateDisconnectedLocal - top > max size")); sl@0: TestPanicChunkCreate2(ECreateLocalDC, 0, gPageSize << 1, gPageSize, EChkCreateTopBiggerThanMax); sl@0: sl@0: test.End(); sl@0: } sl@0: sl@0: sl@0: // sl@0: // TestGlobDiscChunk sl@0: // sl@0: //---------------------------------------------------------------------------------------------- sl@0: //! @SYMTestCaseID KBASE-T_CHUNKCREATE-xxxx sl@0: //! @SYMTestType UT sl@0: //! @SYMPREQ PREQ1954 sl@0: //! @SYMTestCaseDesc Verify the global disconnected chunk creation implementation sl@0: //! @SYMTestActions sl@0: //! 1. Create a global, disconnected chunk and specify the following paging options. sl@0: //! Following this check the paging status of the chunk by calling IsPaged(). sl@0: //! a. Not specified sl@0: //! b. Paged sl@0: //! c. Unpaged sl@0: //! 2. Create a global, disconnected chunk and specify aMaxSize to be negative sl@0: //! 3. Create a global, disconnected chunk and specify aInitialBottom to be negative sl@0: //! 4. Create a global, disconnected chunk and specify aInitialTop to be negative. sl@0: //! 5. Create a global, disconnected chunk and specify aInitialBottom to be greater than aInitialTop. sl@0: //! 6. Create a global, disconnected chunk and specify aInitialBottom to be greater than aMaxSize. sl@0: //! 7. Create global, disconnected chunk and specify aInitialTop to be greater than aMaxSize. sl@0: //! sl@0: //! @SYMTestExpectedResults sl@0: //! 1. 1. The following results are expected: sl@0: //! a. The chunk should take on the paging status of the process sl@0: //! b. ETrue sl@0: //! c. EFalse sl@0: //! 2. Panic USER99 sl@0: //! 3. Panic USER120 sl@0: //! 4. Panic USER121 sl@0: //! 5. Panic USER122 sl@0: //! 6. Panic USER123 sl@0: //! 7. Panic USER123 sl@0: //! sl@0: //! @SYMTestPriority High sl@0: //! @SYMTestStatus Implemented sl@0: //---------------------------------------------------------------------------------------------- sl@0: void TestGlobDiscChunk() sl@0: { sl@0: test.Start(_L("Test RChunk::CreateDisconnectedGlobal - paging attributes")); sl@0: { sl@0: TChunkCreateInfo createInfo; sl@0: createInfo.SetDisconnected(0, gPageSize, gPageSize); sl@0: createInfo.SetGlobal(KGlobalChunkName); sl@0: VerifyChunkPaged(createInfo); sl@0: // Test default create method sl@0: TInt r = gChunk.CreateDoubleEndedLocal(0, gPageSize, gPageSize); sl@0: VerifyChunkPaged(gChunk, gProcessPaged, r); sl@0: } sl@0: sl@0: sl@0: test.Next(_L("Test RChunk::CreateDisconnectedGlobal - invalid max size")); sl@0: TestPanicChunkCreate2(ECreateGlobalDC, 0, gPageSize, -1, EChkCreateMaxSizeNegative); sl@0: sl@0: test.Next(_L("Test RChunk::CreateDisconnectedGlobal - invalid bottom")); sl@0: TestPanicChunkCreate2(ECreateGlobalDC, -1, gPageSize, gPageSize, EChkCreateBottomNegative); sl@0: sl@0: test.Next(_L("Test RChunk::CreateDisconnectedGlobal - invalid top")); sl@0: TestPanicChunkCreate2(ECreateGlobalDC, 0, -1, gPageSize, EChkCreateTopNegative); sl@0: sl@0: test.Next(_L("Test RChunk::CreateDisconnectedGlobal - bottom > top")); sl@0: TestPanicChunkCreate2(ECreateGlobalDC, gPageSize, 0, gPageSize, EChkCreateTopLessThanBottom); sl@0: sl@0: test.Next(_L("Test RChunk::CreateDisconnectedGlobal - top > max size")); sl@0: TestPanicChunkCreate2(ECreateGlobalDC, 0, gPageSize << 1, gPageSize, EChkCreateTopBiggerThanMax); sl@0: sl@0: test.End(); sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: TInt TestingTChunkCreate() sl@0: { sl@0: test.Start(_L("Test TChunkCreateInfo - Local Chunk")); sl@0: TestLocalChunk(); sl@0: sl@0: test.Next(_L("Test TChunkCreateInfo - Code Chunk")); sl@0: TestCodeChunk(); sl@0: sl@0: test.Next(_L("Test TChunkCreateInfo - Global Chunk")); sl@0: TestGlobalChunk(); sl@0: sl@0: test.Next(_L("Test TChunkCreateInfo - Local Double Ended Chunk")); sl@0: TestLocDEChunk(); sl@0: sl@0: test.Next(_L("Test TChunkCreateInfo - Global Double Ended Chunk")); sl@0: TestGlobDEChunk(); sl@0: sl@0: test.Next(_L("Test TChunkCreateInfo - Local Disconnected Chunk")); sl@0: TestLocDiscChunk(); sl@0: sl@0: test.Next(_L("Test TChunkCreateInfo - Global Disconnected Chunk")); sl@0: TestGlobDiscChunk(); sl@0: sl@0: test.End(); sl@0: return 0; sl@0: }