installationservices/swi/test/swicaptests/registrycaptest.cpp
branchRCL_3
changeset 26 8b7f4e561641
parent 25 7333d7932ef7
equal deleted inserted replaced
25:7333d7932ef7 26:8b7f4e561641
     1 /*
     1 /*
     2 * Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2005-2009 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".
    51 _LIT(KPrivateRegistryCapTestName, "Registry private interface capability test");
    51 _LIT(KPrivateRegistryCapTestName, "Registry private interface capability test");
    52 _LIT(KDaemonRegistryCapTestName, "Registry daemon interface capability test");
    52 _LIT(KDaemonRegistryCapTestName, "Registry daemon interface capability test");
    53 _LIT(KRevocationRegistryCapTestName, "Registry revocation interface capability test");
    53 _LIT(KRevocationRegistryCapTestName, "Registry revocation interface capability test");
    54 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
    54 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
    55 _LIT(KSifServerRegistryCapTestName, "Registry SIF interface security test");
    55 _LIT(KSifServerRegistryCapTestName, "Registry SIF interface security test");
    56 _LIT(KSisRegistryTCBCapTestName, "Sis Registry interface requiring TCB security test");
       
    57 #endif
    56 #endif
    58 
    57 
    59 CPublicRegistryCapTest* CPublicRegistryCapTest::NewL()
    58 CPublicRegistryCapTest* CPublicRegistryCapTest::NewL()
    60 	{
    59 	{
    61 	CPublicRegistryCapTest* self=new(ELeave) CPublicRegistryCapTest();
    60 	CPublicRegistryCapTest* self=new(ELeave) CPublicRegistryCapTest();
   410 		
   409 		
   411 		TRAP(err, session.UpdateEntryL(*app, *buffer, id));
   410 		TRAP(err, session.UpdateEntryL(*app, *buffer, id));
   412 		CheckFailL(err, _L("UpdateEntryL"));
   411 		CheckFailL(err, _L("UpdateEntryL"));
   413 
   412 
   414 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
   413 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
   415 		RCPointerArray<Usif::CSoftwareTypeRegInfo> regInfoArray;
   414 		RCPointerArray<CSoftwareTypeRegInfo> regInfoArray;
   416 		CleanupClosePushL(regInfoArray);
   415 		CleanupClosePushL(regInfoArray);
   417 		
   416 		
   418 		TRAP(err, session.AddEntryL(*app, *buffer, regInfoArray, id));
   417 		TRAP(err, session.AddEntryL(*app, *buffer, regInfoArray, id));
   419 		CheckFailL(err, _L("AddEntryL for LEEs"));
   418 		CheckFailL(err, _L("AddEntryL for LEEs"));
   420 		
   419 		
   491 	CheckFailL(err, _L("RemoveDriveL"));
   490 	CheckFailL(err, _L("RemoveDriveL"));
   492 #endif
   491 #endif
   493 
   492 
   494 	TRAP(err, session.RecoverL());
   493 	TRAP(err, session.RecoverL());
   495 	CheckFailL(err, _L("RecoverL"));
   494 	CheckFailL(err, _L("RecoverL"));
   496 	
       
   497 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
       
   498 	TRAP(err, session.SetComponentPresenceL(1, EFalse));
       
   499 	CheckFailL(err, _L("SetComponentPresenceL"));
       
   500 	
       
   501 	// Negative tests
       
   502 	//TRAP(err, session.SetComponentPresenceL(1234, EFalse));
       
   503 	//CheckFailL(err, _L("SetComponentPresenceL Negative 1"));
       
   504     //TRAP(err, session.SetComponentPresenceL(0, EFalse));
       
   505     //CheckFailL(err, _L("SetComponentPresenceL Negative 2"));    
       
   506     //TRAP(err, session.SetComponentPresenceL(-1, EFalse));
       
   507     //CheckFailL(err, _L("SetComponentPresenceL Negative 3"));
       
   508 #endif
       
   509 
   495 
   510 	CleanupStack::PopAndDestroy(&session);
   496 	CleanupStack::PopAndDestroy(&session);
   511 	}
   497 	}
   512 
   498 
   513 
   499 
   606 	TRAP(err, session.DeactivateComponentL(componentId));
   592 	TRAP(err, session.DeactivateComponentL(componentId));
   607 	CheckFailL(err, _L("DeactivateComponentL"));
   593 	CheckFailL(err, _L("DeactivateComponentL"));
   608 
   594 
   609 	CleanupStack::PopAndDestroy(&session);
   595 	CleanupStack::PopAndDestroy(&session);
   610 	}
   596 	}
   611 
   597 #endif
   612 CSisRegistryTCBCapTest* CSisRegistryTCBCapTest::NewL()
   598 
   613     {
   599 
   614     CSisRegistryTCBCapTest* self=new(ELeave) CSisRegistryTCBCapTest();
       
   615     CleanupStack::PushL(self);
       
   616     self->ConstructL();
       
   617     CleanupStack::Pop(self);
       
   618     return self;
       
   619     }
       
   620 
       
   621 CSisRegistryTCBCapTest::CSisRegistryTCBCapTest()
       
   622     {
       
   623     SetCapabilityRequired(ECapabilityTCB); //API requires TCB capability, so giving it
       
   624     }
       
   625     
       
   626 void CSisRegistryTCBCapTest::ConstructL()
       
   627     {
       
   628     SetNameL(KSisRegistryTCBCapTestName);
       
   629     }
       
   630 
       
   631 void CSisRegistryTCBCapTest::RunTestL()
       
   632     {
       
   633     Swi::RSisRegistrySession registrySession;
       
   634     CleanupClosePushL(registrySession);
       
   635     _LIT(regFileName,"c:\\private\\10003a3f\\import\\apps\\dummy_reg.rsc");
       
   636     TInt err = registrySession.Connect();
       
   637     if (KErrNone != err)
       
   638         {
       
   639         SetFail();
       
   640         CleanupStack::PopAndDestroy(&registrySession);
       
   641         return;
       
   642         }
       
   643 
       
   644     TRAP(err, registrySession.AddAppRegInfoL(regFileName));
       
   645     CheckFailL(err, _L("AddAppRegInfoL"));
       
   646     
       
   647     TRAP(err, registrySession.RemoveAppRegInfoL(regFileName));
       
   648     CheckFailL(err, _L("RemoveAppRegInfoL"));
       
   649 
       
   650     CleanupStack::PopAndDestroy(&registrySession);
       
   651     }
       
   652 #endif
       
   653 
       
   654