43 #include "sisregistryobject.h" |
43 #include "sisregistryobject.h" |
44 #include "controllerinfo.h" |
44 #include "controllerinfo.h" |
45 #include "hashcontainer.h" |
45 #include "hashcontainer.h" |
46 #include "sisregistryproperty.h" |
46 #include "sisregistryproperty.h" |
47 |
47 |
|
48 #include <centralrepository.h> |
|
49 #include "sisregistryaccess_client.h" |
48 const TInt KDefaultBufferSize = 2048; |
50 const TInt KDefaultBufferSize = 2048; |
49 ///////////////////////////////////////////////////////////////////// |
51 ///////////////////////////////////////////////////////////////////// |
50 // defs, Constants used by test steps |
52 // defs, Constants used by test steps |
51 ///////////////////////////////////////////////////////////////////// |
53 ///////////////////////////////////////////////////////////////////// |
52 |
54 |
53 _LIT(KNoUid, "nouid"); |
55 _LIT(KNoUid, "nouid"); |
54 _LIT(KUid, "uid"); |
56 _LIT(KUid, "uid"); |
|
57 _LIT(KCenRepKey, "cenrepkey"); |
|
58 _LIT(KCenRepValue, "cenrepvalue"); |
55 _LIT(KDrivebitmapcount, "drivebitmapcout"); |
59 _LIT(KDrivebitmapcount, "drivebitmapcout"); |
56 _LIT(KSid, "sid"); |
60 _LIT(KSid, "sid"); |
57 _LIT(KPackage, "package"); |
61 _LIT(KPackage, "package"); |
58 _LIT(KVendor, "vendor"); |
62 _LIT(KVendor, "vendor"); |
59 _LIT(KSisFile, "sis"); |
63 _LIT(KSisFile, "sis"); |
675 CleanupStack::PopAndDestroy(&expectedUids); |
681 CleanupStack::PopAndDestroy(&expectedUids); |
676 |
682 |
677 return TestStepResult(); |
683 return TestStepResult(); |
678 } |
684 } |
679 |
685 |
|
686 ///////////////////////////////////////////////////////////////////// |
|
687 // CSetCenRepSettingStep - Set Central Reposatory Value |
|
688 ///////////////////////////////////////////////////////////////////// |
|
689 CSetCenRepSettingStep::CSetCenRepSettingStep() |
|
690 { |
|
691 SetTestStepName(KSetCenRepSetting); |
|
692 } |
|
693 |
|
694 TVerdict CSetCenRepSettingStep::doTestStepL() |
|
695 { |
|
696 SetTestStepResult(EPass); |
|
697 TUid repUid; |
|
698 if(!GetUidFromConfig(ConfigSection(), KUid, repUid)) |
|
699 { |
|
700 ERR_PRINTF1(_L("Package UID is missing in the configuration file!")); |
|
701 SetTestStepResult(EFail); |
|
702 return TestStepResult(); |
|
703 } |
|
704 |
|
705 TInt cenRepKey; |
|
706 if(!GetIntFromConfig(ConfigSection(), KCenRepKey, cenRepKey)) |
|
707 { |
|
708 ERR_PRINTF1(_L("Central Reposatory Key is missing in the configuration file!")); |
|
709 SetTestStepResult(EFail); |
|
710 return TestStepResult(); |
|
711 } |
|
712 |
|
713 TInt cenRepValue; |
|
714 if(!GetIntFromConfig(ConfigSection(), KCenRepValue, cenRepValue)) |
|
715 { |
|
716 ERR_PRINTF1(_L("Central Reposatory Value is missing in the configuration file!")); |
|
717 SetTestStepResult(EFail); |
|
718 return TestStepResult(); |
|
719 } |
|
720 |
|
721 CRepository* rep = CRepository::NewLC(repUid); |
|
722 TInt err = rep->Set(cenRepKey, cenRepValue); |
|
723 |
|
724 if( err == KErrNone ) |
|
725 { |
|
726 INFO_PRINTF4(_L("Setting Central Reposatory 0x%08x , key = %d, value = %d"),repUid,cenRepKey,cenRepValue); |
|
727 } |
|
728 else |
|
729 { |
|
730 SetTestStepResult(EFail); |
|
731 ERR_PRINTF4(_L("Failed Setting Central Reposatory 0x%08x , key = %d, value = %d"),repUid,cenRepKey,cenRepValue); |
|
732 } |
|
733 |
|
734 CleanupStack::PopAndDestroy(rep); |
|
735 return TestStepResult(); |
|
736 } |
|
737 |
|
738 |
680 ///////////////////////////////////////////////////////////////////// |
739 ///////////////////////////////////////////////////////////////////// |
681 // CIsPackageInstalledStep - checks if packages are registered |
740 // CIsPackageInstalledStep - checks if packages are registered |
682 ///////////////////////////////////////////////////////////////////// |
741 ///////////////////////////////////////////////////////////////////// |
683 |
742 |
684 CIsPackageInstalledStep::CIsPackageInstalledStep() |
743 CIsPackageInstalledStep::CIsPackageInstalledStep() |
2717 } |
2776 } |
2718 CleanupStack::PopAndDestroy(&packages); |
2777 CleanupStack::PopAndDestroy(&packages); |
2719 SetTestStepResult(EPass); |
2778 SetTestStepResult(EPass); |
2720 return TestStepResult(); |
2779 return TestStepResult(); |
2721 } |
2780 } |
|
2781 |
|
2782 //////////////////////////////////////////////////////////////////////////// |
|
2783 // CAddAppRegInfoStep |
|
2784 //////////////////////////////////////////////////////////////////////////// |
|
2785 CAddAppRegInfoStep::CAddAppRegInfoStep() |
|
2786 { |
|
2787 SetTestStepName(KIsFileRegisteredStep); |
|
2788 } |
|
2789 |
|
2790 TVerdict CAddAppRegInfoStep::doTestStepL() |
|
2791 { |
|
2792 TPtrC regFileName; |
|
2793 if(!GetStringFromConfig(ConfigSection(), _L("regFileName"), regFileName)) |
|
2794 { |
|
2795 ERR_PRINTF1(_L("Reg File Name was not found in ini")); |
|
2796 User::Leave(KErrNotFound); |
|
2797 } |
|
2798 |
|
2799 RSisRegistryAccessSession sisRegistryAccessSessionSession; |
|
2800 User::LeaveIfError(sisRegistryAccessSessionSession.Connect()); |
|
2801 CleanupClosePushL(sisRegistryAccessSessionSession); |
|
2802 |
|
2803 TInt res = sisRegistryAccessSessionSession.AddAppRegInfoL(regFileName, iTimeMeasuredExternally ); |
|
2804 |
|
2805 if(res != KErrNone) |
|
2806 { |
|
2807 ERR_PRINTF2(_L("Application Registration data not added successfuly , error %d"),res); |
|
2808 User::Leave(res); |
|
2809 } |
|
2810 CleanupStack::Pop(&sisRegistryAccessSessionSession); |
|
2811 SetTestStepResult(EPass); |
|
2812 return TestStepResult(); |
|
2813 } |
|
2814 |
|
2815 //////////////////////////////////////////////////////////////////////////// |
|
2816 // CRemoveAppRegInfoStep |
|
2817 //////////////////////////////////////////////////////////////////////////// |
|
2818 |
|
2819 CRemoveAppRegInfoStep::CRemoveAppRegInfoStep() |
|
2820 { |
|
2821 SetTestStepName(KIsFileRegisteredStep); |
|
2822 } |
|
2823 |
|
2824 TVerdict CRemoveAppRegInfoStep::doTestStepL() |
|
2825 { |
|
2826 TPtrC regFileName; |
|
2827 if(!GetStringFromConfig(ConfigSection(), _L("regFileName"), regFileName)) |
|
2828 { |
|
2829 ERR_PRINTF1(_L("Reg File Name was not found in ini")); |
|
2830 User::Leave(KErrNotFound); |
|
2831 } |
|
2832 |
|
2833 RSisRegistryAccessSession sisRegistryAccessSessionSession; |
|
2834 User::LeaveIfError(sisRegistryAccessSessionSession.Connect()); |
|
2835 CleanupClosePushL(sisRegistryAccessSessionSession); |
|
2836 |
|
2837 TInt res = sisRegistryAccessSessionSession.RemoveAppRegInfoL(regFileName, iTimeMeasuredExternally ); |
|
2838 |
|
2839 if(res != KErrNone) |
|
2840 { |
|
2841 ERR_PRINTF2(_L("Application Registration data not added successfuly , error %d"),res); |
|
2842 User::Leave(res); |
|
2843 } |
|
2844 CleanupStack::PopAndDestroy(&sisRegistryAccessSessionSession); |
|
2845 SetTestStepResult(EPass); |
|
2846 return TestStepResult(); |
|
2847 } |
|
2848 |
|
2849 ////////////////////// |
|
2850 //////CheckAppRegData |
|
2851 ///////////////////// |
|
2852 |
|
2853 CheckAppRegData::CheckAppRegData() |
|
2854 { |
|
2855 SetTestStepName(KIsFileRegisteredStep); |
|
2856 } |
|
2857 |
|
2858 TVerdict CheckAppRegData::doTestStepL() |
|
2859 { |
|
2860 SetTestStepResult(EPass); |
|
2861 // Verify if the reg data is removed properly or not |
|
2862 TBool isAppDataExists(EFalse); |
|
2863 Usif::RSoftwareComponentRegistry scrSession; |
|
2864 User::LeaveIfError(scrSession.Connect()); |
|
2865 CleanupClosePushL(scrSession); |
|
2866 GetBoolFromConfig(ConfigSection(), _L("appDataExists"), isAppDataExists); |
|
2867 if(isAppDataExists) |
|
2868 { |
|
2869 TPtrC appFileName; |
|
2870 if(GetStringFromConfig(ConfigSection(), _L("appFileName"), appFileName)) |
|
2871 { |
|
2872 TUid appUid; |
|
2873 TInt intAppUid(0); |
|
2874 if(!GetHexFromConfig(ConfigSection(), _L("appUid"), intAppUid)) |
|
2875 { |
|
2876 User::Leave(KErrNotFound); |
|
2877 } |
|
2878 |
|
2879 appUid = TUid::Uid(intAppUid); |
|
2880 RArray<TUid> appUidArray; |
|
2881 CleanupClosePushL(appUidArray); |
|
2882 appUidArray.AppendL(appUid); |
|
2883 |
|
2884 //check if we have rolled back to the reg in rom after removal |
|
2885 Usif::RApplicationInfoView appRegistryView; |
|
2886 CleanupClosePushL(appRegistryView); |
|
2887 Usif::CAppInfoFilter* appInfoFilter = Usif::CAppInfoFilter::NewLC(); |
|
2888 appInfoFilter->SetAllApps(); |
|
2889 appRegistryView.OpenViewL(scrSession, appInfoFilter); |
|
2890 RPointerArray<Usif::TAppRegInfo> appInfo; |
|
2891 CleanupClosePushL(appInfo); |
|
2892 appRegistryView.GetNextAppInfoL(5, appInfo); |
|
2893 |
|
2894 for(TInt i = 0; i < 5 ; ++i) |
|
2895 { |
|
2896 if(appInfo[i]->Uid() == appUid) |
|
2897 { |
|
2898 if(appInfo[i]->FullName().Compare(appFileName) != 0) |
|
2899 { |
|
2900 SetTestStepResult(EFail); |
|
2901 CleanupStack::Pop(&appInfo); |
|
2902 appInfo.ResetAndDestroy(); |
|
2903 CleanupStack::PopAndDestroy(4, &scrSession); // appInfoFilter, appRegistryView, appUid, scrSession |
|
2904 return TestStepResult(); |
|
2905 } |
|
2906 break; |
|
2907 } |
|
2908 } |
|
2909 CleanupStack::Pop(&appInfo); |
|
2910 appInfo.ResetAndDestroy(); |
|
2911 CleanupStack::PopAndDestroy(3, &appUidArray); // appInfoFilter, appRegistryView, |
|
2912 } |
|
2913 } |
|
2914 else |
|
2915 { |
|
2916 TUid appUid = TUid::Uid(0); |
|
2917 TInt intAppUid(0); |
|
2918 if(!GetHexFromConfig(ConfigSection(), _L("appUid"), intAppUid)) |
|
2919 { |
|
2920 User::Leave(KErrNotFound); |
|
2921 } |
|
2922 appUid = TUid::Uid(intAppUid); |
|
2923 |
|
2924 TRAPD(err, scrSession.GetComponentIdForAppL(appUid)); |
|
2925 if(err != KErrNotFound) |
|
2926 { |
|
2927 SetTestStepResult(EFail); |
|
2928 CleanupStack::PopAndDestroy(&scrSession); |
|
2929 return TestStepResult(); |
|
2930 } |
|
2931 } |
|
2932 |
|
2933 CleanupStack::PopAndDestroy(&scrSession); |
|
2934 return TestStepResult(); |
|
2935 } |