1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of "Eclipse Public License v1.0" |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
25 #include <e32uid.h> |
25 #include <e32uid.h> |
26 #include <ssm/ssmsubstates.hrh> |
26 #include <ssm/ssmsubstates.hrh> |
27 #include <ssm/ssmcommandlist.h> |
27 #include <ssm/ssmcommandlist.h> |
28 #include <ssm/ssmcmd.hrh> |
28 #include <ssm/ssmcmd.hrh> |
29 #include <ssm/ssmcommand.h> |
29 #include <ssm/ssmcommand.h> |
|
30 #include "ssmsubstateext.hrh" |
30 |
31 |
31 #include "tgsa_step_fail.h" |
32 #include "tgsa_step_fail.h" |
32 |
33 |
33 TSsmCommandType ArrFail[] = { ESsmCmdPublishSystemState, ESsmCmdPersistHalAttributes, |
34 TSsmCommandType ArrFail[] = { ESsmCmdCustomCommand, //r_cmd_sastate |
34 ESsmCmdFinaliseDrives, ESsmCmdPowerOff }; |
35 ESsmCmdPublishSystemState, //r_cmd_publishstate |
35 |
36 ESsmCmdSetPAndSKey, //r_cmd_psstate |
|
37 ESsmCmdCustomCommand, //r_cmd_cancelmonitoring |
|
38 ESsmCmdSetPAndSKey, //r_cmd_killsplash |
|
39 ESsmCmdCustomCommand, //r_cmd_contactservice |
|
40 ESsmCmdStartApp, //r_cmd_sysap |
|
41 ESsmCmdMultipleWait //r_cmd_multiwaitforever |
|
42 }; |
36 CGsaFailTest::~CGsaFailTest() |
43 CGsaFailTest::~CGsaFailTest() |
37 { |
44 { |
38 } |
45 } |
39 |
46 |
40 CGsaFailTest::CGsaFailTest() : CGsaTestBase(KTGsaFailStep) |
47 CGsaFailTest::CGsaFailTest() : CGsaTestBase(KTGsaFailStep) |
110 New Test CaseID DEVSRVS-SSPLUGINS-GSA-0025 |
117 New Test CaseID DEVSRVS-SSPLUGINS-GSA-0025 |
111 */ |
118 */ |
112 void CGsaFailTest::doTestPrepareCommandListL() |
119 void CGsaFailTest::doTestPrepareCommandListL() |
113 { |
120 { |
114 INFO_PRINTF1(_L("> CGsaFailTest::doTestPrepareCommandListL")); |
121 INFO_PRINTF1(_L("> CGsaFailTest::doTestPrepareCommandListL")); |
115 TestPrepareCommandListL(ESsmFail ,KSsmAnySubState, KErrNone); |
122 //The default substate in the actual (fail policy) is mapped to |
116 TestPrepareCommandListL(ESsmFail ,KSsmAnySubState, KErrNone); |
123 //ESsmStateFail = 0x30 |
|
124 //Hence testing for the same. |
|
125 TestPrepareCommandListL(ESsmFail ,ESsmStateFail , KErrNone); |
117 TestPrepareCommandListL(ESsmFail ,100, KErrNotFound); |
126 TestPrepareCommandListL(ESsmFail ,100, KErrNotFound); |
118 } |
127 } |
119 |
128 |
120 /** |
129 /** |
121 Old Test CaseID AFSS-GSA-0028 |
130 Old Test CaseID AFSS-GSA-0028 |
123 */ |
132 */ |
124 void CGsaFailTest::doTestCommandListL() |
133 void CGsaFailTest::doTestCommandListL() |
125 { |
134 { |
126 INFO_PRINTF1(_L("> CGsaFailTest::doTestCommandListL")); |
135 INFO_PRINTF1(_L("> CGsaFailTest::doTestCommandListL")); |
127 |
136 |
128 TestCommandListL(ESsmFail, KSsmAnySubState, (sizeof(ArrFail)/sizeof(ArrFail[0]))); |
137 TestCommandListL(ESsmFail, ESsmStateFail, (sizeof(ArrFail)/sizeof(ArrFail[0]))); |
129 } |
138 } |
130 |
139 |
131 /** |
140 /** |
132 Old Test CaseID AFSS-GSA-0029 |
141 Old Test CaseID AFSS-GSA-0029 |
133 New Test CaseID DEVSRVS-SSPLUGINS-GSA-0025 |
142 New Test CaseID DEVSRVS-SSPLUGINS-GSA-0025 |
135 |
144 |
136 void CGsaFailTest::doTestGetNextStateL() |
145 void CGsaFailTest::doTestGetNextStateL() |
137 { |
146 { |
138 CGsaStatePolicyFail* policy = CreateAndInitializeFailPolicyLC(); |
147 CGsaStatePolicyFail* policy = CreateAndInitializeFailPolicyLC(); |
139 |
148 |
140 TSsmState state(ESsmFail, KSsmAnySubState); |
149 TSsmState state(ESsmFail, ESsmStateFail); |
141 TSsmState result(0, 0); |
150 TSsmState result(0, 0); |
142 TestGetNextState(policy, state, KErrNone, result); |
151 TestGetNextState(policy, state, KErrNone, result); |
143 |
152 |
144 TSsmState firstState(ESsmFail, KSsmAnySubState); |
153 TSsmState firstState(ESsmFail, ESsmStateFail); |
145 TestGetNextState(policy, firstState, KErrNone, result); |
154 TestGetNextState(policy, firstState, KErrNone, result); |
146 |
155 |
147 TSsmState unknownState(ESsmFail, 100); |
156 TSsmState unknownState(ESsmFail, 100); |
148 TestGetNextState(policy, unknownState, KErrNone, result); |
157 TestGetNextState(policy, unknownState, KErrNone, result); |
149 |
158 |
264 Helper function to test the GetNextState for each substate within fail state. |
273 Helper function to test the GetNextState for each substate within fail state. |
265 */ |
274 */ |
266 void CGsaFailTest::TestGetNextState(CGsaStatePolicyFail* aPolicy, TSsmState aCurrentTransition, TInt aError, TSsmState aResult) |
275 void CGsaFailTest::TestGetNextState(CGsaStatePolicyFail* aPolicy, TSsmState aCurrentTransition, TInt aError, TSsmState aResult) |
267 { |
276 { |
268 TRequestStatus trs; |
277 TRequestStatus trs; |
269 TSsmState state(ESsmFail, KSsmAnySubState); |
278 TSsmState state(ESsmFail, ESsmStateFail); |
270 aPolicy->PrepareCommandList(state, KErrNone, trs); |
279 aPolicy->PrepareCommandList(state, KErrNone, trs); |
271 StartScheduler(); |
280 StartScheduler(); |
272 User::WaitForRequest(trs); |
281 User::WaitForRequest(trs); |
273 TEST( trs.Int() == KErrNone); |
282 TEST( trs.Int() == KErrNone); |
274 |
283 |