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