1 // Copyright (c) 2007-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 // Perform first set of File Operations as per the Test Specification |
|
15 // |
|
16 // |
|
17 |
|
18 #include "sdfileoperations1.h" |
|
19 |
|
20 /* |
|
21 Class constructor |
|
22 |
|
23 @param None |
|
24 @return None |
|
25 */ |
|
26 CBaseTestSDFileOperations1::CBaseTestSDFileOperations1() |
|
27 { |
|
28 SetTestStepName(KTestStepFileOperations1); |
|
29 } |
|
30 |
|
31 /* |
|
32 Test step |
|
33 |
|
34 @param None |
|
35 @return EPass if successful or EFail if not |
|
36 @see TVerdict |
|
37 */ |
|
38 TVerdict CBaseTestSDFileOperations1::doTestStepL() |
|
39 { |
|
40 if (TestStepResult() == EPass) |
|
41 { |
|
42 TInt r; |
|
43 TBuf<4> sessionPath; |
|
44 sessionPath.Format(_L("%c:\\"), 'A' + iDrive); |
|
45 r = iFs.SetSessionPath(sessionPath); |
|
46 if (r != KErrNone) |
|
47 { |
|
48 ERR_PRINTF3(_L("Could not set session path to %c: (r = %d)"), 'A' + iDrive, r); |
|
49 SetTestStepResult(EFail); |
|
50 return TestStepResult(); |
|
51 } |
|
52 if (SetVolumeName() != iExpectedErrorCode) |
|
53 { |
|
54 SetTestStepResult(EFail); |
|
55 return TestStepResult(); |
|
56 } |
|
57 if (CreateRootEntries() != iExpectedErrorCode) |
|
58 { |
|
59 SetTestStepResult(EFail); |
|
60 return TestStepResult(); |
|
61 } |
|
62 if (ExpandRootFiles() != iExpectedErrorCode) |
|
63 { |
|
64 SetTestStepResult(EFail); |
|
65 return TestStepResult(); |
|
66 } |
|
67 if (DeleteRootDirs() != iExpectedErrorCode) |
|
68 { |
|
69 SetTestStepResult(EFail); |
|
70 return TestStepResult(); |
|
71 } |
|
72 if (RenameFile(_L("file000"), _L("LONG FILE NAME")) != iExpectedErrorCode) |
|
73 { |
|
74 SetTestStepResult(EFail); |
|
75 return TestStepResult(); |
|
76 } |
|
77 TBuf<50> subdir; |
|
78 subdir.Format(_L("\\dir%03d\\"), iRootEntries / 2 - 1); |
|
79 if (CreateSubDirEntries(subdir) != iExpectedErrorCode) |
|
80 { |
|
81 SetTestStepResult(EFail); |
|
82 return TestStepResult(); |
|
83 } |
|
84 if (RenameFile(_L("file001"), _L("Large File")) != iExpectedErrorCode) |
|
85 { |
|
86 SetTestStepResult(EFail); |
|
87 return TestStepResult(); |
|
88 } |
|
89 if (ExpandFile(_L("Large File"), iLargeFileSize) != iExpectedErrorCode) |
|
90 { |
|
91 SetTestStepResult(EFail); |
|
92 return TestStepResult(); |
|
93 } |
|
94 if (CopyFile(_L("file002"), _L("C:\\")) != KErrNone) |
|
95 { |
|
96 SetTestStepResult(EFail); |
|
97 return TestStepResult(); |
|
98 } |
|
99 } |
|
100 else |
|
101 { |
|
102 INFO_PRINTF1(_L("Test preamble did not complete succesfully - Test Step skipped")); |
|
103 } |
|
104 return TestStepResult(); |
|
105 } |
|