|
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 "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 // Examine the space left on the given disk |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 @internalTechnology |
|
21 */ |
|
22 |
|
23 #include "te_sysutilsoomtest.h" |
|
24 |
|
25 |
|
26 /** |
|
27 Destructor |
|
28 */ |
|
29 CSysUtilsOOMTestStep::~CSysUtilsOOMTestStep() |
|
30 { |
|
31 iFs.Close(); |
|
32 } |
|
33 |
|
34 /** |
|
35 Constructor |
|
36 */ |
|
37 CSysUtilsOOMTestStep::CSysUtilsOOMTestStep() |
|
38 { |
|
39 SetTestStepName(KSysUtilsOOMTestStep); |
|
40 } |
|
41 |
|
42 |
|
43 TVerdict CSysUtilsOOMTestStep::doTestStepPreambleL() |
|
44 { |
|
45 iFs.Connect(); |
|
46 return TestStepResult(); |
|
47 } |
|
48 |
|
49 TVerdict CSysUtilsOOMTestStep::doTestStepPostambleL() |
|
50 { |
|
51 iFs.Close(); |
|
52 return TestStepResult(); |
|
53 } |
|
54 |
|
55 /** |
|
56 @SYMTestCaseID SYSLIB-BAFL-CT-4021 |
|
57 @SYMREQ REQ1872, REQ1870, CR1328 |
|
58 @SYMDEF DEF141094 |
|
59 @SYMTestCaseDesc OOMTest |
|
60 @SYMTestPriority HIGH |
|
61 @SYMTestStatus Implemented |
|
62 @SYMTestActions For each of the SysUtil methods set the !OOM flag in |
|
63 @SYMTestActions the script file then call the method. |
|
64 @SYMTestExpectedResults Out of memory conditions is handled correctly by each method. |
|
65 */ |
|
66 TVerdict CSysUtilsOOMTestStep::doTestStepL() |
|
67 { |
|
68 _LIT(KSWMethod, "GetSWVersion"); |
|
69 _LIT(KLangMethod, "GetLangVersion"); |
|
70 _LIT(KLangSWMethod, "GetLangSWVersion"); |
|
71 _LIT(KDiskMethod, "DiskSpaceBelowCriticalLevelL"); |
|
72 _LIT(KFFSMethod, "FFSSpaceBelowCriticalLevelL"); |
|
73 _LIT(KMmcMethod, "MMCSpaceBelowCriticalLevelL"); |
|
74 _LIT(KDeviceTypeInfoMethod, "GetDeviceTypeInfoL"); |
|
75 _LIT(KPRInformationMethod, "GetPRInformation"); |
|
76 |
|
77 _LIT16(kDummy,"xxxxx"); |
|
78 |
|
79 TBuf16<KSysUtilVersionTextLength> version; |
|
80 version.Insert(0,kDummy); |
|
81 |
|
82 TInt err = DeletePSProperties(); |
|
83 if(err != KErrNone) |
|
84 { |
|
85 WARN_PRINTF2(_L("Could not delete P&S properties. Error = %d"), err); |
|
86 SetTestStepResult(EAbort); |
|
87 return TestStepResult(); |
|
88 } |
|
89 INFO_PRINTF1(_L("Deleted P&S properties successfully.")); |
|
90 |
|
91 err = SysUtil::GetSWVersion(version); |
|
92 ProcessError(KSWMethod, err); |
|
93 |
|
94 err = SysUtil::GetLangVersion(version); |
|
95 ProcessError(KLangMethod, err); |
|
96 |
|
97 err = SysUtil::GetLangSWVersion(version); |
|
98 ProcessError(KLangSWMethod, err); |
|
99 |
|
100 TRAP(err, SysUtil::DiskSpaceBelowCriticalLevelL(&iFs, 0, EDriveC)); |
|
101 ProcessError(KDiskMethod, err); |
|
102 |
|
103 TRAP(err, SysUtil::FFSSpaceBelowCriticalLevelL(NULL, 0)); |
|
104 ProcessError(KFFSMethod, err); |
|
105 |
|
106 TRAP(err, SysUtil::MMCSpaceBelowCriticalLevelL(NULL, 0)); |
|
107 ProcessError(KMmcMethod, err); |
|
108 |
|
109 CDeviceTypeInformation* attribs = NULL; |
|
110 TRAP(err, attribs = SysUtil::GetDeviceTypeInfoL()); |
|
111 ProcessError(KDeviceTypeInfoMethod, err); |
|
112 delete attribs; |
|
113 |
|
114 err = SysUtil::GetPRInformation(version); |
|
115 ProcessError(KPRInformationMethod, err); |
|
116 |
|
117 return TestStepResult(); |
|
118 } |
|
119 |
|
120 void CSysUtilsOOMTestStep::ProcessError(const TDesC& aMethod, TInt aErr) |
|
121 { |
|
122 //This only prints out if an error occurs as !OOM doesn't check for failures |
|
123 if ((aErr !=KErrNone) && (aErr !=KErrNoMemory)) |
|
124 { |
|
125 ERR_PRINTF1(aMethod); |
|
126 ERR_PRINTF2(_L("Error occured, error code = %d"), aErr); |
|
127 SetTestStepResult (EFail); |
|
128 } |
|
129 else if (aErr ==KErrNoMemory) |
|
130 { |
|
131 INFO_PRINTF1(aMethod); |
|
132 INFO_PRINTF1(_L("KErrNoMemory caught ")); |
|
133 } |
|
134 } |
|
135 |