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". |
36 #include <centralrepository.h> |
36 #include <centralrepository.h> |
37 |
37 |
38 //Exe name which defines startup PS keys |
38 //Exe name which defines startup PS keys |
39 _LIT (KExeToDefineStartUpPS, "\\sys\\bin\\definestartupps.exe"); |
39 _LIT (KExeToDefineStartUpPS, "\\sys\\bin\\definestartupps.exe"); |
40 _LIT(KStartUpPSKeys, "startupkeys"); |
40 _LIT(KStartUpPSKeys, "startupkeys"); |
|
41 const TUint32 KMiscPluginPropertyKey = 0x2000E658; |
|
42 const TUid KPropertyCategory={0x2000D75B}; |
41 |
43 |
42 CCustomCmdTestPublishStartupMode::~CCustomCmdTestPublishStartupMode() |
44 CCustomCmdTestPublishStartupMode::~CCustomCmdTestPublishStartupMode() |
43 { |
45 { |
44 delete iActiveScheduler; |
46 delete iActiveScheduler; |
45 delete iAsyncStopScheduler; |
47 delete iAsyncStopScheduler; |
91 iActiveScheduler = new(ELeave) CActiveScheduler; |
93 iActiveScheduler = new(ELeave) CActiveScheduler; |
92 CActiveScheduler::Install (iActiveScheduler); |
94 CActiveScheduler::Install (iActiveScheduler); |
93 |
95 |
94 //Needed for calling callback for stopping active scheduler |
96 //Needed for calling callback for stopping active scheduler |
95 iAsyncStopScheduler = new(ELeave) CAsyncCallBack(CActive::EPriorityIdle); |
97 iAsyncStopScheduler = new(ELeave) CAsyncCallBack(CActive::EPriorityIdle); |
96 |
98 |
|
99 // Setting the P and S key will route the request to the reference plugins instead of the actual plugins |
|
100 TInt err = RProperty::Define(KPropertyCategory, KMiscPluginPropertyKey, RProperty::EInt); |
|
101 TEST(KErrNone == err || KErrAlreadyExists == err); |
|
102 err = RProperty::Set(KPropertyCategory, KMiscPluginPropertyKey, 1); |
|
103 TEST (KErrNone == err); |
|
104 |
97 INFO_PRINTF1(_L("Define global startup mode property")); |
105 INFO_PRINTF1(_L("Define global startup mode property")); |
98 |
106 |
99 //Start the test exe which defines startup related property keys |
107 //Start the test exe which defines startup related property keys |
100 TInt err = process.Create(KExeToDefineStartUpPS, KStartUpPSKeys()); |
108 err = process.Create(KExeToDefineStartUpPS, KStartUpPSKeys()); |
101 INFO_PRINTF2(_L("Define global startup mode property process created with %d"), err); |
109 INFO_PRINTF2(_L("Define global startup mode property process created with %d"), err); |
102 TEST(KErrNone == err); |
110 TEST(KErrNone == err); |
103 User::LeaveIfError(err); |
111 User::LeaveIfError(err); |
104 process.Resume(); |
112 process.Resume(); |
105 |
113 |
114 return CTestStep::doTestStepPreambleL(); |
122 return CTestStep::doTestStepPreambleL(); |
115 } |
123 } |
116 |
124 |
117 TVerdict CCustomCmdTestPublishStartupMode::doTestStepPostambleL() |
125 TVerdict CCustomCmdTestPublishStartupMode::doTestStepPostambleL() |
118 { |
126 { |
|
127 if (iTestStepName == KTestPublishStartupModeWithCap) |
|
128 { |
|
129 TInt err = RProperty::Delete(KPropertyCategory, KMiscPluginPropertyKey); |
|
130 TEST (KErrNone == err); |
|
131 } |
119 return CTestStep::doTestStepPostambleL(); |
132 return CTestStep::doTestStepPostambleL(); |
120 } |
133 } |
121 |
134 |
122 TVerdict CCustomCmdTestPublishStartupMode::doTestStepL() |
135 TVerdict CCustomCmdTestPublishStartupMode::doTestStepL() |
123 { |
136 { |
199 |
212 |
200 User::WaitForRequest(iRequestStatus); |
213 User::WaitForRequest(iRequestStatus); |
201 TEST(iRequestStatus == KErrNone); |
214 TEST(iRequestStatus == KErrNone); |
202 |
215 |
203 err = RProperty::Get(CSsmUiSpecific::StartupPSUid(), KPSGlobalStartupMode, startUpMode); |
216 err = RProperty::Get(CSsmUiSpecific::StartupPSUid(), KPSGlobalStartupMode, startUpMode); |
204 INFO_PRINTF3(_L("Startup mode is %d ; Expected %d"), startUpMode, 0); |
217 INFO_PRINTF3(_L("Startup mode is %d ; Expected %d"), startUpMode, EStartupModeNormal); |
205 TEST(startUpMode == 0); |
218 TEST(startUpMode == EStartupModeNormal); |
206 |
219 |
207 // Hidden Reset functionality is not supported in techview\hrp, so the request will be completed with KErrNotSupported |
220 // Hidden Reset functionality is not supported in techview\hrp, so the request will be completed with KErrNotSupported |
208 // And the hidden reset reason would same as we set in the test code, ie., ENormalStartup. |
221 // And the hidden reset reason would same as we set in the test code, ie., ENormalStartup. |
209 TInt startUpReason; |
222 TInt startUpReason; |
210 err = RProperty::Get(CSsmUiSpecific::StartupPSUid(), KPSStartupReason, startUpReason); |
223 err = RProperty::Get(CSsmUiSpecific::StartupPSUid(), KPSStartupReason, startUpReason); |
228 |
241 |
229 |
242 |
230 void CCustomCmdTestPublishStartupMode::doTestFactoryCreateAndExecuteCancelL() |
243 void CCustomCmdTestPublishStartupMode::doTestFactoryCreateAndExecuteCancelL() |
231 { |
244 { |
232 INFO_PRINTF1(_L("Entering test for factory create, execute cancel and destroy")); |
245 INFO_PRINTF1(_L("Entering test for factory create, execute cancel and destroy")); |
|
246 |
233 __UHEAP_MARK; |
247 __UHEAP_MARK; |
234 |
248 |
235 INFO_PRINTF1(_L("Testing factory create for publish startup mode")); |
249 INFO_PRINTF1(_L("Testing factory create for publish startup mode")); |
236 MSsmCustomCommand* customCommand = SsmCustomCmdFactory::CmdPublishStartupModeNewL(); |
250 MSsmCustomCommand* customCommand = SsmCustomCmdFactory::CmdPublishStartupModeNewL(); |
237 CleanupStack::PushL(customCommand); |
251 CleanupStack::PushL(customCommand); |