sysstatemgmt/systemstateplugins/test/tintgsapolicy/src/tgsa_step_statetrantodiffstates.cpp
changeset 63 09d657f1ee00
parent 0 4e1aa6a622a0
child 61 8cb079868133
equal deleted inserted replaced
54:072a9626b290 63:09d657f1ee00
     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".
    44 	User::LeaveIfError(err);
    44 	User::LeaveIfError(err);
    45 	CleanupClosePushL(fs);
    45 	CleanupClosePushL(fs);
    46 		
    46 		
    47 	if (iProcessName == KTestProcTranFromNormal)
    47 	if (iProcessName == KTestProcTranFromNormal)
    48 		{
    48 		{
    49 		RFileReadStream fileReadStream;
    49 		RFileReadStream fileReadStream1;
    50 		err = fileReadStream.Open(fs, KGsaTestStateTranFromNormalResult, EFileRead);
    50 		err = fileReadStream1.Open(fs, KGsaTestStateTranFromNormalResult, EFileRead);
    51 		TEST(err == KErrNone);
    51 		INFO_PRINTF2(_L("Error in opening file: %d"), err);
    52 		User::LeaveIfError(err);
    52 		TEST(err == KErrNone);
    53 		CleanupClosePushL(fileReadStream);
    53 		User::LeaveIfError(err);
    54 
    54 		CleanupClosePushL(fileReadStream1);
    55 		//System state before starting the test.
    55 
    56 		CurrentSystemStateForStateTranTestL(fileReadStream, ESsmNormal);
    56 		//System state before starting the test.
       
    57 		CurrentSystemStateForStateTranTestL(fileReadStream1, ESsmNormal);
    57 
    58 
    58 		//Scenario 1 - Request for state change from Normal to invalid state results in KErrNotSupported
    59 		//Scenario 1 - Request for state change from Normal to invalid state results in KErrNotSupported
    59 		INFO_PRINTF1(_L("Request for state change from Normal to invalid state"));
    60 		INFO_PRINTF1(_L("Request for state change from Normal to invalid state"));
    60 		TInt stateTranResult = fileReadStream.ReadInt32L();
    61 		TInt stateTranResult = fileReadStream1.ReadInt32L();
    61 		TEST(stateTranResult == KErrNotSupported);
    62 		TEST(stateTranResult == KErrNotSupported);
    62 		INFO_PRINTF2(_L("Actual : %d Expected : -5"), stateTranResult);
    63 		INFO_PRINTF2(_L("Actual : %d Expected : -5"), stateTranResult);
    63 		CurrentSystemStateForStateTranTestL(fileReadStream, ESsmNormal);
    64 		CurrentSystemStateForStateTranTestL(fileReadStream1, ESsmNormal);
    64 		
    65 		
    65 		//Scenario 2 - Request for state change from Normal to fail state with invalid substate results in KErrNotSupported
    66 		//Scenario 2 - Request for state change from Normal to fail state with invalid substate results in KErrNotSupported
    66 		INFO_PRINTF1(_L("Request for state change from Normal to fail state with invalid substate"));
    67 		INFO_PRINTF1(_L("Request for state change from Normal to fail state with invalid substate"));
    67 		stateTranResult = fileReadStream.ReadInt32L();
    68 		stateTranResult = fileReadStream1.ReadInt32L();
    68 		TEST(stateTranResult == KErrNotSupported);
    69 		TEST(stateTranResult == KErrNotSupported);
    69 		INFO_PRINTF2(_L("Actual : %d Expected : -5"), stateTranResult);
    70 		INFO_PRINTF2(_L("Actual : %d Expected : -5"), stateTranResult);
    70 		CurrentSystemStateForStateTranTestL(fileReadStream, ESsmNormal);
    71 		CurrentSystemStateForStateTranTestL(fileReadStream1, ESsmNormal);
    71 
    72 
    72 		//Scenario 3 - Request for two state changes(1. fail state 2. shutdown state) one after the other without waiting 
    73 		//Scenario 3 - Request for two state changes(1. fail state 2. shutdown state) one after the other without waiting 
    73 		// for the first one to complete. Cancels both transition request. 		
    74 		// for the first one to complete. Cancels both transition request. 		
    74 		INFO_PRINTF1(_L("Request for two state changes(1. fail state 2. shutdown state)"));
    75 		INFO_PRINTF1(_L("Request for two state changes(1. fail state 2. shutdown state)"));
    75 		INFO_PRINTF1(_L("one after the other without waiting for the first one to complete."));
    76 		INFO_PRINTF1(_L("one after the other without waiting for the first one to complete."));
    76 		INFO_PRINTF1(_L("Cancel the fail state transition request."));
    77 		INFO_PRINTF1(_L("Cancel the fail state transition request."));
    77 		stateTranResult = fileReadStream.ReadInt32L();
    78 		stateTranResult = fileReadStream1.ReadInt32L();
    78 		TEST(stateTranResult == KErrCancel);
    79 		TEST(stateTranResult == KErrCancel);
    79 		INFO_PRINTF2(_L("First request to the fail state will be completed with %d Expected -3"), stateTranResult);
    80 		INFO_PRINTF2(_L("First request to the fail state will be completed with %d Expected -3"), stateTranResult);
    80 		CurrentSystemStateForStateTranTestL(fileReadStream, ESsmNormal);
    81 		CurrentSystemStateForStateTranTestL(fileReadStream1, ESsmNormal);
    81 
    82 
    82 		stateTranResult = fileReadStream.ReadInt32L();
    83 		stateTranResult = fileReadStream1.ReadInt32L();
    83 		TEST(stateTranResult == KErrCancel);
    84 		TEST(stateTranResult == KErrCancel);
    84 		INFO_PRINTF2(_L("Second request to transit to the shutdown state will be completed with %d Expected -3"), stateTranResult);
    85 		INFO_PRINTF2(_L("Second request to transit to the shutdown state will be completed with %d Expected -3"), stateTranResult);
    85 		CurrentSystemStateForStateTranTestL(fileReadStream, ESsmNormal);
    86 		CurrentSystemStateForStateTranTestL(fileReadStream1, ESsmNormal);
    86 
    87 
    87 		//Scenario 4 - Request for two state changes one after the other without waiting for the first one to complete
    88 		INFO_PRINTF2(_L("Test process exits with %d Expected -3"), stateTranResult);
    88 		// Once first and second request are completed the system will be in fail state, now issue another state transition
       
    89 		// request to fail state again.
       
    90 		// The first request to the fail state will be completed with KErrCancel 
       
    91 		// the second request to transit to the fail state will be completed with KErrNone.
       
    92 		// the third request to transit to the fail state will be completed with KErrNotSupported.
       
    93 		INFO_PRINTF1(_L("Request for two state changes one after the other without waiting"));
       
    94 		INFO_PRINTF1(_L("for the first one to complete. Once first and second request are completed the system will be in"));
       
    95 		INFO_PRINTF1(_L("fail state, now issue another state transition request to fail state again."));
       
    96 		stateTranResult = fileReadStream.ReadInt32L();
       
    97 		TEST(stateTranResult == KErrCancel);
       
    98 		INFO_PRINTF2(_L("First request to the fail state will be completed with %d Expected -3"), stateTranResult);
       
    99 		CurrentSystemStateForStateTranTestL(fileReadStream, ESsmNormal);
       
   100 
       
   101 		stateTranResult = fileReadStream.ReadInt32L();
       
   102 		TEST(stateTranResult == KErrNone);
       
   103 		INFO_PRINTF2(_L("Second request to the fail state will be completed with %d Expected 0"), stateTranResult);
       
   104 		CurrentSystemStateForStateTranTestL(fileReadStream, ESsmNormal);
       
   105 
       
   106 		stateTranResult = fileReadStream.ReadInt32L();
       
   107 		TEST(stateTranResult == KErrNotSupported);
       
   108 		INFO_PRINTF2(_L("Third request to the fail state will be completed with %d Expected -5"), stateTranResult);
       
   109 		CurrentSystemStateForStateTranTestL(fileReadStream, ESsmNormal);
       
   110 
       
   111 		//Finally the system should be in fail state i.e., just before the test application is closed.
       
   112 		CurrentSystemStateForStateTranTestL(fileReadStream, ESsmFail);
       
   113 		INFO_PRINTF1(_L("Test Process Exit Reason"));
       
   114 		stateTranResult = fileReadStream.ReadInt32L();
       
   115 		TEST(stateTranResult == KErrNone && stateTranResult != KTestAppFailure);
       
   116 		INFO_PRINTF2(_L("Test process exits with %d Expected 0"), stateTranResult);
       
   117 
    89 
   118 		CleanupStack::PopAndDestroy();
    90 		CleanupStack::PopAndDestroy();
   119 		// Delete the result file
    91 		// Delete the result file
   120 		//err = fs.Delete(KGsaTestStateTranFromNormalResult);
    92 		//err = fs.Delete(KGsaTestStateTranFromNormalResult);
   121 		}
    93 
   122 	else if (iProcessName == KTestProcTranToShutdown)
    94 		RFileReadStream fileReadStream2;
   123 		{
    95 		err = fileReadStream2.Open(fs, KGsaTestStateTranToShutdownResult, EFileRead);
   124 		RFileReadStream fileReadStream;
    96 		TEST(err == KErrNone);
   125 		err = fileReadStream.Open(fs, KGsaTestStateTranToShutdownResult, EFileRead);
    97 		User::LeaveIfError(err);
   126 		TEST(err == KErrNone);
    98 		CleanupClosePushL(fileReadStream2);
   127 		User::LeaveIfError(err);
    99 
   128 		CleanupClosePushL(fileReadStream);
   100 		//System state before starting the test.
   129 
   101 		CurrentSystemStateForStateTranTestL(fileReadStream2, ESsmNormal);
   130 		//System state before starting the test.
       
   131 		CurrentSystemStateForStateTranTestL(fileReadStream, ESsmNormal);
       
   132 
   102 
   133 		//Scenario 1 - Request for state transition to shutdown state - invalid substate
   103 		//Scenario 1 - Request for state transition to shutdown state - invalid substate
   134 		// request to transit to the shutdown state will be completed with KErrNotSupported
   104 		// request to transit to the shutdown state will be completed with KErrNotSupported
   135 		INFO_PRINTF1(_L("Request for state transition to shutdown state - invalid substate"));
   105 		INFO_PRINTF1(_L("Request for state transition to shutdown state - invalid substate"));
   136 		TInt stateTranResult = fileReadStream.ReadInt32L();
   106 		stateTranResult = fileReadStream2.ReadInt32L();
   137 		TEST(stateTranResult == KErrNotSupported);
   107 		TEST(stateTranResult == KErrNotSupported);
   138 		INFO_PRINTF2(_L("Actual : %d Expected : -5"), stateTranResult);
   108 		INFO_PRINTF2(_L("Actual : %d Expected : -5"), stateTranResult);
   139 		CurrentSystemStateForStateTranTestL(fileReadStream, ESsmNormal);
   109 		CurrentSystemStateForStateTranTestL(fileReadStream2, ESsmNormal);
   140 		
   110 		
   141 		//Scenario 2 - Request for state transition to shutdown state - critical substate(Restart)
   111 		INFO_PRINTF2(_L("Test process exits with %d Expected -5"), stateTranResult);
   142 		// Request for state transition to shutdown state - critical substate(Standby)
       
   143 		// first request to transit to the shutdown state critical substate(Restart)will be completed with KErrCancel
       
   144 		// second request to transit to the shutdown state critical substate(Standby)will be completed with KErrNone
       
   145 		INFO_PRINTF1(_L("Request for state transition to shutdown state - critical substate(Standby)"));
       
   146 		stateTranResult = fileReadStream.ReadInt32L();
       
   147 		TEST(stateTranResult == KErrNone);
       
   148 		INFO_PRINTF2(_L("Actual : %d Expected : 0"), stateTranResult);
       
   149 		CurrentSystemStateForStateTranTestL(fileReadStream, ESsmNormal);
       
   150 
       
   151 		INFO_PRINTF1(_L("Request for state transition to shutdown state - critical substate(Restart)"));
       
   152 		stateTranResult = fileReadStream.ReadInt32L();
       
   153 		TEST(stateTranResult == KErrCancel);
       
   154 		INFO_PRINTF2(_L("Actual : %d Expected : -3"), stateTranResult);
       
   155 		CurrentSystemStateForStateTranTestL(fileReadStream, ESsmNormal);
       
   156 
       
   157 		//Finally the system should be in fail state i.e., just before the test application is closed.
       
   158 		CurrentSystemStateForStateTranTestL(fileReadStream, ESsmShutdown);
       
   159 		
       
   160 		INFO_PRINTF1(_L("Test Process Exit Reason"));
       
   161 		stateTranResult = fileReadStream.ReadInt32L();
       
   162 		TEST(stateTranResult == KErrNone && stateTranResult != KTestAppFailure);
       
   163 		INFO_PRINTF2(_L("Test process exits with %d Expected 0"), stateTranResult);
       
   164 
   112 
   165 		CleanupStack::PopAndDestroy();
   113 		CleanupStack::PopAndDestroy();
   166 		// Delete the result file
   114 		// Delete the result file
   167 		//err = fs.Delete(KGsaTestStateTranToShutdownResult);
   115 		//err = fs.Delete(KGsaTestStateTranToShutdownResult);
   168 		}
   116 
   169 	else if (iProcessName == KTestProcTranFromShutdown)
   117 		RFileReadStream fileReadStream3;
   170 		{
   118 		err = fileReadStream3.Open(fs, KGsaTestStateTranFromShutdownResult, EFileRead);
   171 		RFileReadStream fileReadStream;
   119 		TEST(err == KErrNone);
   172 		err = fileReadStream.Open(fs, KGsaTestStateTranFromShutdownResult, EFileRead);
   120 		User::LeaveIfError(err);
   173 		TEST(err == KErrNone);
   121 		CleanupClosePushL(fileReadStream3);
   174 		User::LeaveIfError(err);
   122 
   175 		CleanupClosePushL(fileReadStream);
   123 		//System state before starting the test.
   176 
   124 		CurrentSystemStateForStateTranTestL(fileReadStream3, ESsmNormal);
   177 		//System state before starting the test.
       
   178 		CurrentSystemStateForStateTranTestL(fileReadStream, ESsmNormal);
       
   179 
   125 
   180 		//Scenario 1 - Request for state change from Normal to shutdown state to critical substate
   126 		//Scenario 1 - Request for state change from Normal to shutdown state to critical substate
   181 		// Cancel the request immediately
   127 		// Cancel the request immediately
   182 		INFO_PRINTF1(_L("Request for state change from Normal to shutdown critical substate and Cancel the request"));
   128 		INFO_PRINTF1(_L("Request for state change from Normal to shutdown critical substate and Cancel the request"));
   183 		TInt stateTranResult = fileReadStream.ReadInt32L();
   129 		stateTranResult = fileReadStream3.ReadInt32L();
   184 		TEST(stateTranResult == KErrCancel);
   130 		TEST(stateTranResult == KErrCancel);
   185 		INFO_PRINTF2(_L("Actual : %d Expected : -3"), stateTranResult);
   131 		INFO_PRINTF2(_L("Actual : %d Expected : -3"), stateTranResult);
   186 		CurrentSystemStateForStateTranTestL(fileReadStream, ESsmNormal);
   132 		CurrentSystemStateForStateTranTestL(fileReadStream3, ESsmNormal);
   187 
   133 
   188 		//Scenario 2 - Request for state change from Normal to shutdown state to any substate
   134 		//Scenario 2 - Request for state change from Normal to shutdown state to any substate
   189 		// Cancel the request immediately, so that we can proceed with the next test scenario.
   135 		// Cancel the request immediately, so that we can proceed with the next test scenario.
   190 
   136 
   191 		INFO_PRINTF1(_L("Request for state change from Normal to shutdown any substate and Cancel the request"));
   137 		INFO_PRINTF1(_L("Request for state change from Normal to shutdown any substate and Cancel the request"));
   192 		stateTranResult = fileReadStream.ReadInt32L();
   138 		stateTranResult = fileReadStream3.ReadInt32L();
   193 		TEST(stateTranResult == KErrCancel);
   139 		TEST(stateTranResult == KErrCancel);
   194 		INFO_PRINTF2(_L("Actual : %d Expected : -3"), stateTranResult);
   140 		INFO_PRINTF2(_L("Actual : %d Expected : -3"), stateTranResult);
   195 		CurrentSystemStateForStateTranTestL(fileReadStream, ESsmNormal);
   141 		CurrentSystemStateForStateTranTestL(fileReadStream3, ESsmNormal);
   196 
   142 
   197 		//Scenario 3 - Request for three state changes(1. shutdown state 2. invalid state 3. fail state) one after the other 
   143 		INFO_PRINTF2(_L("Test process exits with %d Expected -3"), stateTranResult);
   198 		// i.e., second request is issued once first one is completed and the third one is issued after the second request is completed.
       
   199 		// Cancel the third request.
       
   200 		// first request to the shutdown state will be completed with KErrNone 
       
   201 		// second request to transit to the fail state will be completed with KErrNotSupported
       
   202 		// third request to transit to the fail state will be completed with KErrCancel
       
   203 		INFO_PRINTF1(_L("Request for 3 state changes(1. shutdown state 2. invalid state 3. fail state)"));
       
   204 		INFO_PRINTF1(_L("one after the other. i.e., second request is issued once first one is completed"));
       
   205 		INFO_PRINTF1(_L("and the third one is issued after the second request is completed."));
       
   206 		INFO_PRINTF1(_L("Cancel the third request."));
       
   207 		stateTranResult = fileReadStream.ReadInt32L();
       
   208 		TEST(stateTranResult == KErrNone);
       
   209 		INFO_PRINTF2(_L("First request to the shutdown state will be completed with %d Expected 0"), stateTranResult);
       
   210 		CurrentSystemStateForStateTranTestL(fileReadStream, ESsmNormal);
       
   211 
       
   212 		stateTranResult = fileReadStream.ReadInt32L();
       
   213 		TEST(stateTranResult == KErrNotSupported);
       
   214 		INFO_PRINTF2(_L("Second request to transit to the fail state will be completed with %d Expected -5"), stateTranResult);
       
   215 		CurrentSystemStateForStateTranTestL(fileReadStream, ESsmNormal);
       
   216 
       
   217 		stateTranResult = fileReadStream.ReadInt32L();
       
   218 		TEST(stateTranResult == KErrCancel);
       
   219 		INFO_PRINTF2(_L("Third request to transit to the fail state will be completed with %d Expected -3"), stateTranResult);
       
   220 		CurrentSystemStateForStateTranTestL(fileReadStream, ESsmShutdown);
       
   221 
       
   222 		//Scenario 4 - The system is now in shutdown state, request for state transition to normal state.
       
   223 		// request to transit to the normal state will be completed with KErrNotSupported
       
   224 		INFO_PRINTF1(_L("The system is now in shutdown state, request for state transition to normal state"));
       
   225 		stateTranResult = fileReadStream.ReadInt32L();
       
   226 		TEST(stateTranResult == KErrNotSupported);
       
   227 		INFO_PRINTF2(_L("Request to transit to the normal state will be completed with %d Expected -5"), stateTranResult);
       
   228 		CurrentSystemStateForStateTranTestL(fileReadStream, ESsmShutdown);
       
   229 
       
   230 		//Scenario 5 - The system is now in shutdown state, request for state transition to fail state.
       
   231 		// request to transit to the fail state will be completed with KErrNone
       
   232 		INFO_PRINTF1(_L("The system is now in shutdown state, request for state transition to fail state"));
       
   233 		stateTranResult = fileReadStream.ReadInt32L();
       
   234 		TEST(stateTranResult == KErrNone);
       
   235 		INFO_PRINTF2(_L("Request to transit to the normal state will be completed with %d Expected 0"), stateTranResult);
       
   236 		CurrentSystemStateForStateTranTestL(fileReadStream, ESsmShutdown);
       
   237 
       
   238 		//Finally the system should be in fail state i.e., just before the test application is closed.
       
   239 		CurrentSystemStateForStateTranTestL(fileReadStream, ESsmFail);
       
   240 		
       
   241 		INFO_PRINTF1(_L("Test Process Exit Reason"));
       
   242 		stateTranResult = fileReadStream.ReadInt32L();
       
   243 		TEST(stateTranResult == KErrNone && stateTranResult != KTestAppFailure);
       
   244 		INFO_PRINTF2(_L("Test process exits with %d Expected 0"), stateTranResult);
       
   245 
   144 
   246 		CleanupStack::PopAndDestroy();
   145 		CleanupStack::PopAndDestroy();
   247 		// Delete the result file
   146 		// Delete the result file
   248 		//err = fs.Delete(KGsaTestStateTranFromShutdownResult);
   147 		//err = fs.Delete(KGsaTestStateTranFromShutdownResult);
   249 		}
   148 		}
   263 		TInt stateTranResult = fileReadStream.ReadInt32L();
   162 		TInt stateTranResult = fileReadStream.ReadInt32L();
   264 		TEST(stateTranResult == KErrNotSupported);
   163 		TEST(stateTranResult == KErrNotSupported);
   265 		INFO_PRINTF2(_L("Actual : %d Expected : -5"), stateTranResult);
   164 		INFO_PRINTF2(_L("Actual : %d Expected : -5"), stateTranResult);
   266 		CurrentSystemStateForStateTranTestL(fileReadStream, ESsmStartup);
   165 		CurrentSystemStateForStateTranTestL(fileReadStream, ESsmStartup);
   267 		
   166 		
   268 		//Scenario 2 - Request for state change from Startup to fail state with invalid substate
   167 		INFO_PRINTF2(_L("Test process exits with %d Expected -5"), stateTranResult);
   269 		INFO_PRINTF1(_L("Request for state change from Startup to fail state with invalid substate"));
       
   270 		stateTranResult = fileReadStream.ReadInt32L();
       
   271 		TEST(stateTranResult == KErrNotSupported);
       
   272 		INFO_PRINTF2(_L("Actual : %d Expected : -5"), stateTranResult);
       
   273 		CurrentSystemStateForStateTranTestL(fileReadStream, ESsmStartup);
       
   274 
       
   275 		//Scenario 3 - Request for state change from Startup to shutdown invalid substate
       
   276 		INFO_PRINTF1(_L("Request for state change from Startup to shutdown invalid substate"));
       
   277 		stateTranResult = fileReadStream.ReadInt32L();
       
   278 		TEST(stateTranResult == KErrNotSupported);
       
   279 		INFO_PRINTF2(_L("Request for state change from Startup to shutdown invalid state completed with %d Expected -5"), stateTranResult);
       
   280 		CurrentSystemStateForStateTranTestL(fileReadStream, ESsmStartup);
       
   281 
       
   282 		//Scenario 4 - Request for two state changes to fail state one after the other
       
   283 		//The first request to the fail state will be completed with KErrCancel and the second request to transit to the fail state will be completed with KErrNone.
       
   284 		INFO_PRINTF1(_L("Request for two state changes to fail state one after the other"));
       
   285 		stateTranResult = fileReadStream.ReadInt32L();
       
   286 		TEST(stateTranResult == KErrCancel);
       
   287 		INFO_PRINTF2(_L("First request to the fail state will be completed with %d Expected -3"), stateTranResult);
       
   288 		CurrentSystemStateForStateTranTestL(fileReadStream, ESsmStartup);
       
   289 
       
   290 		stateTranResult = fileReadStream.ReadInt32L();
       
   291 		TEST(stateTranResult == KErrNone);
       
   292 		INFO_PRINTF2(_L("Second request to the fail state will be completed with %d Expected 0"), stateTranResult);
       
   293 		CurrentSystemStateForStateTranTestL(fileReadStream, ESsmStartup);
       
   294 
       
   295 		//Finally the system should be in fail state i.e., just before the test application is closed.
       
   296 		CurrentSystemStateForStateTranTestL(fileReadStream, ESsmFail);
       
   297 		INFO_PRINTF1(_L("Test Process Exit Reason"));
       
   298 		stateTranResult = fileReadStream.ReadInt32L();
       
   299 		TEST(stateTranResult == KErrNone && stateTranResult != KTestAppFailure);
       
   300 		INFO_PRINTF2(_L("Test process exits with %d Expected 0"), stateTranResult);
       
   301 		
   168 		
   302 		CleanupStack::PopAndDestroy();
   169 		CleanupStack::PopAndDestroy();
   303 		// Delete the result file
   170 		// Delete the result file
   304 		//err = fs.Delete(KGsaTestStateTranFromStartupResult);
   171 		//err = fs.Delete(KGsaTestStateTranFromStartupResult);
   305 		}
       
   306 	else if (iProcessName == KTGsaStateTranFromStartuptoShutdownStep)
       
   307 		{
       
   308 		RFileReadStream fileReadStream;
       
   309 		User::LeaveIfError(fileReadStream.Open(fs, KGsaTestStateTranFromStartupResult, EFileRead));
       
   310 		CleanupClosePushL(fileReadStream);
       
   311 		
       
   312 		//Scenario 1 - Request for state change from Startup to shutdown critical substate
       
   313 		INFO_PRINTF1(_L("Request for state change from Startup to shutdown critical substate"));
       
   314 		TInt stateTranResult = fileReadStream.ReadInt32L();
       
   315 		TEST(stateTranResult == KErrNone);
       
   316 		INFO_PRINTF2(_L("Request for state change from Startup to shutdown critical substate completed with %d Expected 0"), stateTranResult);
       
   317 		CurrentSystemStateForStateTranTestL(fileReadStream, ESsmStartup);
       
   318 		
       
   319 		CurrentSystemStateForStateTranTestL(fileReadStream, ESsmStartup);
       
   320 		
       
   321 		//Finally the system should be in Shutdown state i.e., just before the test application is closed.
       
   322 		CurrentSystemStateForStateTranTestL(fileReadStream, ESsmShutdown);
       
   323 		INFO_PRINTF1(_L("Test Process Exit Reason"));
       
   324 		stateTranResult = fileReadStream.ReadInt32L();
       
   325 		TEST(stateTranResult == KErrNone && stateTranResult != KTestAppFailure);
       
   326 		INFO_PRINTF2(_L("Test process exits with %d Expected 0"), stateTranResult);
       
   327 		
       
   328 		CleanupStack::PopAndDestroy();
       
   329 		}
   172 		}
   330 	else
   173 	else
   331 		{
   174 		{
   332 		TEST(err == KErrArgument);
   175 		TEST(err == KErrArgument);
   333 		return;
   176 		return;
   357 	{
   200 	{
   358 	}
   201 	}
   359 
   202 
   360 CGsaStateTranToDiffStatesTest::CGsaStateTranToDiffStatesTest(const TDesC& aProcessName) : iProcessName(aProcessName)
   203 CGsaStateTranToDiffStatesTest::CGsaStateTranToDiffStatesTest(const TDesC& aProcessName) : iProcessName(aProcessName)
   361 	{
   204 	{
   362 	if (iProcessName == KTestProcTranToShutdown)
   205 	if (iProcessName == KTestProcTranFromNormal)
   363 		SetTestStepName(KTGsaStateTranToShutdownStep);
       
   364 	else if (iProcessName == KTestProcTranFromShutdown)
       
   365 		SetTestStepName(KTGsaStateTranFromShutdownStep);
       
   366 	else if (iProcessName == KTestProcTranFromNormal)
       
   367 		SetTestStepName(KTGsaStateTranFromNormalStep);
   206 		SetTestStepName(KTGsaStateTranFromNormalStep);
   368 	else if (iProcessName == KTestProcTranFromStartup)
   207 	else if (iProcessName == KTestProcTranFromStartup)
   369 		SetTestStepName(KTGsaStateTranFromStartupStep);
   208 		SetTestStepName(KTGsaStateTranFromStartupStep);
   370 	else if (iProcessName == KTGsaStateTranFromStartuptoShutdownStep)
       
   371 		SetTestStepName(KTGsaStateTranFromStartuptoShutdownStep);
       
   372 	else
   209 	else
   373 		
   210 		
   374 		{
   211 		{
   375 		// If the test script is none of the above then we would fail the test
   212 		// If the test script is none of the above then we would fail the test
   376 		TEST(KErrArgument);
   213 		TEST(KErrArgument);