webengine/widgetregistry/tsrc/public/basic/src/WidgetRegistrySTIF.cpp
branchRCL_3
changeset 93 79859ed3eea9
parent 70 8bfb9186a8b8
child 94 919f36ff910f
--- a/webengine/widgetregistry/tsrc/public/basic/src/WidgetRegistrySTIF.cpp	Thu Aug 19 10:58:56 2010 +0300
+++ b/webengine/widgetregistry/tsrc/public/basic/src/WidgetRegistrySTIF.cpp	Tue Aug 31 16:17:46 2010 +0300
@@ -1,24 +1,21 @@
 /*
-* ==============================================================================
-*  Name        : WidgetRegistrySTIF.cpp
-*  Part of     : STIF for WidgetRegistry
-*
-*  Description : CWidgetRegistrySTIF class member functions
-*  Version:   1.0
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
 *
-*  Copyright (C) 2007 Nokia Corporation.
-*  This material, including documentation and any related
-*  computer programs, is protected by copyright controlled by
-*  Nokia Corporation. All rights are reserved. Copying,
-*  including reproducing, storing,  adapting or translating, any
-*  or all of this material requires the prior written consent of
-*  Nokia Corporation. This material also contains confidential
-*  information which may not be disclosed to others without the
-*  prior written consent of Nokia Corporation.
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
 *
-* ============================================================================
+* Description:  CWidgetRegistrySTIF class member functions
+*
 */
 
+
 // INCLUDE FILES
 #include <Stiftestinterface.h>
 #include "WidgetRegistrySTIF.h"
@@ -155,9 +152,7 @@
     RWidgetRegistryClientSession* registryClient;
     registryClient = new (ELeave) RWidgetRegistryClientSession;
     CleanupStack::PushL( registryClient );
