installationservices/swi/test/tuiscriptadaptors/tswisstep.cpp
branchRCL_3
changeset 19 7ca52d38f8c3
parent 0 ba25891c3a9e
child 34 741e5bba2bd1
child 42 d17dc5398051
equal deleted inserted replaced
18:3ba40be8e484 19:7ca52d38f8c3
     1 /*
     1 /*
     2 * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of the License "Eclipse Public License v1.0"
     5 * under the terms of the License "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    38 #include "cafsisdataprovider.h"
    38 #include "cafsisdataprovider.h"
    39 #include "swispubsubdefs.h"
    39 #include "swispubsubdefs.h"
    40 #include "pkgremover.h"
    40 #include "pkgremover.h"
    41 #include "pkgremovererrors.h"
    41 #include "pkgremovererrors.h"
    42 #include "sisregistryaccess_client.h"
    42 #include "sisregistryaccess_client.h"
       
    43 #include <swi/swiutils.h>
    43 
    44 
    44 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
    45 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
    45 #include <usif/scr/scr.h>
    46 #include <usif/scr/scr.h>
    46 #include "installclientserver.h"
    47 #include "installclientserver.h"
    47 #endif
    48 #endif
  2627 		}
  2628 		}
  2628 	CleanupStack::PopAndDestroy(&uninstalledPkgEntry);
  2629 	CleanupStack::PopAndDestroy(&uninstalledPkgEntry);
  2629 	return TestStepResult();
  2630 	return TestStepResult();
  2630 	}
  2631 	}
  2631 
  2632 
       
  2633 
       
  2634 //
       
  2635 // CSwisCheckPublishUidStep
       
  2636 //
       
  2637 
       
  2638 CSwisCheckPublishUidStep::CSwisCheckPublishUidStep()
       
  2639     {
       
  2640     // Call base class method to set up the human readable name for logging
       
  2641     SetTestStepName(KSwisGetPublishedUidArrayStep);
       
  2642     }
       
  2643       
       
  2644 /**
       
  2645  * Override of base class virtual. Prepares for the test run of SWIS
       
  2646  * @return TVerdict code
       
  2647  */
       
  2648 TVerdict CSwisCheckPublishUidStep::doTestStepPreambleL()
       
  2649     {
       
  2650     INFO_PRINTF1(_L("CSwisCheckPublishUidStep::doTestStepPreambleL"));
       
  2651     _LIT(KDefineProperty, "DefineProperty");
       
  2652     iJustDefineProperty=EFalse;
       
  2653     if (GetBoolFromConfig(ConfigSection(),KDefineProperty,iJustDefineProperty) )
       
  2654         {
       
  2655         if(iJustDefineProperty)
       
  2656             {
       
  2657             INFO_PRINTF1(_L("CSwisCheckPublishUidStep is running in define Mode..just define the property"));
       
  2658             return TestStepResult();
       
  2659             }
       
  2660         }
       
  2661     
       
  2662 	_LIT(KPublishedUidCount, "PublishedUidCount");
       
  2663 	_LIT(KPublishedUidValue, "PublishedUidValue");
       
  2664 	TInt expectedUidCount;
       
  2665 	TBuf<20> publishedUidParam;
       
  2666 	
       
  2667 	if (!GetIntFromConfig(ConfigSection(),KPublishedUidCount,expectedUidCount))
       
  2668 		{
       
  2669         ERR_PRINTF1(_L("No uid mentioned in .ini"));
       
  2670 		return TestStepResult();
       
  2671 		}
       
  2672 
       
  2673 	iExpectedUidList[0].iUid = expectedUidCount;
       
  2674 	if(expectedUidCount>=KTestMaxUidCount-1)
       
  2675 	    {
       
  2676         ERR_PRINTF1(_L("The buffer available holds upto 15 Uids"));
       
  2677         return TestStepResult();
       
  2678 	    }
       
  2679 	
       
  2680 	for (TInt i=0; i<iExpectedUidList[0].iUid; i++)
       
  2681 		{
       
  2682         TInt uid;
       
  2683 		publishedUidParam = KPublishedUidValue;
       
  2684 		GenerateIndexedAttributeNameL(publishedUidParam, i);
       
  2685 		if (!GetHexFromConfig(ConfigSection(), publishedUidParam, uid))
       
  2686 			{
       
  2687    			ERR_PRINTF1(_L("Missing uid"));
       
  2688 			continue;
       
  2689    			}
       
  2690 		TUid pkgUid;
       
  2691 		pkgUid.iUid=uid;
       
  2692 		iExpectedUidList[i+1]= pkgUid;
       
  2693 		}
       
  2694     return TestStepResult();
       
  2695     }
       
  2696 	
       
  2697 void CSwisCheckPublishUidStep::GenerateIndexedAttributeNameL(TDes& aInitialAttributeName, TInt aIndex)
       
  2698 	{
       
  2699 	const TInt MAX_INT_STR_LEN = 8;
       
  2700 	TBuf<MAX_INT_STR_LEN> integerAppendStr;
       
  2701 	integerAppendStr.Format(_L("%d"), aIndex);
       
  2702 	aInitialAttributeName.Append(integerAppendStr);
       
  2703 	}
       
  2704 
       
  2705 
       
  2706 TVerdict CSwisCheckPublishUidStep::doTestStepL()
       
  2707     {
       
  2708     INFO_PRINTF1(KSwisGetPublishedUidArrayStep);
       
  2709     TInt err=0;
       
  2710     if(iJustDefineProperty)
       
  2711         {
       
  2712          err = RProperty::Define(KUidSystemCategory, KSWIUidsCurrentlyBeingProcessed, RProperty::EByteArray);
       
  2713         if (err != KErrNone && err != KErrAlreadyExists)
       
  2714             User::Leave(err);
       
  2715         return TestStepResult();
       
  2716         }
       
  2717       
       
  2718     TUid expUid;
       
  2719     TInt expCount;
       
  2720     RArray<TUid> retrivedUidList;
       
  2721     CleanupClosePushL(retrivedUidList);
       
  2722     expCount=iExpectedUidList[0].iUid;
       
  2723     if(KErrNone!=GetAllUids(retrivedUidList))
       
  2724         {
       
  2725         ERR_PRINTF1(_L("Failed to read all uids "));
       
  2726         SetTestStepResult(EFail);
       
  2727         CleanupStack::PopAndDestroy(&retrivedUidList);
       
  2728         return TestStepResult();
       
  2729         }
       
  2730     if (expCount!=retrivedUidList.Count())
       
  2731         {
       
  2732         ERR_PRINTF3(_L("expected and read count is not same , expected count is %d  read count is %d"),expCount, retrivedUidList.Count());
       
  2733         SetTestStepResult(EFail);
       
  2734         CleanupStack::PopAndDestroy(&retrivedUidList);
       
  2735         return TestStepResult();
       
  2736         }
       
  2737 	for(TInt i=0;i<expCount;i++)
       
  2738         {
       
  2739         expUid=iExpectedUidList[i+1];
       
  2740         INFO_PRINTF2(_L("Expected package uid %x"), expUid.iUid);
       
  2741         if (retrivedUidList.Find(expUid)==KErrNotFound)
       
  2742             {
       
  2743             ERR_PRINTF3(_L("Expected uid %x is not found and return code for retrivedUidList.Find is %d "), expUid.iUid,err);
       
  2744             SetTestStepResult(EFail);
       
  2745             }
       
  2746         }
       
  2747     CleanupStack::PopAndDestroy(&retrivedUidList);
       
  2748     return TestStepResult();
       
  2749     }
       
  2750 
       
  2751 TVerdict CSwisCheckPublishUidStep::doTestStepPostambleL()
       
  2752     {
       
  2753     if(!iJustDefineProperty)
       
  2754            {
       
  2755         TInt err = RProperty::Delete(KUidSystemCategory,KSWIUidsCurrentlyBeingProcessed);
       
  2756         if(err != KErrNone)
       
  2757             {
       
  2758             ERR_PRINTF1(_L("Not able to delete property "));
       
  2759             }
       
  2760            return TestStepResult();
       
  2761            }
       
  2762            
       
  2763     return TestStepResult();
       
  2764     }
       
  2765 
  2632 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
  2766 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
  2633 /**
  2767 /**
  2634  * Override of base class pure virtual
  2768  * Override of base class pure virtual
  2635  * Demonstrates reading configuration parameters from an ini file section
  2769  * Demonstrates reading configuration parameters from an ini file section
  2636  * @return TVerdict code
  2770  * @return TVerdict code