30 |
30 |
31 #include <ssm/ssmuiproviderdll.h> |
31 #include <ssm/ssmuiproviderdll.h> |
32 #include <ssm/startupdomainpskeys.h> |
32 #include <ssm/startupdomainpskeys.h> |
33 #include <ssm/starterdomaincrkeys.h> |
33 #include <ssm/starterdomaincrkeys.h> |
34 #include <e32property.h> |
34 #include <e32property.h> |
|
35 #include <e32cmn.h> |
35 #include <centralrepository.h> |
36 #include <centralrepository.h> |
36 |
37 |
37 //Exe name which defines startup PS keys |
38 //Exe name which defines startup PS keys |
38 _LIT (KExeToDefineStartUpPS, "\\sys\\bin\\definestartupps.exe"); |
39 _LIT (KExeToDefineStartUpPS, "\\sys\\bin\\definestartupps.exe"); |
39 _LIT(KStartUpPSKeys, "startupkeys"); |
40 _LIT(KStartUpPSKeys, "startupkeys"); |
42 { |
43 { |
43 delete iActiveScheduler; |
44 delete iActiveScheduler; |
44 delete iAsyncStopScheduler; |
45 delete iAsyncStopScheduler; |
45 } |
46 } |
46 |
47 |
47 CCustomCmdTestPublishStartupMode::CCustomCmdTestPublishStartupMode() |
48 CCustomCmdTestPublishStartupMode::CCustomCmdTestPublishStartupMode(const TDesC& aTestStepName):iTestStepName(aTestStepName) |
48 { |
49 { |
49 SetTestStepName(KTCCustomCmdTestPublishStartupMode); |
50 if (iTestStepName == KTestPublishStartupModeWithCap) |
50 } |
51 { |
51 |
52 SetTestStepName(KTestPublishStartupModeWithCap); |
52 // |
53 } |
|
54 else |
|
55 { |
|
56 SetTestStepName(KTestPublishStartupModeWithoutCap); |
|
57 } |
|
58 } |
|
59 |
|
60 |
53 static TInt CallBackL(TAny* aCCustomCmdTestPublishStartupMode) |
61 static TInt CallBackL(TAny* aCCustomCmdTestPublishStartupMode) |
54 { |
62 { |
55 //Call back function to stop active scheduler |
63 //Call back function to stop active scheduler |
56 CCustomCmdTestPublishStartupMode* test = reinterpret_cast<CCustomCmdTestPublishStartupMode*>(aCCustomCmdTestPublishStartupMode); |
64 CCustomCmdTestPublishStartupMode* test = reinterpret_cast<CCustomCmdTestPublishStartupMode*>(aCCustomCmdTestPublishStartupMode); |
57 test->CallBackRunL(); |
65 test->CallBackRunL(); |
72 } |
80 } |
73 } |
81 } |
74 |
82 |
75 TVerdict CCustomCmdTestPublishStartupMode::doTestStepPreambleL() |
83 TVerdict CCustomCmdTestPublishStartupMode::doTestStepPreambleL() |
76 { |
84 { |
77 INFO_PRINTF1(_L("doTestStepPreambleL")); |
85 INFO_PRINTF1(_L("doTestStepPreambleL")); |
78 //Create and install active scheduler |
86 if (iTestStepName == KTestPublishStartupModeWithCap) |
79 iActiveScheduler = new(ELeave) CActiveScheduler; |
87 { |
80 CActiveScheduler::Install (iActiveScheduler); |
88 RProcess process; |
81 |
89 CleanupClosePushL(process); |
82 //Needed for calling callback for stopping active scheduler |
90 //Create and install active scheduler |
83 iAsyncStopScheduler = new(ELeave) CAsyncCallBack(CActive::EPriorityIdle); |
91 iActiveScheduler = new(ELeave) CActiveScheduler; |
84 |
92 CActiveScheduler::Install (iActiveScheduler); |
85 INFO_PRINTF1(_L("Define global startup mode property")); |
93 |
86 |
94 //Needed for calling callback for stopping active scheduler |
87 RProcess process; |
95 iAsyncStopScheduler = new(ELeave) CAsyncCallBack(CActive::EPriorityIdle); |
88 //Start the test exe which defines startup related property keys |
96 |
89 TInt err = process.Create(KExeToDefineStartUpPS, KStartUpPSKeys()); |
97 INFO_PRINTF1(_L("Define global startup mode property")); |
90 INFO_PRINTF2(_L("Define global startup mode property process created with %d"), err); |
98 |
91 TEST(KErrNone == err); |
99 //Start the test exe which defines startup related property keys |
92 User::LeaveIfError(err); |
100 TInt err = process.Create(KExeToDefineStartUpPS, KStartUpPSKeys()); |
93 process.Resume(); |
101 INFO_PRINTF2(_L("Define global startup mode property process created with %d"), err); |
94 |
102 TEST(KErrNone == err); |
95 process.Rendezvous(iRequestStatus); |
103 User::LeaveIfError(err); |
96 User::WaitForRequest(iRequestStatus); |
104 process.Resume(); |
97 TEST(KErrNone == iRequestStatus.Int()); |
105 |
98 |
106 process.Rendezvous(iRequestStatus); |
99 //Kill the define startup ps process |
107 User::WaitForRequest(iRequestStatus); |
100 process.Kill(KErrNone); |
108 TEST(KErrNone == iRequestStatus.Int()); |
101 process.Close(); |
109 |
102 |
110 //Kill the define startup ps process |
|
111 process.Kill(KErrNone); |
|
112 CleanupStack::PopAndDestroy(&process); |
|
113 } |
103 return CTestStep::doTestStepPreambleL(); |
114 return CTestStep::doTestStepPreambleL(); |
104 } |
115 } |
105 |
116 |
106 TVerdict CCustomCmdTestPublishStartupMode::doTestStepPostambleL() |
117 TVerdict CCustomCmdTestPublishStartupMode::doTestStepPostambleL() |
107 { |
118 { |
110 |
121 |
111 TVerdict CCustomCmdTestPublishStartupMode::doTestStepL() |
122 TVerdict CCustomCmdTestPublishStartupMode::doTestStepL() |
112 { |
123 { |
113 INFO_PRINTF1(_L("Entering test for publish startup mode custom command")); |
124 INFO_PRINTF1(_L("Entering test for publish startup mode custom command")); |
114 __UHEAP_MARK; |
125 __UHEAP_MARK; |
115 |
126 RProcess process(KCurrentProcessHandle); |
116 TRAPD(err, doTestCreateExecuteAndDestroyL()); |
127 if(!(process.HasCapability(ECapabilityPowerMgmt) && |
117 TEST(err == KErrNone); |
128 process.HasCapability(ECapabilityWriteDeviceData)&& |
118 |
129 process.HasCapability(ECapabilityProtServ))) |
119 TRAP(err, doTestFactoryCreateAndExecuteCancelL()); |
130 { |
120 TEST(err == KErrNone); |
131 TUid KCentRepId = {0x101f8762}; |
121 |
132 CRepository* repository = NULL; |
|
133 repository = CRepository::NewL(KCentRepId); |
|
134 |
|
135 TInt ret = repository->Set(KStartupReason, ENormalStartup); |
|
136 delete repository; |
|
137 INFO_PRINTF3(_L("Setting Central Repository key 101f8762 Return value = %d Expected value = %d"),ret, KErrPermissionDenied); |
|
138 TEST(ret == KErrPermissionDenied); |
|
139 } |
|
140 else |
|
141 { |
|
142 TRAPD(err, doTestCreateExecuteAndDestroyL()); |
|
143 TEST(err == KErrNone); |
|
144 |
|
145 TRAP(err, doTestFactoryCreateAndExecuteCancelL()); |
|
146 TEST(err == KErrNone); |
|
147 |
|
148 |
|
149 } |
122 __UHEAP_MARKEND; |
150 __UHEAP_MARKEND; |
123 INFO_PRINTF1(_L("Leaving test for publish startup mode custom command")); |
151 INFO_PRINTF1(_L("Leaving test for publish startup mode custom command")); |
124 return TestStepResult(); |
152 return TestStepResult(); |
125 } |
153 } |
126 |
154 |
136 |
164 |
137 // Define the startmode central repository. |
165 // Define the startmode central repository. |
138 TUid KCentRepId = {0x101f8762}; |
166 TUid KCentRepId = {0x101f8762}; |
139 CRepository* repository = CRepository::NewL(KCentRepId); |
167 CRepository* repository = CRepository::NewL(KCentRepId); |
140 TInt ret = repository->Set(KStartupReason, ENormalStartup); |
168 TInt ret = repository->Set(KStartupReason, ENormalStartup); |
141 delete repository; |
169 delete repository; |
142 |
170 INFO_PRINTF3(_L("Setting Central Repository key 101f8762 Return value = %d Expected value = %d"),ret, KErrNone); |
|
171 TEST(ret == KErrNone); |
|
172 |
143 TInt startUpMode = -1; |
173 TInt startUpMode = -1; |
144 |
174 |
145 //Setting inital value of startUpMode as -1 |
175 //Setting inital value of startUpMode as -1 |
146 TInt err = RProperty::Set(CSsmUiSpecific::StartupPSUid(), KPSGlobalStartupMode, startUpMode); |
176 TInt err = RProperty::Set(CSsmUiSpecific::StartupPSUid(), KPSGlobalStartupMode, startUpMode); |
147 err = RProperty::Get(CSsmUiSpecific::StartupPSUid(), KPSGlobalStartupMode, startUpMode); |
177 err = RProperty::Get(CSsmUiSpecific::StartupPSUid(), KPSGlobalStartupMode, startUpMode); |