-    TInt error = registryClient->Connect();
-    if ( KErrNone == error )
-        error = registryClient->Disconnect();
+        TInt error = registryClient->Disconnect();
         if ( KErrNone == error )
             {
             aResult.SetResult( KErrNone, KPassed );
@@ -193,12 +188,7 @@
     RWidgetRegistryClientSession* registryClient2;
     registryClient2 = new (ELeave) RWidgetRegistryClientSession;
     CleanupStack::PushL( registryClient2 );
-    
-  
-            
-    
     TInt error = registryClient2->Connect();
-   
     if ( KErrNone == error )
         {
         aResult.SetResult( KErrNone, KPassed );
@@ -359,19 +349,7 @@
     TInt error = registryClient->Connect();
     if ( KErrNone == error )
         {
-        //TBool b = registryClient->WidgetExistsL( KValidBundle );
-        RWidgetInfoArray widgetInfoArray;
-        error = registryClient->InstalledWidgetsL( widgetInfoArray );
-        CWidgetInfo *myInfo = widgetInfoArray[0];
-        //myInfo->iBundleName;
-        
-           TUid     ValidUid = myInfo->iUid;
-           HBufC*  iWidgetBundleId = HBufC::NewL(KWidgetRegistryVal);
-           TPtr widgetBundleId = iWidgetBundleId->Des();
-            
-        //HBufC BundleID( HBufC16::NewL(1024));
-        registryClient->GetWidgetBundleId( ValidUid , widgetBundleId );
-        TBool b = registryClient->WidgetExistsL( widgetBundleId );
+        TBool b = registryClient->WidgetExistsL( KValidBundle );
         if ( b != EFalse )
             {
             aResult.SetResult( KErrNone, KPassed );
@@ -518,20 +496,7 @@
     TInt error = registryClient->Connect();
     if ( KErrNone == error )
         {
-        RWidgetInfoArray widgetInfoArray;
-        error = registryClient->InstalledWidgetsL( widgetInfoArray );
-        CWidgetInfo *myInfo = widgetInfoArray[0];
-        //myInfo->iBundleName;
-    
-       TUid     ValidUid = myInfo->iUid;
-       HBufC*  iWidgetBundleId = HBufC::NewL(KWidgetRegistryVal);
-       TPtr widgetBundleId = iWidgetBundleId->Des();
-        
-      //HBufC BundleID( HBufC16::NewL(1024));
-       
-       registryClient->GetWidgetBundleId( ValidUid , widgetBundleId );
-        TInt uid = registryClient->GetWidgetUidL( widgetBundleId );
-        
+        TInt uid = registryClient->GetWidgetUidL( KValidBundle );
         if ( iValidUid == TUid::Uid( uid ) )
             {
             aResult.SetResult( KErrNone, KPassed );
@@ -831,232 +796,6 @@
  }
 
 
-//Added as part of homescreen implementation testcases
-    
-//Method to verify IsWidgetInFullView API
- TInt CWidgetRegistrySTIF::ClientSessionIsWidgetInFullViewTest( TTestResult& aResult )
- {
-    aResult.SetResult( KErrGeneral, KFailed );
-    RWidgetRegistryClientSession* registryClient;
-    registryClient = new (ELeave) RWidgetRegistryClientSession;
-    CleanupStack::PushL( registryClient );
-    TInt error = registryClient->Connect();
-    if ( KErrNone == error )
-        {
-    
-    const TInt maxExponent = 32;
-    TAny* Cells[maxExponent];
-    TInt j=0;
-
-    for (TInt i = 0; i < maxExponent; i++)
-        Cells[i] = 0;
-        
-    
-    for (TInt i = KMaxTInt/2-1; i > 0; )
-    {
-        Cells[j] = User::Alloc(i);
-        if( !( Cells[j] ) )
-        {
-            i/=2;
-        }
-        else
-        {
-            j++;
-        }
-    }
-          TBool iswidgetinfullview = registryClient->IsWidgetInFullView( KNullUid );
-          
-          for (TInt i = 0; i < maxExponent; i++) // release all consumed heap memory
-                      if (Cells[i])
-                       User::Free(Cells[i]);
-          
-          
-          if(EFalse == iswidgetinfullview)
-          {
-             aResult.SetResult( KErrNone, KPassed );    
-          }
-        registryClient->Disconnect();
-        } 
-    CleanupStack::PopAndDestroy( registryClient );
-    return KErrNone;
- }
-
-//Method to verify IsWidgetInMiniView API
- TInt CWidgetRegistrySTIF::ClientSessionIsWidgetInMiniViewTest( TTestResult& aResult )
- {
-    aResult.SetResult( KErrGeneral, KFailed );
-    RWidgetRegistryClientSession* registryClient;
-    registryClient = new (ELeave) RWidgetRegistryClientSession;
-    CleanupStack::PushL( registryClient );
-    TInt error = registryClient->Connect();
-    if ( KErrNone == error )
-        {
-    
-    const TInt maxExponent = 32;
-       TAny* Cells[maxExponent];
-       TInt j=0;
-
-       for (TInt i = 0; i < maxExponent; i++)
-           Cells[i] = 0;
-           
-       
-       for (TInt i = KMaxTInt/2-1; i > 0; )
-       {
-           Cells[j] = User::Alloc(i);
-           if( !( Cells[j] ) )
-           {
-               i/=2;
-           }
-           else
-           {
-               j++;
-           }
-       }
-          TBool iswidgetinminiview = registryClient->IsWidgetInMiniView( KNullUid );
-          
-          for (TInt i = 0; i < maxExponent; i++) // release all consumed heap memory
-                               if (Cells[i])
-                                User::Free(Cells[i]);
-          if(EFalse == iswidgetinminiview)
-          {
-              aResult.SetResult( KErrNone, KPassed );    
-          }
-        registryClient->Disconnect();
-        } 
-    CleanupStack::PopAndDestroy( registryClient );
-    return KErrNone;
- }
-    
-//Method to verify IsBlanketPermGranted API
- TInt CWidgetRegistrySTIF::ClientSessionIsBlanketPermGrantedTest( TTestResult& aResult )
- {
-    aResult.SetResult( KErrGeneral, KFailed );
-    RWidgetRegistryClientSession* registryClient;
-    registryClient = new (ELeave) RWidgetRegistryClientSession;
-    CleanupStack::PushL( registryClient );
-    TInt error = registryClient->Connect();
-    if ( KErrNone == error )
-        {
-            TBool iswidgetgranted = registryClient->IsBlanketPermGranted( KNullUid );
-            if(EFalse == iswidgetgranted)
-            {
-                aResult.SetResult( KErrNone, KPassed );    
-            }
-        registryClient->Disconnect();
-        } 
-    CleanupStack::PopAndDestroy( registryClient );
-    return KErrNone;
- }
-    
-    
-//Method to verify SetminiViewL API
- TInt CWidgetRegistrySTIF::ClientSessionSetMiniViewTestL( TTestResult& aResult )
- {
-    aResult.SetResult( KErrGeneral, KFailed );
-    RWidgetRegistryClientSession* registryClient;
-    registryClient = new (ELeave) RWidgetRegistryClientSession;
-    CleanupStack::PushL( registryClient );
-    TInt error = registryClient->Connect();
-    if ( KErrNone == error )
-        {
-           registryClient->SetMiniViewL( KNullUid, 0 );
-           aResult.SetResult( KErrNone, KPassed );
-           registryClient->Disconnect();
-        }
-    CleanupStack::PopAndDestroy( registryClient );
-    return KErrNone;
- }
-
-
-//Method to verify SetFullViewL API
- TInt CWidgetRegistrySTIF::ClientSessionSetFullViewTestL( TTestResult& aResult )
- {
-    aResult.SetResult( KErrGeneral, KFailed );
-    RWidgetRegistryClientSession* registryClient;
-    registryClient = new (ELeave) RWidgetRegistryClientSession;
-    CleanupStack::PushL( registryClient );
-    TInt error = registryClient->Connect();
-    if ( KErrNone == error )
-        {
-           registryClient->SetFullViewL( KNullUid, 0 );
-           aResult.SetResult( KErrNone, KPassed );
-           registryClient->Disconnect();
-        }
-    CleanupStack::PopAndDestroy( registryClient );
-    return KErrNone;
- }
-
-//Method to verify SetBlanketPermissionL API
- TInt CWidgetRegistrySTIF::ClientSessionSetBlanketPermissionTestL( TTestResult& aResult )
- {
-    aResult.SetResult( KErrGeneral, KFailed );
-    RWidgetRegistryClientSession* registryClient;
-    registryClient = new (ELeave) RWidgetRegistryClientSession;
-    CleanupStack::PushL( registryClient );
-    TInt error = registryClient->Connect();
-    if ( KErrNone == error )
-        {
-    const TInt maxExponent = 32;
-      TAny* Cells[maxExponent];
-      TInt j=0;
-
-      for (TInt i = 0; i < maxExponent; i++)
-          Cells[i] = 0;
-          
-      
-      for (TInt i = KMaxTInt/2-1; i > 0; )
-      {
-          Cells[j] = User::Alloc(i);
-          if( !( Cells[j] ) )
-          {
-              i/=2;
-          }
-          else
-          {
-              j++;
-          }
-      }     
-           registryClient->SetBlanketPermissionL( KNullUid, 0 );
-           
-           for (TInt i = 0; i < maxExponent; i++) // release all consumed heap memory
-                               if (Cells[i])
-                                User::Free(Cells[i]);
-           
-           
-           aResult.SetResult( KErrNone, KPassed );
-           registryClient->Disconnect();
-        }
-    CleanupStack::PopAndDestroy( registryClient );
-    return KErrNone;
- }
- 
-
-//Method to verify WidgetSapiAccessState API
- TInt CWidgetRegistrySTIF::ClientSessionWidgetSapiAccessStateTest( TTestResult& aResult )
- {
-    aResult.SetResult( KErrGeneral, KFailed );
-    RWidgetRegistryClientSession* registryClient;
-    registryClient = new (ELeave) RWidgetRegistryClientSession;
-    CleanupStack::PushL( registryClient );
-    TInt error = registryClient->Connect();
-    if ( KErrNone == error )
-        {
-           TInt aAccessState = registryClient->WidgetSapiAccessState( KNullUid );
-           if(aAccessState == -1)
-            {
-                aResult.SetResult( KErrNone, KPassed );   
-            }
-           else
-            {
-                aResult.SetResult( KErrNone, KFailed );      
-            }
-        registryClient->Disconnect();
-        }
-    CleanupStack::PopAndDestroy( registryClient );
-    return KErrNone;
- }
- 
- 
 const TCaseInfo CWidgetRegistrySTIF::Case ( const TInt aCaseNumber ) const
     {
     static TCaseInfoInternal const KCases[] =
@@ -1132,20 +871,6 @@
                CWidgetRegistrySTIF::ClientSessionGetLprojNameL ),
         ENTRY( "ClientSession SecurityPolicyId",
                CWidgetRegistrySTIF::ClientSessionSecurityPolicyId ),
-        ENTRY( "ClientSession IsWidgetInFullViewTest",
-               CWidgetRegistrySTIF::ClientSessionIsWidgetInFullViewTest ),
-        ENTRY( "ClientSession IsWidgetInMiniViewTest",
-               CWidgetRegistrySTIF::ClientSessionIsWidgetInMiniViewTest ),
-        ENTRY( "ClientSession IsBlanketPermGrantedTest",
-               CWidgetRegistrySTIF::ClientSessionIsBlanketPermGrantedTest ),
-        ENTRY( "ClientSession SetminiViewTestL",
-               CWidgetRegistrySTIF::ClientSessionSetMiniViewTestL ),
-        ENTRY( "ClientSession SetFullViewTestL",
-               CWidgetRegistrySTIF::ClientSessionSetFullViewTestL ),
-        ENTRY( "ClientSession SetBlanketPermissionTestL",
-               CWidgetRegistrySTIF::ClientSessionSetBlanketPermissionTestL ),
-        ENTRY( "ClientSession WidgetSapiAccessStateTest",
-               CWidgetRegistrySTIF::ClientSessionWidgetSapiAccessStateTest ),
         
         };
     /*