authorisation/userpromptservice/test/tups_backuprestore/step_uninstall.cpp
changeset 8 35751d3474b7
equal deleted inserted replaced
2:675a964f4eb5 8:35751d3474b7
       
     1 /*
       
     2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "tbackuprestorestep.h"
       
    20 #include <test/testexecutelog.h>
       
    21 
       
    22 #include <swi/launcher.h>
       
    23 #include "tui.h"
       
    24 
       
    25 CTStepUninstall::CTStepUninstall()
       
    26 	{
       
    27 	SetTestStepName(KTStepUninstall);
       
    28 	}
       
    29 
       
    30 TVerdict CTStepUninstall::doTestStepL()
       
    31 	{
       
    32 	if (TestStepResult() != EPass)
       
    33 		{
       
    34 		return TestStepResult();
       
    35 		}
       
    36 
       
    37 	TInt expectedResult;
       
    38 	if (GetIntFromConfig(ConfigSection(),_L("UninstallResult"), expectedResult) == EFalse)
       
    39 		{
       
    40 		expectedResult = KErrNone;
       
    41 		}
       
    42 		
       
    43 	while (NextPackage())
       
    44 		{
       
    45 		TUI ui;	
       
    46 		TInt err = Launcher::Uninstall(ui, PackageUID());
       
    47 		if (expectedResult == KErrNotFound)
       
    48 			{
       
    49 			if (err != KErrNone)
       
    50 				{
       
    51 				// Can't set error to KErrServerBusy, or Testexecute will retry.
       
    52 				SetTestStepResult((err != KErrServerBusy)? static_cast<TVerdict>(err) : EFail);
       
    53 				}
       
    54 			CheckExpectedResultCodesL();
       
    55 			err = expectedResult;
       
    56 			}
       
    57 		if (err != expectedResult)
       
    58 			{
       
    59 			INFO_PRINTF3(_L("Expected %d, got %d"), expectedResult, err);
       
    60 			SetTestStepResult(EFail);
       
    61 			SetTestStepError(err);
       
    62 			}
       
    63 		}
       
    64 	return TestStepResult();
       
    65 	}