sysstatemgmt/systemstateplugins/test/tintgsapolicy/src/tgsa_step_statetrantodiffstates.cpp
branchRCL_3
changeset 22 8cb079868133
parent 21 ccb4f6b3db21
equal deleted inserted replaced
21:ccb4f6b3db21 22:8cb079868133
     1 // Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2008-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".
    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 fileReadStream1;
    49 		RFileReadStream fileReadStream;
    50 		err = fileReadStream1.Open(fs, KGsaTestStateTranFromNormalResult, EFileRead);
    50 		err = fileReadStream.Open(fs, KGsaTestStateTranFromNormalResult, EFileRead);
    51 		INFO_PRINTF2(_L("Error in opening file: %d"), err);
       
    52 		TEST(err == KErrNone);
    51 		TEST(err == KErrNone);
    53 		User::LeaveIfError(err);
    52 		User::LeaveIfError(err);
    54 		CleanupClosePushL(fileReadStream1);
    53 		CleanupClosePushL(fileReadStream);
    55 
    54 
    56 		//System state before starting the test.
    55 		//System state before starting the test.
    57 		CurrentSystemStateForStateTranTestL(fileReadStream1, ESsmNormal);
    56 		CurrentSystemStateForStateTranTestL(fileReadStream, ESsmNormal);
    58 
    57 
    59 		//Scenario 1 - Request for state change from Normal to invalid state results in KErrNotSupported
    58 		//Scenario 1 - Request for state change from Normal to invalid state results in KErrNotSupported
    60 		INFO_PRINTF1(_L("Request for state change from Normal to invalid state"));
    59 		INFO_PRINTF1(_L("Request for state change from Normal to invalid state"));
    61 		TInt stateTranResult = fileReadStream1.ReadInt32L();
    60 		TInt stateTranResult = fileReadStream.ReadInt32L();
    62 		TEST(stateTranResult == KErrNotSupported);
    61 		TEST(stateTranResult == KErrNotSupported);
    63 		INFO_PRINTF2(_L("Actual : %d Expected : -5"), stateTranResult);
    62 		INFO_PRINTF2(_L("Actual : %d Expected : -5"), stateTranResult);
    64 		CurrentSystemStateForStateTranTestL(fileReadStream1, ESsmNormal);
    63 		CurrentSystemStateForStateTranTestL(fileReadStream, ESsmNormal);
    65 		
    64 		
    66 		//Scenario 2 - Request for state change from Normal to fail state with invalid substate results in KErrNotSupported
    65 		//Scenario 2 - Request for state change from Normal to fail state with invalid substate results in KErrNotSupported
    67 		INFO_PRINTF1(_L("Request for state change from Normal to fail state with invalid substate"));
    66 		INFO_PRINTF1(_L("Request for state change from Normal to fail state with invalid substate"));
    68 		stateTranResult = fileReadStream1.ReadInt32L();
    67 		stateTranResult = fileReadStream.ReadInt32L();
    69 		TEST(stateTranResult == KErrNotSupported);
    68 		TEST(stateTranResult == KErrNotSupported);
    70 		INFO_PRINTF2(_L("Actual : %d Expected : -5"), stateTranResult);
    69 		INFO_PRINTF2(_L("Actual : %d Expected : -5"), stateTranResult);
    71 		CurrentSystemStateForStateTranTestL(fileReadStream1, ESsmNormal);
    70 		CurrentSystemStateForStateTranTestL(fileReadStream, ESsmNormal);
    72 
    71 
    73 		//Scenario 3 - Request for two state changes(1. fail state 2. shutdown state) one after the other without waiting 
    72 		//Scenario 3 - Request for two state changes(1. fail state 2. shutdown state) one after the other without waiting 
    74 		// for the first one to complete. Cancels both transition request. 		
    73 		// for the first one to complete. Cancels both transition request. 		
    75 		INFO_PRINTF1(_L("Request for two state changes(1. fail state 2. shutdown state)"));
    74 		INFO_PRINTF1(_L("Request for two state changes(1. fail state 2. shutdown state)"));
    76 		INFO_PRINTF1(_L("one after the other without waiting for the first one to complete."));
    75 		INFO_PRINTF1(_L("one after the other without waiting for the first one to complete."));
    77 		INFO_PRINTF1(_L("Cancel the fail state transition request."));
    76 		INFO_PRINTF1(_L("Cancel the fail state transition request."));
    78 		stateTranResult = fileReadStream1.ReadInt32L();
    77 		stateTranResult = fileReadStream.ReadInt32L();
    79 		TEST(stateTranResult == KErrCancel);
    78 		TEST(stateTranResult == KErrCancel);
    80 		INFO_PRINTF2(_L("First request to the fail state will be completed with %d Expected -3"), stateTranResult);
    79 		INFO_PRINTF2(_L("First request to the fail state will be completed with %d Expected -3"), stateTranResult);
    81 		CurrentSystemStateForStateTranTestL(fileReadStream1, ESsmNormal);
    80 		CurrentSystemStateForStateTranTestL(fileReadStream, ESsmNormal);
    82 
    81 
    83 		stateTranResult = fileReadStream1.ReadInt32L();
    82 		stateTranResult = fileReadStream.ReadInt32L();
    84 		TEST(stateTranResult == KErrCancel);
    83 		TEST(stateTranResult == KErrCancel);
    85 		INFO_PRINTF2(_L("Second request to transit to the shutdown state will be completed with %d Expected -3"), stateTranResult);
    84 		INFO_PRINTF2(_L("Second request to transit to the shutdown state will be completed with %d Expected -3"), stateTranResult);
    86 		CurrentSystemStateForStateTranTestL(fileReadStream1, ESsmNormal);
    85 		CurrentSystemStateForStateTranTestL(fileReadStream, ESsmNormal);
    87 
    86 
    88 		INFO_PRINTF2(_L("Test process exits with %d Expected -3"), stateTranResult);
    87 		//Scenario 4 - Request for two state changes one after the other without waiting for the first one to complete
       
    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);
    89 
   117 
    90 		CleanupStack::PopAndDestroy();
   118 		CleanupStack::PopAndDestroy();
    91 		// Delete the result file
   119 		// Delete the result file
    92 		//err = fs.Delete(KGsaTestStateTranFromNormalResult);
   120 		//err = fs.Delete(KGsaTestStateTranFromNormalResult);
    93 
   121 		}
    94 		RFileReadStream fileReadStream2;
   122 	else if (iProcessName == KTestProcTranToShutdown)
    95 		err = fileReadStream2.Open(fs, KGsaTestStateTranToShutdownResult, EFileRead);
   123 		{
       
   124 		RFileReadStream fileReadStream;
       
   125 		err = fileReadStream.Open(fs, KGsaTestStateTranToShutdownResult, EFileRead);
    96 		TEST(err == KErrNone);
   126 		TEST(err == KErrNone);
    97 		User::LeaveIfError(err);
   127 		User::LeaveIfError(err);
    98 		CleanupClosePushL(fileReadStream2);
   128 		CleanupClosePushL(fileReadStream);
    99 
   129 
   100 		//System state before starting the test.
   130 		//System state before starting the test.
   101 		CurrentSystemStateForStateTranTestL(fileReadStream2, ESsmNormal);
   131 		CurrentSystemStateForStateTranTestL(fileReadStream, ESsmNormal);
   102 
   132 
   103 		//Scenario 1 - Request for state transition to shutdown state - invalid substate
   133 		//Scenario 1 - Request for state transition to shutdown state - invalid substate
   104 		// request to transit to the shutdown state will be completed with KErrNotSupported
   134 		// request to transit to the shutdown state will be completed with KErrNotSupported
   105 		INFO_PRINTF1(_L("Request for state transition to shutdown state - invalid substate"));
   135 		INFO_PRINTF1(_L("Request for state transition to shutdown state - invalid substate"));
   106 		stateTranResult = fileReadStream2.ReadInt32L();
   136 		TInt stateTranResult = fileReadStream.ReadInt32L();
   107 		TEST(stateTranResult == KErrNotSupported);
   137 		TEST(stateTranResult == KErrNotSupported);
   108 		INFO_PRINTF2(_L("Actual : %d Expected : -5"), stateTranResult);
   138 		INFO_PRINTF2(_L("Actual : %d Expected : -5"), stateTranResult);
   109 		CurrentSystemStateForStateTranTestL(fileReadStream2, ESsmNormal);
   139 		CurrentSystemStateForStateTranTestL(fileReadStream, ESsmNormal);
   110 		
   140 		
   111 		INFO_PRINTF2(_L("Test process exits with %d Expected -5"), stateTranResult);
   141 		//Scenario 2 - Request for state transition to shutdown state - critical substate(Restart)
       
   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);
   112 
   164 
   113 		CleanupStack::PopAndDestroy();
   165 		CleanupStack::PopAndDestroy();
   114 		// Delete the result file
   166 		// Delete the result file
   115 		//err = fs.Delete(KGsaTestStateTranToShutdownResult);
   167 		//err = fs.Delete(KGsaTestStateTranToShutdownResult);
   116 
   168 		}
   117 		RFileReadStream fileReadStream3;
   169 	else if (iProcessName == KTestProcTranFromShutdown)
   118 		err = fileReadStream3.Open(fs, KGsaTestStateTranFromShutdownResult, EFileRead);
   170 		{
       
   171 		RFileReadStream fileReadStream;
       
   172 		err = fileReadStream.Open(fs, KGsaTestStateTranFromShutdownResult, EFileRead);
   119 		TEST(err == KErrNone);
   173 		TEST(err == KErrNone);
   120 		User::LeaveIfError(err);
   174 		User::LeaveIfError(err);
   121 		CleanupClosePushL(fileReadStream3);
   175 		CleanupClosePushL(fileReadStream);
   122 
   176 
   123 		//System state before starting the test.
   177 		//System state before starting the test.
   124 		CurrentSystemStateForStateTranTestL(fileReadStream3, ESsmNormal);
   178 		CurrentSystemStateForStateTranTestL(fileReadStream, ESsmNormal);
   125 
   179 
   126 		//Scenario 1 - Request for state change from Normal to shutdown state to critical substate
   180 		//Scenario 1 - Request for state change from Normal to shutdown state to critical substate
   127 		// Cancel the request immediately
   181 		// Cancel the request immediately
   128 		INFO_PRINTF1(_L("Request for state change from Normal to shutdown critical substate and Cancel the request"));
   182 		INFO_PRINTF1(_L("Request for state change from Normal to shutdown critical substate and Cancel the request"));
   129 		stateTranResult = fileReadStream3.ReadInt32L();
   183 		TInt stateTranResult = fileReadStream.ReadInt32L();
   130 		TEST(stateTranResult == KErrCancel);
   184 		TEST(stateTranResult == KErrCancel);
   131 		INFO_PRINTF2(_L("Actual : %d Expected : -3"), stateTranResult);
   185 		INFO_PRINTF2(_L("Actual : %d Expected : -3"), stateTranResult);
   132 		CurrentSystemStateForStateTranTestL(fileReadStream3, ESsmNormal);
   186 		CurrentSystemStateForStateTranTestL(fileReadStream, ESsmNormal);
   133 
   187 
   134 		//Scenario 2 - Request for state change from Normal to shutdown state to any substate
   188 		//Scenario 2 - Request for state change from Normal to shutdown state to any substate
   135 		// Cancel the request immediately, so that we can proceed with the next test scenario.
   189 		// Cancel the request immediately, so that we can proceed with the next test scenario.
   136 
   190 
   137 		INFO_PRINTF1(_L("Request for state change from Normal to shutdown any substate and Cancel the request"));
   191 		INFO_PRINTF1(_L("Request for state change from Normal to shutdown any substate and Cancel the request"));
   138 		stateTranResult = fileReadStream3.ReadInt32L();
   192 		stateTranResult = fileReadStream.ReadInt32L();
   139 		TEST(stateTranResult == KErrCancel);
   193 		TEST(stateTranResult == KErrCancel);
   140 		INFO_PRINTF2(_L("Actual : %d Expected : -3"), stateTranResult);
   194 		INFO_PRINTF2(_L("Actual : %d Expected : -3"), stateTranResult);
   141 		CurrentSystemStateForStateTranTestL(fileReadStream3, ESsmNormal);
   195 		CurrentSystemStateForStateTranTestL(fileReadStream, ESsmNormal);
   142 
   196 
   143 		INFO_PRINTF2(_L("Test process exits with %d Expected -3"), stateTranResult);
   197 		//Scenario 3 - Request for three state changes(1. shutdown state 2. invalid state 3. fail state) one after the other 
       
   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);
   144 
   245 
   145 		CleanupStack::PopAndDestroy();
   246 		CleanupStack::PopAndDestroy();
   146 		// Delete the result file
   247 		// Delete the result file
   147 		//err = fs.Delete(KGsaTestStateTranFromShutdownResult);
   248 		//err = fs.Delete(KGsaTestStateTranFromShutdownResult);
   148 		}
   249 		}
   162 		TInt stateTranResult = fileReadStream.ReadInt32L();
   263 		TInt stateTranResult = fileReadStream.ReadInt32L();
   163 		TEST(stateTranResult == KErrNotSupported);
   264 		TEST(stateTranResult == KErrNotSupported);
   164 		INFO_PRINTF2(_L("Actual : %d Expected : -5"), stateTranResult);
   265 		INFO_PRINTF2(_L("Actual : %d Expected : -5"), stateTranResult);
   165 		CurrentSystemStateForStateTranTestL(fileReadStream, ESsmStartup);
   266 		CurrentSystemStateForStateTranTestL(fileReadStream, ESsmStartup);
   166 		
   267 		
   167 		INFO_PRINTF2(_L("Test process exits with %d Expected -5"), stateTranResult);
   268 		//Scenario 2 - Request for state change from Startup to fail state with invalid substate
       
   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);
   168 		
   301 		
   169 		CleanupStack::PopAndDestroy();
   302 		CleanupStack::PopAndDestroy();
   170 		// Delete the result file
   303 		// Delete the result file
   171 		//err = fs.Delete(KGsaTestStateTranFromStartupResult);
   304 		//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();
   172 		}
   329 		}
   173 	else
   330 	else
   174 		{
   331 		{
   175 		TEST(err == KErrArgument);
   332 		TEST(err == KErrArgument);
   176 		return;
   333 		return;
   200 	{
   357 	{
   201 	}
   358 	}
   202 
   359 
   203 CGsaStateTranToDiffStatesTest::CGsaStateTranToDiffStatesTest(const TDesC& aProcessName) : iProcessName(aProcessName)
   360 CGsaStateTranToDiffStatesTest::CGsaStateTranToDiffStatesTest(const TDesC& aProcessName) : iProcessName(aProcessName)
   204 	{
   361 	{
   205 	if (iProcessName == KTestProcTranFromNormal)
   362 	if (iProcessName == KTestProcTranToShutdown)
       
   363 		SetTestStepName(KTGsaStateTranToShutdownStep);
       
   364 	else if (iProcessName == KTestProcTranFromShutdown)
       
   365 		SetTestStepName(KTGsaStateTranFromShutdownStep);
       
   366 	else if (iProcessName == KTestProcTranFromNormal)
   206 		SetTestStepName(KTGsaStateTranFromNormalStep);
   367 		SetTestStepName(KTGsaStateTranFromNormalStep);
   207 	else if (iProcessName == KTestProcTranFromStartup)
   368 	else if (iProcessName == KTestProcTranFromStartup)
   208 		SetTestStepName(KTGsaStateTranFromStartupStep);
   369 		SetTestStepName(KTGsaStateTranFromStartupStep);
       
   370 	else if (iProcessName == KTGsaStateTranFromStartuptoShutdownStep)
       
   371 		SetTestStepName(KTGsaStateTranFromStartuptoShutdownStep);
   209 	else
   372 	else
   210 		
   373 		
   211 		{
   374 		{
   212 		// If the test script is none of the above then we would fail the test
   375 		// If the test script is none of the above then we would fail the test
   213 		TEST(KErrArgument);
   376 		TEST(KErrArgument);