equal
deleted
inserted
replaced
62 TInt UserHeapAtt(TBool aPaged, TChunkHeapCreateInfo& aCreateInfo) |
62 TInt UserHeapAtt(TBool aPaged, TChunkHeapCreateInfo& aCreateInfo) |
63 { |
63 { |
64 UpdatePaged(aPaged); |
64 UpdatePaged(aPaged); |
65 |
65 |
66 RHeap* heap = UserHeap::ChunkHeap(aCreateInfo); |
66 RHeap* heap = UserHeap::ChunkHeap(aCreateInfo); |
67 |
|
68 test_NotNull(heap); |
67 test_NotNull(heap); |
69 RChunk chunk; |
68 RChunk chunk; |
70 chunk.SetHandle(heap->ChunkHandle()); |
69 chunk.SetHandle(((TestHybridHeap*) heap)->ChunkHandle()); |
71 TBool paged = chunk.IsPaged(); |
70 TBool paged = chunk.IsPaged(); |
72 chunk.Close(); |
71 chunk.Close(); |
73 return (aPaged == paged); |
72 return (aPaged == paged); |
74 } |
73 } |
75 |
74 |
213 heap = (RHeap*)UserHeap::ChunkHeap(createInfo); |
212 heap = (RHeap*)UserHeap::ChunkHeap(createInfo); |
214 if (heap == NULL) |
213 if (heap == NULL) |
215 { |
214 { |
216 test.Printf(_L("RHeap not created\n")); |
215 test.Printf(_L("RHeap not created\n")); |
217 } |
216 } |
218 test.Printf(_L("chunkHandle = %d heapHandle = %d\n"),chunky.Handle(), heap->ChunkHandle()); |
217 test.Printf(_L("chunkHandle = %d heapHandle = %d\n"),chunky.Handle(), ((TestHybridHeap*) heap)->ChunkHandle()); |
219 test_Equal(chunky.Handle(), heap->ChunkHandle()); |
218 test_Equal(chunky.Handle(), ((TestHybridHeap*) heap)->ChunkHandle()); |
220 heap->Close(); |
219 heap->Close(); |
221 } |
220 } |
222 |
221 |
223 test.Next(_L("Test SetUseChunk - calling SetCreate after")); |
222 test.Next(_L("Test SetUseChunk - calling SetCreate after")); |
224 { |
223 { |
236 heap = (RHeap*)UserHeap::ChunkHeap(createInfo); |
235 heap = (RHeap*)UserHeap::ChunkHeap(createInfo); |
237 if (heap == NULL) |
236 if (heap == NULL) |
238 { |
237 { |
239 test.Printf(_L("RHeap not created\n")); |
238 test.Printf(_L("RHeap not created\n")); |
240 } |
239 } |
241 test.Printf(_L("chunkHandle = %d heapHandle = %d\n"),chunky.Handle(), heap->ChunkHandle()); |
240 test.Printf(_L("chunkHandle = %d heapHandle = %d\n"),chunky.Handle(), ((TestHybridHeap*) heap)->ChunkHandle()); |
242 TBool isSame = EFalse; |
241 TBool isSame = EFalse; |
243 if (chunky.Handle() == heap->ChunkHandle()) |
242 if (chunky.Handle() == ((TestHybridHeap*) heap)->ChunkHandle()) |
244 isSame = ETrue; |
243 isSame = ETrue; |
245 test_Equal(EFalse, isSame); |
244 test_Equal(EFalse, isSame); |
246 heap->Close(); |
245 heap->Close(); |
247 } |
246 } |
248 |
247 |
302 createInfo.SetGrowBy(gPageSize); |
301 createInfo.SetGrowBy(gPageSize); |
303 createInfo.SetMode(UserHeap::EChunkHeapSwitchTo); |
302 createInfo.SetMode(UserHeap::EChunkHeapSwitchTo); |
304 heap = (RHeap*)UserHeap::ChunkHeap(createInfo); |
303 heap = (RHeap*)UserHeap::ChunkHeap(createInfo); |
305 test_NotNull(heap); |
304 test_NotNull(heap); |
306 RChunk chunk; |
305 RChunk chunk; |
307 chunk.SetHandle(heap->ChunkHandle()); |
306 chunk.SetHandle(((TestHybridHeap*) heap)->ChunkHandle()); |
308 TInt* numBuf = new TInt[gPageSize]; |
307 TInt* numBuf = new TInt[gPageSize]; |
309 test_NotNull(numBuf); |
308 test_NotNull(numBuf); |
310 test.Printf(_L("chunkSize = %d\n"), chunk.Size()); |
309 test.Printf(_L("chunkSize = %d\n"), chunk.Size()); |
311 test(chunk.Size() > KMinHeapGrowBy); |
310 test(chunk.Size() > KMinHeapGrowBy); |
312 delete numBuf; |
311 delete numBuf; |
321 createInfo.SetGrowBy(gPageSize * 6); |
320 createInfo.SetGrowBy(gPageSize * 6); |
322 createInfo.SetMode(UserHeap::EChunkHeapSwitchTo); |
321 createInfo.SetMode(UserHeap::EChunkHeapSwitchTo); |
323 heap = (RHeap*)UserHeap::ChunkHeap(createInfo); |
322 heap = (RHeap*)UserHeap::ChunkHeap(createInfo); |
324 test_NotNull(heap); |
323 test_NotNull(heap); |
325 RChunk chunk; |
324 RChunk chunk; |
326 chunk.SetHandle(heap->ChunkHandle()); |
325 chunk.SetHandle(((TestHybridHeap*) heap)->ChunkHandle()); |
327 TInt* numBuf = new TInt[gPageSize]; |
326 TInt* numBuf = new TInt[gPageSize]; |
328 test_Equal(NULL, numBuf); |
327 test_Equal(NULL, numBuf); |
329 |
328 |
330 delete numBuf; |
329 delete numBuf; |
331 heap->Close(); |
330 heap->Close(); |
340 createInfo.SetOffset(8); |
339 createInfo.SetOffset(8); |
341 createInfo.SetMode(UserHeap::EChunkHeapSwitchTo); |
340 createInfo.SetMode(UserHeap::EChunkHeapSwitchTo); |
342 heap = (RHeap*)UserHeap::ChunkHeap(createInfo); |
341 heap = (RHeap*)UserHeap::ChunkHeap(createInfo); |
343 TInt heapAddr = (TInt)heap; |
342 TInt heapAddr = (TInt)heap; |
344 RChunk chunk; |
343 RChunk chunk; |
345 chunk.SetHandle(heap->ChunkHandle()); |
344 chunk.SetHandle(((TestHybridHeap*) heap)->ChunkHandle()); |
346 test_Equal((TInt)chunk.Base() + 8, heapAddr); |
345 test_Equal((TInt)chunk.Base() + 8, heapAddr); |
347 test_NotNull(heap); |
346 test_NotNull(heap); |
348 heap->Close(); |
347 heap->Close(); |
349 } |
348 } |
350 |
349 |