|
1 // Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of the License "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // f32test\manager\t_locdrv.cpp |
|
15 // |
|
16 // |
|
17 |
|
18 #include <e32test.h> |
|
19 #include <e32svr.h> |
|
20 const TUint KMaxDriveFileLen=0x00020000; |
|
21 |
|
22 LOCAL_D RTest test(_L("T_LOCDRV")); |
|
23 |
|
24 GLDEF_C TInt E32Main() |
|
25 { |
|
26 TBusLocalDrive TheLocalDrives[KMaxLocalDrives]; |
|
27 TBool isBoolean; |
|
28 |
|
29 test.Title(); |
|
30 test.Start(_L("Test Local Drive Sw")); |
|
31 |
|
32 test.Next(_L("Connect - all drives")); |
|
33 TInt i=0; |
|
34 for (; i<KMaxLocalDrives; i++) |
|
35 TheLocalDrives[i].Connect(i,isBoolean); |
|
36 |
|
37 test.Next(_L("Caps - all drives")); |
|
38 TLocalDriveCaps info; |
|
39 for (i=0;i<KMaxLocalDrives;i++) |
|
40 { |
|
41 TInt r=TheLocalDrives[i].Caps(info); |
|
42 if (r==KErrNotSupported) |
|
43 test.Printf(_L("Drive %c: Not Supported\r\n"),(i+'A')); |
|
44 else if (r==KErrNone) |
|
45 test.Printf(_L("Drive %c size: %d\r\n"),(i+'A'),info.iSize ); |
|
46 else |
|
47 { |
|
48 test.Printf(_L("Drive %c: Error %d\r\n"),(i+'A'),r); |
|
49 test.Getch(); |
|
50 } |
|
51 } |
|
52 |
|
53 TBuf8<256> wrBuf(0x100); |
|
54 TBuf8<256> rdBuf(0X100); |
|
55 |
|
56 for (TInt j=0 ; j<0x100 ; j++) |
|
57 wrBuf[j]=(TUint8)j; |
|
58 for (i=0;i<KMaxLocalDrives;i++) |
|
59 { |
|
60 rdBuf.Fill(0,0x100); |
|
61 TInt r=TheLocalDrives[i].Write((KMaxDriveFileLen-0x100),wrBuf); |
|
62 test((r==KErrNone)||(r==KErrNotSupported)); |
|
63 r=TheLocalDrives[i].Read((KMaxDriveFileLen-0x100),0x100,rdBuf); |
|
64 test((r==KErrNone)||(r==KErrNotSupported)); |
|
65 r=rdBuf.Compare(wrBuf); |
|
66 test((r==KErrNone)||(r==KErrNotFound)); |
|
67 test.Printf( _L("Drive %c Rd/Wr\r\n"),(i+'A')); |
|
68 } |
|
69 |
|
70 test.Next(_L("Drive A: Format")); |
|
71 for (i=0 ; i<0x100 ; i++) |
|
72 wrBuf[i]=0; |
|
73 |
|
74 TFormatInfo formatInfo; |
|
75 |
|
76 TInt r=TheLocalDrives[0].Format(formatInfo); |
|
77 test((r==KErrNone)||(r==KErrNotSupported)); |
|
78 r=TheLocalDrives[0].Read((KMaxDriveFileLen-0x100),0x100,rdBuf); |
|
79 test((r==KErrNone)||(r==KErrNotSupported)); |
|
80 r=rdBuf.Compare(wrBuf); |
|
81 test((r==KErrNone)||(r==KErrNotFound)); |
|
82 |
|
83 test.End(); |
|
84 |
|
85 return(0); |
|
86 } |
|
87 |