homescreensrv_plat/sapi_homescreenplugin/tsrc/hspsconfigurationif/src/mt_hspsconfigurationif.cpp
branchRCL_3
changeset 23 ace62b58f4b2
parent 19 edd621764147
child 27 2c7f27287390
equal deleted inserted replaced
22:1b207dd38b72 23:ace62b58f4b2
   261     // Detach from HSPS 
   261     // Detach from HSPS 
   262     TRAPD( err, DetachServiceL() );
   262     TRAPD( err, DetachServiceL() );
   263     // Remove test configuration resource files
   263     // Remove test configuration resource files
   264     TRAP( err, RemoveResourceFilesL( iFileserver ) );
   264     TRAP( err, RemoveResourceFilesL( iFileserver ) );
   265     if ( err != KErrNone )
   265     if ( err != KErrNone )
   266     	{    	
   266         {        
   267     	EUNIT_FAIL_TEST( "Teardown failed." );
   267         EUNIT_FAIL_TEST( "Teardown failed." );
   268     	}
   268         }
   269     }
   269     }
   270 
   270 
   271 //------------------------------------------------------------------------------
   271 //------------------------------------------------------------------------------
   272 // Prints liw list to a file.
   272 // Prints liw list to a file.
   273 //------------------------------------------------------------------------------
   273 //------------------------------------------------------------------------------
  2637         ( TUint8* )requestnotify_6_ts_6_method,
  2637         ( TUint8* )requestnotify_6_ts_6_method,
  2638         ( TUint8* )requestnotify_6_ts_6_input,
  2638         ( TUint8* )requestnotify_6_ts_6_input,
  2639         ( TUint8* )requestnotify_6_ts_6_output );    
  2639         ( TUint8* )requestnotify_6_ts_6_output );    
  2640     EUNIT_PRINT( _L8( "Test step passed" ) );       
  2640     EUNIT_PRINT( _L8( "Test step passed" ) );       
  2641     }
  2641     }
       
  2642 
       
  2643 
       
  2644 //------------------------------------------------------------------------------
       
  2645 // Test case: SisxUpgrade(1)
       
  2646 //------------------------------------------------------------------------------
       
  2647 void MT_CHSPSConfigurationIf::SisxUpgrade_1_L()
       
  2648    {
       
  2649     // Pre conditions        
       
  2650 
       
  2651     // Attach to HSPS 
       
  2652     EUNIT_PRINT( _L8( "Pre conditions: Attach to HSPS service IConfiguration interface" ) );
       
  2653     AttachServiceL( KHSPS, KHSPSConfigurationIf, KHSPSTestAppUid );
       
  2654 
       
  2655     // Test step 1: 
       
  2656     EUNIT_PRINT( _L8( "Test step 1: simulate installation of a SISX package" ) );
       
  2657 
       
  2658     CFileMan* fileManager = CFileMan::NewL( iFileserver );
       
  2659     CleanupStack::PushL( fileManager );
       
  2660 
       
  2661     // Copy installation files to c\private\200159c0\import
       
  2662     User::LeaveIfError( fileManager->Copy(
       
  2663         _L( "c:\\data\\mt_hsps\\installed_widget\\0\\" ),
       
  2664         _L( "c:\\private\\200159c0\\import\\0998\\101FB657\\2000B133\\1.0\\0\\" ),
       
  2665         CFileMan::ERecurse|CFileMan::EOverWrite ) );
       
  2666     User::LeaveIfError( fileManager->Copy(
       
  2667         _L( "c:\\data\\mt_hsps\\installed_widget\\1\\" ),
       
  2668         _L( "c:\\private\\200159c0\\import\\0998\\101FB657\\2000B133\\1.0\\1\\" ),
       
  2669         CFileMan::ERecurse|CFileMan::EOverWrite ) );
       
  2670     User::LeaveIfError( fileManager->Copy(
       
  2671         _L( "c:\\data\\mt_hsps\\installed_widget\\9\\" ),
       
  2672         _L( "c:\\private\\200159c0\\import\\0998\\101FB657\\2000B133\\1.0\\9\\" ),
       
  2673         CFileMan::ERecurse|CFileMan::EOverWrite ) );
       
  2674     User::LeaveIfError( fileManager->Copy(
       
  2675         _L( "c:\\data\\mt_hsps\\installed_widget\\widgetconfiguration.xml" ),
       
  2676         _L( "c:\\private\\200159c0\\import\\0998\\101FB657\\2000B133\\1.0\\" ),
       
  2677         CFileMan::EOverWrite ) );
       
  2678     User::LeaveIfError( fileManager->Copy(
       
  2679         _L( "c:\\data\\mt_hsps\\installed_widget\\manifest.dat" ),
       
  2680         _L( "c:\\private\\200159c0\\import\\0998\\101FB657\\2000B133\\1.0\\" ),
       
  2681         CFileMan::EOverWrite ) );
       
  2682     User::LeaveIfError( fileManager->Copy(
       
  2683         _L( "c:\\data\\mt_hsps\\installed_widget\\plugin_0998_101FB657_2000B133_1.0.dat" ),
       
  2684         _L( "c:\\private\\200159c0\\import\\" ),
       
  2685         CFileMan::EOverWrite ) );
       
  2686             
       
  2687     // Wait until configuration is installed
       
  2688     User::After( 4000000 );
       
  2689     
       
  2690     // Make sure "InstalledWidget" is installed
       
  2691     if ( !BaflUtils::FileExists( iFileserver, _L( "c:\\private\\200159c0\\themes\\2456\\270513751\\536916275\\1.0\\InstallWidgetConf.o0000" ) ) )
       
  2692         {
       
  2693         // Installation failed - remove imports to be able to re-run the test again
       
  2694         // The ChspsThemeServer::HandleConfigurationImportsL does handle newly
       
  2695         // added files only
       
  2696         User::LeaveIfError( fileManager->RmDir( _L( "c:\\private\\200159c0\\import\\0998\\" ) ) );
       
  2697         fileManager->Attribs( _L( "c:\\private\\200159c0\\import\\plugin_0998_101FB657_2000B133.dat" ),
       
  2698             0, KEntryAttReadOnly, TTime( 0 ) ); // TTime(0) = preserve original time stamp.
       
  2699         User::LeaveIfError( fileManager->Delete( _L( "c:\\private\\200159c0\\import\\plugin_0998_101FB657_2000B133_1.0.dat" ) ) );     
       
  2700         
       
  2701         // Leave - the test was not successfull
       
  2702         User::Leave( KErrGeneral );
       
  2703         }
       
  2704     EUNIT_PRINT( _L8( "Test step passed" ) );
       
  2705 
       
  2706     // Test step 1: 
       
  2707     EUNIT_PRINT( _L8( "Test step 2: simulate upgrade to v2 of a SISX package" ) );
       
  2708     // Copy installation files to c\private\200159c0\import
       
  2709     User::LeaveIfError( fileManager->Copy(
       
  2710         _L( "c:\\data\\mt_hsps\\installed_widget_v2\\0\\" ),
       
  2711         _L( "c:\\private\\200159c0\\import\\0998\\101FB657\\2000B133\\2.0\\0\\" ),
       
  2712         CFileMan::ERecurse|CFileMan::EOverWrite ) );
       
  2713     User::LeaveIfError( fileManager->Copy(
       
  2714         _L( "c:\\data\\mt_hsps\\installed_widget_v2\\1\\" ),
       
  2715         _L( "c:\\private\\200159c0\\import\\0998\\101FB657\\2000B133\\2.0\\1\\" ),
       
  2716         CFileMan::ERecurse|CFileMan::EOverWrite ) );
       
  2717     User::LeaveIfError( fileManager->Copy(
       
  2718         _L( "c:\\data\\mt_hsps\\installed_widget_v2\\9\\" ),
       
  2719         _L( "c:\\private\\200159c0\\import\\0998\\101FB657\\2000B133\\2.0\\9\\" ),
       
  2720         CFileMan::ERecurse|CFileMan::EOverWrite ) );
       
  2721     User::LeaveIfError( fileManager->Copy(
       
  2722         _L( "c:\\data\\mt_hsps\\installed_widget_v2\\widgetconfiguration.xml" ),
       
  2723         _L( "c:\\private\\200159c0\\import\\0998\\101FB657\\2000B133\\2.0\\" ),
       
  2724         CFileMan::EOverWrite ) );
       
  2725     User::LeaveIfError( fileManager->Copy(
       
  2726         _L( "c:\\data\\mt_hsps\\installed_widget_v2\\manifest.dat" ),
       
  2727         _L( "c:\\private\\200159c0\\import\\0998\\101FB657\\2000B133\\2.0\\" ),
       
  2728         CFileMan::EOverWrite ) );
       
  2729     User::LeaveIfError( fileManager->Copy(
       
  2730         _L( "c:\\data\\mt_hsps\\installed_widget_v2\\plugin_0998_101FB657_2000B133_2.0.dat" ),
       
  2731         _L( "c:\\private\\200159c0\\import\\" ),
       
  2732         CFileMan::EOverWrite ) );
       
  2733             
       
  2734     // Wait until configuration is installed
       
  2735     User::After( 4000000 );
       
  2736     
       
  2737     // Make sure "InstalledWidget v1" is removed
       
  2738     if ( BaflUtils::FileExists( iFileserver, _L( "c:\\private\\200159c0\\themes\\2456\\270513751\\536916275\\1.0\\InstallWidgetConf.o0000" ) ) )
       
  2739         {
       
  2740         // Installation failed - remove imports to be able to re-run the test again
       
  2741         // The ChspsThemeServer::HandleConfigurationImportsL does handle newly
       
  2742         // added files only
       
  2743         User::LeaveIfError( fileManager->RmDir( _L( "c:\\private\\200159c0\\import\\0998\\" ) ) );
       
  2744         fileManager->Attribs( _L( "c:\\private\\200159c0\\import\\plugin_0998_101FB657_2000B133_1.0.dat" ),
       
  2745             0, KEntryAttReadOnly, TTime( 0 ) ); // TTime(0) = preserve original time stamp.
       
  2746         fileManager->Attribs( _L( "c:\\private\\200159c0\\import\\plugin_0998_101FB657_2000B133_2.0.dat" ),
       
  2747             0, KEntryAttReadOnly, TTime( 0 ) ); // TTime(0) = preserve original time stamp.
       
  2748 
       
  2749         User::LeaveIfError( fileManager->Delete( _L( "c:\\private\\200159c0\\import\\plugin_0998_101FB657_2000B133_1.0.dat" ) ) );     
       
  2750         User::LeaveIfError( fileManager->Delete( _L( "c:\\private\\200159c0\\import\\plugin_0998_101FB657_2000B133_2.0.dat" ) ) );     
       
  2751         // Leave - the test was not successfull
       
  2752         User::Leave( KErrGeneral );
       
  2753         }
       
  2754     
       
  2755     EUNIT_PRINT( _L8( "Test step passed" ) );
       
  2756 
       
  2757 
       
  2758     // Test step 3: 
       
  2759     EUNIT_PRINT( _L8( "Test step 3: simulate uninstalation of a SISX package" ) );
       
  2760     // Remove installation files to c\private\200159c0\import
       
  2761     User::LeaveIfError( fileManager->RmDir( _L( "c:\\private\\200159c0\\import\\0998\\" ) ) );
       
  2762     fileManager->Attribs( _L( "c:\\private\\200159c0\\import\\plugin_0998_101FB657_2000B133_1.0.dat" ),
       
  2763         0, KEntryAttReadOnly, TTime( 0 ) ); // TTime(0) = preserve original time stamp.
       
  2764     fileManager->Attribs( _L( "c:\\private\\200159c0\\import\\plugin_0998_101FB657_2000B133_2.0.dat" ),
       
  2765         0, KEntryAttReadOnly, TTime( 0 ) ); // TTime(0) = preserve original time stamp.        
       
  2766     User::LeaveIfError( fileManager->Delete( _L( "c:\\private\\200159c0\\import\\plugin_0998_101FB657_2000B133_1.0.dat" ) ) );     
       
  2767     User::LeaveIfError( fileManager->Delete( _L( "c:\\private\\200159c0\\import\\plugin_0998_101FB657_2000B133_2.0.dat" ) ) );     
       
  2768         
       
  2769     EUNIT_PRINT( _L8( "Test step passed" ) );
       
  2770     User::After( 4000000 );
       
  2771     
       
  2772     // check
       
  2773     // Copy installation files to c\private\200159c0\import
       
  2774     EUNIT_PRINT( _L8( "Test step 4: simulate installation of a SISX package" ) );
       
  2775     User::LeaveIfError( fileManager->Copy(
       
  2776         _L( "c:\\data\\mt_hsps\\installed_widget\\0\\" ),
       
  2777         _L( "c:\\private\\200159c0\\import\\0998\\101FB657\\2000B133\\1.0\\0\\" ),
       
  2778         CFileMan::ERecurse|CFileMan::EOverWrite ) );
       
  2779     User::LeaveIfError( fileManager->Copy(
       
  2780         _L( "c:\\data\\mt_hsps\\installed_widget\\1\\" ),
       
  2781         _L( "c:\\private\\200159c0\\import\\0998\\101FB657\\2000B133\\1.0\\1\\" ),
       
  2782         CFileMan::ERecurse|CFileMan::EOverWrite ) );
       
  2783     User::LeaveIfError( fileManager->Copy(
       
  2784         _L( "c:\\data\\mt_hsps\\installed_widget\\9\\" ),
       
  2785         _L( "c:\\private\\200159c0\\import\\0998\\101FB657\\2000B133\\1.0\\9\\" ),
       
  2786         CFileMan::ERecurse|CFileMan::EOverWrite ) );
       
  2787     User::LeaveIfError( fileManager->Copy(
       
  2788         _L( "c:\\data\\mt_hsps\\installed_widget\\widgetconfiguration.xml" ),
       
  2789         _L( "c:\\private\\200159c0\\import\\0998\\101FB657\\2000B133\\1.0\\" ),
       
  2790         CFileMan::EOverWrite ) );
       
  2791     User::LeaveIfError( fileManager->Copy(
       
  2792         _L( "c:\\data\\mt_hsps\\installed_widget\\manifest.dat" ),
       
  2793         _L( "c:\\private\\200159c0\\import\\0998\\101FB657\\2000B133\\1.0\\" ),
       
  2794         CFileMan::EOverWrite ) );
       
  2795     User::LeaveIfError( fileManager->Copy(
       
  2796         _L( "c:\\data\\mt_hsps\\installed_widget\\plugin_0998_101FB657_2000B133_1.0.dat" ),
       
  2797         _L( "c:\\private\\200159c0\\import\\" ),
       
  2798         CFileMan::EOverWrite ) );
       
  2799             
       
  2800     // Wait until configuration is installed
       
  2801     User::After( 4000000 );
       
  2802     
       
  2803     // Make sure "InstalledWidget" is installed
       
  2804     if ( !BaflUtils::FileExists( iFileserver, _L( "c:\\private\\200159c0\\themes\\2456\\270513751\\536916275\\1.0\\InstallWidgetConf.o0000" ) ) )
       
  2805         {
       
  2806         // Installation failed - remove imports to be able to re-run the test again
       
  2807         // The ChspsThemeServer::HandleConfigurationImportsL does handle newly
       
  2808         // added files only
       
  2809         User::LeaveIfError( fileManager->RmDir( _L( "c:\\private\\200159c0\\import\\0998\\" ) ) );
       
  2810         fileManager->Attribs( _L( "c:\\private\\200159c0\\import\\plugin_0998_101FB657_2000B133_1.0.dat" ),
       
  2811             0, KEntryAttReadOnly, TTime( 0 ) ); // TTime(0) = preserve original time stamp.
       
  2812         User::LeaveIfError( fileManager->Delete( _L( "c:\\private\\200159c0\\import\\plugin_0998_101FB657_2000B133_1.0.dat" ) ) );     
       
  2813 
       
  2814         // Leave - the test was not successfull
       
  2815         User::Leave( KErrGeneral );
       
  2816         }
       
  2817     
       
  2818     EUNIT_PRINT( _L8( "Test step passed" ) );
       
  2819         
       
  2820     // Test step 2: 
       
  2821     EUNIT_PRINT( _L8( "Test step 5: simulate un-installation of the SISX package" ) );
       
  2822     
       
  2823     // Remove installation files from c\private\200159c0\import
       
  2824     User::LeaveIfError( fileManager->RmDir( _L( "c:\\private\\200159c0\\import\\0998\\" ) ) );
       
  2825     fileManager->Attribs( _L( "c:\\private\\200159c0\\import\\plugin_0998_101FB657_2000B133.dat" ),
       
  2826                           0,
       
  2827                           KEntryAttReadOnly,
       
  2828                           TTime( 0 ) ); // TTime(0) = preserve original time stamp.
       
  2829     User::LeaveIfError( fileManager->Delete( _L( "c:\\private\\200159c0\\import\\plugin_0998_101FB657_2000B133_1.0.dat" ) ) );     
       
  2830     // Removing of *.dat file causes configuration uninstallation
       
  2831     // Wait until configuration is uninstalled
       
  2832     User::After( 4000000 );
       
  2833 
       
  2834     // Make sure "InstalledWidget" is uninstalled
       
  2835     if ( BaflUtils::FileExists( iFileserver, _L( "c:\\private\\200159c0\\themes\\2456\\270513751\\536916275\\1.0\\InstallWidgetConf.o0000" ) ) )
       
  2836         {
       
  2837         User::Leave( KErrGeneral );
       
  2838         }
       
  2839 
       
  2840     EUNIT_PRINT( _L8( "Test step passed" ) );
       
  2841 
       
  2842     CleanupStack::PopAndDestroy( fileManager );
       
  2843     };
       
  2844 
       
  2845 
       
  2846 
  2642 
  2847 
  2643 //------------------------------------------------------------------------------
  2848 //------------------------------------------------------------------------------
  2644 // Test case: SisxInstallation(1)
  2849 // Test case: SisxInstallation(1)
  2645 //------------------------------------------------------------------------------
  2850 //------------------------------------------------------------------------------
  2646 void MT_CHSPSConfigurationIf::SisxInstallation_1_L()
  2851 void MT_CHSPSConfigurationIf::SisxInstallation_1_L()
  3421        "SetPluginSettings",
  3626        "SetPluginSettings",
  3422        "FUNCTIONALITY",
  3627        "FUNCTIONALITY",
  3423        SetupL, SetPluginSettings_6_L, Teardown )
  3628        SetupL, SetPluginSettings_6_L, Teardown )
  3424 
  3629 
  3425     EUNIT_TEST(
  3630     EUNIT_TEST(
  3426 	   "GetPluginSettings(1)",
  3631        "GetPluginSettings(1)",
  3427 	   "IConfiguration",
  3632        "IConfiguration",
  3428 	   "GetPluginSettings",
  3633        "GetPluginSettings",
  3429 	   "FUNCTIONALITY",
  3634        "FUNCTIONALITY",
  3430 	   SetupL, GetPluginSettings_1_L, Teardown )
  3635        SetupL, GetPluginSettings_1_L, Teardown )
  3431 
  3636 
  3432     EUNIT_TEST(
  3637     EUNIT_TEST(
  3433        "GetPluginSettings(2)",
  3638        "GetPluginSettings(2)",
  3434        "IConfiguration",
  3639        "IConfiguration",
  3435        "GetPluginSettings",
  3640        "GetPluginSettings",
  3567        "IConfiguration",
  3772        "IConfiguration",
  3568        "RequestNotify",
  3773        "RequestNotify",
  3569        "FUNCTIONALITY",
  3774        "FUNCTIONALITY",
  3570        SetupL, RequestNotify_6_L, Teardown )
  3775        SetupL, RequestNotify_6_L, Teardown )
  3571 
  3776 
  3572 	EUNIT_TEST(
  3777     EUNIT_TEST(
       
  3778        "SisxUpgrade(1)",
       
  3779        "IConfiguration",
       
  3780        "SisxUpgrade",
       
  3781        "FUNCTIONALITY",
       
  3782        SetupL, SisxUpgrade_1_L, Teardown )       
       
  3783       
       
  3784     EUNIT_TEST(
  3573        "SisxInstallation(1)",
  3785        "SisxInstallation(1)",
  3574        "IConfiguration",
  3786        "IConfiguration",
  3575        "SisxInstallation",
  3787        "SisxInstallation",
  3576        "FUNCTIONALITY",
  3788        "FUNCTIONALITY",
  3577        SetupL, SisxInstallation_1_L, Teardown )       
  3789        SetupL, SisxInstallation_1_L, Teardown )       
  3578        
  3790               
  3579     EUNIT_TEST(   
  3791     EUNIT_TEST(   
  3580        "NativeInstallation(1)",
  3792        "NativeInstallation(1)",
  3581        "IConfiguration",
  3793        "IConfiguration",
  3582        "NativeInstallation",
  3794        "NativeInstallation",
  3583        "FUNCTIONALITY",
  3795        "FUNCTIONALITY",