1 /* |
|
2 * Copyright (c) 2004-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 #ifndef __T_BACKUP_RESTORE_STEP_H__ |
|
20 #define __T_BACKUP_RESTORE_STEP_H__ |
|
21 |
|
22 #include <test/testexecutestepbase.h> |
|
23 #include "tbackuprestore.h" |
|
24 |
|
25 _LIT(KTStepInstall, "INSTALL"); |
|
26 _LIT(KTStepUninstall, "UNINSTALL"); |
|
27 _LIT(KTStepBackup, "BACKUP"); |
|
28 _LIT(KTStepRestore, "RESTORE"); |
|
29 |
|
30 |
|
31 class CTBackupRestoreStepBase : public CTestStep |
|
32 { |
|
33 protected: |
|
34 CTBackupRestoreStepBase(); |
|
35 ~CTBackupRestoreStepBase(); |
|
36 virtual TVerdict doTestStepPreambleL(); |
|
37 virtual TVerdict doTestStepPostambleL(); |
|
38 // Iterates through SIS files within a step |
|
39 TBool NextPackage(); |
|
40 // The UID of the current SIS file |
|
41 TUid PackageUID(); |
|
42 // The filename of the current SIS file |
|
43 TPtrC SISFileNameL(); |
|
44 // The expected selected drive of the current package |
|
45 TChar ExpectedDriveL(); |
|
46 // Iterates through files within a SIS file |
|
47 TBool NextFile(); |
|
48 TBool NextDataFile(); |
|
49 TFileName BackupFileName(); |
|
50 // The location where the current file is [to be] installed |
|
51 TPtrC InstalledFileName(); |
|
52 TPtrC DataFileName(); |
|
53 // The location where the current file is not [to be] installed |
|
54 TPtrC WrongInstalledFileName(); |
|
55 // Utility method |
|
56 TBool Exists(TPtrC aFileName); |
|
57 // Method for creating empty files |
|
58 void TouchL(const TDesC& aFileName); |
|
59 // Utility method |
|
60 void CopyFileL(TPtrC aSourceFileName, TPtrC aDestFileName); |
|
61 // Utility method for storing backup metadata |
|
62 void WriteMetaDataL(HBufC8* aMetaData); |
|
63 // Utility method for recovering backup metadata |
|
64 HBufC8* ReadMetaDataL(TInt aBytesToCrop = 0); |
|
65 |
|
66 // test if we should write some garbage to the file, just test |
|
67 // if we can/can not restore a file that would fail its hash check |
|
68 TBool ModifyFile(); |
|
69 |
|
70 // Get the length in bytes to crop from the end of the metadata on restore. |
|
71 TInt MetaDataCropLength(); |
|
72 // utility method to Check current step result against list of expected result codes. |
|
73 void CheckExpectedResultCodesL(); |
|
74 |
|
75 private: |
|
76 TInt iCurrentPackageNumber; |
|
77 TInt iCurrentFileNumber; |
|
78 TInt iDataFileNumber; |
|
79 RFs iFs; |
|
80 }; |
|
81 |
|
82 class CTStepInstall : public CTBackupRestoreStepBase |
|
83 { |
|
84 public: |
|
85 CTStepInstall(); |
|
86 virtual TVerdict doTestStepL(); |
|
87 }; |
|
88 |
|
89 class CTStepUninstall : public CTBackupRestoreStepBase |
|
90 { |
|
91 public: |
|
92 CTStepUninstall(); |
|
93 virtual TVerdict doTestStepL(); |
|
94 }; |
|
95 |
|
96 class CTStepBackup : public CTBackupRestoreStepBase |
|
97 { |
|
98 public: |
|
99 CTStepBackup(); |
|
100 virtual TVerdict doTestStepL(); |
|
101 }; |
|
102 |
|
103 class CTStepRestore : public CTBackupRestoreStepBase |
|
104 { |
|
105 public: |
|
106 CTStepRestore(); |
|
107 virtual TVerdict doTestStepL(); |
|
108 private: |
|
109 void RestoreL(); |
|
110 }; |
|
111 |
|
112 #endif /* __T_BACKUP_RESTORE_STEP_H__ */ |
|