sysstatemgmt/systemstatemgr/test/testapps/src/ssmtestappsucessfulafterretry.cpp
branchRCL_3
changeset 21 ccb4f6b3db21
parent 0 4e1aa6a622a0
child 22 8cb079868133
--- a/sysstatemgmt/systemstatemgr/test/testapps/src/ssmtestappsucessfulafterretry.cpp	Thu Aug 19 11:09:10 2010 +0300
+++ b/sysstatemgmt/systemstatemgr/test/testapps/src/ssmtestappsucessfulafterretry.cpp	Tue Aug 31 16:29:05 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -19,107 +19,14 @@
  @internalComponent - Internal Symbian test code
 */
 
-#include <eikstart.h> 
-#include <eikapp.h>
-#include "ssmtestappsucessfulafterretry.h"
+#include <s32file.h>
+#include <f32file.h>
 #include "ssmtestapps.h"
 
-
-/**
-Standard DLL entry point function.
-Creates and returns an instance of the CApaApplication-derived class.
-@return an instance of the CApaApplication-derived class
-*/
-TInt E32Main()
-	{
-	return EikStart::RunApplication(CTestFAndFApplication::NewApplication);
-	}
-
-CTestFAndFApplication::CTestFAndFApplication()
-	{
-	}
-
-CTestFAndFApplication::~CTestFAndFApplication()
-	{
-	}
-		
-/**
-@return The application's UID 
-*/
-TUid CTestFAndFApplication::AppDllUid() const
-	{
-	const TUid dll = {KTestAppForFAndFUid};
-	return dll;
-	}
-
-/**
-@return CTestFAndFApplication or NULL if KErrNoMemory
-*/
-CApaApplication* CTestFAndFApplication::NewApplication()
-	{
-	// As the framework has at this point not started up enough, and therefore the TRAP-harness and 
-	// exception handlers aren’t available yet, this factory function is a non-leaving function and 
-	// can't use the new(Eleave) operator.
-	return new CTestFAndFApplication();
-	}
-	
-/**
-Called by the UI framework at application start-up to create an instance of the document class.
-@leave	KErrNoMemory
-@return A CTestFAndFDocument
-*/
-CApaDocument* CTestFAndFApplication::CreateDocumentL()
-	{
-	return CTestFAndFDocument::NewL(*this);
-	}
-
-CTestFAndFDocument::CTestFAndFDocument(CEikApplication& aApp) : CEikDocument(aApp)
-	{
-	}
-
-CTestFAndFDocument::~CTestFAndFDocument()
-	{
-	}
-
-/**
-Factory function for this class
-@return a new CEndTaskTestDocument instance.
-*/
-CTestFAndFDocument* CTestFAndFDocument::NewL(CEikApplication& aApp)
-	{
-	return new(ELeave) CTestFAndFDocument(aApp);
-	}
-
-
-
-/**
-Called by the UI framework to construct the application UI class. 
-Note that the app UI's ConstructL() is called by the UI framework.
-*/
-CEikAppUi* CTestFAndFDocument::CreateAppUiL()
-	{
-	return new(ELeave) CTestFAndFAppUi();
-	}
-
-
-
-CTestFAndFAppUi::CTestFAndFAppUi()
-	{
-	}
-
-
-
-CTestFAndFAppUi::~CTestFAndFAppUi()
-	{
-	}
-
-
-
-void CTestFAndFAppUi::ConstructL()
-	{
-	// Complete the UI framework's construction of the App UI.
-	BaseConstructL(CEikAppUi::ENoAppResourceFile);
-	
+// This exe fails to start for a specified number of times given in failCount, 
+// decrements the failCount each time and starts successfully once the fail count is exhausted
+static void StartProcessL()
+{
 	RFs fs;
 	RFileReadStream readStream;
 	RFileWriteStream writeStream;
@@ -159,6 +66,29 @@
 		RProcess::Rendezvous(KErrGeneral);
 		}
 	CleanupStack::PopAndDestroy(3, &fs);
+}
+
+/**
+Process entry point function.
+@return KErrNone if successful; KErrNoMemory if there is insufficient memory; otherwise, one of the other system-wide error codes.
+*/
+TInt E32Main()
+	{
+    CTrapCleanup* cleanup=CTrapCleanup::New();
+	
+	TInt error = KErrNoMemory;
+	if (cleanup)
+		{
+		TRAP(error, StartProcessL());
+		delete cleanup;
+		}
+
+	if (KErrNone != error)
+		{
+		User::Panic(_L("SUCCESSFULRETRY"),error);
+		}
+	User::WaitForAnyRequest();
+	return error;
 	}