diff -r 2c28af138640 -r c6215323ad55 sysstatemgmt/systemstatemgr/test/testapps/src/ssmtestappsucessfulafterretry.cpp --- a/sysstatemgmt/systemstatemgr/test/testapps/src/ssmtestappsucessfulafterretry.cpp Wed Jun 23 19:38:32 2010 +0300 +++ b/sysstatemgmt/systemstatemgr/test/testapps/src/ssmtestappsucessfulafterretry.cpp Tue Jul 06 15:43:30 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 -#include -#include "ssmtestappsucessfulafterretry.h" +#include +#include #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; }