1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2008-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". |
20 */ |
20 */ |
21 |
21 |
22 #include <eikstart.h> |
22 #include <eikstart.h> |
23 #include <eikapp.h> |
23 #include <eikapp.h> |
24 #include <bautils.h> |
24 #include <bautils.h> |
|
25 #include <centralrepository.h> |
25 #include "sspluginstest_tappgsapolicy.h" |
26 #include "sspluginstest_tappgsapolicy.h" |
|
27 #include "ssmpolicypluginsprivatecrkeys.h" |
26 |
28 |
27 //Fail to execute this exe for KDontRvBootCount times |
29 //Fail to execute this exe for KDontRvBootCount times |
28 const TInt KDontRvBootCount = 3; |
30 const TInt KDontRvBootCount = 3; |
29 _LIT(KBootUpFolder, ":\\private\\2000d75b\\bootupinfo\\"); |
|
30 _LIT(KBootUpFile, "bootupcount.bin"); |
|
31 |
31 |
32 /** |
32 /** |
33 Standard DLL entry point function. |
33 Standard DLL entry point function. |
34 Creates and returns an instance of the CApaApplication-derived class. |
34 Creates and returns an instance of the CApaApplication-derived class. |
35 @return an instance of the CApaApplication-derived class |
35 @return an instance of the CApaApplication-derived class |
125 ie we panic for KDontRvBootCount invocations but don't do the Rendezvous, then eventually ETrue, so the Framework |
125 ie we panic for KDontRvBootCount invocations but don't do the Rendezvous, then eventually ETrue, so the Framework |
126 Rendezvous for us. our final invocation therefore being successful. |
126 Rendezvous for us. our final invocation therefore being successful. |
127 |
127 |
128 This particular test case can be used to test following |
128 This particular test case can be used to test following |
129 1.Transitions to fail |
129 1.Transitions to fail |
130 To test above need to set KDontRvBootCount to KSsmMaxBootAttempts+1. |
130 To test above need to set KDontRvBootCount to KSsmStartupErrorResetLimit+1. |
131 2.Persisted number of consecutive failed device start-ups |
131 2.Persisted number of consecutive failed device start-ups |
132 To test above feature need set KDontRvBootCount to KSsmMaxBootAttempts |
132 To test above feature need set KDontRvBootCount to KSsmStartupErrorResetLimit |
133 3.Transitions to restart to infinite times. |
133 */ |
134 To test above feature set KDontRvBootCount and KSsmMaxBootAttempts to 0xFFFFFFFF |
|
135 */ |
|
136 void DoFrameworkCallsRendezvousL(); |
134 void DoFrameworkCallsRendezvousL(); |
137 |
135 |
138 TBool CTestAppUi::FrameworkCallsRendezvous() const |
136 TBool CTestAppUi::FrameworkCallsRendezvous() const |
139 { |
137 { |
140 TRAPD(err,DoFrameworkCallsRendezvousL()); |
138 TRAPD(err,DoFrameworkCallsRendezvousL()); |
141 return ( KErrNone == err ) ? ETrue : EFalse; |
139 return ( KErrNone == err ) ? ETrue : EFalse; |
142 } |
140 } |
143 |
141 |
144 void DoFrameworkCallsRendezvousL() |
142 void DoFrameworkCallsRendezvousL() |
145 { |
143 { |
146 RFs fs; |
144 CRepository* repository = CRepository::NewLC( KCRUidSsmStartupPolicy ); |
147 User::LeaveIfError(fs.Connect()); |
145 TInt Resetlimit; |
148 CleanupClosePushL(fs); |
146 User::LeaveIfError( repository->Get( KSsmStartupErrorResetLimit, Resetlimit ) ); |
149 RBuf bootupInfoPath; |
147 CleanupStack::Pop(repository); |
150 CleanupClosePushL( bootupInfoPath ); |
148 if( Resetlimit < KDontRvBootCount ) |
151 const TChar drive = RFs::GetSystemDriveChar(); |
|
152 TInt length = KBootUpFolder().Length() + KBootUpFile().Length() + 1 /* for RFs::GetSystemDriveChar() */; |
|
153 bootupInfoPath.CreateL(length); |
|
154 bootupInfoPath.Append(drive); |
|
155 bootupInfoPath.Append(KBootUpFolder()); |
|
156 bootupInfoPath.Append(KBootUpFile()); |
|
157 |
|
158 TBool found = BaflUtils::FileExists(fs, bootupInfoPath); |
|
159 TInt bootCount = 0; |
|
160 if(found) |
|
161 { |
|
162 RFileReadStream file; |
|
163 CleanupClosePushL(file); |
|
164 User::LeaveIfError(file.Open(fs, bootupInfoPath, EFileRead)); |
|
165 bootCount = file.ReadUint8L(); |
|
166 RDebug::Printf("--- CTestAppUi::FrameworkCallsRendezvous() bootcount %d", bootCount); |
|
167 CleanupStack::PopAndDestroy( &file ); |
|
168 } |
|
169 CleanupStack::PopAndDestroy( &bootupInfoPath ); |
|
170 CleanupStack::PopAndDestroy( &fs ); |
|
171 if( bootCount < KDontRvBootCount ) |
|
172 { |
149 { |
173 _LIT(KMainErrorStatement, "*** Program error in Starting sspluginstest_tappgsapolicy.exe: %d"); |
150 _LIT(KMainErrorStatement, "*** Program error in Starting sspluginstest_tappgsapolicy.exe: %d"); |
174 RDebug::Print(KMainErrorStatement, KErrNone); |
151 RDebug::Print(KMainErrorStatement, KErrNone); |
175 User::Panic(KMainErrorStatement,KErrNone); |
152 User::Panic(KMainErrorStatement,KErrNone); |
176 } |
153 } |
|
154 |
177 } |
155 } |