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