author | John Imhofe <john.imhofe@nokia.com> |
Mon, 21 Dec 2009 16:14:42 +0000 | |
changeset 15 | 4122176ea935 |
parent 0 | a41df078684a |
permissions | -rw-r--r-- |
0 | 1 |
/* |
15
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
2 |
* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
0 | 3 |
* All rights reserved. |
4 |
* This component and the accompanying materials are made available |
|
15
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
5 |
* under the terms of "Eclipse Public License v1.0" |
0 | 6 |
* which accompanies this distribution, and is available |
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 |
* |
|
9 |
* Initial Contributors: |
|
10 |
* Nokia Corporation - initial contribution. |
|
11 |
* |
|
12 |
* Contributors: |
|
13 |
* |
|
15
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
14 |
* Description: |
0 | 15 |
* |
16 |
*/ |
|
17 |
||
18 |
||
19 |
||
15
4122176ea935
Revision: 200948 + Removing redundant base integration tests and fixing build errors
John Imhofe <john.imhofe@nokia.com>
parents:
0
diff
changeset
|
20 |
|
0 | 21 |
#include "t_fat32readwrite.h" |
22 |
||
23 |
/** |
|
24 |
Class Constructor |
|
25 |
*/ |
|
26 |
CBaseTestFat32ReadWrite::CBaseTestFat32ReadWrite() |
|
27 |
{ |
|
28 |
SetTestStepName(KTestStepReadWrite); |
|
29 |
} |
|
30 |
||
31 |
/** |
|
32 |
Class Destructor |
|
33 |
*/ |
|
34 |
CBaseTestFat32ReadWrite::~CBaseTestFat32ReadWrite() |
|
35 |
{ |
|
36 |
} |
|
37 |
||
38 |
/** |
|
39 |
Writes and reads a file on the drive |
|
40 |
The disk should be removed while doing read or write operation. |
|
41 |
||
42 |
@return EPass if test passes and EFail if test fails |
|
43 |
*/ |
|
44 |
TVerdict CBaseTestFat32ReadWrite::doTestStepL() |
|
45 |
{ |
|
46 |
SetTestStepResult(EPass); |
|
47 |
||
48 |
TInt r; |
|
49 |
RFile rfile; |
|
50 |
_LIT(KFileCreate, "RFs::Replace, expecting KErrNone"); |
|
51 |
_LIT(KTestFilename, "%c:\\TEST.txt"); |
|
52 |
TBuf<255> testFilename; |
|
53 |
testFilename.Format(KTestFilename, (TUint)iDriveToTest); |
|
54 |
r = rfile.Replace(iTheFs,testFilename, EFileWrite); |
|
55 |
FAT_TEST(r == KErrNone, KFileCreate); |
|
56 |
||
57 |
_LIT(KData, "Testing file operation"); |
|
58 |
TBuf8<25> buffer; |
|
59 |
buffer.Copy(KData); |
|
60 |
TUint index = 0; |
|
61 |
TInt pos = 0; |
|
62 |
||
63 |
while(index++<1000) |
|
64 |
{ |
|
65 |
r = rfile.Write(buffer); |
|
66 |
if(r == KErrNotReady) |
|
67 |
{ |
|
68 |
INFO_PRINTF2(_L("Write Failed:%d"), r); |
|
69 |
break; |
|
70 |
} |
|
71 |
} |
|
72 |
if(r == KErrNone) |
|
73 |
{ |
|
74 |
rfile.Seek(ESeekStart, pos); |
|
75 |
index = 0; |
|
76 |
while(index++ < 1000) |
|
77 |
{ |
|
78 |
rfile.Read(buffer, 25); |
|
79 |
if(r==KErrNotReady) |
|
80 |
{ |
|
81 |
INFO_PRINTF2(_L("Read Failed:%d"), r); |
|
82 |
break; |
|
83 |
} |
|
84 |
} |
|
85 |
} |
|
86 |
rfile.Close(); |
|
87 |
return TestStepResult(); |
|
88 |
} |
|
89 |