|
1 /* |
|
2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.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 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "t_fat32checkdisk.h" |
|
20 |
|
21 /** |
|
22 Class Constructor |
|
23 */ |
|
24 CBaseTestFat32CheckDisk::CBaseTestFat32CheckDisk() |
|
25 { |
|
26 SetTestStepName(KTestStepCheckDisk); |
|
27 } |
|
28 |
|
29 /** |
|
30 Class Destructor |
|
31 */ |
|
32 CBaseTestFat32CheckDisk::~CBaseTestFat32CheckDisk() |
|
33 { |
|
34 } |
|
35 |
|
36 |
|
37 /** |
|
38 The function performs the following actions |
|
39 1. Verify the integrity of the disk by calling RFs::ScanDisk() |
|
40 2. Check whether the code returned match the code specified in the ini file. |
|
41 3. If scan dsik is specified in the ini file then call RFs::ScanDrive() |
|
42 |
|
43 @return EPass if test passes and EFail if test fails |
|
44 */ |
|
45 TVerdict CBaseTestFat32CheckDisk::doTestStepL() |
|
46 { |
|
47 SetTestStepResult(EFail); |
|
48 TInt r; |
|
49 _LIT(KCheckCode,"CheckCode"); |
|
50 TInt checkcode; |
|
51 _LIT(KScan,"Scan"); |
|
52 TInt scan; |
|
53 _LIT(KPassRegardless,"PassRegardless"); |
|
54 TBuf<4> passRegardless; |
|
55 TPtrC16 passregardless = passRegardless; |
|
56 TBool alright = GetIntFromConfig(ConfigSection(), KCheckCode, checkcode); |
|
57 if(alright) |
|
58 { |
|
59 TBool alright2 = GetStringFromConfig(ConfigSection(), KPassRegardless, passregardless); |
|
60 if(alright2) |
|
61 { |
|
62 // Perform a check disk. |
|
63 r=iTheFs.CheckDisk(iSessionPath); |
|
64 if (r!=checkcode) |
|
65 { |
|
66 // If the code returned does not match the code expected and would |
|
67 // like only a warning to be displayed as opposed to failing the |
|
68 // test |
|
69 if (passregardless == _L("Y")) |
|
70 { |
|
71 SetTestStepResult(EPass); |
|
72 _LIT(KErrorPass, "RFs::CheckDisk() returns %d & does not match expected value %d"); |
|
73 INFO_PRINTF3(KErrorPass, r, checkcode); |
|
74 } |
|
75 // If the code returned does not match the code expected and would |
|
76 // like to fail the test |
|
77 else |
|
78 { |
|
79 SetTestStepResult(EFail); |
|
80 _LIT(KCheckDiskFail, "RFs::CheckDisk() returns %d & does not match expected value %d"); |
|
81 INFO_PRINTF3(KCheckDiskFail, r, checkcode); |
|
82 } |
|
83 } |
|
84 else |
|
85 { |
|
86 SetTestStepResult(EPass); |
|
87 _LIT(KCheckDiskPass, "RFs::CheckDisk() returns %d & matches expected value %d"); |
|
88 INFO_PRINTF3(KCheckDiskPass, r, checkcode); |
|
89 } |
|
90 // If specified in the ini file, perform a ScanDrive on the volume |
|
91 TBool alright = GetIntFromConfig(ConfigSection(), KScan, scan); |
|
92 if(alright) |
|
93 { |
|
94 r=iTheFs.ScanDrive(iSessionPath); |
|
95 if (r!=KErrNone) |
|
96 { |
|
97 SetTestStepResult(EFail); |
|
98 _LIT(KScanFail, "RFs::ScanDrive() failed returns %d"); |
|
99 INFO_PRINTF2(KScanFail, r); |
|
100 } |
|
101 else |
|
102 { |
|
103 SetTestStepResult(EPass); |
|
104 _LIT(KScanPass, "RFs::ScanDrive() passed"); |
|
105 INFO_PRINTF1(KScanPass); |
|
106 } |
|
107 } |
|
108 else |
|
109 { |
|
110 _LIT(KNoScan, "RFs::ScanDrive() not indicated in ini file"); |
|
111 INFO_PRINTF1(KNoScan); |
|
112 } |
|
113 return TestStepResult(); |
|
114 } |
|
115 |
|
116 else |
|
117 { |
|
118 _LIT(KReadIniFail, "Could not read PassRegardless from ini file"); |
|
119 INFO_PRINTF1(KReadIniFail); |
|
120 return TestStepResult(); |
|
121 } |
|
122 } |
|
123 else |
|
124 { |
|
125 _LIT(KReadIniFail, "Could not read CheckCode from ini file"); |
|
126 INFO_PRINTF1(KReadIniFail); |
|
127 return TestStepResult(); |
|
128 } |
|
129 } |